+#define PS_PORT_ACTIONS_SIZE(x) \
+ PS_ACTION_SIZE(x, struct _posix_spawn_port_actions, _ps_port_action_t)
+
+#define NBINPREFS 4
+
+/*
+ * Mapping of opaque data pointer to a MAC policy (specified by name).
+ */
+typedef struct _ps_mac_policy_extension {
+ char policyname[128];
+ union {
+ uint64_t data;
+ void *datap; /* pointer in kernel memory */
+ };
+ uint64_t datalen;
+} _ps_mac_policy_extension_t;
+
+/*
+ * A collection of extra data passed to MAC policies for the newly spawned process.
+ */
+typedef struct _posix_spawn_mac_policy_extensions {
+ int psmx_alloc;
+ int psmx_count;
+ _ps_mac_policy_extension_t psmx_extensions[];
+} *_posix_spawn_mac_policy_extensions_t;
+
+/*
+ * Returns size in bytes of a _posix_spawn_mac_policy_extensions holding x elements.
+ */
+#define PS_MAC_EXTENSIONS_SIZE(x) \
+ PS_ACTION_SIZE(x, struct _posix_spawn_mac_policy_extensions, _ps_mac_policy_extension_t)
+
+#define PS_MAC_EXTENSIONS_INIT_COUNT 2
+
+/*
+ * Coalition posix spawn attributes
+ */
+struct _posix_spawn_coalition_info {
+ struct {
+ uint64_t psci_id;
+ uint32_t psci_role;
+ uint32_t psci_reserved1;
+ uint64_t psci_reserved2;
+ } psci_info[COALITION_NUM_TYPES];
+};
+
+/*
+ * UID/GID attributes
+ */
+struct _posix_spawn_posix_cred_info {
+ uint32_t pspci_flags; /* spawn persona flags */
+ uid_t pspci_uid; /* alternate posix/unix UID */
+ gid_t pspci_gid; /* alternate posix/unix GID */
+ uint32_t pspci_ngroups; /* alternate advisory groups */
+ gid_t pspci_groups[NGROUPS];
+ uid_t pspci_gmuid; /* group membership UID */
+ char pspci_login[MAXLOGNAME + 1];
+};
+
+#define POSIX_SPAWN_POSIX_CRED_UID 0x00010000
+#define POSIX_SPAWN_POSIX_CRED_GID 0x00020000
+#define POSIX_SPAWN_POSIX_CRED_GROUPS 0x00040000
+#define POSIX_SPAWN_POSIX_CRED_LOGIN 0x00080000
+
+/*
+ * Persona attributes
+ */
+struct _posix_spawn_persona_info {
+ uid_t pspi_id; /* persona ID (unix UID) */
+ uint32_t pspi_flags; /* spawn persona flags */
+ uid_t pspi_uid; /* alternate posix/unix UID */
+ gid_t pspi_gid; /* alternate posix/unix GID */
+ uint32_t pspi_ngroups; /* alternate advisory groups */
+ gid_t pspi_groups[NGROUPS];
+ uid_t pspi_gmuid; /* group membership UID */
+};
+
+#define POSIX_SPAWN_PERSONA_FLAGS_NONE 0x0
+#define POSIX_SPAWN_PERSONA_FLAGS_OVERRIDE 0x1
+#define POSIX_SPAWN_PERSONA_FLAGS_VERIFY 0x2
+
+#define POSIX_SPAWN_PERSONA_ALL_FLAGS \
+ (POSIX_SPAWN_PERSONA_FLAGS_OVERRIDE \
+ | POSIX_SPAWN_PERSONA_FLAGS_VERIFY \
+ )
+
+#define POSIX_SPAWN_PERSONA_UID POSIX_SPAWN_POSIX_CRED_UID
+#define POSIX_SPAWN_PERSONA_GID POSIX_SPAWN_POSIX_CRED_GID
+#define POSIX_SPAWN_PERSONA_GROUPS POSIX_SPAWN_POSIX_CRED_GROUPS