#include <spawn.h>
spawn.h
[SPN] Support for _POSIX_SPAWN
typedefposix_spawnattr_t
Opaque types for use with posix_spawn() family functions. Internals are
not defined, and should not be accessed directly. Types are defined as
mandated by POSIX.
typedef void *posix_spawnattr_t
typedefposix_spawn_file_actions_t
typedef void *posix_spawn_file_actions_t
functionposix_spawn
__API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos) int posix_spawn( pid_t * __restrict, const char * __restrict, const posix_spawn_file_actions_t *, const posix_spawnattr_t * __restrict, char *const __argv[__restrict], char *const __envp[__restrict] )
man page · November 2, 2010
posix_spawn(2) — spawn a processfunctionposix_spawnp
__API_AVAILABLE(macos(10.5), ios(2.0)) int posix_spawnp( pid_t * __restrict, const char * __restrict, const posix_spawn_file_actions_t *, const posix_spawnattr_t * __restrict, char *const __argv[__restrict], char *const __envp[__restrict] )
man page · November 2, 2010
posix_spawnp(2) — spawn a processfunctionposix_spawn_file_actions_addchdir
__API_AVAILABLE(macos(26.0)) __API_UNAVAILABLE(ios, tvos, watchos, visionos) int posix_spawn_file_actions_addchdir( posix_spawn_file_actions_t *, const char * __restrict )
functionposix_spawn_file_actions_addfchdir
__API_AVAILABLE(macos(26.0)) __API_UNAVAILABLE(ios, tvos, watchos, visionos) int posix_spawn_file_actions_addfchdir(posix_spawn_file_actions_t *, int)
functionposix_spawn_file_actions_addclose
__API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos) int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t *, int)
man page · November 2, 2010
posix_spawn_file_actions_addclose(3) — add open or close actions to afunctionposix_spawn_file_actions_adddup2
__API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos) int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t *, int, int)
functionposix_spawn_file_actions_addopen
__API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos) int posix_spawn_file_actions_addopen( posix_spawn_file_actions_t * __restrict, int, const char * __restrict, int, mode_t )
man page · November 2, 2010
posix_spawn_file_actions_addopen(3) — add open or close actions to afunctionposix_spawn_file_actions_destroy
__API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos) int posix_spawn_file_actions_destroy(posix_spawn_file_actions_t *)
man page · August 22, 2007
posix_spawn_file_actions_destroy(3) — initialize or destroy spawn file actions objectsfunctionposix_spawn_file_actions_init
__API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos) int posix_spawn_file_actions_init(posix_spawn_file_actions_t *)
man page · August 22, 2007
posix_spawn_file_actions_init(3) — initialize or destroy spawn file actions objectsfunctionposix_spawnattr_destroy
__API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos) int posix_spawnattr_destroy(posix_spawnattr_t *)
man page · August 22, 2007
posix_spawnattr_destroy(3) — initialize or destroy a spawn attributes objectfunctionposix_spawnattr_getsigdefault
__API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos) int posix_spawnattr_getsigdefault( const posix_spawnattr_t * __restrict, sigset_t * __restrict )
man page · August 22, 2007
posix_spawnattr_getsigdefault(3) — set or get thefunctionposix_spawnattr_getflags
__API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos) int posix_spawnattr_getflags(const posix_spawnattr_t * __restrict, short * __restrict)
man page · October 28, 2010
posix_spawnattr_getflags(3) — get or set flags on afunctionposix_spawnattr_getpgroup
__API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos) int posix_spawnattr_getpgroup(const posix_spawnattr_t * __restrict, pid_t * __restrict)
man page · August 22, 2007
posix_spawnattr_getpgroup(3) — set or get thefunctionposix_spawnattr_getsigmask
__API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos) int posix_spawnattr_getsigmask( const posix_spawnattr_t * __restrict, sigset_t * __restrict )
man page · August 22, 2007
posix_spawnattr_getsigmask(3) — set or get thefunctionposix_spawnattr_init
__API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos) int posix_spawnattr_init(posix_spawnattr_t *)
man page · August 22, 2007
posix_spawnattr_init(3) — initialize or destroy a spawn attributes objectfunctionposix_spawnattr_setsigdefault
__API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos) int posix_spawnattr_setsigdefault( posix_spawnattr_t * __restrict, const sigset_t * __restrict )
man page · August 22, 2007
posix_spawnattr_setsigdefault(3) — set or get thefunctionposix_spawnattr_setflags
__API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos) int posix_spawnattr_setflags(posix_spawnattr_t *, short)
man page · October 28, 2010
posix_spawnattr_setflags(3) — get or set flags on afunctionposix_spawnattr_setpgroup
__API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos) int posix_spawnattr_setpgroup(posix_spawnattr_t *, pid_t)
man page · August 22, 2007
posix_spawnattr_setpgroup(3) — set or get thefunctionposix_spawnattr_setsigmask
__API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos) int posix_spawnattr_setsigmask( posix_spawnattr_t * __restrict, const sigset_t * __restrict )
man page · August 22, 2007
posix_spawnattr_setsigmask(3) — set or get thefunctionposix_spawnattr_getbinpref_np
__API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos) int posix_spawnattr_getbinpref_np( const posix_spawnattr_t * __restrict, size_t, cpu_type_t *__restrict, size_t *__restrict )
man page · May 8, 2020
posix_spawnattr_getbinpref_np(3) — set or get thefunctionposix_spawnattr_getarchpref_np
__API_AVAILABLE(macos(11.0), ios(14.0)) __API_UNAVAILABLE(watchos, tvos) int posix_spawnattr_getarchpref_np( const posix_spawnattr_t * __restrict, size_t, cpu_type_t *__restrict, cpu_subtype_t *__restrict, size_t *__restrict )
man page · May 8, 2020
posix_spawnattr_getarchpref_np(3) — set or get thefunctionposix_spawnattr_setauditsessionport_np
__API_AVAILABLE(macos(10.6), ios(3.2)) int posix_spawnattr_setauditsessionport_np(posix_spawnattr_t * __restrict, mach_port_t)
functionposix_spawnattr_setbinpref_np
__API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos) int posix_spawnattr_setbinpref_np( posix_spawnattr_t * __restrict, size_t, cpu_type_t *__restrict, size_t *__restrict )
man page · May 8, 2020
posix_spawnattr_setbinpref_np(3) — set or get thefunctionposix_spawnattr_setarchpref_np
__API_AVAILABLE(macos(11.0), ios(14.0)) __API_UNAVAILABLE(watchos, tvos) int posix_spawnattr_setarchpref_np( posix_spawnattr_t * __restrict, size_t, cpu_type_t *__restrict, cpu_subtype_t *__restrict, size_t *__restrict )
man page · May 8, 2020
posix_spawnattr_setarchpref_np(3) — set or get thefunctionposix_spawnattr_setexceptionports_np
__API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos) int posix_spawnattr_setexceptionports_np( posix_spawnattr_t * __restrict, exception_mask_t, mach_port_t, exception_behavior_t, thread_state_flavor_t )
man page · August 22, 2007
posix_spawnattr_setexceptionports_np(3) — set special ports on afunctionposix_spawnattr_setspecialport_np
__API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos) int posix_spawnattr_setspecialport_np(posix_spawnattr_t * __restrict, mach_port_t, int)
man page · August 22, 2007
posix_spawnattr_setspecialport_np(3) — set special ports on afunctionposix_spawnattr_setnosmt_np
__API_AVAILABLE(macos(11.0)) int posix_spawnattr_setnosmt_np(const posix_spawnattr_t * __restrict attr)
functionposix_spawnattr_set_csm_np
__API_AVAILABLE(macos(11.0)) int posix_spawnattr_set_csm_np(const posix_spawnattr_t * __restrict attr, uint32_t flags)
Set CPU Security Mitigation on the spawned process
This attribute affects all threads and is inherited on fork and exec
macroPOSIX_SPAWN_NP_CSM_ALL
flags for CPU Security Mitigation attribute
POSIX_SPAWN_NP_CSM_ALL should be used in most cases,
the individual flags are provided only for performance evaluation etc
#define POSIX_SPAWN_NP_CSM_ALL 0x0001
macroPOSIX_SPAWN_NP_CSM_NOSMT
#define POSIX_SPAWN_NP_CSM_NOSMT 0x0002
macroPOSIX_SPAWN_NP_CSM_TECS
#define POSIX_SPAWN_NP_CSM_TECS 0x0004
functionposix_spawn_file_actions_addinherit_np
__API_AVAILABLE(macos(10.7), ios(4.3)) __API_UNAVAILABLE(watchos, tvos) int posix_spawn_file_actions_addinherit_np(posix_spawn_file_actions_t *, int)
functionposix_spawn_file_actions_addchdir_np
__API_DEPRECATED("posix_spawn_file_actions_addchdir(3) has replaced posix_spawn_file_actions_addchdir_np(3)", macos(10.15, 26.0)) __API_UNAVAILABLE(ios, tvos, watchos, visionos) int posix_spawn_file_actions_addchdir_np( posix_spawn_file_actions_t *, const char * __restrict )
functionposix_spawn_file_actions_addfchdir_np
__API_DEPRECATED("posix_spawn_file_actions_addfchdir(3) has replaced posix_spawn_file_actions_addfchdir_np(3)", macos(10.15, 26.0)) __API_UNAVAILABLE(ios, tvos, watchos, visionos) int posix_spawn_file_actions_addfchdir_np(posix_spawn_file_actions_t *, int)