p had been called) for a new process spawned using this file actions object. A relative .Fa path is interpreted relative to the working directory determined by any prior actions. The string pointed to by .Fa path is copied by the .Fn posix_spawn_file_actions_addchdir function.
p The .Fn posix_spawn_file_actions_addfchdir function adds a fchdir action to the object referenced by .Fa file_actions that causes the working directory to be set to the directory referenced by .Fa fildes (as if d -literal -offset indent fchdir(fildes) .Ed
p
had been called) for a new process spawned using this file actions object.
The last paragraph of APPLICATION USAGE
p File actions are performed in the new process created by .Fn posix_spawn or .Fn posix_spawnp in the same order that they were added to the file actions object. Thus the execution of an .Dq open action that was created by a call to .Fn 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 .Fn posix_spawn_file_actions_addchdir or .Fn posix_spawn_file_actions_addfchdir . Likewise, a relative path passed to .Fn posix_spawn will be affected by the last chdir or fchdir action in the file action list. .Sh RETURN VALUES Upon successful completion, these function return zero; otherwise, an error number is returned to indicate the error. .Sh ERRORS The .Fn posix_spawn_file_actions_addfchdir function fails if: l -tag -width Er t Bq Er EBADF The value specified by .Fa fildes is negative. .El
p Both functions may fail with: l -tag -width Er t Bq Er EINVAL The value specified by .Fa file_actions is invalid. t Bq Er ENOMEM Insufficient memory exists to add the spawn file actions object. .El
p It is not an error for the .Fa path or .Fa 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 .Fn posix_spawn or .Fn posix_spawnp operation. .Sh SEE ALSO .Xr chdir 2 , .Xr fchdir 2 , .Xr posix_spawn 3 , .Xr posix_spawn_file_actions_destroy 3 , .Xr posix_spawn_file_actions_init 3 , .Xr posix_spawnp 3 .Sh STANDARDS The .Fn posix_spawn_file_actions_addchdir and .Fn posix_spawn_file_actions_addfchdir functions conform to .St -p1003.1-2001 . .Sh HISTORY The POSIX implementation of .Fn posix_spawn_file_actions_addchdir and .Fn posix_spawn_file_actions_addfchdir is derived from SOLARIS kernel's .Fn posix_spawn_file_actions_addchdir_np . .Sh AUTHORS .An Piyush Sachdeva