Example #1
0
unsigned int
get_max_idle_FP(tasks_schedule * t_sched, unsigned int kth_task)
{
    unsigned int max_idle = 0;
    task_timeline *tl;

    tl = &t_sched->timeline;
    max_idle += t_sched->hyperperiod;


    /*computing W_min */
    {
	unsigned int W_min = 0;
	unsigned int prev_time, prev_duration;

	do {
	    next_task(t_sched);
	}
	while (has_priority_FP(t_sched->ts, kth_task, tl->id));

	prev_time = t_sched->timeline.release_time;
	prev_duration = min_index(&t_sched->ts->task_list[tl->id]->sd);
	W_min = prev_duration;

	while (next_task(t_sched)) {
	    if (!has_priority_FP(t_sched->ts, kth_task, tl->id)) {
		W_min = (W_min > tl->release_time - prev_time) ?
		    W_min - (tl->release_time - prev_time) : 0;

		prev_duration =
		    min_index(&t_sched->ts->task_list[tl->id]->sd);

		prev_time = t_sched->timeline.release_time;
		W_min += prev_duration;
	    }
	}
	W_min = (W_min > t_sched->hyperperiod - prev_time) ?
	    W_min - (t_sched->hyperperiod - prev_time) : 0;

	max_idle += W_min;
    }
    /*computing C_min */
    {
	unsigned int C_min = 0;
	while (next_task(t_sched)) {
	    if (!has_priority_FP(t_sched->ts, kth_task, tl->id)) {
		C_min += min_index(&t_sched->ts->task_list[tl->id]->sd);
	    }

	}
	max_idle -= C_min;
    }


    return max_idle;
}
Example #2
0
File: modes.c Project: geechee/iraf
/* TASKMODE -- Determine the effective mode for a task.
 */
int 
taskmode (register struct task *tp)
{
	register int	modebits, mode;
	struct	pfile *pfp;
	int	clmode, pkmode, ltmode;
	int	interactive, learn;

	/* Determine whether or not the task was called interactively.
	 * Menu mode is only permitted for tasks called interactively.
	 */
	interactive = 0;
	if (next_task(tp))
	    interactive = (next_task(tp)->t_flags & (T_INTERACTIVE|T_BATCH));
	if (interactive)
	    modebits = (M_QUERY|M_HIDDEN|M_MENU);
	else
	    modebits = (M_QUERY|M_HIDDEN);

	ltmode = scanmode (tp->t_modep->p_val.v_s);
	clmode = scanmode (firstask->t_modep->p_val.v_s);
	learn  = ((ltmode|clmode) & M_LEARN);

	/* If the mode of the task is anything but AUTO we are done.
	 */
	if ( (mode = (ltmode & modebits)) )
	    if (interactive || !(mode & M_MENU))
		return (mode|learn);

	/* If the package to which the task belongs has a pfile and the mode
	 * of the package is anything but AUTO, we are done.
	 */
	if ( (pfp = tp->t_ltp->lt_pkp->pk_pfp) ) {
	    struct param   *ppx;

	    pkmode = ERR;
	    ppx = paramfind (pfp, "mode", 0, YES);
	    if ((ppx != NULL) && (ppx != (struct param *)ERR))
		pkmode = scanmode (ppx->p_val.v_s);

	    if (pkmode != ERR && (mode = (pkmode & modebits)))
		if (interactive || !(mode & M_MENU))
		    return (mode|learn|(pkmode&M_LEARN));
	}

	/* Return the CL mode (menu mode not permitted at the CL level).
	 */
	return (clmode);
}
/******************************************************************************
 Prototype      : CpuView_GetTaskName
 Description    : 获取任务ID和NAME的对应关系
 Input          :
 Output         :
 Return Value   :
 Calls          :
 Called By      :

 History        : ---
  1.Date        : 2007-1-24
    Author      : g45205
    Modification: Created function
******************************************************************************/
void AcpuView_GetTaskName(void)
{
    struct task_struct                 *pTask;
    ACPU_UINT32                         ulTaskNum;

    memset(g_astAcpuTaskName, 0, sizeof(CPU_TASK_NAME_STRU) * CPU_VIEW_MAX_TASK_NUMBER);

    /* 记录Linux中第一个内核进程,pid为0。这个任务可以视为Idle */
    ulTaskNum = 0;
    g_astAcpuTaskName[ulTaskNum].ulPid = 0;
    strncpy(g_astAcpuTaskName[ulTaskNum].aucTaskName, "swapper", sizeof("swapper"));

    /* 逐个记录Linux其他的任务 */
    ulTaskNum++;
    for (pTask = &init_task ; (pTask = next_task(pTask)) != &init_task ; )
    {
        if(ulTaskNum >= CPU_VIEW_MAX_TASK_NUMBER)
        {
            printk("Task Number Outof Range!\r\n");
            g_ulAcpuTaskNumber = CPU_VIEW_MAX_TASK_NUMBER;
            return;
        }

        g_astAcpuTaskName[ulTaskNum].ulPid = (ACPU_UINT32)pTask->pid;

        strncpy(g_astAcpuTaskName[ulTaskNum].aucTaskName, pTask->comm, (CPU_VIEW_TASK_NAME_LENTH - 1));
        g_astAcpuTaskName[ulTaskNum].aucTaskName[CPU_VIEW_TASK_NAME_LENTH - 1]='\0';

        ulTaskNum++;
    }

    g_ulAcpuTaskNumber = ulTaskNum;

    return;
} /* CpuView_GetTaskName */
Example #4
0
void task_ecompass(void)
{
   static  int temp_direction;

   ControlLoopCompass();
   
   /* determine how far is from north*/
   if (ecompass_direction<180)    temp_direction = ecompass_direction;         //0 to 180    NE
   else  temp_direction = (360 - ecompass_direction);   //0 to 180  NW
   t_flash = (temp_direction)*2 + 10 ;
   
   printf("Yaw =%4d Pitch =%4d Roll =%4d \r", APsi6DOF, APhi6DOF, AThe6DOF);

   
   if (!ti_task)
   {
     ti_task = t_flash;    
     LED1_TOGGLE;
     LED2_TOGGLE;
   }   
 
     if (input_rise(SW1_ON, &sw1_aux1)) 
   {
     next_task(task_light_sensor);
     printf("\n\r ADC:  light sensor test ");  
   }
   
   
}
Example #5
0
/**
 * Execute scheduled tasks.
 */
void schedule_run(void) {
 	//execute this timestep
	TASK_PTR next_task;

	//Copy this to ensure the value we use doesn't change mid-execution
	int curr_sched_slot_start_index;

	//we do not want things to run before schedule_tick has been called for the first time.
	if(sched_slot_start_index >= 0) {
		while(1){
            curr_sched_slot_start_index = sched_slot_start_index;
			
            if((curr_sched_slot_start_index != sched_saved_slot_start_index)){   //check if rescheduling has occured,
				sched_saved_slot_start_index = curr_sched_slot_start_index;
				sched_next_task_index = curr_sched_slot_start_index;
			}
			
            next_task = sched_schedule[sched_next_task_index];
			
            if(next_task != (TASK_PTR)NULL) {
				next_task();//execute next task
				sched_next_task_index++;
			} else {//bah, race conditions!!! ???
				break;
			}
		}
	}
	//not sure how sleep scheduling can be done w/o race, does it require a hardware sleep_enable bit?
//	if(SCHEDULE_DONE) if(SLEEP_ENABLED)sleep(); else;
}
Example #6
0
void task_test_lcd(void)
{
  static char count_mode=0;
  if (!ti_task)
  {
    ti_task = 200;
    if (count_mode++>=10)count_mode=0;
    
    switch(count_mode)
    {
    case 0: vfnLCD_Write_Msg("0000");  break;
    case 1: vfnLCD_Write_Msg("1111");  break;
    case 2: vfnLCD_Write_Msg("2222");  break;
    case 3: vfnLCD_Write_Msg("3333");  break;
    case 4: vfnLCD_Write_Msg("4444");  break;
    case 5: vfnLCD_Write_Msg("5555");  break;
    case 6: vfnLCD_Write_Msg("6666");  break;
    case 7: vfnLCD_Write_Msg("7777");  break;
    case 8: vfnLCD_Write_Msg("8888");  break;
    case 9: vfnLCD_Write_Msg("9999");  break;
    }
  
  } 
  
   if (input_rise(SW1_ON, &sw1_aux1)) 
   {
     next_task(task_test_slider);
     printf("\n\r TSI: slider test ");
   }
  
}
Example #7
0
File: BBS.C Project: jeske/GTalk
void find_bbs(char *directory, struct bbs_board_info bbs_info[],
    int *num_bbs, int limit)
 {
   char wildcard[25];
   struct ffblk look_up;
   int isfile;

   *num_bbs=0;
   sprintf(wildcard,"%s\\m*.*",directory);
   lock_dos();
   isfile=findfirst(wildcard,&look_up,FA_NORMAL);
   while ((!isfile) && (*num_bbs<limit))
    {
      strcpy(bbs_info[*num_bbs].filename,look_up.ff_name);
      bbs_info[*num_bbs].filedate=(unsigned long int)
           ((((unsigned long int)look_up.ff_fdate) << 16) |
              ((unsigned long int)look_up.ff_ftime));
      (*num_bbs)++;
      unlock_dos();
      next_task();
      lock_dos();
      isfile = findnext(&look_up);
    };
   unlock_dos();
   qsort((void *)bbs_info, *num_bbs, sizeof(struct bbs_board_info), compare_dates);
 };
Example #8
0
ssize_t fortune_write( struct file *filp, const char __user *buff,unsigned long len, void *data )
{
	char * command;
	//获取用户传进来的命令
	if (command = copy_from_user( &cookie_pot[cookie_index], buff, len ))
	{
		return -EFAULT;
	}
	//解析命令,比如是某个进程还是部分进程还是全部进程
	//格式为“id1 id2 id3...”或者“all"
	if(traverseall)
	{
		/* Set up the anchor point */
		struct task_struct *task = &init_task;
		/* Walk through the task list, until we hit the init_task again */
		do {
			printk( KERN_INFO "*** %s [%d]\n",task->comm, task->pid);
			//下一步调用函数获得物理地址,存入到info中,也可不用结构体,直接构造返回字符串



		} while ( (task = next_task(task)) != &init_task );
	}
	else
	{
		//获得指定进程的id和物理地址,存入info中
	}
}
Example #9
0
int receiver_driven_start(int mode)
{
    int attempts = 0;
    char charbuf;
    char mode_letter;
    int cur_timer;

    switch (mode)
    {
      case X_MODEM_PROTOCOL:       mode_letter = NAK_CHR;
                                   break;
      case X_MODEM_CRC_PROTOCOL:   mode_letter = 'C';
                                   break;
      case X_MODEM_1K_PROTOCOL:    mode_letter = 'C';
                                   break;
      case Y_MODEM_PROTOCOL:       mode_letter = 'C';
                                   break;
    }
    while (attempts++ < 20)
    {
      delay(10);
      empty_inbuffer(tswitch);
      send_short(mode_letter);
      wait_for_xmit(tswitch,30);
      cur_timer = dans_counter;
      while (((dans_counter - cur_timer) < SMALL_TIMEOUT_TICKS) &&
       (!(charbuf=char_in_buf(tswitch)))) next_task();
      if (charbuf) return (0);
    }
    return (-1);
}
void AcpuView_TaskPrint(void)
{
    struct task_struct                 *pCurrenttaskId;
    struct task_struct                 *pTask;
    ACPU_UINT32                         ulTaskNum = 0;

    pCurrenttaskId = (struct task_struct *)current;
    printk("Current Task Name:%s, Id:0x%x\r\n", pCurrenttaskId->comm, pCurrenttaskId->pid);

    printk("Task list as follows:\r\n");
    printk("%-16s %-10s %-10s %-10s %-16s %-16s\r\n", "NAME", "PID", "POLICY", "STATUS", "DYNAMIC_PRIORI", "RT_PRIORI");
    for (pTask = &init_task ; (pTask = next_task(pTask)) != &init_task ; )
    {
        if(ulTaskNum >= CPU_VIEW_MAX_TASK_NUMBER)
        {
            printk("Total Task Number:%d\r\n", (ACPU_UINT16)CPU_VIEW_MAX_TASK_NUMBER);
            return;
        }

        printk("%-16s 0x%-8x 0x%-8x %-10d %-16d 0x%-14x\r\n", pTask->comm, pTask->pid, pTask->policy, (ACPU_UINT16)pTask->state, pTask->prio, pTask->rt_priority);

        ulTaskNum++;
    }

    printk("Total Task Number:%d\r\n", (ACPU_UINT16)ulTaskNum);

    return;
}
Example #11
0
/* 
 * return the next task in this array using iter
 */
work_task *next_task(

  all_tasks *at,
  int       *iter)

  {
  work_task *wt;

  pthread_mutex_lock(at->alltasks_mutex);

  wt = next_thing(at->ra,iter);
  if (wt != NULL)
    pthread_mutex_lock(wt->wt_mutex);

  pthread_mutex_unlock(at->alltasks_mutex);

  if (wt != NULL)
    {
    if (wt->wt_being_recycled == TRUE)
      {
      pthread_mutex_unlock(wt->wt_mutex);

      wt = next_task(at, iter);
      }
    }

  return(wt);
  } /* END next_task() */
Example #12
0
int wait_for_sending_state(unsigned int wait_ticks, int state)
{
    unsigned int cur_ticks = dans_counter;
    int ch;
    while ( ((dans_counter-cur_ticks)<wait_ticks) &&
     ((ch = (char_in_buf(tswitch)!=state)))) next_task();
    return (ch);
}
Example #13
0
void window_action(Task* tsk, int action) {
    if (!tsk) return;
    int desk;
    switch (action) {
    case CLOSE:
        set_close(tsk->win);
        break;
    case TOGGLE:
        set_active(tsk->win);
        break;
    case ICONIFY:
        XIconifyWindow(server.dsp, tsk->win, server.screen);
        break;
    case TOGGLE_ICONIFY:
        if (task_active && tsk->win == task_active->win)
            XIconifyWindow(server.dsp, tsk->win, server.screen);
        else
            set_active(tsk->win);
        break;
    case SHADE:
        window_toggle_shade(tsk->win);
        break;
    case MAXIMIZE_RESTORE:
        window_maximize_restore(tsk->win);
        break;
    case MAXIMIZE:
        window_maximize_restore(tsk->win);
        break;
    case RESTORE:
        window_maximize_restore(tsk->win);
        break;
    case DESKTOP_LEFT:
        if (tsk->desktop == 0) break;
        desk = tsk->desktop - 1;
        windows_set_desktop(tsk->win, desk);
        if (desk == server.desktop) set_active(tsk->win);
        break;
    case DESKTOP_RIGHT:
        if (tsk->desktop == (uint32_t)server.nb_desktop) break;
        desk = tsk->desktop + 1;
        windows_set_desktop(tsk->win, desk);
        if (desk == server.desktop) set_active(tsk->win);
        break;
    case NEXT_TASK: {
        Task* tsk1;
        tsk1 = next_task(find_active_task(tsk, task_active));
        set_active(tsk1->win);
    }
    break;
    case PREV_TASK: {
        Task* tsk1;
        tsk1 = prev_task(find_active_task(tsk, task_active));
        set_active(tsk1->win);
    }
    }
}
Example #14
0
int get_timeout(unsigned int wait_ticks)
{
    unsigned int cur_ticks = dans_counter;
    int ch;
    if (!dcd_detect(tswitch)) leave();
    while ((dans_counter-cur_ticks)<wait_ticks)
     if ((ch = get_nchar(tswitch)) != -1) break;
      else next_task();
    return (ch);
};
Example #15
0
/**
 * This function is called after the beginning of a sequence.
 * It's called untill the return is NULL (this ends the sequence).
 *
 */
static void *my_seq_next(struct seq_file *s, void *v, loff_t *pos)
{
    struct task_struct *task = next_task((struct task_struct *)v);
    mcurrent = task;
    (*pos)++;
    if (task != &init_task) {
        return task;
    }
    return NULL;
}
Example #16
0
File: BBS.C Project: jeske/GTalk
void create_bbs_message(char *directory,char *copyfile,char *subject,
      int user,char *from, struct board_info *new_board, int num_msg,
      struct bbs_board_info *bbs_info)
 {
   int flag = 0;
   struct ffblk look_up;
   char s[27];
   char str[60];
   char temp[29];
   FILE *file_write;
   FILE *file_read;
   time_t now;

   while (!flag)
    {
      sprintf(s,"%s\\m%04dx%02d",directory,user_lines[tswitch].number,(dans_counter % 100));
      lock_dos();
      flag = findfirst(s,&look_up,FA_NORMAL);
      unlock_dos();
      next_task();
    };
   lock_dos();
   if ((file_write=g_fopen(s,"wb","BBS#1"))==NULL)
    {
#ifdef DEBUG
      log_error(s);
#endif

      unlock_dos();
      return;
    };
   fprintf(file_write,"|*h1|*f4   User: |*f7(#%03d) %s|*r1%s",user,from,cr_lf);
   fprintf(file_write,"|*h1|*f4Subject: |*f7%s|*r1%s",subject,cr_lf);
   time(&now);
   str_time(temp,30,localtime(&now));
   strftime(s,70,"%a %b %d %Y",localtime(&now));
   sprintf(str,"%s  %s ",s,temp);
   fprintf(file_write,"   |*f4|*h1Date:|*f7 %s%s%s|*r1",str,cr_lf,cr_lf);
   if ((file_read=g_fopen(copyfile,"rb","BBS#2"))==NULL)
    {
      log_error(copyfile);
      g_fclose(file_write);
      unlock_dos();
      return;
    };
   copy_stream(file_read,file_write);
   g_fclose(file_read);
   g_fclose(file_write);
   if (num_msg >= new_board->limit_messages)
    {
      sprintf(s,"%s\\%s",directory,bbs_info[0].filename);
      remove(s);
    };
   unlock_dos();
 };
Example #17
0
static void *l_next(struct seq_file *m, void *p, loff_t * pos)
{
        task_t * task = (task_t *)p;

        task = next_task(task);
        if ((*pos != 0) && (task == &init_task)) {
                return NULL;
        }
        ++*pos;
        return task;
}
Example #18
0
void first_assignment(task current, task last, task assignment[], int n)
{
    memset(assignment, 0, sizeof(task) * n);
    if (n == 0) {
        return;
    }

    memcpy(&assignment[1], current, sizeof(task));
    for (int i = 2; i < n; i++) {
        next_task(assignment[i - 1], last, assignment[i]);
    }
}
Example #19
0
/*
  Traverse Tasks, marking to-be-traced if it is one of target processes.
*/
void mark_process(void) {
  struct task_struct *task = &init_task;
  int node_index;
  do {
    if ((node_index = is_target_proc(task->pid)) >= 0) {
      task->hp_node = node_array[node_index];
      printk(KERN_INFO "*** %s [%ld] parent %s\n",
             task->comm, task->hp_node, task->parent->comm);
    } else {
      task->hp_node = -1;
    }
  } while ((task = next_task(task)) != &init_task);
}
Example #20
0
static void *my_seq_start(struct seq_file *s, loff_t *pos)
{
    struct task_struct *task = &init_task;

    if (*pos == 0)
        return task;
    if (mcurrent != &init_task) {
        seq_printf(s, "continue\n");
        return next_task(mcurrent);
    }
    *pos = 0;
    return NULL;
}
Example #21
0
static void *as_next(struct seq_file *m, void *p, loff_t *pos)
{
	struct task_struct *tp = (struct task_struct *)p;

	printk("%lld (%s)\n", *pos, __func__);

	(*pos)++;

	tp = next_task(tp);
	if (tp == &init_task)
		return NULL;

	return (tp);
}
Example #22
0
static inline int ltt_enumerate_vm_maps(void)
{
	struct task_struct *  t = &init_task;
	
	do {
		read_lock(&tasklist_lock);
		if(t != &init_task) atomic_dec(&t->usage);
		t = next_task(t);
		atomic_inc(&t->usage);
		read_unlock(&tasklist_lock);
		ltt_enumerate_task_vm_maps(t);
 	} while( t != &init_task );
	return 0;
}
Example #23
0
File: exec.c Project: geechee/iraf
/* SET_CLIO -- Set the command input and output for the new cl().  If the
 * standard input or output has been redirected, use that, otherwise inherit
 * the t_in, t_out of the task preceeding the most recent non-CL task that has
 * the same t_in as the current task (this is not obvious, but permits packages
 * to be called or loaded within scripts).  In the case of a cl() type task
 * used to change packages, change the current package and push a cl() on the
 * control stack but continue reading from the current command stream.
 */
void
set_clio (
  register struct task *newtask
)
{
	register struct task *tp;

	if ((newtask->t_stdin == currentask->t_stdin) &&
	    (currentask->t_in != stdin)) {
	    newtask->t_in = NULL;

	    if (newtask->t_flags & T_PKGCL) {		/* package()	*/
		newtask->t_in = currentask->t_in;
		tp = currentask;
	    } else {					/* cl()		*/
		for (tp=currentask;  tp != firstask; tp = next_task(tp))
		    if (!(tp->t_flags & T_CL) &&
			 (tp->t_in == currentask->t_in)) {
			tp = next_task(tp);
			newtask->t_in = tp->t_in;
			break;
		    }
	    }
	    if (newtask->t_in == NULL)
		cl_error (E_IERR, "Cannot find t_in for cl()");

	} else {					/* pk|cl <	*/
	    tp = NULL;
	    newtask->t_in = newtask->t_stdin;
	}

	if ((newtask->t_stdout == stdout) && (tp != NULL))
	    newtask->t_out = tp->t_out;
	else
	    newtask->t_out = newtask->t_stdout;		/* pk|cl >	*/
}
static inline int
ltt_enumerate_vm_maps(struct ltt_probe_private_data *call_data)
{
	struct task_struct *t = &init_task;

	do {
		read_lock(&tasklist_lock);
		if (t != &init_task)
			atomic_dec(&t->usage);
		t = next_task(t);
		atomic_inc(&t->usage);
		read_unlock(&tasklist_lock);
		ltt_enumerate_task_vm_maps(call_data, t);
	} while (t != &init_task);
	return 0;
}
Example #25
0
void task_test_slider(void)
{
     static int touch_slider_last_valid_value=50;
     
     
     if (AbsolutePercentegePosition>0) touch_slider_last_valid_value=AbsolutePercentegePosition;
     t_flash = (touch_slider_last_valid_value*2 + 50);
     sprintf((char *)gu8USB_Buffer,"%4i", touch_slider_last_valid_value);
     
#ifdef FRDM_REVA     
     PORTA_PCR6 = PORT_PCR_MUX(3); //enable as TPM0_CH3
     TPM0_C3V=touch_slider_last_valid_value*10;
#else
     PORTD_PCR5 = PORT_PCR_MUX(4); //enable as TPM0_CH5
     TPM0_C5V=touch_slider_last_valid_value*10; 
#endif
         
     
     
     
     vfnLCD_Write_Msg(gu8USB_Buffer);
     printf("\r tsi %%= %03i  ", AbsolutePercentegePosition);
     
     
     
  if (!ti_task)
   {
     ti_task = t_flash;    
     LED1_TOGGLE;
     LED2_TOGGLE;
   }     
 
    if (input_rise(SW1_ON, &sw1_aux1)) 
   {
#ifdef FRDM_REVA
                 PORTA_PCR6 = PORT_PCR_MUX(1); //PTA6 as GPIO LED3
#else
                 PORTD_PCR5 = PORT_PCR_MUX(1); //PTA6 as GPIO LED3
                 
#endif  
     
     
       next_task(task_ecompass);
       printf("\n\r eCompass,  Magenetomer + accelerometer test ");  
   }
  
}
Example #26
0
int check_cancel(void)
{
  int ch;
  int count = 0;
  unsigned int cur_time;

  while (count<4)
  {
    cur_time = dans_counter;
    while ( ((dans_counter-cur_time)<SMALL_TIMEOUT_TICKS)
            && ((ch=time_char()) == -1) ) next_task();
    if (ch == -1) return (0);
    if (ch == CAN_CHR) count++;
     else return (0);
  }
  return (CAN_CHR);
}
static void static_enum_exiting_process_modules(void)
{
	struct task_struct *p_task = &init_task;

	do
	{
		/* static enumeration: load sample count of modules are all zero */
		enum_modules_for_process(p_task->pid, 0);

		read_lock(&tasklist_lock);

		p_task = next_task(p_task);

		read_unlock(&tasklist_lock);
	}while (p_task != &init_task);

}
static void *
mydrv_seq_next(struct seq_file *seq, void *v, loff_t *pos)
{
 
	 struct task_struct *taskn = (struct task_struct *)v;   
  ++*pos; 
   printk("in seq_next :%d\n",*pos);
   
if((taskn=next_task(taskn)) != &init_task)
	{
		return taskn;
	}

	
	return NULL;

}
Example #29
0
static void *proc_seq_next(struct seq_file *s, void *v, loff_t * pos)
{
	tmp_v = (struct task_struct *)v;
	tmp_v=next_task(tmp_v);
	printk("next\n");
	
	if(tmp_v->pid!=init_task.pid)
	{
		(*pos)++;
		return tmp_v;
	}
	else{

		flag=1;
		return NULL;
	}
	
}
Example #30
0
static inline int ltt_enumerate_file_descriptors(void)
{
	struct task_struct * t = &init_task;
	char *tmp = (char*)__get_free_page(GFP_KERNEL);

	/* Enumerate active file descriptors */
	do {
		read_lock(&tasklist_lock);
		if(t != &init_task) atomic_dec(&t->usage);
		t = next_task(t);
		atomic_inc(&t->usage);
		read_unlock(&tasklist_lock);
		task_lock(t);
		ltt_enumerate_task_fd(t, tmp);
		task_unlock(t);
	} while( t != &init_task );
	free_page((unsigned long)tmp);
	return 0;
}