# SOME DESCRIPTIVE TITLE # Copyright (C) YEAR Free Software Foundation, Inc. # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "POT-Creation-Date: 2024-06-01 06:09+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #. type: TH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "posix_spawn" msgstr "" #. type: TH #: archlinux debian-unstable opensuse-tumbleweed #, no-wrap msgid "2024-05-02" msgstr "" #. type: TH #: archlinux debian-unstable #, no-wrap msgid "Linux man-pages 6.8" msgstr "" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "NAME" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "posix_spawn, posix_spawnp - spawn a process" msgstr "" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "LIBRARY" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "Standard C library (I, I<-lc>)" msgstr "" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "SYNOPSIS" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B<#include Espawn.hE>\n" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "" "BIB<, const char *restrict >IB<,>\n" "B< const posix_spawn_file_actions_t *restrict >IB<,>\n" "B< const posix_spawnattr_t *restrict >IB<,>\n" "B< char *const >IB<[restrict],>\n" "B< char *const >IB<[restrict]);>\n" "BIB<, const char *restrict >IB<,>\n" "B< const posix_spawn_file_actions_t *restrict >IB<,>\n" "B< const posix_spawnattr_t *restrict >IB<,>\n" "B< char *const >IB<[restrict],>\n" "B< char *const >IB<[restrict]);>\n" msgstr "" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "DESCRIPTION" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The B() and B() functions are used to create a " "new child process that executes a specified file. These functions were " "specified by POSIX to provide a standardized method of creating new " "processes on machines that lack the capability to support the B(2) " "system call. These machines are generally small, embedded systems lacking " "MMU support." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The B() and B() functions provide the " "functionality of a combined B(2) and B(3), with some optional " "housekeeping steps in the child process before the B(3). These " "functions are not meant to replace the B(2) and B(2) system " "calls. In fact, they provide only a subset of the functionality that can be " "achieved by using the system calls." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The only difference between B() and B() is the " "manner in which they specify the file to be executed by the child process. " "With B(), the executable file is specified as a pathname (which " "can be absolute or relative). With B(), the executable file " "is specified as a simple filename; the system searches for this file in the " "list of directories specified by B (in the same way as for " "B(3)). For the remainder of this page, the discussion is phrased in " "terms of B(), with the understanding that B() " "differs only on the point just described." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "The remaining arguments to these two functions are as follows:" msgstr "" #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "I" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "points to a buffer that is used to return the process ID of the new child " "process." msgstr "" #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "I" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "points to a I that specifies file-related actions " "to be performed in the child between the B(2) and B(3) steps. " "This object is initialized and populated before the B() call " "using B(3) and the " "B() functions." msgstr "" #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "I" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "points to an I that specifies various attributes of the " "created child process. This object is initialized and populated before the " "B() call using B(3) and the " "B() functions." msgstr "" #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "I" msgstr "" #. type: TQ #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "I" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "specify the argument list and environment for the program that is executed " "in the child process, as for B(2)." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Below, the functions are described in terms of a three-step process: the " "B() step, the pre-B() step (executed in the child), and the " "B() step (executed in the child)." msgstr "" #. type: SS #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "fork() step" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Since glibc 2.24, the B() function commences by calling " "B(2) with B and B flags. Older " "implementations use B(2), or possibly B(2) (see below)." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The PID of the new child process is placed in I<*pid>. The " "B() function then returns control to the parent process." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Subsequently, the parent can use one of the system calls described in " "B(2) to check the status of the child process. If the child fails in " "any of the housekeeping steps described below, or fails to execute the " "desired file, it exits with a status of 127." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Before glibc 2.24, the child process is created using B(2) instead " "of B(2) when either of the following is true:" msgstr "" #. type: IP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "\\[bu]" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "the I element of the attributes object pointed to by I " "contains the GNU-specific flag B; or" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "I is NULL and the I element of the attributes " "object pointed to by I does I contain B, " "B, B, " "B, B, or " "B." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "In other words, B(2) is used if the caller requests it, or if there " "is no cleanup expected in the child before it B(3)s the requested file." msgstr "" #. type: SS #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "pre-exec() step: housekeeping" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "In between the B and the B steps, a child process may need " "to perform a set of housekeeping actions. The B() and " "B() functions support a small, well-defined set of system " "tasks that the child process can accomplish before it executes the " "executable file. These operations are controlled by the attributes object " "pointed to by I and the file actions object pointed to by " "I. In the child, processing is done in the following sequence:" msgstr "" #. type: IP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "(1)" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Process attribute actions: signal mask, signal default handlers, scheduling " "algorithm and parameters, process group, and effective user and group IDs " "are changed as specified by the attributes object pointed to by I." msgstr "" #. type: IP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "(2)" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "File actions, as specified in the I argument, are performed in " "the order that they were specified using calls to the " "B() functions." msgstr "" #. type: IP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "(3)" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "File descriptors with the B flag set are closed." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "All process attributes in the child, other than those affected by attributes " "specified in the object pointed to by I and the file actions in the " "object pointed to by I, will be affected as though the child " "was created with B(2) and it executed the program with B(2)." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The process attributes actions are defined by the attributes object pointed " "to by I. The I attribute (set using " "B(3)) controls the general actions that occur, " "and other attributes in the object specify values to be used during those " "actions." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The effects of the flags that may be specified in I are as " "follows:" msgstr "" #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "" #. FIXME . #. (see #. .BR posix_spawnattr_setsigmask (3)) #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Set the signal mask to the signal set specified in the I " "attribute of the object pointed to by I. If the " "B flag is not set, then the child inherits the " "parent's signal mask." msgstr "" #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "" #. FIXME . #. (see #. .BR posix_spawnattr_setsigdefault (3)) #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Reset the disposition of all signals in the set specified in the I attribute of the object pointed to by I to the default. " "For the treatment of the dispositions of signals not specified in the " "I attribute, or the treatment when " "B is not specified, see B(2)." msgstr "" #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "" #. (POSIX_PRIORITY_SCHEDULING only) #. FIXME . #. (see #. .BR posix_spawnattr_setschedparam (3)) #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "If this flag is set, and the B flag is not set, " "then set the scheduling parameters to the parameters specified in the " "I attribute of the object pointed to by I." msgstr "" #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Set the scheduling policy algorithm and parameters of the child, as follows:" msgstr "" #. FIXME . #. (see #. .BR posix_spawnattr_setpolicy (3)) #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The scheduling policy is set to the value specified in the I attribute of the object pointed to by I." msgstr "" #. FIXME . #. (see #. .BR posix_spawnattr_setschedparam (3)) #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The scheduling parameters are set to the value specified in the I attribute of the object pointed to by I (but see BUGS)." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "If the B and B flags " "are not specified, the child inherits the corresponding scheduling " "attributes from the parent." msgstr "" #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "If this flag is set, reset the effective UID and GID to the real UID and GID " "of the parent process. If this flag is not set, then the child retains the " "effective UID and GID of the parent. In either case, if the set-user-ID and " "set-group-ID permission bits are enabled on the executable file, their " "effect will override the setting of the effective UID and GID (se " "B(2))." msgstr "" #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "" #. FIXME . #. (see #. .BR posix_spawnattr_setpgroup (3)) #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Set the process group to the value specified in the I " "attribute of the object pointed to by I. If the I " "attribute has the value 0, the child's process group ID is made the same as " "its process ID. If the B flag is not set, the child " "inherits the parent's process group ID." msgstr "" #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Since glibc 2.24, this flag has no effect. On older implementations, " "setting this flag forces the B step to use B(2) instead of " "B(2). The B<_GNU_SOURCE> feature test macro must be defined to obtain " "the definition of this constant." msgstr "" #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B (since glibc 2.26)" msgstr "" #. This flag has been accepted in POSIX, see: #. http://austingroupbugs.net/view.php?id=1044 #. and has been implemented since glibc 2.26 #. commit daeb1fa2e1b33323e719015f5f546988bd4cc73b #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "If this flag is set, the child process shall create a new session and become " "the session leader. The child process shall also become the process group " "leader of the new process group in the session (see B(2)). The " "B<_GNU_SOURCE> feature test macro must be defined to obtain the definition " "of this constant." msgstr "" #. mtk: I think we probably don't want to say the following, since it #. could lead people to do the wrong thing #. The POSIX standard tells you to call #. this function to de-initialize the attributes object pointed to by #. .I attrp #. when you are done with it; #. however, on Linux systems this operation is a no-op. #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "If I is NULL, then the default behaviors described above for each " "flag apply." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The I argument specifies a sequence of file operations that " "are performed in the child process after the general processing described " "above, and before it performs the B(3). If I is NULL, " "then no special action is taken, and standard B(3) semantics " "apply\\[em]file descriptors open before the exec remain open in the new " "process, except those for which the B flag has been set. File " "locks remain in place." msgstr "" #. FIXME . I think the following is best placed in the #. posix_spawn_file_actions_adddup2(3) page, and a similar statement is #. also needed in posix_spawn_file_actions_addclose(3) #. Note that you can specify file descriptors in #. .I posix_spawn_file_actions_adddup2 (3) #. which would not be usable if you called #. .BR dup2 (2) #. at that time--i.e., file descriptors that are opened or #. closed by the earlier operations #. added to #. .I file_actions . #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "If I is not NULL, then it contains an ordered set of requests " "to B(2), B(2), and B(2) files. These requests are added " "to the I by B(3), " "B(3), and " "B(3). The requested operations are " "performed in the order they were added to I." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "If any of the housekeeping actions fails (due to bogus values being passed " "or other reasons why signal handling, process scheduling, process group ID " "functions, and file descriptor operations might fail), the child process " "exits with exit value 127." msgstr "" #. type: SS #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "exec() step" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Once the child has successfully forked and performed all requested pre-exec " "steps, the child runs the requested executable." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The child process takes its environment from the I argument, which is " "interpreted as if it had been passed to B(2). The arguments to the " "created process come from the I argument, which is processed as for " "B(2)." msgstr "" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "RETURN VALUE" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Upon successful completion, B() and B() place " "the PID of the child process in I, and return 0. If there is an error " "during the B step, then no child is created, the contents of I<*pid> " "are unspecified, and these functions return an error number as described " "below." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Even when these functions return a success status, the child process may " "still fail for a plethora of reasons related to its pre-B() " "initialization. In addition, the B(3) may fail. In all of these " "cases, the child process will exit with the exit value of 127." msgstr "" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "ERRORS" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The B() and B() functions fail only in the case " "where the underlying B(2), B(2), or B(2) call fails; in " "these cases, these functions return an error number, which will be one of " "the errors described for B(2), B(2), or B(2)." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "In addition, these functions fail if:" msgstr "" #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "Function not supported on this system." msgstr "" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "STANDARDS" msgstr "" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-leap-15-6 opensuse-tumbleweed msgid "POSIX.1-2008." msgstr "" #. type: SH #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "HISTORY" msgstr "" #. FIXME . This piece belongs in spawnattr_setflags(3) #. The #. .B POSIX_SPAWN_USEVFORK #. flag is a GNU extension; the #. .B _GNU_SOURCE #. feature test macro must be defined (before including any header files) #. to obtain the definition of this constant. #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-leap-15-6 opensuse-tumbleweed msgid "glibc 2.2. POSIX.1-2001." msgstr "" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "NOTES" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The housekeeping activities in the child are controlled by the objects " "pointed to by I (for non-file actions) and I In POSIX " "parlance, the I and I data " "types are referred to as objects, and their elements are not specified by " "name. Portable programs should initialize these objects using only the " "POSIX-specified functions. (In other words, although these objects may be " "implemented as structures containing fields, portable programs must avoid " "dependence on such implementation details.)" msgstr "" #. Tested on glibc 2.12 #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "According to POSIX, it is unspecified whether fork handlers established with " "B(3) are called when B() is invoked. Since " "glibc 2.24, the fork handlers are not executed in any case. On older " "implementations, fork handlers are called only if the child is created using " "B(2)." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "There is no \"posix_fspawn\" function (i.e., a function that is to " "B() as B(3) is to B(2)). However, this " "functionality can be obtained by specifying the I argument as one of " "the files in the caller's I directory." msgstr "" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "BUGS" msgstr "" #. http://sourceware.org/bugzilla/show_bug.cgi?id=12052 #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "POSIX.1 says that when B is specified in I, then the B (if present) is ignored. " "However, before glibc 2.14, calls to B() failed with an error " "if B was specified without also specifying " "B." msgstr "" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "EXAMPLES" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The program below demonstrates the use of various functions in the POSIX " "spawn API. The program accepts command-line attributes that can be used to " "create file actions and attributes objects. The remaining command-line " "arguments are used as the executable name and command-line arguments of the " "program that is executed in the child." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "In the first run, the B(1) command is executed in the child, and the " "B() call employs no file actions or attributes objects." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "" "$ B<./a.out date>\n" "PID of child: 7634\n" "Tue Feb 1 19:47:50 CEST 2011\n" "Child status: exited, status=0\n" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "In the next run, the I<-c> command-line option is used to create a file " "actions object that closes standard output in the child. Consequently, " "B(1) fails when trying to perform output and exits with a status of 1." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "" "$ B<./a.out -c date>\n" "PID of child: 7636\n" "date: write error: Bad file descriptor\n" "Child status: exited, status=1\n" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "In the next run, the I<-s> command-line option is used to create an " "attributes object that specifies that all (blockable) signals in the child " "should be blocked. Consequently, trying to kill child with the default " "signal sent by B(1) (i.e., B) fails, because that signal is " "blocked. Therefore, to kill the child, B is necessary (B " "can't be blocked)." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "" "$ B<./a.out -s sleep 60 &>\n" "[1] 7637\n" "$ PID of child: 7638\n" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "" "$ B\n" "$ B\n" "$ Child status: killed by signal 9\n" "[1]+ Done ./a.out -s sleep 60\n" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "When we try to execute a nonexistent command in the child, the B(3) " "fails and the child exits with a status of 127." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "" "$ B<./a.out xxxxx\n" "PID of child: 10190\n" "Child status: exited, status=127>\n" msgstr "" #. type: SS #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "Program source" msgstr "" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-tumbleweed #, no-wrap msgid "" "#include Eerrno.hE\n" "#include Espawn.hE\n" "#include Estdint.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Estring.hE\n" "#include Eunistd.hE\n" "#include Ewait.hE\n" "\\&\n" "#define errExit(msg) do { perror(msg); \\e\n" " exit(EXIT_FAILURE); } while (0)\n" "\\&\n" "#define errExitEN(en, msg) \\e\n" " do { errno = en; perror(msg); \\e\n" " exit(EXIT_FAILURE); } while (0)\n" "\\&\n" "char **environ;\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" " pid_t child_pid;\n" " int s, opt, status;\n" " sigset_t mask;\n" " posix_spawnattr_t attr;\n" " posix_spawnattr_t *attrp;\n" " posix_spawn_file_actions_t file_actions;\n" " posix_spawn_file_actions_t *file_actionsp;\n" "\\&\n" " /* Parse command-line options, which can be used to specify an\n" " attributes object and file actions object for the child. */\n" "\\&\n" " attrp = NULL;\n" " file_actionsp = NULL;\n" "\\&\n" " while ((opt = getopt(argc, argv, \"sc\")) != -1) {\n" " switch (opt) {\n" " case \\[aq]c\\[aq]: /* -c: close standard output in child */\n" "\\&\n" " /* Create a file actions object and add a \"close\"\n" " action to it. */\n" "\\&\n" " s = posix_spawn_file_actions_init(&file_actions);\n" " if (s != 0)\n" " errExitEN(s, \"posix_spawn_file_actions_init\");\n" "\\&\n" " s = posix_spawn_file_actions_addclose(&file_actions,\n" " STDOUT_FILENO);\n" " if (s != 0)\n" " errExitEN(s, \"posix_spawn_file_actions_addclose\");\n" "\\&\n" " file_actionsp = &file_actions;\n" " break;\n" "\\&\n" " case \\[aq]s\\[aq]: /* -s: block all signals in child */\n" "\\&\n" " /* Create an attributes object and add a \"set signal mask\"\n" " action to it. */\n" "\\&\n" " s = posix_spawnattr_init(&attr);\n" " if (s != 0)\n" " errExitEN(s, \"posix_spawnattr_init\");\n" " s = posix_spawnattr_setflags(&attr, POSIX_SPAWN_SETSIGMASK);\n" " if (s != 0)\n" " errExitEN(s, \"posix_spawnattr_setflags\");\n" "\\&\n" " sigfillset(&mask);\n" " s = posix_spawnattr_setsigmask(&attr, &mask);\n" " if (s != 0)\n" " errExitEN(s, \"posix_spawnattr_setsigmask\");\n" "\\&\n" " attrp = &attr;\n" " break;\n" " }\n" " }\n" "\\&\n" " /* Spawn the child. The name of the program to execute and the\n" " command-line arguments are taken from the command-line arguments\n" " of this program. The environment of the program execed in the\n" " child is made the same as the parent\\[aq]s environment. */\n" "\\&\n" " s = posix_spawnp(&child_pid, argv[optind], file_actionsp, attrp,\n" " &argv[optind], environ);\n" " if (s != 0)\n" " errExitEN(s, \"posix_spawn\");\n" "\\&\n" " /* Destroy any objects that we created earlier. */\n" "\\&\n" " if (attrp != NULL) {\n" " s = posix_spawnattr_destroy(attrp);\n" " if (s != 0)\n" " errExitEN(s, \"posix_spawnattr_destroy\");\n" " }\n" "\\&\n" " if (file_actionsp != NULL) {\n" " s = posix_spawn_file_actions_destroy(file_actionsp);\n" " if (s != 0)\n" " errExitEN(s, \"posix_spawn_file_actions_destroy\");\n" " }\n" "\\&\n" " printf(\"PID of child: %jd\\en\", (intmax_t) child_pid);\n" "\\&\n" " /* Monitor status of the child until it terminates. */\n" "\\&\n" " do {\n" " s = waitpid(child_pid, &status, WUNTRACED | WCONTINUED);\n" " if (s == -1)\n" " errExit(\"waitpid\");\n" "\\&\n" " printf(\"Child status: \");\n" " if (WIFEXITED(status)) {\n" " printf(\"exited, status=%d\\en\", WEXITSTATUS(status));\n" " } else if (WIFSIGNALED(status)) {\n" " printf(\"killed by signal %d\\en\", WTERMSIG(status));\n" " } else if (WIFSTOPPED(status)) {\n" " printf(\"stopped by signal %d\\en\", WSTOPSIG(status));\n" " } else if (WIFCONTINUED(status)) {\n" " printf(\"continued\\en\");\n" " }\n" " } while (!WIFEXITED(status) && !WIFSIGNALED(status));\n" "\\&\n" " exit(EXIT_SUCCESS);\n" "}\n" msgstr "" #. SRC END #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "SEE ALSO" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "B(2), B(2), B(2), B(2), B(2), B(2), " "B(2), B(2), B(2), B(2), " "B(2), B(2), B(3), " "B(3), " "B(3), " "B(3), B(3), " "B(3), B(3), " "B(3), B(3), " "B(3), B(3), " "B(3), B(3), " "B(3), B(3), " "B(3), B(3), " "B(3), B(3), " "B(3), Ispawn.hE>, Base Definitions volume of " "POSIX.1-2001, I" msgstr "" #. type: TH #: debian-bookworm #, no-wrap msgid "2023-02-05" msgstr "" #. type: TH #: debian-bookworm #, no-wrap msgid "Linux man-pages 6.03" msgstr "" #. type: SH #: debian-bookworm #, no-wrap msgid "VERSIONS" msgstr "" #. type: Plain text #: debian-bookworm msgid "" "The B() and B() functions are available since " "glibc 2.2." msgstr "" #. FIXME . This piece belongs in spawnattr_setflags(3) #. The #. .B POSIX_SPAWN_USEVFORK #. flag is a GNU extension; the #. .B _GNU_SOURCE #. feature test macro must be defined (before including any header files) #. to obtain the definition of this constant. #. type: Plain text #: debian-bookworm msgid "POSIX.1-2001, POSIX.1-2008." msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" "#include Eerrno.hE\n" "#include Espawn.hE\n" "#include Estdint.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Estring.hE\n" "#include Eunistd.hE\n" "#include Ewait.hE\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" "#define errExit(msg) do { perror(msg); \\e\n" " exit(EXIT_FAILURE); } while (0)\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" "#define errExitEN(en, msg) \\e\n" " do { errno = en; perror(msg); \\e\n" " exit(EXIT_FAILURE); } while (0)\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "char **environ;\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" "int\n" "main(int argc, char *argv[])\n" "{\n" " pid_t child_pid;\n" " int s, opt, status;\n" " sigset_t mask;\n" " posix_spawnattr_t attr;\n" " posix_spawnattr_t *attrp;\n" " posix_spawn_file_actions_t file_actions;\n" " posix_spawn_file_actions_t *file_actionsp;\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " /* Parse command-line options, which can be used to specify an\n" " attributes object and file actions object for the child. */\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " attrp = NULL;\n" " file_actionsp = NULL;\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " while ((opt = getopt(argc, argv, \"sc\")) != -1) {\n" " switch (opt) {\n" " case \\[aq]c\\[aq]: /* -c: close standard output in child */\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " /* Create a file actions object and add a \"close\"\n" " action to it. */\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " s = posix_spawn_file_actions_init(&file_actions);\n" " if (s != 0)\n" " errExitEN(s, \"posix_spawn_file_actions_init\");\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " s = posix_spawn_file_actions_addclose(&file_actions,\n" " STDOUT_FILENO);\n" " if (s != 0)\n" " errExitEN(s, \"posix_spawn_file_actions_addclose\");\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " file_actionsp = &file_actions;\n" " break;\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid " case \\[aq]s\\[aq]: /* -s: block all signals in child */\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " /* Create an attributes object and add a \"set signal mask\"\n" " action to it. */\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " s = posix_spawnattr_init(&attr);\n" " if (s != 0)\n" " errExitEN(s, \"posix_spawnattr_init\");\n" " s = posix_spawnattr_setflags(&attr, POSIX_SPAWN_SETSIGMASK);\n" " if (s != 0)\n" " errExitEN(s, \"posix_spawnattr_setflags\");\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " sigfillset(&mask);\n" " s = posix_spawnattr_setsigmask(&attr, &mask);\n" " if (s != 0)\n" " errExitEN(s, \"posix_spawnattr_setsigmask\");\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " attrp = &attr;\n" " break;\n" " }\n" " }\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " /* Spawn the child. The name of the program to execute and the\n" " command-line arguments are taken from the command-line arguments\n" " of this program. The environment of the program execed in the\n" " child is made the same as the parent\\[aq]s environment. */\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " s = posix_spawnp(&child_pid, argv[optind], file_actionsp, attrp,\n" " &argv[optind], environ);\n" " if (s != 0)\n" " errExitEN(s, \"posix_spawn\");\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid " /* Destroy any objects that we created earlier. */\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " if (attrp != NULL) {\n" " s = posix_spawnattr_destroy(attrp);\n" " if (s != 0)\n" " errExitEN(s, \"posix_spawnattr_destroy\");\n" " }\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " if (file_actionsp != NULL) {\n" " s = posix_spawn_file_actions_destroy(file_actionsp);\n" " if (s != 0)\n" " errExitEN(s, \"posix_spawn_file_actions_destroy\");\n" " }\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid " printf(\"PID of child: %jd\\en\", (intmax_t) child_pid);\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid " /* Monitor status of the child until it terminates. */\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " do {\n" " s = waitpid(child_pid, &status, WUNTRACED | WCONTINUED);\n" " if (s == -1)\n" " errExit(\"waitpid\");\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " printf(\"Child status: \");\n" " if (WIFEXITED(status)) {\n" " printf(\"exited, status=%d\\en\", WEXITSTATUS(status));\n" " } else if (WIFSIGNALED(status)) {\n" " printf(\"killed by signal %d\\en\", WTERMSIG(status));\n" " } else if (WIFSTOPPED(status)) {\n" " printf(\"stopped by signal %d\\en\", WSTOPSIG(status));\n" " } else if (WIFCONTINUED(status)) {\n" " printf(\"continued\\en\");\n" " }\n" " } while (!WIFEXITED(status) && !WIFSIGNALED(status));\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " exit(EXIT_SUCCESS);\n" "}\n" msgstr "" #. type: TH #: fedora-40 fedora-rawhide mageia-cauldron #, no-wrap msgid "2023-10-31" msgstr "" #. type: TH #: fedora-40 mageia-cauldron #, no-wrap msgid "Linux man-pages 6.06" msgstr "" #. type: TH #: fedora-rawhide #, no-wrap msgid "Linux man-pages 6.7" msgstr "" #. type: TH #: opensuse-leap-15-6 #, no-wrap msgid "2023-03-30" msgstr "" #. type: TH #: opensuse-leap-15-6 #, no-wrap msgid "Linux man-pages 6.04" msgstr "" #. type: TH #: opensuse-tumbleweed #, no-wrap msgid "Linux man-pages (unreleased)" msgstr ""