#ifndef __WAIT_LOADED #define __WAIT_LOADED 1 #pragma __nostandard #include #if __CRTL_VER >= 60100000 /**************************************************************************** ** ** - Declarations for process waiting ** ***************************************************************************** ** Header introduced by the ISO POSIX-1 Standard ***************************************************************************** ** ** Copyright 2003 Hewlett-Packard Development Company, L.P. ** ** Confidential computer software. Valid license from HP and/or ** its subsidiaries required for possession, use, or copying. ** ** Consistent with FAR 12.211 and 12.212, Commercial Computer Software, ** Computer Software Documentation, and Technical Data for Commercial ** Items are licensed to the U.S. Government under vendor's standard ** commercial license. ** ** Neither HP nor any of its subsidiaries shall be liable for technical ** or editorial errors or omissions contained herein. The information ** in this document is provided "as is" without warranty of any kind and ** is subject to change without notice. The warranties for HP products ** are set forth in the express limited warranty statements accompanying ** such products. Nothing herein should be construed as constituting an ** additional warranty. ** ***************************************************************************** */ #ifdef __cplusplus extern "C" { #endif /* ** Create 'public' typedefs that are either insensitive to pointer size or ** are sensitive to pointer size and must use short pointers. */ #if !defined __PID_T && (defined _XOPEN_SOURCE || !defined _POSIX_C_SOURCE) # define __PID_T 1 typedef __pid_t pid_t; #endif /* ** X/Open extended (XPG4 V2) extensions */ #if defined _XOPEN_SOURCE_EXTENDED || !defined _POSIX_C_SOURCE /* ** pid_t, the same as in */ # ifndef __PID_T # define __PID_T 1 typedef __pid_t pid_t; # endif #endif #if __CRTL_VER >= 70000000 /* ** Includes needed in X/Open extended (XPG4 V2) compilation */ #if defined _XOPEN_SOURCE_EXTENDED || !defined _POSIX_C_SOURCE # include /* for siginfo_t */ # include /* for struct rusage */ #endif /* ** Ensure that regardless of user /pointer_size usage, we begin processing ** using a 32 bit pointer context. */ #if __INITIAL_POINTER_SIZE # pragma __pointer_size __save # pragma __pointer_size 32 #endif /* ** Member align structures */ #pragma __member_alignment __save #pragma __member_alignment /* ** Symbolic constants for waitpid() */ #define WNOHANG 1 #define WUNTRACED 2 /* ** Macros for analysis of process status values */ # define WIFEXITED(s) (((s)&0x7F)==0) # define WEXITSTATUS(s) (((s)>>8)&0xFF) # define WIFSTOPPED(s) (((s)&0xFF)==0x7F) /* not implemented */ # define WSTOPSIG(s) (((s)>>8)&0xFF) # define WIFSIGNALED(s) (((unsigned)(((s)&0x7F)-1))<0x7E) # define WTERMSIG(s) ((s)&0x7F) /* ** X/Open extended (XPG4 V2) extensions */ #if defined _XOPEN_SOURCE_EXTENDED || !defined _POSIX_C_SOURCE # define WCONTINUED 4 # define WNOWAIT 8 # define WIFCONTINUED(s) (((s)&0xFF)==0xff) /* not implemented */ /* ** Options argument to waitid */ # define WEXITED 3 # define WSTOPPED 4 /* ** idtype_t and id_t for waitid() */ typedef enum { P_ALL, P_PID, P_PGID } idtype_t; # ifndef __ID_T # define __ID_T typedef __id_t id_t; # endif #endif /* ** DEC C extensions ** ** union wait is for BSD compatibility. */ #if !defined _POSIX_C_SOURCE # define _WSTOPPED 0x7f union wait { int w_status; /* ** For processes that have exited */ struct { unsigned _w_termsig:7; /* termination signal */ unsigned _w_coredump:1; /* core dump indicator */ unsigned _w_retcode:8; /* exit code if w_termsig==0 */ unsigned short _w_PAD16; } _w_t; /* ** For processed that have stopped. Not currently implemented. */ struct { unsigned _w_stopval:8; /* == _WSTOPPED if stopped */ unsigned _w_stopsig:8; /* signal that stopped us */ unsigned short _w_PAD16; } _w_s; }; # define w_termsig _w_t._w_termsig # define w_coredump _w_t._w_coredump # define w_retcode _w_t._w_retcode # define w_stopval _w_s._w_stopval # define w_stopsig _w_s._w_stopsig #endif /* ** We are done defining things which must always be short pointers. If ** the user has used /pointer_size=short or /pointer_size=long, we will ** allow long pointers to be used in function calls. */ #if __INITIAL_POINTER_SIZE # pragma __pointer_size 64 #endif /* ** Function prototypes */ #if defined _POSIX_EXIT # if __CAN_USE_EXTERN_PREFIX # pragma __extern_prefix __save # pragma __extern_prefix "__posix_" # else # define wait(__p1) __posix_wait(__p1) # endif #endif __pid_t wait(int *__stat_loc); #if defined _POSIX_EXIT # if __CAN_USE_EXTERN_PREFIX # pragma __extern_prefix __restore # endif #endif /* ** Beginning in OpenVMS Version 7.2 waitpid, wait3 and wait4 have two ** implementations. One implementation returns UNIX-style exit status ** which can be analyzed using the macros for analysis of process status ** values from this header. The other __vms_* returns VMS completion code. */ #if (__CRTL_VER >= 70100322) && defined(_VMS_WAIT) # ifdef __CAN_USE_EXTERN_PREFIX # pragma __extern_prefix __save # pragma __extern_prefix "__vms_" # else # define waitpid(__p1,__p2,__p3) __vms_waitpid(__p1,__p2,__p3) # define wait3(__p1,__p2,__p3) __vms_wait3(__p1,__p2,__p3) # define wait4(__p1,__p2,__p3,__p4) __vms_wait4(__p1,__p2,__p3,__p4) # endif #endif __pid_t waitpid( __pid_t __pid, int *__stat_loc, int __options ); /* ** X/Open extended (XPG4 V2) Function prototypes */ #if defined _XOPEN_SOURCE_EXTENDED || !defined _POSIX_C_SOURCE #if 0 /* waitid not yet implemented */ int waitid(idtype_t __idtype, id_t __id, siginfo_t *__infop, int __options); #endif __pid_t wait3(int *__stat_loc, int options, struct rusage *__resource_usage); #endif /* ** DEC C extensions */ #if !defined _POSIX_C_SOURCE __pid_t wait4(__pid_t __pid, union wait *__exit_status, int __options, struct rusage *__resource_usage); #endif #if (__CRTL_VER >= 70100322) && defined(_VMS_WAIT) # if __CAN_USE_EXTERN_PREFIX # pragma __extern_prefix __restore # endif #endif /* ** Restore the users pointer context */ #if __INITIAL_POINTER_SIZE # pragma __pointer_size __restore #endif #pragma __member_alignment __restore #else /* ** The functions declared in this header except for the wait() are new in ** OpenVMS V7.0. The wait() function was introduced in OpenVMS V6.1 and its ** prototype is included here without any prefixing for the users compiling ** with DEC C V5.2 or higher on OpenVMS V6.1 or V6.2. The pid_t data type ** was defined above in the common part of the header. */ __pid_t wait(int *__stat_loc); #endif /* #if __CRTL_VER >= 70000000 */ #ifdef __cplusplus } #endif #endif /* #if __CRTL_VER >= 60100000 */ #pragma __standard #endif /* __WAIT_LOADED */