noble (3) execl.3.gz

Provided by: manpages-pl-dev_4.21.0-2_all bug

NAZWA

       execl, execlp, execle, execv, execvp, execvpe - uruchomienie pliku

BIBLIOTEKA

       Standardowa biblioteka C (libc, -lc)

SKŁADNIA

       #include <unistd.h>

       extern char **environ;

       int execl(const char *pathname, const char *arg, ...
       /*, (char *) NULL */);
       int execlp(const char *file, const char *arg, ...
       /*, (char *) NULL */);
       int execle(const char *pathname, const char *arg, ...
                       /*, (char *) NULL, char *const envp[] */);
       int execv(const char *pathname, char *const argv[]);
       int execvp(const char *file, char *const argv[]);
       int execvpe(const char *file, char *const argv[], char *const envp[]);

   Wymagane ustawienia makr biblioteki glibc (patrz feature_test_macros(7)):

       execvpe():
           _GNU_SOURCE

OPIS

       Rodzina  funkcji  exec()  zastępuje  w  pamięci  obraz  bieżącego procesu obrazem nowego procesu. Funkcje
       opisane na tej stronie podręcznika są tylko nakładkami dla funkcji execve(2).  (Dodatkowe  informacje  na
       temat nadpisywania bieżącego procesu można znaleźć na stronie podręcznika execve(2)).

       Pierwszym argumentem tych funkcji jest ścieżka do pliku, który ma być uruchomiony.

       The functions can be grouped based on the letters following the "exec" prefix.

   l - execl(), execlp(), execle()
       Kolejne  wyrażenia  const  char *arg można traktować jako arg0, arg1, ..., argn.  Razem opisują one listę
       jednego lub więcej wskaźników do zakończonych znakiem NUL łańcuchów,  reprezentujących  listę  argumentów
       udostępnianych  wykonywanemu  programowi.  Pierwszy  argument, zgodnie z konwencją, powinien wskazywać na
       nazwę pliku powiązaną z wykonywanym plikiem. Lista argumentów musi być  zakończona  wskaźnikiem  null,  a
       ponieważ  te  funkcje  są  funkcjami  o  zmiennej  liczbie argumentów, wskaźnik ten musi być rzutowany na
       (char *) NULL.

       By contrast with the 'l' functions, the 'v' functions (below) specify the command-line arguments  of  the
       executed program as a vector.

   v - execv(), execvp(), execvpe()
       Argument    char *const   argv[]   jest   tablicą   wskaźników  do  zakończonych  znakami  NUL  łańcuchów
       reprezentujących listę argumentów dostępnych dla wykonywanego  programu.  Pierwszy  argument,  zgodnie  z
       konwencją, powinien wskazywać na nazwę pliku powiązaną z wykonywanym plikiem. Tablica wskaźników musi być
       zakończona wskaźnikiem null.

   e - execle(), execvpe()
       The environment of the new process image is specified via the argument envp.  The  envp  argument  is  an
       array of pointers to null-terminated strings and must be terminated by a null pointer.

       All  other  exec()   functions  (which do not include 'e' in the suffix) take the environment for the new
       process image from the external variable environ in the calling process.

   p - execlp(), execvp(), execvpe()
       These functions duplicate the actions of the shell in searching for an executable file if  the  specified
       filename  does  not  contain  a  slash  (/) character.  The file is sought in the colon-separated list of
       directory pathnames specified in the PATH environment variable.  If this variable isn't defined, the path
       list  defaults  to  a  list  that includes the directories returned by confstr(_CS_PATH) (which typically
       returns the value "/bin:/usr/bin")  and possibly also  the  current  working  directory;  see  NOTES  for
       further details.

       execvpe()   searches  for the program using the value of PATH from the caller's environment, not from the
       envp argument.

       Jeśli podana nazwa pliku zawiera znak ukośnika, to wartość zmiennej PATH  jest  ignorowana  i  wykonywany
       jest plik z podanej lokalizacji.

       Dodatkowo pewne błędy są traktowane w specjalny sposób.

       Jeśli  dostęp  do pliku został zabroniony (wywołanie execve(2) zakończyło się błędem  EACCES), funkcje te
       będą przeszukiwać resztę ścieżki. Jeśli jednak nie  odnajdą  innego  pliku,  powrócą  i  ustawią  wartość
       zmiennej errno na EACCES.

       Jeśli  nagłówek  nie  zostanie  rozpoznany  (wywołanie execve(2) zakończy się błędem ENOEXEC), funkcje te
       spróbują uruchomić powłokę (/bin/sh) ze ścieżką do pliku jako pierwszym argumentem. (Jeśli i ta próba się
       nie powiedzie, przeszukiwanie zostanie zakończone).

       All  other  exec()   functions  (which  do  not include 'p' in the suffix) take as their first argument a
       (relative or absolute) pathname that identifies the program to be executed.

WARTOŚĆ ZWRACANA

       Funkcje exec() powracają tylko wtedy, gdy wystąpi błąd. Zwracana jest wartość -1 i ustawiana jest zmienna
       errno, określająca rodzaj błędu.

BŁĘDY

       Każda  z  tych  funkcji  może  zakończyć  się  niepowodzeniem  i  ustawić jako wartość errno dowolny błąd
       określony dla execve(2).

WERSJE

       Funkcja execvpe() pojawiła się po raz pierwszy w wersji 2.11 biblioteki glibc.

ATRYBUTY

       Informacje o pojęciach używanych w tym rozdziale można znaleźć w podręczniku attributes(7).

       ┌─────────────────────────────────────────────────────────────────┬────────────────────────┬─────────────┐
       │InterfejsAtrybutWartość     │
       ├─────────────────────────────────────────────────────────────────┼────────────────────────┼─────────────┤
       │execl(), execle(), execv()                                       │ Bezpieczeństwo wątkowe │ MT-Safe     │
       ├─────────────────────────────────────────────────────────────────┼────────────────────────┼─────────────┤
       │execlp(), execvp(), execvpe()                                    │ Bezpieczeństwo wątkowe │ MT-Safe env │
       └─────────────────────────────────────────────────────────────────┴────────────────────────┴─────────────┘

STANDARDY

       POSIX.1-2001, POSIX.1-2008.

       execvpe() jest rozszerzeniem GNU.

UWAGI

       The default search path (used when the environment does  not  contain  the  variable  PATH)   shows  some
       variation  across  systems.  It generally includes /bin and /usr/bin (in that order) and may also include
       the current working directory.  On some other systems, the current working is  included  after  /bin  and
       /usr/bin,  as  an  anti-Trojan-horse  measure.   The  glibc  implementation long followed the traditional
       default where the current working directory is included at the start of the search path.   However,  some
       code  refactoring during the development of glibc 2.24 caused the current working directory to be dropped
       altogether from  the  default  search  path.   This  accidental  behavior  change  is  considered  mildly
       beneficial, and won't be reverted.

       Zachowanie execlp() oraz execvp() w przypadku wystąpienia błędów podczas uruchamiania pliku jest przyjęte
       jako tradycyjne, ale nie jest udokumentowane przez standard POSIX. BSD (a być może także inne systemy) po
       napotkaniu  błędu  ETXTBSY  czeka  przez chwilę i próbuje ponownie. Linux traktuje to jako błąd i powraca
       natychmiast.

       Tradycyjnie funkcje execlp() oraz execvp() ignorowały wszystkie błędy oprócz podanych powyżej oraz ENOMEM
       i  E2BIG, po których powracały. Obecnie powracają także wtedy, gdy wystąpi dowolny błąd inny od opisanych
       powyżej.

BŁĘDY

       Before glibc 2.24, execl()  and execle()   employed  realloc(3)  internally  and  were  consequently  not
       async-signal-safe, in violation of the requirements of POSIX.1.  This was fixed in glibc 2.24.

   Architecture-specific details
       On  sparc  and  sparc64,  execv()   is  provided as a system call by the kernel (with the prototype shown
       above)  for compatibility with SunOS.  This function is not employed by the execv()  wrapper function  on
       those architectures.

ZOBACZ TAKŻE

       sh(1), execve(2), execveat(2), fork(2), ptrace(2), fexecve(3), system(3), environ(7)

TŁUMACZENIE

       Autorami  polskiego  tłumaczenia  niniejszej  strony  podręcznika są: Adam Byrtek <alpha@irc.pl>, Andrzej
       Krzysztofowicz  <ankry@green.mf.pg.gda.pl>,  Robert   Luberda   <robert@debian.org>   i   Michał   Kułach
       <michal.kulach@gmail.com>

       Niniejsze  tłumaczenie  jest  wolną  dokumentacją.  Bliższe informacje o warunkach licencji można uzyskać
       zapoznając się z GNU General Public License w wersji  3  ⟨https://www.gnu.org/licenses/gpl-3.0.html⟩  lub
       nowszej. Nie przyjmuje się ŻADNEJ ODPOWIEDZIALNOŚCI.

       Błędy  w  tłumaczeniu  strony  podręcznika  prosimy  zgłaszać  na  adres  listy dyskusyjnej ⟨manpages-pl-
       list@lists.sourceforge.net⟩.