.\" -*- coding: UTF-8 -*-
'\" t
.\" Copyright (c) 1991 The Regents of the University of California.
.\" All rights reserved.
.\"
.\" SPDX-License-Identifier: BSD-4-Clause-UC
.\"
.\"     @(#)exec.3	6.4 (Berkeley) 4/19/91
.\"
.\" Converted for Linux, Mon Nov 29 11:12:48 1993, faith@cs.unc.edu
.\" Updated more for Linux, Tue Jul 15 11:54:18 1997, pacman@cqc.com
.\" Modified, 24 Jun 2004, Michael Kerrisk <mtk.manpages@gmail.com>
.\"     Added note on casting NULL
.\"
.\"*******************************************************************
.\"
.\" This file was generated with po4a. Translate the source file.
.\"
.\"*******************************************************************
.TH exec 3 "7 stycznia 2023 r." "Linux man\-pages 6.03" 
.SH NAZWA
execl, execlp, execle, execv, execvp, execvpe \- uruchomienie pliku
.SH BIBLIOTEKA
Standardowa biblioteka C (\fIlibc\fP, \fI\-lc\fP)
.SH SKŁADNIA
.nf
\fB#include <unistd.h>\fP
.PP
\fBextern char **environ;\fP
.PP
\fBint execl(const char *\fP\fIpathname\fP\fB, const char *\fP\fIarg\fP\fB, ...\fP
\fB/*, (char *) NULL */);\fP
\fBint execlp(const char *\fP\fIfile\fP\fB, const char *\fP\fIarg\fP\fB, ...\fP
\fB/*, (char *) NULL */);\fP
\fBint execle(const char *\fP\fIpathname\fP\fB, const char *\fP\fIarg\fP\fB, ...\fP
\fB                /*, (char *) NULL, char *const \fP\fIenvp\fP\fB[] */);\fP
\fBint execv(const char *\fP\fIpathname\fP\fB, char *const \fP\fIargv\fP\fB[]);\fP
\fBint execvp(const char *\fP\fIfile\fP\fB, char *const \fP\fIargv\fP\fB[]);\fP
\fBint execvpe(const char *\fP\fIfile\fP\fB, char *const \fP\fIargv\fP\fB[], char *const \fP\fIenvp\fP\fB[]);\fP
.fi
.PP
.RS -4
Wymagane ustawienia makr biblioteki glibc (patrz \fBfeature_test_macros\fP(7)):
.RE
.PP
\fBexecvpe\fP():
.nf
    _GNU_SOURCE
.fi
.SH OPIS
Rodzina funkcji \fBexec\fP() 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 \fBexecve\fP(2). (Dodatkowe informacje na temat
nadpisywania bieżącego procesu można znaleźć na stronie podręcznika
\fBexecve\fP(2)).
.PP
Pierwszym argumentem tych funkcji jest ścieżka do pliku, który ma być
uruchomiony.
.PP
.\"
The functions can be grouped based on the letters following the "exec"
prefix.
.SS "l \- execl(), execlp(), execle()"
Kolejne wyrażenia \fIconst char\ *arg\fP można traktować jako \fIarg0\fP, \fIarg1\fP,
\&..., \fIargn\fP.  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 \fImusi\fP być zakończona wskaźnikiem null, a
ponieważ te funkcje są funkcjami o zmiennej liczbie argumentów, wskaźnik ten
musi być rzutowany na \fI(char\ *) NULL\fP.
.PP
.\"
By contrast with the 'l' functions, the 'v' functions (below) specify the
command\-line arguments of the executed program as a vector.
.SS "v \- execv(), execvp(), execvpe()"
Argument  \fIchar\ *const argv[]\fP 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
\fImusi\fP być zakończona wskaźnikiem null.
.SS "e \- execle(), execvpe()"
The environment of the new process image is specified via the argument
\fIenvp\fP.  The \fIenvp\fP argument is an array of pointers to null\-terminated
strings and \fImust\fP be terminated by a null pointer.
.PP
All other \fBexec\fP()  functions (which do not include 'e' in the suffix)
take the environment for the new process image from the external variable
\fIenviron\fP in the calling process.
.SS "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 \fBPATH\fP environment variable.  If this variable
isn't defined, the path list defaults to a list that includes the
directories returned by \fIconfstr(_CS_PATH)\fP (which typically returns the
value "/bin:/usr/bin")  and possibly also the current working directory; see
NOTES for further details.
.PP
\fBexecvpe\fP()  searches for the program using the value of \fBPATH\fP from the
caller's environment, not from the \fIenvp\fP argument.
.PP
Jeśli podana nazwa pliku zawiera znak ukośnika, to wartość zmiennej \fBPATH\fP
jest ignorowana i wykonywany jest plik z podanej lokalizacji.
.PP
Dodatkowo pewne błędy są traktowane w specjalny sposób.
.PP
Jeśli dostęp do pliku został zabroniony (wywołanie \fBexecve\fP(2) zakończyło
się błędem  \fBEACCES\fP), funkcje te będą przeszukiwać resztę ścieżki. Jeśli
jednak nie odnajdą innego pliku, powrócą i ustawią wartość zmiennej \fIerrno\fP
na \fBEACCES\fP.
.PP
Jeśli nagłówek nie zostanie rozpoznany (wywołanie \fBexecve\fP(2) zakończy się
błędem \fBENOEXEC\fP), funkcje te spróbują uruchomić powłokę (\fI/bin/sh\fP) ze
ścieżką do pliku jako pierwszym argumentem. (Jeśli i ta próba się nie
powiedzie, przeszukiwanie zostanie zakończone).
.PP
All other \fBexec\fP()  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.
.SH "WARTOŚĆ ZWRACANA"
Funkcje \fBexec\fP() powracają tylko wtedy, gdy wystąpi błąd. Zwracana jest
wartość \-1 i ustawiana jest zmienna \fIerrno\fP, określająca rodzaj błędu.
.SH BŁĘDY
Każda z tych funkcji może zakończyć się niepowodzeniem i ustawić jako
wartość \fIerrno\fP dowolny błąd określony dla \fBexecve\fP(2).
.SH WERSJE
Funkcja \fBexecvpe\fP() pojawiła się po raz pierwszy w wersji 2.11 biblioteki
glibc.
.SH ATRYBUTY
Informacje o pojęciach używanych w tym rozdziale można znaleźć w podręczniku
\fBattributes\fP(7).
.ad l
.nh
.TS
allbox;
lbx lb lb
l l l.
Interfejs	Atrybut	Wartość
T{
\fBexecl\fP(),
\fBexecle\fP(),
\fBexecv\fP()
T}	Bezpieczeństwo wątkowe	MT\-Safe
T{
\fBexeclp\fP(),
\fBexecvp\fP(),
\fBexecvpe\fP()
T}	Bezpieczeństwo wątkowe	MT\-Safe env
.TE
.hy
.ad
.sp 1
.SH STANDARDY
POSIX.1\-2001, POSIX.1\-2008.
.PP
\fBexecvpe\fP() jest rozszerzeniem GNU.
.SH UWAGI
.\" glibc commit 1eb8930608705702d5746e5491bab4e4429fcb83
The default search path (used when the environment does not contain the
variable \fBPATH\fP)  shows some variation across systems.  It generally
includes \fI/bin\fP and \fI/usr/bin\fP (in that order) and may also include the
current working directory.  On some other systems, the current working is
included after \fI/bin\fP and \fI/usr/bin\fP, 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.
.PP
Zachowanie \fBexeclp\fP() oraz \fBexecvp\fP() 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 \fBETXTBSY\fP czeka przez chwilę i próbuje ponownie. Linux
traktuje to jako błąd i powraca natychmiast.
.PP
Tradycyjnie funkcje \fBexeclp\fP() oraz \fBexecvp\fP() ignorowały wszystkie błędy
oprócz podanych powyżej oraz \fBENOMEM\fP i \fBE2BIG\fP, po których
powracały. Obecnie powracają także wtedy, gdy wystąpi dowolny błąd inny od
opisanych powyżej.
.SH BŁĘDY
.\" https://sourceware.org/bugzilla/show_bug.cgi?id=19534
.\"
Before glibc 2.24, \fBexecl\fP()  and \fBexecle\fP()  employed \fBrealloc\fP(3)
internally and were consequently not async\-signal\-safe, in violation of the
requirements of POSIX.1.  This was fixed in glibc 2.24.
.SS "Architecture\-specific details"
On sparc and sparc64, \fBexecv\fP()  is provided as a system call by the kernel
(with the prototype shown above)  for compatibility with SunOS.  This
function is \fInot\fP employed by the \fBexecv\fP()  wrapper function on those
architectures.
.SH "ZOBACZ TAKŻE"
\fBsh\fP(1), \fBexecve\fP(2), \fBexecveat\fP(2), \fBfork\fP(2), \fBptrace\fP(2),
\fBfexecve\fP(3), \fBsystem\fP(3), \fBenviron\fP(7)
.PP
.SH 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>
.
.PP
Niniejsze tłumaczenie jest wolną dokumentacją. Bliższe informacje o warunkach
licencji można uzyskać zapoznając się z
.UR https://www.gnu.org/licenses/gpl-3.0.html
GNU General Public License w wersji 3
.UE
lub nowszej. Nie przyjmuje się ŻADNEJ ODPOWIEDZIALNOŚCI.
.PP
Błędy w tłumaczeniu strony podręcznika prosimy zgłaszać na adres listy
dyskusyjnej
.MT manpages-pl-list@lists.sourceforge.net
.ME .