home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / pdksh-4.9-src.tgz / tar.out / contrib / pdksh / std / h / sys / wait.h < prev   
C/C++ Source or Header  |  1996-09-28  |  1KB  |  50 lines

  1. /*
  2.  * POSIX <sys/wait.h>
  3.  */
  4. /* $Id: wait.h,v 1.3 93/05/05 21:18:00 sjg Exp $ */
  5. #if __STDC__
  6. #define    ARGS(args)    args
  7. #else
  8. #define    ARGS(args)    ()
  9. #endif
  10.  
  11. #ifdef HAVE_SYS_STDTYPES
  12. # include <sys/stdtypes.h>
  13. #else
  14. # ifndef _PID_T
  15. #   define _PID_T
  16. typedef int pid_t;        /* belong in sys/types.h */
  17. # endif
  18. #endif
  19.  
  20. #ifdef sun
  21. # include "/./usr/include/sys/wait.h"
  22. #else
  23.  
  24. #define WAIT_T int
  25.  
  26. /* waitpid options */
  27. #define WNOHANG        1    /* don't hang in wait */
  28. #define WUNTRACED    2    /* tell about stopped, untraced children */
  29.  
  30. #define    WSTOPPED    0x7F    /* process is stopped */
  31.  
  32. #define WIFSTOPPED(x)    (((x)&0xFF) == 0x7F)
  33. #define WIFSIGNALED(x)    (((x)&0xFF) != 0x7F && ((x)&0x7F) != 0)
  34. #define WIFEXITED(x)    (((x)&0xFF) != 0x7F && ((x)&0x7F) == 0)
  35. #define    WIFCORED(x)    (!!((x)&0x80)) /* non-standard */
  36. #define    WEXITSTATUS(x)    ((x)>>8&0xFF)
  37. #define    WTERMSIG(x)    ((x)&0x7F)
  38. #define    WSTOPSIG(x)    ((x)>>8&0xFF)
  39.  
  40. pid_t wait ARGS((int *statp));
  41. #if _BSD
  42. pid_t wait3 ARGS((int *statp, int options, void *));
  43. /* todo: does not emulate pid argument */
  44. #define    waitpid(pid, sp, opts)    wait3(sp, opts, (void*)NULL)
  45. #else
  46. pid_t waitpid ARGS((pid_t pid, int *statp, int options));
  47. #endif
  48.  
  49. #endif /* sparc */
  50.