1570af302Sopenharmony_ci#ifndef _SPAWN_H
2570af302Sopenharmony_ci#define _SPAWN_H
3570af302Sopenharmony_ci
4570af302Sopenharmony_ci#ifdef __cplusplus
5570af302Sopenharmony_ciextern "C" {
6570af302Sopenharmony_ci#endif
7570af302Sopenharmony_ci
8570af302Sopenharmony_ci#include <features.h>
9570af302Sopenharmony_ci
10570af302Sopenharmony_ci#define __NEED_mode_t
11570af302Sopenharmony_ci#define __NEED_pid_t
12570af302Sopenharmony_ci#define __NEED_sigset_t
13570af302Sopenharmony_ci
14570af302Sopenharmony_ci#include <bits/alltypes.h>
15570af302Sopenharmony_ci
16570af302Sopenharmony_cistruct sched_param;
17570af302Sopenharmony_ci
18570af302Sopenharmony_ci#define POSIX_SPAWN_RESETIDS 1
19570af302Sopenharmony_ci#define POSIX_SPAWN_SETPGROUP 2
20570af302Sopenharmony_ci#define POSIX_SPAWN_SETSIGDEF 4
21570af302Sopenharmony_ci#define POSIX_SPAWN_SETSIGMASK 8
22570af302Sopenharmony_ci#define POSIX_SPAWN_SETSCHEDPARAM 16
23570af302Sopenharmony_ci#define POSIX_SPAWN_SETSCHEDULER 32
24570af302Sopenharmony_ci#define POSIX_SPAWN_USEVFORK 64
25570af302Sopenharmony_ci#define POSIX_SPAWN_SETSID 128
26570af302Sopenharmony_ci
27570af302Sopenharmony_citypedef struct {
28570af302Sopenharmony_ci	int __flags;
29570af302Sopenharmony_ci	pid_t __pgrp;
30570af302Sopenharmony_ci	sigset_t __def, __mask;
31570af302Sopenharmony_ci	int __prio, __pol;
32570af302Sopenharmony_ci	void *__fn;
33570af302Sopenharmony_ci	char __pad[64-sizeof(void *)];
34570af302Sopenharmony_ci} posix_spawnattr_t;
35570af302Sopenharmony_ci
36570af302Sopenharmony_citypedef struct {
37570af302Sopenharmony_ci	int __pad0[2];
38570af302Sopenharmony_ci	void *__actions;
39570af302Sopenharmony_ci	int __pad[16];
40570af302Sopenharmony_ci} posix_spawn_file_actions_t;
41570af302Sopenharmony_ci
42570af302Sopenharmony_ciint posix_spawn(pid_t *__restrict, const char *__restrict, const posix_spawn_file_actions_t *,
43570af302Sopenharmony_ci	const posix_spawnattr_t *__restrict, char *const *__restrict, char *const *__restrict);
44570af302Sopenharmony_ciint posix_spawnp(pid_t *__restrict, const char *__restrict, const posix_spawn_file_actions_t *,
45570af302Sopenharmony_ci	const posix_spawnattr_t *__restrict, char *const *__restrict, char *const *__restrict);
46570af302Sopenharmony_ci
47570af302Sopenharmony_ciint posix_spawnattr_init(posix_spawnattr_t *);
48570af302Sopenharmony_ciint posix_spawnattr_destroy(posix_spawnattr_t *);
49570af302Sopenharmony_ci
50570af302Sopenharmony_ciint posix_spawnattr_setflags(posix_spawnattr_t *, short);
51570af302Sopenharmony_ciint posix_spawnattr_getflags(const posix_spawnattr_t *__restrict, short *__restrict);
52570af302Sopenharmony_ci
53570af302Sopenharmony_ciint posix_spawnattr_setpgroup(posix_spawnattr_t *, pid_t);
54570af302Sopenharmony_ciint posix_spawnattr_getpgroup(const posix_spawnattr_t *__restrict, pid_t *__restrict);
55570af302Sopenharmony_ci
56570af302Sopenharmony_ciint posix_spawnattr_setsigmask(posix_spawnattr_t *__restrict, const sigset_t *__restrict);
57570af302Sopenharmony_ciint posix_spawnattr_getsigmask(const posix_spawnattr_t *__restrict, sigset_t *__restrict);
58570af302Sopenharmony_ci
59570af302Sopenharmony_ciint posix_spawnattr_setsigdefault(posix_spawnattr_t *__restrict, const sigset_t *__restrict);
60570af302Sopenharmony_ciint posix_spawnattr_getsigdefault(const posix_spawnattr_t *__restrict, sigset_t *__restrict);
61570af302Sopenharmony_ci
62570af302Sopenharmony_ciint posix_spawnattr_setschedparam(posix_spawnattr_t *__restrict, const struct sched_param *__restrict);
63570af302Sopenharmony_ciint posix_spawnattr_getschedparam(const posix_spawnattr_t *__restrict, struct sched_param *__restrict);
64570af302Sopenharmony_ciint posix_spawnattr_setschedpolicy(posix_spawnattr_t *, int);
65570af302Sopenharmony_ciint posix_spawnattr_getschedpolicy(const posix_spawnattr_t *__restrict, int *__restrict);
66570af302Sopenharmony_ci
67570af302Sopenharmony_ciint posix_spawn_file_actions_init(posix_spawn_file_actions_t *);
68570af302Sopenharmony_ciint posix_spawn_file_actions_destroy(posix_spawn_file_actions_t *);
69570af302Sopenharmony_ci
70570af302Sopenharmony_ciint posix_spawn_file_actions_addopen(posix_spawn_file_actions_t *__restrict, int, const char *__restrict, int, mode_t);
71570af302Sopenharmony_ciint posix_spawn_file_actions_addclose(posix_spawn_file_actions_t *, int);
72570af302Sopenharmony_ciint posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t *, int, int);
73570af302Sopenharmony_ci
74570af302Sopenharmony_ci#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
75570af302Sopenharmony_ciint posix_spawn_file_actions_addchdir_np(posix_spawn_file_actions_t *__restrict, const char *__restrict);
76570af302Sopenharmony_ciint posix_spawn_file_actions_addfchdir_np(posix_spawn_file_actions_t *, int);
77570af302Sopenharmony_ci#endif
78570af302Sopenharmony_ci
79570af302Sopenharmony_ci#ifdef __cplusplus
80570af302Sopenharmony_ci}
81570af302Sopenharmony_ci#endif
82570af302Sopenharmony_ci
83570af302Sopenharmony_ci#endif
84