bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

remove vestiges of 'union wait'


From: Bruno Haible
Subject: remove vestiges of 'union wait'
Date: Sun, 19 Oct 2008 21:58:02 +0200
User-agent: KMail/1.5.4

Very old BSD systems had a <sys/wait.h> that was based on 'union wait'.
The last system that required the use of this type was NeXTstep, ca.
1992-1996. Not relevant to gnulib any more.


2008-10-19  Bruno Haible  <address@hidden>

        Assume that waitpid() fills an 'int' status, not a 'union wait'.
        * lib/wait-process.c (WAIT_T): Remove type.
        (WTERMSIG, WCOREDUMP, WEXITSTATUS): Define fallbacks using bit masks.
        (wait_subprocess): Update.

*** lib/wait-process.c.orig     2008-10-19 21:49:14.000000000 +0200
--- lib/wait-process.c  2008-10-19 21:41:30.000000000 +0200
***************
*** 33,39 ****
  /* Native Woe32 API.  */
  #include <process.h>
  #define waitpid(pid,statusp,options) _cwait (statusp, pid, WAIT_CHILD)
- #define WAIT_T int
  #define WTERMSIG(x) ((x) & 0xff) /* or: SIGABRT ?? */
  #define WCOREDUMP(x) 0
  #define WEXITSTATUS(x) (((x) >> 8) & 0xff) /* or: (x) ?? */
--- 33,38 ----
***************
*** 47,74 ****
  #include <sys/wait.h>
  /* On Linux, WEXITSTATUS are bits 15..8 and WTERMSIG are bits 7..0, while
     BeOS uses the contrary.  Therefore we use the abstract macros.  */
! #if HAVE_UNION_WAIT
! # define WAIT_T union wait
! # ifndef WTERMSIG
! #  define WTERMSIG(x) ((x).w_termsig)
! # endif
! # ifndef WCOREDUMP
! #  define WCOREDUMP(x) ((x).w_coredump)
! # endif
! # ifndef WEXITSTATUS
! #  define WEXITSTATUS(x) ((x).w_retcode)
! # endif
! #else
! # define WAIT_T int
! # ifndef WTERMSIG
! #  define WTERMSIG(x) ((x) & 0x7f)
! # endif
! # ifndef WCOREDUMP
! #  define WCOREDUMP(x) ((x) & 0x80)
! # endif
! # ifndef WEXITSTATUS
! #  define WEXITSTATUS(x) (((x) >> 8) & 0xff)
! # endif
  #endif
  /* For valid x, exactly one of WIFSIGNALED(x), WIFEXITED(x), WIFSTOPPED(x)
     is true.  */
--- 46,59 ----
  #include <sys/wait.h>
  /* On Linux, WEXITSTATUS are bits 15..8 and WTERMSIG are bits 7..0, while
     BeOS uses the contrary.  Therefore we use the abstract macros.  */
! #ifndef WTERMSIG
! # define WTERMSIG(x) ((x) & 0x7f)
! #endif
! #ifndef WCOREDUMP
! # define WCOREDUMP(x) ((x) & 0x80)
! #endif
! #ifndef WEXITSTATUS
! # define WEXITSTATUS(x) (((x) >> 8) & 0xff)
  #endif
  /* For valid x, exactly one of WIFSIGNALED(x), WIFEXITED(x), WIFSTOPPED(x)
     is true.  */
***************
*** 346,352 ****
      }
  #else
    /* waitpid() is just as portable as wait() nowadays.  */
!   WAIT_T status;
  
    if (termsigp != NULL)
      *termsigp = 0;
--- 331,337 ----
      }
  #else
    /* waitpid() is just as portable as wait() nowadays.  */
!   int status;
  
    if (termsigp != NULL)
      *termsigp = 0;





reply via email to

[Prev in Thread] Current Thread [Next in Thread]