posix-next API 0.1.0
Out-of-tree Zephyr POSIX module
Loading...
Searching...
No Matches
spawn.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: Copyright The Zephyr Project Contributors
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
21#ifndef ZEPHYR_INCLUDE_POSIX_SPAWN_H_
22#define ZEPHYR_INCLUDE_POSIX_SPAWN_H_
23
24#include <sched.h>
25#include <signal.h>
26#include <sys/types.h>
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
36#define POSIX_SPAWN_RESETIDS 0x01
41#define POSIX_SPAWN_SETPGROUP 0x02
46#define POSIX_SPAWN_SETSCHEDPARAM 0x04
51#define POSIX_SPAWN_SETSCHEDULER 0x08
56#define POSIX_SPAWN_SETSIGDEF 0x10
61#define POSIX_SPAWN_SETSIGMASK 0x20
62
63#ifndef __posix_spawnattr_t_defined
64#define __posix_spawnattr_t_defined
69typedef struct {
70 short flags;
71 pid_t pgroup;
72 sigset_t sigdefault;
73 sigset_t sigmask;
74 struct sched_param schedparam;
75 int schedpolicy;
77#endif
78
79#ifndef __posix_spawn_file_actions_t_defined
80#define __posix_spawn_file_actions_t_defined
86typedef struct {
87 struct posix_spawn_file_action *actions;
88 int num;
89 int cap;
91#endif
92
109int posix_spawn(pid_t *pid, const char *path, const posix_spawn_file_actions_t *file_actions,
110 const posix_spawnattr_t *attrp, char *const argv[], char *const envp[]);
111
124int posix_spawnp(pid_t *pid, const char *file, const posix_spawn_file_actions_t *file_actions,
125 const posix_spawnattr_t *attrp, char *const argv[], char *const envp[]);
126
136
147 int newfildes);
148
161 const char *path, int oflag, mode_t mode);
162
171
180
189
198int posix_spawnattr_getflags(const posix_spawnattr_t *attr, short *flags);
199
209
218int posix_spawnattr_getschedparam(const posix_spawnattr_t *attr, struct sched_param *schedparam);
219
228int posix_spawnattr_getschedpolicy(const posix_spawnattr_t *attr, int *schedpolicy);
229
239
249
258
268
278
287int posix_spawnattr_setschedparam(posix_spawnattr_t *attr, const struct sched_param *schedparam);
288
298
308
318
319#ifdef __cplusplus
320}
321#endif
322
323#endif /* ZEPHYR_INCLUDE_POSIX_SPAWN_H_ */
int pid_t
Process ID type.
Definition fcntl.h:192
int mode_t
File permission bits type.
Definition fcntl.h:178
int posix_spawnattr_getschedparam(const posix_spawnattr_t *attr, struct sched_param *schedparam)
Get the scheduling parameter attribute.
int posix_spawnattr_setschedparam(posix_spawnattr_t *attr, const struct sched_param *schedparam)
Set the scheduling parameter attribute, applied with POSIX_SPAWN_SETSCHEDPARAM.
int posix_spawnattr_init(posix_spawnattr_t *attr)
Initialize a spawn attributes object with default values.
int posix_spawnattr_getsigdefault(const posix_spawnattr_t *attr, sigset_t *sigdefault)
Get the default-signals attribute.
int posix_spawn_file_actions_destroy(posix_spawn_file_actions_t *file_actions)
Destroy a file actions object.
int posix_spawnattr_setflags(posix_spawnattr_t *attr, short flags)
Set the POSIX_SPAWN_* flags of a spawn attributes object.
int posix_spawnattr_getflags(const posix_spawnattr_t *attr, short *flags)
Get the POSIX_SPAWN_* flags of a spawn attributes object.
int posix_spawn(pid_t *pid, const char *path, const posix_spawn_file_actions_t *file_actions, const posix_spawnattr_t *attrp, char *const argv[], char *const envp[])
Spawn a new process from the executable image named by path.
int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t *file_actions, int fildes, const char *path, int oflag, mode_t mode)
Add an open action in the child, opening path as descriptor fildes.
int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t *file_actions, int fildes, int newfildes)
Add a dup2 action in the child, duplicating fildes onto newfildes.
int posix_spawnattr_getschedpolicy(const posix_spawnattr_t *attr, int *schedpolicy)
Get the scheduling policy attribute.
int posix_spawn_file_actions_init(posix_spawn_file_actions_t *file_actions)
Initialize a file actions object with no actions.
int posix_spawnattr_getpgroup(const posix_spawnattr_t *attr, pid_t *pgroup)
Get the process group attribute.
int posix_spawnattr_setsigdefault(posix_spawnattr_t *attr, const sigset_t *sigdefault)
Set the default-signals attribute, applied with POSIX_SPAWN_SETSIGDEF.
int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t *file_actions, int fildes)
Add a close action for descriptor fildes in the child.
int posix_spawnattr_setsigmask(posix_spawnattr_t *attr, const sigset_t *sigmask)
Set the signal mask attribute, applied with POSIX_SPAWN_SETSIGMASK.
int posix_spawnattr_setpgroup(posix_spawnattr_t *attr, pid_t pgroup)
Set the process group attribute, applied with POSIX_SPAWN_SETPGROUP.
int posix_spawnp(pid_t *pid, const char *file, const posix_spawn_file_actions_t *file_actions, const posix_spawnattr_t *attrp, char *const argv[], char *const envp[])
Spawn a new process, resolving file as posix_spawn() resolves a path.
int posix_spawnattr_getsigmask(const posix_spawnattr_t *attr, sigset_t *sigmask)
Get the signal mask attribute.
int posix_spawnattr_setschedpolicy(posix_spawnattr_t *attr, int schedpolicy)
Set the scheduling policy attribute, applied with POSIX_SPAWN_SETSCHEDULER.
int posix_spawnattr_destroy(posix_spawnattr_t *attr)
Destroy a spawn attributes object.
POSIX process and thread scheduling API (<sched.h>)
Ordered list of file actions performed in the child, initialized with posix_spawn_file_actions_init()...
Definition spawn.h:86
Spawn attributes object, initialized with posix_spawnattr_init().
Definition spawn.h:69
Set of signals (bitmask).
POSIX fundamental types (<sys/types.h>)