logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

posix_spawn_file_actions_adddup2.3p (4405B)


  1. '\" et
  2. .TH POSIX_SPAWN_FILE_ACTIONS_ADDDUP2 "3P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
  3. .\"
  4. .SH PROLOG
  5. This manual page is part of the POSIX Programmer's Manual.
  6. The Linux implementation of this interface may differ (consult
  7. the corresponding Linux manual page for details of Linux behavior),
  8. or the interface may not be implemented on Linux.
  9. .\"
  10. .SH NAME
  11. posix_spawn_file_actions_adddup2
  12. \(em add dup2 action to spawn file actions object
  13. (\fBADVANCED REALTIME\fP)
  14. .SH SYNOPSIS
  15. .LP
  16. .nf
  17. #include <spawn.h>
  18. .P
  19. int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t
  20. *\fIfile_actions\fP, int \fIfildes\fP, int \fInewfildes\fP);
  21. .fi
  22. .SH DESCRIPTION
  23. The
  24. \fIposix_spawn_file_actions_adddup2\fR()
  25. function shall add a
  26. \fIdup2\fR()
  27. action to the object referenced by
  28. .IR file_actions
  29. that shall cause the file descriptor
  30. .IR fildes
  31. to be duplicated as
  32. .IR newfildes
  33. (as if
  34. .IR dup2 (\c
  35. .IR fildes ,
  36. .IR newfildes )
  37. had been called) when a new process is spawned using this file actions
  38. object.
  39. .P
  40. A spawn file actions object is as defined in
  41. .IR "\fIposix_spawn_file_actions_addclose\fR\^(\|)".
  42. .SH "RETURN VALUE"
  43. Upon successful completion, the
  44. \fIposix_spawn_file_actions_adddup2\fR()
  45. function shall return zero; otherwise, an error number shall be
  46. returned to indicate the error.
  47. .SH ERRORS
  48. The
  49. \fIposix_spawn_file_actions_adddup2\fR()
  50. function shall fail if:
  51. .TP
  52. .BR EBADF
  53. The value specified by
  54. .IR fildes
  55. or
  56. .IR newfildes
  57. is negative or greater than or equal to
  58. {OPEN_MAX}.
  59. .TP
  60. .BR ENOMEM
  61. Insufficient memory exists to add to the spawn file actions object.
  62. .P
  63. The
  64. \fIposix_spawn_file_actions_adddup2\fR()
  65. function may fail if:
  66. .TP
  67. .BR EINVAL
  68. The value specified by
  69. .IR file_actions
  70. is invalid.
  71. .P
  72. It shall not be considered an error for the
  73. .IR fildes
  74. argument passed to the
  75. \fIposix_spawn_file_actions_adddup2\fR()
  76. function to specify a file descriptor for which the specified operation
  77. could not be performed at the time of the call. Any such error will be
  78. detected when the associated file actions object is later used during a
  79. \fIposix_spawn\fR()
  80. or
  81. \fIposix_spawnp\fR()
  82. operation.
  83. .LP
  84. .IR "The following sections are informative."
  85. .SH EXAMPLES
  86. None.
  87. .SH "APPLICATION USAGE"
  88. The
  89. \fIposix_spawn_file_actions_adddup2\fR()
  90. function is part of the Spawn option and need not be
  91. provided on all implementations.
  92. .P
  93. Implementations may use file descriptors that must be inherited into
  94. child processes for the child process to remain conforming, such as for
  95. message catalog or tracing purposes. Therefore, an application that calls
  96. \fIposix_spawn_file_actions_adddup2\fR()
  97. with an arbitrary integer for
  98. .IR newfildes
  99. risks non-conforming behavior, and this function can only portably be
  100. used to overwrite file descriptor values that the application has obtained
  101. through explicit actions, or for the three file descriptors corresponding
  102. to the standard file streams. In order to avoid a race condition of
  103. leaking an unintended file descriptor into a child process, an application
  104. should consider opening all file descriptors with the FD_CLOEXEC bit
  105. set unless the file descriptor is intended to be inherited across
  106. .IR exec .
  107. .SH RATIONALE
  108. Refer to the RATIONALE section in
  109. .IR "\fIposix_spawn_file_actions_addclose\fR\^(\|)".
  110. .SH "FUTURE DIRECTIONS"
  111. None.
  112. .SH "SEE ALSO"
  113. .IR "\fIdup\fR\^(\|)",
  114. .IR "\fIposix_spawn\fR\^(\|)",
  115. .IR "\fIposix_spawn_file_actions_addclose\fR\^(\|)",
  116. .IR "\fIposix_spawn_file_actions_destroy\fR\^(\|)"
  117. .P
  118. The Base Definitions volume of POSIX.1\(hy2017,
  119. .IR "\fB<spawn.h>\fP"
  120. .\"
  121. .SH COPYRIGHT
  122. Portions of this text are reprinted and reproduced in electronic form
  123. from IEEE Std 1003.1-2017, Standard for Information Technology
  124. -- Portable Operating System Interface (POSIX), The Open Group Base
  125. Specifications Issue 7, 2018 Edition,
  126. Copyright (C) 2018 by the Institute of
  127. Electrical and Electronics Engineers, Inc and The Open Group.
  128. In the event of any discrepancy between this version and the original IEEE and
  129. The Open Group Standard, the original IEEE and The Open Group Standard
  130. is the referee document. The original Standard can be obtained online at
  131. http://www.opengroup.org/unix/online.html .
  132. .PP
  133. Any typographical or formatting errors that appear
  134. in this page are most likely
  135. to have been introduced during the conversion of the source files to
  136. man page format. To report such errors, see
  137. https://www.kernel.org/doc/man-pages/reporting_bugs.html .