.\" -*- coding: UTF-8 -*- .\" Copyright (c) 2000 Andries Brouwer .\" and Copyright (c) 2007 Michael Kerrisk .\" and Copyright (c) 2008, Linux Foundation, written by Michael Kerrisk .\" .\" based on work by Rik Faith .\" and Mike Battersby . .\" .\" SPDX-License-Identifier: Linux-man-pages-copyleft .\" .\" Modified 2004-11-19, mtk: .\" added pointer to sigaction.2 for details of ignoring SIGCHLD .\" 2007-06-03, mtk: strengthened portability warning, and rewrote .\" various sections. .\" 2008-07-11, mtk: rewrote and expanded portability discussion. .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH signal 2 "30. března 2023" "Linux man\-pages 6.05.01" .SH JMÉNO signal \- práce se signály v ANSI C .SH KNIHOVNA Standardní knihovna C (\fIlibc\fP, \fI\-lc\fP) .SH POUŽITÍ .nf \fB#include \fP .PP \fBtypedef void (*sighandler_t)(int);\fP .PP \fBsighandler_t signal(int \fP\fIsignum\fP\fB, sighandler_t \fP\fIhandler\fP\fB);\fP .fi .SH POPIS \fBWARNING\fP: the behavior of \fBsignal\fP() varies across UNIX versions, and has also varied historically across different versions of Linux. \fBAvoid its use\fP: use \fBsigaction\fP(2) instead. See \fIPortability\fP below. .PP Systémové volání \fBsignal\fP() instaluje novou obslužnou funkci pro signál s číslem \fIsignum\fP. Obsluha signálu je nastavena na \fIhandler\fP, což může být uživatelsky definovaná funkce nebo \fBSIG_IGN\fP případně \fBSIG_DFL\fP. .PP Pokud je signál \fIsignum\fP přijat procesem, stane se jedna z následujících věcí: .TP 3 * Je\-li nastaveno \fBSIG_IGN\fP signál je ignorován. .TP * If the disposition is set to \fBSIG_DFL\fP, then the default action associated with the signal (see \fBsignal\fP(7)) occurs. .TP * Pokud je dispozice nastavena na funkci, pak je nejdřív buď znovu nastavena dispozice na \fBSIG_DFL\fP nebo je signál blokován (viz \fIPřenositelnost\fP níže) a \fIobslužná funkce\fP je volána s parametrem \fIsignum\fP. Pokud volání funkce zablokovalo signál, je signál odblokován při návratu z obslužné funkce. .PP Signály \fBSIGKILL\fP a \fBSIGSTOP\fP nemohou být odchyceny nebo blokovány. .SH "NÁVRATOVÉ HODNOTY" \fBsignal\fP() returns the previous value of the signal handler. On failure, it returns \fBSIG_ERR\fP, and \fIerrno\fP is set to indicate the error. .SH "CHYBOVÉ STAVY" .TP \fBEINVAL\fP \fIsignum\fP je neplatný. .SH VERZE .\" libc4 and libc5 define .\" .IR SignalHandler ; The use of \fIsighandler_t\fP is a GNU extension, exposed if \fB_GNU_SOURCE\fP is defined; glibc also defines (the BSD\-derived) \fIsig_t\fP if \fB_BSD_SOURCE\fP (glibc 2.19 and earlier) or \fB_DEFAULT_SOURCE\fP (glibc 2.19 and later) is defined. Without use of such a type, the declaration of \fBsignal\fP() is the somewhat harder to read: .PP .in +4n .EX \fBvoid ( *\fP\fIsignal\fP\fB(int \fP\fIsignum\fP\fB, void (*\fP\fIhandler\fP\fB)(int)) ) (int);\fP .EE .in .SS Přenositelnost Jediné přenositelné použití funkce \fBsignal\fP() je nastavit obsluhu signálu na \fBSIG_DFL\fP nebo \fBSIG_IGN\fP. Sémantika použití \fBsignal\fP() na nastavení obsluhy signálu se liší na různých systémech (a POSIX.1 tot explicitně podporuje). \fBProto jej nepoužívejte za tímto účelem.\fP .PP POSIX.1 vyřešil tento nesoulad v přenositelnosti zavedením \fBsigaction\fP(2), který poskytuje explicitní kontrolu sémantiky v případě vyvolání obsluhy signálu. Používejte jej proto místo \fBsignal\fP()u. .SH STANDARDY C11, POSIX.1\-2008. .SH HISTORIE C89, POSIX.1\-2001. .PP In the original UNIX systems, when a handler that was established using \fBsignal\fP() was invoked by the delivery of a signal, the disposition of the signal would be reset to \fBSIG_DFL\fP, and the system did not block delivery of further instances of the signal. This is equivalent to calling \fBsigaction\fP(2) with the following flags: .PP .in +4n .EX sa.sa_flags = SA_RESETHAND | SA_NODEFER; .EE .in .PP System\ V also provides these semantics for \fBsignal\fP(). This was bad because the signal might be delivered again before the handler had a chance to reestablish itself. Furthermore, rapid deliveries of the same signal could result in recursive invocations of the handler. .PP BSD improved on this situation, but unfortunately also changed the semantics of the existing \fBsignal\fP() interface while doing so. On BSD, when a signal handler is invoked, the signal disposition is not reset, and further instances of the signal are blocked from being delivered while the handler is executing. Furthermore, certain blocking system calls are automatically restarted if interrupted by a signal handler (see \fBsignal\fP(7)). The BSD semantics are equivalent to calling \fBsigaction\fP(2) with the following flags: .PP .in +4n .EX sa.sa_flags = SA_RESTART; .EE .in .PP Situace na Linuxu je následující: .IP \[bu] 3 Systémové volání jádra \fBsignal\fP() poskytuje System V\ sémantiku. .IP \[bu] .\" .\" System V semantics are also provided if one uses the separate .\" .BR sysv_signal (3) .\" function. .\" .IP * .\" The .\" .BR signal () .\" function in Linux libc4 and libc5 provide System\ V semantics. .\" If one on a libc5 system includes .\" .I .\" instead of .\" .IR , .\" then .\" .BR signal () .\" provides BSD semantics. By default, in glibc 2 and later, the \fBsignal\fP() wrapper function does not invoke the kernel system call. Instead, it calls \fBsigaction\fP(2) using flags that supply BSD semantics. This default behavior is provided as long as a suitable feature test macro is defined: \fB_BSD_SOURCE\fP on glibc 2.19 and earlier or \fB_DEFAULT_SOURCE\fP in glibc 2.19 and later. (By default, these macros are defined; see \fBfeature_test_macros\fP(7) for details.) If such a feature test macro is not defined, then \fBsignal\fP() provides System\ V semantics. .SH POZNÁMKY Efekt funkce \fBsignal\fP() v procesech s vlákny nejsou specifikovány. .PP Dle specifikace POSIX je chování systému nespecifikováno, pokud ignoruje \fBSIGFPE\fP, \fBSIGILL\fP nebo \fBSIGSEGV\fP signál pokud nebyl vyvolán pomocí \fBkill\fP(2) nebo \fBraise\fP(3). Celočíselné dělení nulou má nedefinovaný výsledek. Na některých architekturách se generuje \fBSIGFRE\fP signál. (Také dělení největšího záporného celého čísla \-1 generuje \fBSIGFRE\fP). Ignorování tohoto signálu může vést k nekonečné smyčce. .PP See \fBsigaction\fP(2) for details on what happens when the disposition \fBSIGCHLD\fP is set to \fBSIG_IGN\fP. .PP Viz \fBsignal\-safety\fP(7) pro seznam asynchronních bezpečných funkcí, které mohou být bezpečně volány uvnitř funkce pro obsluhu signálu. .SH "DALŠÍ INFORMACE" \fBkill\fP(1), \fBalarm\fP(2), \fBkill\fP(2), \fBpause\fP(2), \fBsigaction\fP(2), \fBsignalfd\fP(2), \fBsigpending\fP(2), \fBsigprocmask\fP(2), \fBsigsuspend\fP(2), \fBbsd_signal\fP(3), \fBkillpg\fP(3), \fBraise\fP(3), \fBsiginterrupt\fP(3), \fBsigqueue\fP(3), \fBsigsetops\fP(3), \fBsigvec\fP(3), \fBsysv_signal\fP(3), \fBsignal\fP(7) .PP .SH PŘEKLAD Překlad této příručky do španělštiny vytvořili Marek Kubita a Pavel Heimlich . .PP Tento překlad je bezplatná dokumentace; Přečtěte si .UR https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3 .UE nebo novější ohledně podmínek autorských práv. Neexistuje ŽÁDNÁ ODPOVĚDNOST. .PP Pokud narazíte na nějaké chyby v překladu této příručky, pošlete e-mail na adresu .MT translation-team-cs@lists.sourceforge.net .ME .