Tizen RT Libs&Environment  v1.0 D5
wait.h
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * Copyright 2016 Samsung Electronics All Rights Reserved.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing,
12  * software distributed under the License is distributed on an
13  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
14  * either express or implied. See the License for the specific
15  * language governing permissions and limitations under the License.
16  *
17  ****************************************************************************/
18 /****************************************************************************
19  * include/sys/wait.h
20  *
21  * Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved.
22  * Author: Gregory Nutt <gnutt@nuttx.org>
23  *
24  * Redistribution and use in source and binary forms, with or without
25  * modification, are permitted provided that the following conditions
26  * are met:
27  *
28  * 1. Redistributions of source code must retain the above copyright
29  * notice, this list of conditions and the following disclaimer.
30  * 2. Redistributions in binary form must reproduce the above copyright
31  * notice, this list of conditions and the following disclaimer in
32  * the documentation and/or other materials provided with the
33  * distribution.
34  * 3. Neither the name NuttX nor the names of its contributors may be
35  * used to endorse or promote products derived from this software
36  * without specific prior written permission.
37  *
38  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
39  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
40  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
41  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
42  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
43  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
44  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
45  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
46  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
47  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
48  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
49  * POSSIBILITY OF SUCH DAMAGE.
50  *
51  ****************************************************************************/
53 
54 #ifndef __INCLUDE_SYS_WAIT_H
55 #define __INCLUDE_SYS_WAIT_H
56 
57 /****************************************************************************
58  * Included Files
59  ****************************************************************************/
60 
61 #include <sys/types.h>
62 #include <signal.h>
63 
64 #ifdef CONFIG_SCHED_WAITPID
65 
66 /****************************************************************************
67  * Pre-Processor Definitions
68  ****************************************************************************/
69 
70 /* The following are provided for analysis of returned status values.
71  * Encoded is as follows as 2 bytes of info(MS) then two bytes of code (LS).
72  * Code:
73  * 0 - Child has exited, info is the exit code.
74  * Other values - Not implemented
75  */
76 
77 #define WEXITSTATUS(s) (((s) >> 8) & 0xff) /* Return exit status */
78 #define WIFEXITED(s) (((s) & 0xff) == 0) /* True: Child exited normally */
79 
80 #define WIFCONTINUED(s) (false) /* True: Child has been continued */
81 #define WIFSIGNALED(s) (false) /* True: Child exited due to uncaught signal */
82 #define WIFSTOPPED(s) (false) /* True: Child is currently stopped */
83 #define WSTOPSIG(s) (false) /* Return signal number that caused process to stop */
84 #define WTERMSIG(s) (false) /* Return signal number that caused process to terminate */
85 
86 /* The following symbolic constants are possible values for the options
87  * argument to waitpid() (1) and/or waitid() (2),
88  */
89 
90 #define WCONTINUED (1 << 0) /* Status for child that has been continued (1)(2) */
91 #define WNOHANG (1 << 1) /* Do not wait if status not available (1) (2) */
92 #define WUNTRACED (1 << 2) /* Report status of stopped child process (1) */
93 #define WEXITED (1 << 3) /* Wait for processes that have exited (2) */
94 #define WSTOPPED (1 << 4) /* Status for child stopped on signal (2) */
95 #define WNOWAIT (1 << 5) /* Keep the process in a waitable state (2) */
96 
97 /****************************************************************************
98  * Public Type Definitions
99  ****************************************************************************/
100 
101 #ifndef __ASSEMBLY__
102 
106 enum idtype_e {
107  P_PID = 1,
108  P_GID = 2,
109  P_ALL = 3
110 };
111 typedef enum idtype_e idtype_t;
112 
113 /****************************************************************************
114  * Public Function Prototypes
115  ****************************************************************************/
116 
117 #undef EXTERN
118 #if defined(__cplusplus)
119 #define EXTERN extern "C"
120 extern "C" {
121 #else
122 #define EXTERN extern
123 #endif
124 
145 EXTERN pid_t wait(FAR int *stat_loc);
208 EXTERN int waitid(idtype_t idtype, id_t id, FAR siginfo_t *info, int options);
316 EXTERN pid_t waitpid(pid_t pid, FAR int *stat_loc, int options);
317 
318 #undef EXTERN
319 #if defined(__cplusplus)
320 }
321 #endif
322 
323 #endif /* __ASSEMBLY__ */
324 #endif /* CONFIG_SCHED_WAITPID */
325 #endif /* __INCLUDE_SYS_WAIT_H */
enum idtype_e idtype_t
Definition: wait.h:111
Definition: wait.h:108
Structure for using to pass parameters to/from signal handlers.
Definition: signal.h:240
Definition: wait.h:109
EXTERN int waitid(idtype_t idtype, id_t id, FAR siginfo_t *info, int options)
suspend execution of the calling thread
#define EXTERN
Definition: wait.h:122
Signal APIs.
EXTERN pid_t waitpid(pid_t pid, FAR int *stat_loc, int options)
suspend execution of the calling thread
EXTERN pid_t wait(FAR int *stat_loc)
suspend execution of the calling thread
Definition: wait.h:107
idtype_e
Enumeration for waitid idtype.
Definition: wait.h:106