POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR(3) | Library Functions Manual | POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR(3) |
posix_spawn_file_actions_addchdir
,
posix_spawn_file_actions_addfchdir
—
#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);
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.
posix_spawn_file_actions_addfchdir
() function fails
if:
EBADF
]Both functions may fail with:
EINVAL
]ENOMEM
]It is not an error for the path or
fildes argument passed to these functions 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.
posix_spawn_file_actions_addchdir
() and
posix_spawn_file_actions_addfchdir
() functions conform
to IEEE Std 1003.1-2001 (“POSIX.1”).
posix_spawn_file_actions_addchdir
() and
posix_spawn_file_actions_addfchdir
() is derived from
SOLARIS kernel's
posix_spawn_file_actions_addchdir_np
().
July 8, 2020 | NetBSD 10.0 |