POSIX_SPAWN_FILE_ACT... NetBSD Library Functions ManualPOSIX_SPAWN_FILE_ACT...
NAME
posix_spawn_file_actions_addchdir, posix_spawn_file_actions_addfchdir -- add chdir or fchdir action to spawn file actions object
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <spawn.h> int posix_spawn_file_actions_addchdir(posix_spawn_file_actions_t *restrict file_actions, const char *restrict path); int posix_spawn_file_actions_addfchdir(posix_spawn_file_actions_t * file_actions, int fildes);
DESCRIPTION
The posix_spawn_file_actions_addchdir() function adds a chdir action to the object referenced by file_actions that causes the working directory to be set to path (as if chdir(path) had been called) for a new process spawned using this file actions object. A relative path is interpreted relative to the working directory determined by any prior actions. The string pointed to by path is copied by the posix_spawn_file_actions_addchdir() function. The posix_spawn_file_actions_addfchdir() function adds a fchdir action to the object referenced by file_actions that causes the working directory to be set to the directory referenced by fildes (as if fchdir(fildes) had been called) for a new process spawned using this file actions object. File actions are performed in the new process created by posix_spawn() or posix_spawnp() in the same order that they were added to the file actions object. Thus the execution of an ``open'' action that was created by a call to posix_spawn_file_actions_addopen() that specifies a relative path will be affected by the execution of a chdir or fchdir action that was created by a previous call to posix_spawn_file_actions_addchdir() or posix_spawn_file_actions_addfchdir(). Likewise, a relative path passed to posix_spawn() will be affected by the last chdir or fchdir action in the file action list.
RETURN VALUES
Upon successful completion, these function return zero; otherwise, an error number is returned to indicate the error.
ERRORS
The posix_spawn_file_actions_addfchdir() function fails if: [EBADF] The value specified by fildes is negative. Both functions may fail with: [EINVAL] The value specified by file_actions is invalid. [ENOMEM] Insufficient memory exists to add the spawn file actions object. It is not an error for the path or fildes argument passed to these func- tions to specify a pathname or file descriptor for which the specified operation could not be performed at the time of the call. Any such error will be detected when the associated file actions object is later used during a posix_spawn() or posix_spawnp() operation.
SEE ALSO
chdir(2), fchdir(2), posix_spawn(3), posix_spawn_file_actions_destroy(3), posix_spawn_file_actions_init(3), posix_spawnp(3)
STANDARDS
The posix_spawn_file_actions_addchdir() and posix_spawn_file_actions_addfchdir() functions conform to IEEE Std 1003.1-2001 (``POSIX.1'').
HISTORY
The POSIX implementation of posix_spawn_file_actions_addchdir() and posix_spawn_file_actions_addfchdir() is derived from SOLARIS kernel's posix_spawn_file_actions_addchdir_np().
AUTHORS
Piyush Sachdeva NetBSD 10.99 July 8, 2020 NetBSD 10.99
Powered by man-cgi (2024-08-26). Maintained for NetBSD by Kimmo Suominen. Based on man-cgi by Panagiotis Christias.