]> git.saurik.com Git - apple/xnu.git/blobdiff - libsyscall/wrappers/spawn/posix_spawn.c
xnu-4903.241.1.tar.gz
[apple/xnu.git] / libsyscall / wrappers / spawn / posix_spawn.c
index 1334f4c3d91f828c2a29df6bd3eed0f1e7f7ffa9..20083809a4358086a258c044cef1324f6d0164d2 100644 (file)
@@ -123,6 +123,9 @@ posix_spawnattr_init(posix_spawnattr_t *attr)
                (*psattrp)->psa_memlimit_active = -1;
                (*psattrp)->psa_memlimit_inactive = -1;
 
+               /* Default is no thread limit */
+               (*psattrp)->psa_thread_limit = 0;
+
                /* Default is no CPU usage monitor active. */
                (*psattrp)->psa_cpumonitor_percent = 0;
                (*psattrp)->psa_cpumonitor_interval = 0;
@@ -150,6 +153,8 @@ posix_spawnattr_init(posix_spawnattr_t *attr)
 
                /* Default is no change to role */
                (*psattrp)->psa_darwin_role = POSIX_SPAWN_DARWIN_ROLE_NONE;
+
+               (*psattrp)->psa_max_addr = 0;
        }
 
        return (err);
@@ -1415,6 +1420,23 @@ posix_spawnattr_setjetsam_ext(posix_spawnattr_t * __restrict attr,
        return (0);
 }
 
+int
+posix_spawnattr_set_threadlimit_ext(posix_spawnattr_t * __restrict attr,
+       int thread_limit)
+{
+       _posix_spawnattr_t psattr;
+
+       if (attr == NULL || *attr == NULL)
+               return EINVAL;
+
+       psattr = *(_posix_spawnattr_t *)attr;
+
+       psattr->psa_thread_limit = thread_limit;
+
+       return (0);
+
+}
+
 
 /*
  * posix_spawnattr_set_importancewatch_port_np
@@ -1730,7 +1752,7 @@ posix_spawnattr_set_persona_groups_np(const posix_spawnattr_t * __restrict attr,
        if (gidarray == NULL)
                return EINVAL;
 
-       if (ngroups > NGROUPS)
+       if (ngroups > NGROUPS || ngroups < 0)
                return EINVAL;
 
        psattr = *(_posix_spawnattr_t *)attr;
@@ -1752,7 +1774,20 @@ posix_spawnattr_set_persona_groups_np(const posix_spawnattr_t * __restrict attr,
        return 0;
 }
 
+int
+posix_spawnattr_set_max_addr_np(const posix_spawnattr_t * __restrict attr, uint64_t max_addr)
+{
+       _posix_spawnattr_t psattr;
 
+       if (attr == NULL || *attr == NULL) {
+               return EINVAL;
+       }
+
+       psattr = *(_posix_spawnattr_t *)attr;
+       psattr->psa_max_addr = max_addr;
+
+       return 0;
+}
 
 /*
  * posix_spawn