Back to index

glibc  2.9
spawn_faction_addclose.c File Reference
#include <errno.h>
#include <spawn.h>
#include <unistd.h>
#include "spawn_int.h"

Go to the source code of this file.


int posix_spawn_file_actions_addclose (posix_spawn_file_actions_t *file_actions, int fd)

Function Documentation

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.  */

  return 0;

Here is the call graph for this function:

Here is the caller graph for this function: