home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume21 / amd / part02 / uwait.h < prev   
Encoding:
C/C++ Source or Header  |  1990-04-10  |  2.4 KB  |  68 lines

  1. /*
  2.  * $Id: uwait.h,v 5.1 89/11/17 18:22:37 jsp Exp Locker: jsp $
  3.  *
  4.  * Copyright (c) 1989 Jan-Simon Pendry
  5.  * Copyright (c) 1989 Imperial College of Science, Technology & Medicine
  6.  * Copyright (c) 1989 The Regents of the University of California.
  7.  * All rights reserved.
  8.  *
  9.  * This code is derived from software contributed to Berkeley by
  10.  * Jan-Simon Pendry at Imperial College, London.
  11.  *
  12.  * Redistribution and use in source and binary forms are permitted
  13.  * provided that the above copyright notice and this paragraph are
  14.  * duplicated in all such forms and that any documentation,
  15.  * advertising materials, and other materials related to such
  16.  * distribution and use acknowledge that the software was developed
  17.  * by Imperial College of Science, Technology and Medicine, London, UK.
  18.  * The names of the College and University may not be used to endorse
  19.  * or promote products derived from this software without specific
  20.  * prior written permission.
  21.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  22.  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  23.  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  24.  *
  25.  *    %W% (Berkeley) %G%
  26.  */
  27.  
  28. #if defined(mc68k) || defined(mc68000) || defined(mc68020) || defined(sparc) || defined(hp9000s300)
  29. #define BITS_BIGENDIAN
  30. #endif
  31. #if defined(vax) || defined(i386)
  32. #define BITS_LITTLENDIAN
  33. #endif
  34. #if !defined BITS_BIGENDIAN && !defined BITS_LITTLENDIAN
  35.  #error Do not know my byte ordering
  36. #endif
  37.  
  38. /*
  39.  * Structure of the information in the first word returned by both
  40.  * wait and wait3.  If w_stopval==WSTOPPED, then the second structure
  41.  * describes the information returned, else the first.  See WUNTRACED below.
  42.  */
  43. union wait    {
  44.     int    w_status;        /* used in syscall */
  45.     /*
  46.      * Terminated process status.
  47.      */
  48.     struct {
  49. #ifdef BITS_LITTLENDIAN
  50.         unsigned short    w_Termsig:7;    /* termination signal */
  51.         unsigned short    w_Coredump:1;    /* core dump indicator */
  52.         unsigned short    w_Retcode:8;    /* exit code if w_termsig==0 */
  53. #endif
  54. #ifdef BITS_BIGENDIAN
  55.         unsigned short    w_Fill1:16;    /* high 16 bits unused */
  56.         unsigned short    w_Retcode:8;    /* exit code if w_termsig==0 */
  57.         unsigned short    w_Coredump:1;    /* core dump indicator */
  58.         unsigned short    w_Termsig:7;    /* termination signal */
  59. #endif
  60.     } w_U;
  61. };
  62. #define    w_termsig    w_U.w_Termsig
  63. #define w_coredump    w_U.w_Coredump
  64. #define w_retcode    w_U.w_Retcode
  65.  
  66. #define WIFSIGNALED(x)    ((x).w_termsig != 0)
  67. #define WIFEXITED(x)    ((x).w_termsig == 0)
  68.