#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 **************************************************************************** ** ** ** HPE CONFIDENTIAL. This software is confidential proprietary software ** ** licensed by Hewlett Packard Enterprise Development, LP, and is not ** ** authorized to be used, duplicated or disclosed to anyone without the ** ** prior written permission of HPE. ** ** Copyright 2003 Hewlett Packard Enterprise Development, LP ** ** ** ** VMS SOFTWARE, INC. CONFIDENTIAL. This software is confidential ** ** proprietary software licensed by VMS Software, Inc., and is not ** ** authorized to be used, duplicated or disclosed to anyone without ** ** the prior written permission of VMS Software, Inc. ** ** Copyright 2022-2023 VMS Software, Inc. ** ** ** ***************************************************************************/ #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 # if defined(__clang__) # define wait __posix_wait # else # define wait(__p1) __posix_wait(__p1) # endif # 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. ** ** Beginning with __CRTL_VER >= 90210000 for non-x86 architectures, the wait3 ** and wait4 routines have support for both the old rusage structure format ** and the new extended one. On x86, only the extended version of the rusage ** structure is used. */ #if __CRTL_VER >= 90210000 && !defined __x86_64 && !defined __DONT_USE_EXT_WAIT # if defined(_VMS_WAIT) # define waitpid __vms_waitpid # define wait3 __vms_ext_wait3 # define wait4 __vms_ext_wait4 # else # define wait3 __ext_wait3 # define wait4 __ext_wait4 # endif #else # if (__CRTL_VER >= 70100322) && defined(_VMS_WAIT) # define waitpid __vms_waitpid # define wait3 __vms_wait3 # define wait4 __vms_wait4 # 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 __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 /* ** 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 */