]>
Commit | Line | Data |
---|---|---|
6793dd51 | 1 | /* Internal definitions for posix_spawn functionality. |
6d7e8eda | 2 | Copyright (C) 2000-2023 Free Software Foundation, Inc. |
6793dd51 FW |
3 | This file is part of the GNU C Library. |
4 | ||
5 | The GNU C Library is free software; you can redistribute it and/or | |
6 | modify it under the terms of the GNU Lesser General Public | |
7 | License as published by the Free Software Foundation; either | |
8 | version 2.1 of the License, or (at your option) any later version. | |
9 | ||
10 | The GNU C Library is distributed in the hope that it will be useful, | |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | Lesser General Public License for more details. | |
14 | ||
15 | You should have received a copy of the GNU Lesser General Public | |
16 | License along with the GNU C Library; if not, see | |
5a82c748 | 17 | <https://www.gnu.org/licenses/>. */ |
6793dd51 FW |
18 | |
19 | #ifndef _SPAWN_INT_H | |
20 | #define _SPAWN_INT_H | |
21 | ||
22 | #include <spawn.h> | |
882d6e17 | 23 | #include <spawn_int_def.h> |
6793dd51 FW |
24 | #include <stdbool.h> |
25 | ||
a5a6f926 UD |
26 | /* Data structure to contain the action information. */ |
27 | struct __spawn_action | |
28 | { | |
29 | enum | |
30 | { | |
31 | spawn_do_close, | |
32 | spawn_do_dup2, | |
4a938cb2 FW |
33 | spawn_do_open, |
34 | spawn_do_chdir, | |
3a3fb755 | 35 | spawn_do_fchdir, |
882d6e17 | 36 | spawn_do_closefrom, |
6289d28d | 37 | spawn_do_tcsetpgrp |
a5a6f926 UD |
38 | } tag; |
39 | ||
40 | union | |
41 | { | |
42 | struct | |
43 | { | |
44 | int fd; | |
45 | } close_action; | |
46 | struct | |
47 | { | |
48 | int fd; | |
49 | int newfd; | |
50 | } dup2_action; | |
51 | struct | |
52 | { | |
53 | int fd; | |
89e435f3 | 54 | char *path; |
a5a6f926 UD |
55 | int oflag; |
56 | mode_t mode; | |
57 | } open_action; | |
4a938cb2 FW |
58 | struct |
59 | { | |
60 | char *path; | |
61 | } chdir_action; | |
3a3fb755 FW |
62 | struct |
63 | { | |
64 | int fd; | |
65 | } fchdir_action; | |
882d6e17 AZ |
66 | struct |
67 | { | |
68 | int from; | |
69 | } closefrom_action; | |
6289d28d AZ |
70 | struct |
71 | { | |
72 | int fd; | |
73 | } setpgrp_action; | |
a5a6f926 UD |
74 | } action; |
75 | }; | |
76 | ||
d96de963 UD |
77 | #define SPAWN_XFLAGS_USE_PATH 0x1 |
78 | #define SPAWN_XFLAGS_TRY_SHELL 0x2 | |
0d6f9f62 | 79 | #define SPAWN_XFLAGS_RET_PIDFD 0x4 |
d96de963 | 80 | |
a5a6f926 | 81 | extern int __posix_spawn_file_actions_realloc (posix_spawn_file_actions_t * |
85b35894 L |
82 | file_actions) |
83 | attribute_hidden; | |
a5a6f926 | 84 | |
0d6f9f62 | 85 | extern int __spawni (int *pid, const char *path, |
a5a6f926 UD |
86 | const posix_spawn_file_actions_t *file_actions, |
87 | const posix_spawnattr_t *attrp, char *const argv[], | |
85b35894 | 88 | char *const envp[], int xflags) attribute_hidden; |
6793dd51 FW |
89 | |
90 | /* Return true if FD falls into the range valid for file descriptors. | |
91 | The check in this form is mandated by POSIX. */ | |
b41bd5bc | 92 | bool __spawn_valid_fd (int fd) attribute_hidden; |
6793dd51 FW |
93 | |
94 | #endif /* _SPAWN_INT_H */ |