Loading...
--- Libc/Libc-825.25/sys/posix_spawn.c
+++ Libc/Libc-583/sys/posix_spawn.c
@@ -39,9 +39,6 @@
#include <mach/port.h>
#include <mach/exception_types.h>
-#if TARGET_OS_EMBEDDED
-#include <sys/kern_memorystatus.h>
-#endif
/*
* posix_spawnattr_init
@@ -108,23 +105,6 @@
* process control on resource starvation
*/
(*psattrp)->psa_pcontrol = 0;
-
- /*
- * The default value of this attribute shall be an no
- * process control on resource starvation
- */
- (*psattrp)->psa_apptype = 0;
-
-#if TARGET_OS_EMBEDDED
- /* Jetsam related */
- (*psattrp)->psa_jetsam_flags = 0;
- (*psattrp)->psa_priority = DEFAULT_JETSAM_PRIORITY;
- (*psattrp)->psa_high_water_mark = -1;
-#endif
-
- /* Default is no CPU usage monitor active. */
- (*psattrp)->psa_cpumonitor_percent = 0;
- (*psattrp)->psa_cpumonitor_interval = 0;
}
return (err);
@@ -151,7 +131,7 @@
* NOTIMP: Allowed failures (checking NOT required):
* EINVAL The value specified by attr is invalid.
*/
-static int posix_spawn_destroyportactions_np(posix_spawnattr_t *);
+int posix_spawn_destroyportactions_np(posix_spawnattr_t *);
int
posix_spawnattr_destroy(posix_spawnattr_t *attr)
@@ -424,41 +404,6 @@
}
/*
- * posix_spawnattr_getapptype_np
- *
- * Description: Retrieve the process specific behaviors and app launch typea
- * spawn attribute value referenced by 'attr' and place the
- * result into the memory containing the control referenced by
- * 'apptype'
- *
- * Parameters: attr The spawn attributes object whose
- * signal set for default signals is to
- * be retrieved
- * apptype A pointer to an int to receive
- * the process control info
- *
- * Returns: 0 Success
- *
- * Implicit Returns:
- * *pcontrol (modified) The signal set of signals to default
- * from the spawn attributes object
- */
-int
-posix_spawnattr_getapptype_np(const posix_spawnattr_t * __restrict attr,
- int * __restrict apptype)
-{
- _posix_spawnattr_t psattr;
-
- if (attr == NULL || *attr == NULL)
- return EINVAL;
-
- psattr = *(_posix_spawnattr_t *)attr;
- *apptype = psattr->psa_apptype;
-
- return (0);
-}
-
-/*
* posix_spawnattr_setsigdefault
*
* Description: Set the set of signals to be set to default for the spawn
@@ -619,43 +564,12 @@
return (0);
}
-
-
-/*
- * posix_spawnattr_setapptype_np
- *
- * Description: Set the process specific behaviors and app launch type
- * attribute value referenced by 'attr' from the memory
- * containing the int value 'apptype'
- *
- * Parameters: attr The spawn attributes object whose
- * signal set for default signals is to
- * be set
- * apptype An int value of the apptype info
- *
- * Returns: 0 Success
- */
-int
-posix_spawnattr_setapptype_np(posix_spawnattr_t * __restrict attr,
- const int apptype)
-{
- _posix_spawnattr_t psattr;
-
- if (attr == NULL || *attr == NULL)
- return EINVAL;
-
- psattr = *(_posix_spawnattr_t *)attr;
- psattr->psa_apptype = apptype;
-
- return (0);
-}
-
/*
* posix_spawn_createportactions_np
* Description: create a new posix_spawn_port_actions struct and link
* it into the posix_spawnattr.
*/
-static int
+int
posix_spawn_createportactions_np(posix_spawnattr_t *attr)
{
_posix_spawnattr_t psattr;
@@ -680,7 +594,7 @@
* posix_spawn_growportactions_np
* Description: Enlarge the size of portactions if necessary
*/
-static int
+int
posix_spawn_growportactions_np(posix_spawnattr_t *attr)
{
_posix_spawnattr_t psattr;
@@ -709,7 +623,7 @@
* posix_spawn_destroyportactions_np
* Description: clean up portactions struct in posix_spawnattr_t attr
*/
-static int
+int
posix_spawn_destroyportactions_np(posix_spawnattr_t *attr)
{
_posix_spawnattr_t psattr;
@@ -1023,7 +937,7 @@
* opened with flags 'oflag' and mode 'mode', and, if successful,
* return as descriptor 'filedes' to the spawned process.
*
- * Parameters: file_actions File action object to augment
+ * Parameters: file_actions File action object to add open to
* filedes fd that open is to use
* path path to file to open
* oflag open file flags
@@ -1085,7 +999,7 @@
* that will cause the file referenced by 'filedes' to be
* attempted to be closed in the spawned process.
*
- * Parameters: file_actions File action object to augment
+ * Parameters: file_actions File action object to add open to
* filedes fd to close
*
* Returns: 0 Success
@@ -1135,12 +1049,12 @@
/*
* posix_spawn_file_actions_adddup2
*
- * Description: Add a dup2 action to the object referenced by 'file_actions'
+ * Description: Add a dpu2 action to the object referenced by 'file_actions'
* that will cause the file referenced by 'filedes' to be
* attempted to be dup2'ed to the descriptor 'newfiledes' in the
* spawned process.
*
- * Parameters: file_actions File action object to augment
+ * Parameters: file_actions File action object to add open to
* filedes fd to dup2
* newfiledes fd to dup2 it to
*
@@ -1189,140 +1103,6 @@
return (0);
}
-/*
- * posix_spawn_file_actions_addinherit_np
- *
- * Description: Add the "inherit" action to the object referenced by
- * 'file_actions' that will cause the file referenced by
- * 'filedes' to continue to be available in the spawned
- * process via the same descriptor.
- *
- * Inheritance is the normal default behaviour for
- * file descriptors across exec and spawn; but if the
- * POSIX_SPAWN_CLOEXEC_DEFAULT flag is set, the usual
- * default is reversed for the purposes of the spawn
- * invocation. Any pre-existing descriptors that
- * need to be made available to the spawned process can
- * be marked explicitly as 'inherit' via this interface.
- * Otherwise they will be automatically closed.
- *
- * Note that any descriptors created via the other file
- * actions interfaces are automatically marked as 'inherit'.
- *
- * Parameters: file_actions File action object to augment
- * filedes fd to inherit.
- *
- * Returns: 0 Success
- * EBADF The value specified by fildes is
- * negative or greater than or equal to
- * {OPEN_MAX}.
- * ENOMEM Insufficient memory exists to add to
- * the spawn file actions object.
- *
- * NOTIMP: Allowed failures (checking NOT required):
- * EINVAL The value specified by file_actions is invalid.
- */
-int
-posix_spawn_file_actions_addinherit_np(posix_spawn_file_actions_t *file_actions,
- int filedes)
-{
- _posix_spawn_file_actions_t *psactsp;
- _psfa_action_t *psfileact;
-
- if (file_actions == NULL || *file_actions == NULL)
- return (EINVAL);
-
- psactsp = (_posix_spawn_file_actions_t *)file_actions;
- /* Range check; required by POSIX */
- if (filedes < 0 || filedes >= OPEN_MAX)
- return (EBADF);
-
-#if defined(POSIX_SPAWN_CLOEXEC_DEFAULT) // TODO: delete this check
- /* If we do not have enough slots, grow the structure */
- if ((*psactsp)->psfa_act_count == (*psactsp)->psfa_act_alloc) {
- /* need to grow file actions structure */
- if (_posix_spawn_file_actions_grow(psactsp))
- return (ENOMEM);
- }
-
- /*
- * Allocate next available slot and fill it out
- */
- psfileact = &(*psactsp)->psfa_act_acts[(*psactsp)->psfa_act_count++];
-
- psfileact->psfaa_type = PSFA_INHERIT;
- psfileact->psfaa_filedes = filedes;
-#endif
- return (0);
-}
-
-int
-posix_spawnattr_setcpumonitor(posix_spawnattr_t * __restrict attr,
- uint64_t percent, uint64_t interval)
-{
- _posix_spawnattr_t psattr;
-
- if (attr == NULL || *attr == NULL || percent == 0 || percent > 100)
- return (EINVAL);
-
- psattr = *(_posix_spawnattr_t *)attr;
-
- psattr->psa_cpumonitor_percent = percent;
- psattr->psa_cpumonitor_interval = interval;
-
- return (0);
-}
-
-int
-posix_spawnattr_getcpumonitor(posix_spawnattr_t * __restrict attr,
- uint64_t *percent, uint64_t *interval)
-{
- _posix_spawnattr_t psattr;
-
- if (attr == NULL || *attr == NULL)
- return (EINVAL);
-
- psattr = *(_posix_spawnattr_t *)attr;
-
- *percent = psattr->psa_cpumonitor_percent;
- *interval = psattr->psa_cpumonitor_interval;
-
- return (0);
-}
-
-#if TARGET_OS_EMBEDDED
-/*
- * posix_spawnattr_setjetsam
- *
- * Description: Set jetsam attributes for the spawn attribute object
- * referred to by 'attr'.
- *
- * Parameters: flags The flags value to set
- * priority Relative jetsam priority
- * high_water_mark Value in pages; resident page
- * counts above this level can
- * result in termination
- *
- * Returns: 0 Success
- */
-int
-posix_spawnattr_setjetsam(posix_spawnattr_t * __restrict attr,
- short flags, int priority, int high_water_mark)
-{
- _posix_spawnattr_t psattr;
-
- if (attr == NULL || *attr == NULL)
- return EINVAL;
-
- psattr = *(_posix_spawnattr_t *)attr;
-
- psattr->psa_jetsam_flags = flags;
- psattr->psa_priority = priority;
- psattr->psa_high_water_mark = high_water_mark;
-
- return (0);
-}
-#endif
/*
* posix_spawnp