This is p-wait.h in view mode; [Download] [Up]
/*+++* * RCS $Id: p-wait.h,v 1.2 1993/02/02 21:00:42 gerben Exp $ * title: p-wait.h * abstract: portable Posix-compliant <sys/wait.h>. * author: T.R.Hageman, Groningen, The Netherlands * created: September 1992 * modified: (see RCS Log at end) * copyleft: * * Copyright (C) 1992 Tom R. Hageman. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * description: * * This is a Posix-compatible version of <sys/wait.h> for both Posix * and non-Posix systems. * * Notes: * o Some systems (BSD) use `union wait' instead of `int' for the * child's exit status returned by `wait'. Use `WAIT_T' to disguise * this difference. * * TODO: * support vfork() {{here??}}, wait2(), wait3(), wait4() * BUGS: * usually there is no way to emulate waitpid() on non-Posix systems. *---*/ #ifndef _P_WAIT_H_ #define _P_WAIT_H_ 0x101 #ifndef _PORTDEFS_H_ # include "portdefs.h" #endif #if __STRICT_ANSI__ #error "You shouldn't use this header in strict ANSI C code" #endif #if _I_SYS_WAIT # include <sys/wait.h> #else # if _I_WAIT # include <wait.h> # endif #endif #ifndef _P_TYPES_H_ # include "p-types.h" /* for pid_t */ #endif #ifndef HAVE_UNION_WAIT # if (!__POSIX__ && _I_SYS_WAIT) /* assume BSD-style wait */ # define HAVE_UNION_WAIT 1 # endif #endif #if HAVE_UNION_WAIT # define WAIT_T union wait #else # define WAIT_T int #endif #ifndef HAVE_WAIT3 # if (WNOHANG && WUNTRACED) /* educated guess... */ # define HAVE_WAIT3 1 # endif #endif #if !__STRICT_POSIX__ /* {{Handle vfork??}} */ #endif #if !(__POSIX__) # ifndef WNOHANG # define WNOHANG 1 # endif # ifndef WUNTRACED # define WUNTRACED (WNOHANG<<1) # endif # if HAVE_UNION_WAIT # ifndef WEXITSTATUS # define WEXITSTATUS(w) ((w).w_retcode) # endif # ifndef WSTOPSIG # ifdef WSTOPPED # define WSTOPSIG(w) ((w).w_stopsig) # else # define WSTOPSIG(w) (0) # endif # endif # ifndef WTERMSIG # define WTERMSIG(w) ((w).w_termsig) # endif # ifndef WIFEXITED # define WIFEXITED(w) (WTERMSIG(w)==0) # endif # ifndef WIFSTOPPED # ifdef WSTOPPED # define WIFSTOPPED(w) ((w).w_stopval==WSTOPPED) # else # define WIFSTOPPED(w) (WTERMSIG(w)==0177) # endif # endif # ifndef WIFSIGNALLED # define WIFSIGNALLED(w) (!WIFSTOPPED(w)&&!WIFEXITED(w)) # endif # else /* !HAVE_UNION_WAIT */ # ifndef WEXITSTATUS # if __UNIX__ /* {{should we sign-extend?}} */ # define WEXITSTATUS(w) ((short)(w)>>8) # else # define WEXITSTATUS(w) (w) # endif # endif # ifndef WSTOPSIG # define WSTOPSIG(w) WEXITSTATUS(w) # endif # ifndef WTERMSIG # if __UNIX__ # define WTERMSIG(w) ((w)&0177) # else # define WTERMSIG(w) (0) # endif # endif # ifndef WIFEXITED # define WIFEXITED(w) (WTERMSIG(w)==0) # endif # ifndef WIFSTOPPED # define WIFSTOPPED(w) (WTERMSIG(w)==0177) # endif # ifndef WIFSIGNALED # define WIFSIGNALED(w) ((unsigned)(WTERMSIG(w)-1)<(0177-1)) # endif # endif /* HAVE_UNION_WAIT */ # if !__NO_PROTO__ extern pid_t wait __(( WAIT_T *_(status) )); # ifndef waitpid extern pid_t waitpid __(( pid_t _(pid), WAIT_T *_(status), int _(flags) )); # endif # endif #endif /* !__POSIX__ */ #endif /* _P_WAIT_H_ */ /*======================================================================* * $Log: p-wait.h,v $ * Revision 1.2 1993/02/02 21:00:42 gerben * *** empty log message *** * * Revision 1.2 1993/02/02 15:40:06 tom * some changes to facilitate emulation of waitpid(). * * Revision 1.1 1992/10/23 04:32:03 tom * add __STRICT_ANSI__ check. * * Revision 1.0 1992/10/20 16:52:19 tom * Initial revision * *======================================================================*/
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.