예제 #1
0
파일: osprd1333.c 프로젝트: qinyiyan/CS111
void
add_read_pid(pid_t pid, osprd_info_t *d)
{
  
  if(d->pid_list_tail== NULL)
  {
    d->pid_list_tail = initPidlist(pid);
    d->pid_list_head= d->pid_list_tail;
  }
  else
  {
    pid_list_t pid_new = initPidlist(pid);
    //command_stream_head->next = command_stream_new;
    d->pid_list_tail->next = pid_new;
    d->pid_list_tail = d->pid_list_tail->next;
    d->pid_list_tail->next = NULL;
  }
}
예제 #2
0
/*int
clear_current_reader (pid_list_t pid_list_head, pid_list_t pid_list_tail)
{
	pid_list_t tmp = pid_list_head;
	pid_list_t prev = NULL;
	while (tmp ->pid != current->pid && tmp != pid_list_tail)
	{
		prev = tmp;
		tmp = tmp->next;
	}
	if (tmp ->pid == current->pid)
	{
		tmp -> pid = -1;
		if (tmp==pid_list_tail)
		{
			prev->next = NULL;
			pid_list_tail == prev;
		}
		else if (tmp == pid_list_head)
		{
			pid_list_head = tmp->next;
		}
		else
			prev->next = tmp->next;
		kfree(tmp);
	}
	else 
		return -ENOTTY;

}
*/
void
add_check_deadlock_list(pid_t pid, osprd_info_t *d)
{
  
  if(d->check_deadlock_list_tail== NULL)
  {
    d->check_deadlock_list_tail = initPidlist(pid);
    d->check_deadlock_list_head= d->check_deadlock_list_tail;
  }
  else
  {
    pid_list_t pid_new = initPidlist(pid);
    //command_stream_head->next = command_stream_new;
    d->check_deadlock_list_tail->next = pid_new;
    pid_new->prev = d->check_deadlock_list_tail;
    d->check_deadlock_list_tail = d->check_deadlock_list_tail->next;
    d->check_deadlock_list_tail->next = NULL;
  }
}
예제 #3
0
void
add_read_pid(pid_t pid)
{
  
  if(pid_list_tail== NULL)
  {
    pid_list_tail = initPidlist(pid);
    pid_list_head= pid_list_tail;
  }
  else
  {
    pid_list_t pid_new = initPidlist(pid);
    //command_stream_head->next = command_stream_new;
    pid_new->prev = pid_list_tail;
    pid_list_tail->next = pid_new;
    pid_list_tail = pid_list_tail->next;
    //pid_list_tail->prev = 
    pid_list_tail->next = NULL;
  }
}