]> git.saurik.com Git - apple/xnu.git/blobdiff - libsyscall/wrappers/spawn/posix_spawn.c
xnu-6153.141.1.tar.gz
[apple/xnu.git] / libsyscall / wrappers / spawn / posix_spawn.c
index ae5585b048ed24a32e279881c5aea5959995009f..73dfc1a3e02d2c9b3679039f1b6be5cd1b47310e 100644 (file)
@@ -943,6 +943,27 @@ posix_spawnattr_setspecialport_np(
        return posix_spawn_appendportaction_np(attr, &action);
 }
 
+/*
+ * posix_spawnattr_setsuidcredport_np
+ *
+ * Description:        Set an suid cred port to be used to execute with a different UID.
+ *
+ * Parameters: attr                    The spawn attributes object for the
+ *                                      new process
+ *              port                   The suid cred port
+ *
+ * Returns:    0                       Success
+ */
+int
+posix_spawnattr_setsuidcredport_np(posix_spawnattr_t *attr, mach_port_t port)
+{
+       _ps_port_action_t action = {
+               .port_type = PSPA_SUID_CRED,
+               .new_port = port,
+       };
+       return posix_spawn_appendportaction_np(attr, &action);
+}
+
 /*
  * posix_spawnattr_setexceptionports_np
  *