2 * Copyright 2017 Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the Haiku License.
12 #include <sys/types.h>
16 * Flags for spawn attributes.
18 #define POSIX_SPAWN_RESETIDS 0x01
19 #define POSIX_SPAWN_SETPGROUP 0x02
20 #if 0 /* Unimplemented flags: */
21 #define POSIX_SPAWN_SETSCHEDPARAM 0x04
22 #define POSIX_SPAWN_SETSCHEDULER 0x08
24 #define POSIX_SPAWN_SETSIGDEF 0x10
25 #define POSIX_SPAWN_SETSIGMASK 0x20
28 typedef struct _posix_spawnattr
*posix_spawnattr_t
;
29 typedef struct _posix_spawn_file_actions
*posix_spawn_file_actions_t
;
37 extern int posix_spawn(pid_t
*pid
, const char *path
,
38 const posix_spawn_file_actions_t
*file_actions
,
39 const posix_spawnattr_t
*attrp
, char *const argv
[], char *const envp
[]);
40 extern int posix_spawnp(pid_t
*pid
, const char *file
,
41 const posix_spawn_file_actions_t
*file_actions
,
42 const posix_spawnattr_t
*attrp
, char *const argv
[],
45 /* file actions functions */
46 extern int posix_spawn_file_actions_init(
47 posix_spawn_file_actions_t
*file_actions
);
48 extern int posix_spawn_file_actions_destroy(
49 posix_spawn_file_actions_t
*file_actions
);
50 extern int posix_spawn_file_actions_addopen(
51 posix_spawn_file_actions_t
*file_actions
,
52 int fildes
, const char *path
, int oflag
, mode_t mode
);
53 extern int posix_spawn_file_actions_addclose(
54 posix_spawn_file_actions_t
*file_actions
, int fildes
);
55 extern int posix_spawn_file_actions_adddup2(
56 posix_spawn_file_actions_t
*file_actions
, int fildes
, int newfildes
);
58 /* spawn attribute functions */
59 extern int posix_spawnattr_destroy(posix_spawnattr_t
*attr
);
60 extern int posix_spawnattr_init(posix_spawnattr_t
*attr
);
61 extern int posix_spawnattr_getflags(const posix_spawnattr_t
*attr
,
63 extern int posix_spawnattr_setflags(posix_spawnattr_t
*attr
, short flags
);
64 extern int posix_spawnattr_getpgroup(const posix_spawnattr_t
*attr
,
66 extern int posix_spawnattr_setpgroup(posix_spawnattr_t
*attr
, pid_t pgroup
);
67 extern int posix_spawnattr_getsigdefault(const posix_spawnattr_t
*attr
,
68 sigset_t
*sigdefault
);
69 extern int posix_spawnattr_setsigdefault(posix_spawnattr_t
*attr
,
70 const sigset_t
*sigdefault
);
71 extern int posix_spawnattr_getsigmask(const posix_spawnattr_t
*attr
,
73 extern int posix_spawnattr_setsigmask(posix_spawnattr_t
*attr
,
74 const sigset_t
*sigmask
);
82 #endif /* _SPAWN_H_ */