summaryrefslogtreecommitdiffstats
path: root/man-pages-posix-2017/man3p/posix_spawn_file_actions_adddup2.3p
diff options
context:
space:
mode:
Diffstat (limited to 'man-pages-posix-2017/man3p/posix_spawn_file_actions_adddup2.3p')
-rw-r--r--man-pages-posix-2017/man3p/posix_spawn_file_actions_adddup2.3p137
1 files changed, 137 insertions, 0 deletions
diff --git a/man-pages-posix-2017/man3p/posix_spawn_file_actions_adddup2.3p b/man-pages-posix-2017/man3p/posix_spawn_file_actions_adddup2.3p
new file mode 100644
index 0000000..10a64e1
--- /dev/null
+++ b/man-pages-posix-2017/man3p/posix_spawn_file_actions_adddup2.3p
@@ -0,0 +1,137 @@
+'\" et
+.TH POSIX_SPAWN_FILE_ACTIONS_ADDDUP2 "3P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
+.\"
+.SH PROLOG
+This manual page is part of the POSIX Programmer's Manual.
+The Linux implementation of this interface may differ (consult
+the corresponding Linux manual page for details of Linux behavior),
+or the interface may not be implemented on Linux.
+.\"
+.SH NAME
+posix_spawn_file_actions_adddup2
+\(em add dup2 action to spawn file actions object
+(\fBADVANCED REALTIME\fP)
+.SH SYNOPSIS
+.LP
+.nf
+#include <spawn.h>
+.P
+int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t
+ *\fIfile_actions\fP, int \fIfildes\fP, int \fInewfildes\fP);
+.fi
+.SH DESCRIPTION
+The
+\fIposix_spawn_file_actions_adddup2\fR()
+function shall add a
+\fIdup2\fR()
+action to the object referenced by
+.IR file_actions
+that shall cause the file descriptor
+.IR fildes
+to be duplicated as
+.IR newfildes
+(as if
+.IR dup2 (\c
+.IR fildes ,
+.IR newfildes )
+had been called) when a new process is spawned using this file actions
+object.
+.P
+A spawn file actions object is as defined in
+.IR "\fIposix_spawn_file_actions_addclose\fR\^(\|)".
+.SH "RETURN VALUE"
+Upon successful completion, the
+\fIposix_spawn_file_actions_adddup2\fR()
+function shall return zero; otherwise, an error number shall be
+returned to indicate the error.
+.SH ERRORS
+The
+\fIposix_spawn_file_actions_adddup2\fR()
+function shall fail if:
+.TP
+.BR EBADF
+The value specified by
+.IR fildes
+or
+.IR newfildes
+is negative or greater than or equal to
+{OPEN_MAX}.
+.TP
+.BR ENOMEM
+Insufficient memory exists to add to the spawn file actions object.
+.P
+The
+\fIposix_spawn_file_actions_adddup2\fR()
+function may fail if:
+.TP
+.BR EINVAL
+The value specified by
+.IR file_actions
+is invalid.
+.P
+It shall not be considered an error for the
+.IR fildes
+argument passed to the
+\fIposix_spawn_file_actions_adddup2\fR()
+function to specify a 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
+\fIposix_spawn\fR()
+or
+\fIposix_spawnp\fR()
+operation.
+.LP
+.IR "The following sections are informative."
+.SH EXAMPLES
+None.
+.SH "APPLICATION USAGE"
+The
+\fIposix_spawn_file_actions_adddup2\fR()
+function is part of the Spawn option and need not be
+provided on all implementations.
+.P
+Implementations may use file descriptors that must be inherited into
+child processes for the child process to remain conforming, such as for
+message catalog or tracing purposes. Therefore, an application that calls
+\fIposix_spawn_file_actions_adddup2\fR()
+with an arbitrary integer for
+.IR newfildes
+risks non-conforming behavior, and this function can only portably be
+used to overwrite file descriptor values that the application has obtained
+through explicit actions, or for the three file descriptors corresponding
+to the standard file streams. In order to avoid a race condition of
+leaking an unintended file descriptor into a child process, an application
+should consider opening all file descriptors with the FD_CLOEXEC bit
+set unless the file descriptor is intended to be inherited across
+.IR exec .
+.SH RATIONALE
+Refer to the RATIONALE section in
+.IR "\fIposix_spawn_file_actions_addclose\fR\^(\|)".
+.SH "FUTURE DIRECTIONS"
+None.
+.SH "SEE ALSO"
+.IR "\fIdup\fR\^(\|)",
+.IR "\fIposix_spawn\fR\^(\|)",
+.IR "\fIposix_spawn_file_actions_addclose\fR\^(\|)",
+.IR "\fIposix_spawn_file_actions_destroy\fR\^(\|)"
+.P
+The Base Definitions volume of POSIX.1\(hy2017,
+.IR "\fB<spawn.h>\fP"
+.\"
+.SH COPYRIGHT
+Portions of this text are reprinted and reproduced in electronic form
+from IEEE Std 1003.1-2017, Standard for Information Technology
+-- Portable Operating System Interface (POSIX), The Open Group Base
+Specifications Issue 7, 2018 Edition,
+Copyright (C) 2018 by the Institute of
+Electrical and Electronics Engineers, Inc and The Open Group.
+In the event of any discrepancy between this version and the original IEEE and
+The Open Group Standard, the original IEEE and The Open Group Standard
+is the referee document. The original Standard can be obtained online at
+http://www.opengroup.org/unix/online.html .
+.PP
+Any typographical or formatting errors that appear
+in this page are most likely
+to have been introduced during the conversion of the source files to
+man page format. To report such errors, see
+https://www.kernel.org/doc/man-pages/reporting_bugs.html .