0

I see that in sys_wait4 (that is reached through calls to wait() or waitpid()) we insert the current process into a special queue that is saved in its struct task:

DECLARE_WAITQUEUE(wait, current);    
add_wait_queue(&current->wait_chldexit,&wait);

So if I want to check if a certain process is waiting due to call to wait() or waitpid() I need to check if it's in its own (???) wait_chldexit queue?

So only the process itself could be inserted into its own wait_chldexit queue?

Did I get it right?

This is linux kernel 2.4.

Mano Mini
  • 607
  • 4
  • 15

1 Answers1

1

Yes, waitqueue current->wait_chldexit may contain either single element for current process or non elements at all.

No one wakes up given waitqueue, instead waiting is broken by a signal arised from the child thread.

By checking this waitqueue for some thread, you may detect whether that the thread is blocked in wait() or waitpid() call.

Tsyvarev
  • 60,011
  • 17
  • 110
  • 153