xref: /onnv-gate/usr/src/lib/libast/common/include/wait.h (revision 12068:08a39a083754)
14887Schin /***********************************************************************
24887Schin *                                                                      *
34887Schin *               This software is part of the ast package               *
4*12068SRoger.Faulkner@Oracle.COM *          Copyright (c) 1985-2010 AT&T Intellectual Property          *
54887Schin *                      and is licensed under the                       *
64887Schin *                  Common Public License, Version 1.0                  *
78462SApril.Chin@Sun.COM *                    by AT&T Intellectual Property                     *
84887Schin *                                                                      *
94887Schin *                A copy of the License is available at                 *
104887Schin *            http://www.opensource.org/licenses/cpl1.0.txt             *
114887Schin *         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
124887Schin *                                                                      *
134887Schin *              Information and Software Systems Research               *
144887Schin *                            AT&T Research                             *
154887Schin *                           Florham Park NJ                            *
164887Schin *                                                                      *
174887Schin *                 Glenn Fowler <gsf@research.att.com>                  *
184887Schin *                  David Korn <dgk@research.att.com>                   *
194887Schin *                   Phong Vo <kpv@research.att.com>                    *
204887Schin *                                                                      *
214887Schin ***********************************************************************/
224887Schin #pragma prototyped
234887Schin /*
244887Schin  * ast POSIX wait/exit support
254887Schin  */
264887Schin 
274887Schin #ifndef _WAIT_H
284887Schin #define _WAIT_H
294887Schin 
304887Schin #include <ast.h>
314887Schin #include <ast_wait.h>
324887Schin 
334887Schin #if _sys_wait
344887Schin #if defined(__STDPP__directive) && defined(__STDPP__hide)
354887Schin __STDPP__directive pragma pp:hide wait waitpid
364887Schin #else
374887Schin #define wait		______wait
384887Schin #define waitpid		______waitpid
394887Schin #endif
404887Schin #include <sys/wait.h>
414887Schin #if defined(__STDPP__directive) && defined(__STDPP__hide)
424887Schin __STDPP__directive pragma pp:nohide wait waitpid
434887Schin #else
444887Schin #undef	wait
454887Schin #undef	waitpid
464887Schin #endif
474887Schin #endif
484887Schin 
494887Schin #ifndef WNOHANG
504887Schin #define WNOHANG		1
514887Schin #endif
524887Schin 
534887Schin #ifndef WUNTRACED
544887Schin #define WUNTRACED	2
554887Schin #endif
564887Schin 
574887Schin #if !_ok_wif
584887Schin #undef	WIFEXITED
594887Schin #undef	WEXITSTATUS
604887Schin #undef	WIFSIGNALED
614887Schin #undef	WTERMSIG
624887Schin #undef	WIFSTOPPED
634887Schin #undef	WSTOPSIG
644887Schin #undef	WTERMCORE
654887Schin #endif
664887Schin 
674887Schin #ifndef WIFEXITED
684887Schin #define WIFEXITED(x)	(!((x)&((1<<(EXIT_BITS-1))-1)))
694887Schin #endif
704887Schin 
714887Schin #ifndef WEXITSTATUS
724887Schin #define WEXITSTATUS(x)	(((x)>>EXIT_BITS)&((1<<EXIT_BITS)-1))
734887Schin #endif
744887Schin 
754887Schin #ifndef WIFSIGNALED
764887Schin #define WIFSIGNALED(x)	(((x)&((1<<(EXIT_BITS-1))-1))!=0)
774887Schin #endif
784887Schin 
794887Schin #ifndef WTERMSIG
804887Schin #define WTERMSIG(x)	((x)&((1<<(EXIT_BITS-1))-1))
814887Schin #endif
824887Schin 
834887Schin #ifndef WIFSTOPPED
844887Schin #define WIFSTOPPED(x)	(((x)&((1<<EXIT_BITS)-1))==((1<<(EXIT_BITS-1))-1))
854887Schin #endif
864887Schin 
874887Schin #ifndef WSTOPSIG
884887Schin #define WSTOPSIG(x)	WEXITSTATUS(x)
894887Schin #endif
904887Schin 
914887Schin #ifndef WTERMCORE
924887Schin #define WTERMCORE(x)	((x)&(1<<(EXIT_BITS-1)))
934887Schin #endif
944887Schin 
954887Schin extern pid_t		wait(int*);
964887Schin extern pid_t		waitpid(pid_t, int*, int);
974887Schin 
984887Schin #endif
99