����15-11 linux/lib/wait.c


  1 /*

  2  *  linux/lib/wait.c

  3  *

  4  *  (C) 1991  Linus Torvalds

  5  */

  6

  7 #define __LIBRARY__

  8 #include <unistd.h>       // Linux��׼ͷ�ļ��������˸��ַ��ų��������ͣ��������˸��ֺ�����

                              // �綨����__LIBRARY__���򻹺�ϵͳ���úź���Ƕ���_syscall0()�ȡ�

  9 #include <sys/wait.h>     // �ȴ�����ͷ�ļ�������ϵͳ����wait()��waitpid()����س������š�

 10

    //// �ȴ�������ֹϵͳ���ú�����

    // �������ṹ��Ӧ�ں�����pid_t waitpid(pid_t pid, int * wait_stat, int options)

    //

    // ������pid - �ȴ�����ֹ���̵Ľ���id������������ָ����������������ض���ֵ��

    //       wait_stat - ���ڴ��״̬��Ϣ��options - WNOHANG��WUNTRACED����0��

 11 _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options)

 12

    //// wait()ϵͳ���á�ֱ�ӵ���waitpid()������

 13 pid_t wait(int * wait_stat)

 14 {

 15         return waitpid(-1,wait_stat,0);

 16 }

 17