Back to index

glibc  2.9
Classes | Defines | Functions
spawn.h File Reference
#include <features.h>
#include <sched.h>
#include <signal.h>
#include <sys/types.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  posix_spawnattr_t
struct  posix_spawn_file_actions_t

Defines

#define POSIX_SPAWN_RESETIDS   0x01
#define POSIX_SPAWN_SETPGROUP   0x02
#define POSIX_SPAWN_SETSIGDEF   0x04
#define POSIX_SPAWN_SETSIGMASK   0x08
#define POSIX_SPAWN_SETSCHEDPARAM   0x10
#define POSIX_SPAWN_SETSCHEDULER   0x20

Functions

__BEGIN_DECLS int posix_spawn (pid_t *__restrict __pid, __const char *__restrict __path, __const posix_spawn_file_actions_t *__restrict __file_actions, __const posix_spawnattr_t *__restrict __attrp, char *__const argv[__restrict_arr], char *__const envp[__restrict_arr])
int posix_spawnp (pid_t *__pid, __const char *__file, __const posix_spawn_file_actions_t *__file_actions, __const posix_spawnattr_t *__attrp, char *__const argv[], char *__const envp[])
int posix_spawnattr_init (posix_spawnattr_t *__attr) __THROW
int posix_spawnattr_destroy (posix_spawnattr_t *__attr) __THROW
int posix_spawnattr_getsigdefault (__const posix_spawnattr_t *__restrict __attr, sigset_t *__restrict __sigdefault) __THROW
int posix_spawnattr_setsigdefault (posix_spawnattr_t *__restrict __attr, __const sigset_t *__restrict __sigdefault) __THROW
int posix_spawnattr_getsigmask (__const posix_spawnattr_t *__restrict __attr, sigset_t *__restrict __sigmask) __THROW
int posix_spawnattr_setsigmask (posix_spawnattr_t *__restrict __attr, __const sigset_t *__restrict __sigmask) __THROW
int posix_spawnattr_getflags (__const posix_spawnattr_t *__restrict __attr, short int *__restrict __flags) __THROW
int posix_spawnattr_setflags (posix_spawnattr_t *_attr, short int __flags) __THROW
int posix_spawnattr_getpgroup (__const posix_spawnattr_t *__restrict __attr, pid_t *__restrict __pgroup) __THROW
int posix_spawnattr_setpgroup (posix_spawnattr_t *__attr, pid_t __pgroup) __THROW
int posix_spawnattr_getschedpolicy (__const posix_spawnattr_t *__restrict __attr, int *__restrict __schedpolicy) __THROW
int posix_spawnattr_setschedpolicy (posix_spawnattr_t *__attr, int __schedpolicy) __THROW
int posix_spawnattr_getschedparam (__const posix_spawnattr_t *__restrict __attr, struct sched_param *__restrict __schedparam) __THROW
int posix_spawnattr_setschedparam (posix_spawnattr_t *__restrict __attr, const struct sched_param *__restrict __schedparam) __THROW
int posix_spawn_file_actions_init (posix_spawn_file_actions_t *__file_actions) __THROW
int posix_spawn_file_actions_destroy (posix_spawn_file_actions_t *__file_actions) __THROW
int posix_spawn_file_actions_addopen (posix_spawn_file_actions_t *__restrict __file_actions, int __fd, __const char *__restrict __path, int __oflag, mode_t __mode) __THROW
int posix_spawn_file_actions_addclose (posix_spawn_file_actions_t *__file_actions, int __fd) __THROW
int posix_spawn_file_actions_adddup2 (posix_spawn_file_actions_t *__file_actions, int __fd, int __newfd) __THROW

Class Documentation

struct posix_spawnattr_t

Definition at line 30 of file spawn.h.

Collaboration diagram for posix_spawnattr_t:
Class Members
short int __flags
int __pad
pid_t __pgrp
int __policy
sigset_t __sd
sigset_t __ss
struct posix_spawn_file_actions_t

Definition at line 44 of file spawn.h.

Collaboration diagram for posix_spawn_file_actions_t:
Class Members
struct __spawn_action * __actions
int __allocated
int __pad
int __used

Define Documentation

#define POSIX_SPAWN_RESETIDS   0x01

Definition at line 54 of file spawn.h.

#define POSIX_SPAWN_SETPGROUP   0x02

Definition at line 55 of file spawn.h.

#define POSIX_SPAWN_SETSCHEDPARAM   0x10

Definition at line 58 of file spawn.h.

#define POSIX_SPAWN_SETSCHEDULER   0x20

Definition at line 59 of file spawn.h.

#define POSIX_SPAWN_SETSIGDEF   0x04

Definition at line 56 of file spawn.h.

#define POSIX_SPAWN_SETSIGMASK   0x08

Definition at line 57 of file spawn.h.


Function Documentation

__BEGIN_DECLS int posix_spawn ( pid_t *__restrict  __pid,
__const char *__restrict  __path,
__const posix_spawn_file_actions_t *__restrict  __file_actions,
__const posix_spawnattr_t *__restrict  __attrp,
char *__const  argv[__restrict_arr],
char *__const  envp[__restrict_arr] 
)

Definition at line 28 of file spawn_faction_addclose.c.

{
  int maxfd = __sysconf (_SC_OPEN_MAX);
  struct __spawn_action *rec;

  /* Test for the validity of the file descriptor.  */
  if (fd < 0 || fd >= maxfd)
    return EBADF;

  /* Allocate more memory if needed.  */
  if (file_actions->__used == file_actions->__allocated
      && __posix_spawn_file_actions_realloc (file_actions) != 0)
    /* This can only mean we ran out of memory.  */
    return ENOMEM;

  /* Add the new value.  */
  rec = &file_actions->__actions[file_actions->__used];
  rec->tag = spawn_do_close;
  rec->action.open_action.fd = fd;

  /* Account for the new entry.  */
  ++file_actions->__used;

  return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int posix_spawn_file_actions_adddup2 ( posix_spawn_file_actions_t __file_actions,
int  __fd,
int  __newfd 
)

Definition at line 28 of file spawn_faction_adddup2.c.

{
  int maxfd = __sysconf (_SC_OPEN_MAX);
  struct __spawn_action *rec;

  /* Test for the validity of the file descriptor.  */
  if (fd < 0 || newfd < 0 || fd >= maxfd || newfd >= maxfd)
    return EBADF;

  /* Allocate more memory if needed.  */
  if (file_actions->__used == file_actions->__allocated
      && __posix_spawn_file_actions_realloc (file_actions) != 0)
    /* This can only mean we ran out of memory.  */
    return ENOMEM;

  /* Add the new value.  */
  rec = &file_actions->__actions[file_actions->__used];
  rec->tag = spawn_do_dup2;
  rec->action.dup2_action.fd = fd;
  rec->action.dup2_action.newfd = newfd;

  /* Account for the new entry.  */
  ++file_actions->__used;

  return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int posix_spawn_file_actions_addopen ( posix_spawn_file_actions_t *__restrict  __file_actions,
int  __fd,
__const char *__restrict  __path,
int  __oflag,
mode_t  __mode 
)

Definition at line 24 of file spawn_faction_destroy.c.

{
  /* Free the memory allocated.  */
  free (file_actions->__actions);
  return 0;
}

Here is the caller graph for this function:

Definition at line 49 of file spawn_faction_init.c.

{
  /* Simply clear all the elements.  */
  memset (file_actions, '\0', sizeof (*file_actions));
  return 0;
}

Here is the caller graph for this function:

Definition at line 23 of file spawnattr_destroy.c.

{
  /* Nothing to do in the moment.  */
  return 0;
}

Definition at line 24 of file spawnattr_init.c.

{
  /* All elements have to be initialized to the default values which
     is generally zero.  */
  memset (attr, '\0', sizeof (*attr));

  return 0;
}
int posix_spawnattr_setflags ( posix_spawnattr_t _attr,
short int  __flags 
)

Definition at line 33 of file spawnattr_setflags.c.

{
  /* Check no invalid bits are set.  */
  if (flags & ~ALL_FLAGS)
    return EINVAL;

  /* Store the flag word.  */
  attr->__flags = flags;

  return 0;
}
int posix_spawnattr_setpgroup ( posix_spawnattr_t __attr,
pid_t  __pgroup 
)

Definition at line 24 of file spawnattr_setpgroup.c.

{
  /* Store the process group ID.  */
  attr->__pgrp = pgroup;

  return 0;
}
int posix_spawnattr_setschedpolicy ( posix_spawnattr_t __attr,
int  __schedpolicy 
)

Definition at line 24 of file spawnattr_setschedpolicy.c.

{
  if (schedpolicy != SCHED_OTHER && schedpolicy != SCHED_FIFO
      && schedpolicy != SCHED_RR)
    return EINVAL;

  /* Store the policy.  */
  attr->__policy = schedpolicy;

  return 0;
}
int posix_spawnp ( pid_t __pid,
__const char *  __file,
__const posix_spawn_file_actions_t __file_actions,
__const posix_spawnattr_t __attrp,
char *__const  argv[],
char *__const  envp[] 
)

Here is the caller graph for this function: