.\" -*- coding: UTF-8 -*- .\" Copyright (c) 1991 The Regents of the University of California. .\" All rights reserved. .\" .\" %%%LICENSE_START(BSD_4_CLAUSE_UCB) .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" %%%LICENSE_END .\" .\" @(#)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 .\" Added note on casting NULL .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH EXEC 3 "2 sierpnia 2019 r." GNU "Podręcznik programisty Linuksa" .SH NAZWA execl, execlp, execle, execv, execvp, execvpe \- uruchomienie pliku .SH SKŁADNIA .nf \fB#include \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[],\fP \fB char *const \fP\fIenvp\fP\fB[]);\fP .fi .PP .in -4n Wymagane ustawienia makr biblioteki glibc (patrz \fBfeature_test_macros\fP(7)): .in .PP \fBexecvpe\fP(): _GNU_SOURCE .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()" .PP 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()" .PP 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()" .PP The environment of the caller 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()" .PP 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 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). .TS allbox; lbw29 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 .SH "ZGODNE Z" 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) .SH "O STRONIE" Angielska wersja tej strony pochodzi z wydania 5.04 projektu Linux \fIman\-pages\fP. Opis projektu, informacje dotyczące zgłaszania błędów oraz najnowszą wersję oryginału można znaleźć pod adresem \%https://www.kernel.org/doc/man\-pages/. .SH TŁUMACZENIE Autorami polskiego tłumaczenia niniejszej strony podręcznika są: Adam Byrtek , Andrzej Krzysztofowicz , Robert Luberda i Michał Kułach . 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. Błędy w tłumaczeniu strony podręcznika prosimy zgłaszać na adres .MT manpages-pl-list@lists.sourceforge.net .ME .