Debian Codegraph @

share/libc/spawn.h

raw
1 /**************************************************************************/
2 /* */
3 /* This file is part of Frama-C. */
4 /* */
5 /* Copyright (C) 2007-2022 */
6 /* CEA (Commissariat à l'énergie atomique et aux énergies */
7 /* alternatives) */
8 /* */
9 /* you can redistribute it and/or modify it under the terms of the GNU */
10 /* Lesser General Public License as published by the Free Software */
11 /* Foundation, version 2.1. */
12 /* */
13 /* It is distributed in the hope that it will be useful, */
14 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
15 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
16 /* GNU Lesser General Public License for more details. */
17 /* */
18 /* See the GNU Lesser General Public License version 2.1 */
19 /* for more details (enclosed in the file licenses/LGPLv2.1). */
20 /* */
21 /**************************************************************************/
22
23 #ifndef __FC_SPAWN
24 #define __FC_SPAWN
25 #include "features.h"
26 __PUSH_FC_STDLIB
27 #include "__fc_define_mode_t.h"
28 #include "__fc_define_pid_t.h"
29 #include "__fc_define_sigset_t.h"
30
31 __BEGIN_DECLS
32
33
34 typedef struct __fc_posix_spawnattr_t {
35 int __fc_psa;
36 } posix_spawnattr_t;
37
38 typedef struct __fc_posix_posix_spawn_file_actions_t {
39 int __fc_psfa;
40 } posix_spawn_file_actions_t;
41
42 #define POSIX_SPAWN_RESETIDS 0x01
43 #define POSIX_SPAWN_SETPGROUP 0x02
44 #define POSIX_SPAWN_SETSCHEDPARAM 0x10
45 #define POSIX_SPAWN_SETSCHEDULER 0x20
46 #define POSIX_SPAWN_SETSIGDEF 0x04
47 #define POSIX_SPAWN_SETSIGMASK 0x08
48
49 extern int posix_spawn(pid_t *restrict pid, const char *restrict path,
50 const posix_spawn_file_actions_t *file_actions,
51 const posix_spawnattr_t *restrict attrp,
52 char *const *restrict argv,
53 char *const *restrict envp);
54
55 extern int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t
56 *file_actions,
57 int fildes);
58
59 extern int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t
60 *file_actions,
61 int fildes, int newfildes);
62
63 extern int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t
64 *restrict file_actions,
65 int fildes,
66 const char *restrict path,
67 int oflag, mode_t mode);
68
69 extern int posix_spawn_file_actions_destroy(posix_spawn_file_actions_t
70 *file_actions);
71
72 extern int posix_spawn_file_actions_init(posix_spawn_file_actions_t
73 *file_actions);
74
75 extern int posix_spawnattr_destroy(posix_spawnattr_t *attr);
76
77 extern int posix_spawnattr_getflags(const posix_spawnattr_t *restrict attr,
78 short *restrict flags);
79
80 extern int posix_spawnattr_getpgroup(const posix_spawnattr_t *restrict attr,
81 pid_t *restrict pgroup);
82
83 extern int posix_spawnattr_getschedparam(const posix_spawnattr_t *restrict attr,
84 struct sched_param *restrict
85 schedparam);
86
87 extern int posix_spawnattr_getschedpolicy(const posix_spawnattr_t *restrict
88 attr,
89 int *restrict schedpolicy);
90
91 extern int posix_spawnattr_getsigdefault(const posix_spawnattr_t *restrict attr,
92 sigset_t *restrict sigdefault);
93
94 extern int posix_spawnattr_getsigmask(const posix_spawnattr_t *restrict attr,
95 sigset_t *restrict);
96
97 extern int posix_spawnattr_init(posix_spawnattr_t *attr);
98
99 extern int posix_spawnattr_setflags(posix_spawnattr_t *attr, short flags);
100
101 extern int posix_spawnattr_setpgroup(posix_spawnattr_t *attr, pid_t pgroup);
102
103 extern int posix_spawnattr_setschedparam(posix_spawnattr_t *restrict attr,
104 const struct sched_param *restrict
105 schedparam);
106
107 extern int posix_spawnattr_setschedpolicy(posix_spawnattr_t *attr,
108 int schedpolicy);
109
110 extern int posix_spawnattr_setsigdefault(posix_spawnattr_t *restrict attr,
111 const sigset_t *restrict sigdefault);
112
113 extern int posix_spawnattr_setsigmask(posix_spawnattr_t *restrict attr,
114 const sigset_t *restrict sigmask);
115
116 extern int posix_spawnp(pid_t *restrict pid, const char *restrict file,
117 const posix_spawn_file_actions_t *file_actions,
118 const posix_spawnattr_t *restrict attrp,
119 char *const *restrict argv,
120 char *const *restrict envp);
121
122 __END_DECLS
123
124 __POP_FC_STDLIB
125 #endif