Man page - signal(7)
Packages contains this manual
- shm_overview(7)
- nss(5)
- proc_mtrr(5)
- intro(7)
- tcp(7)
- iso_8859-9(7)
- armscii-8(7)
- proc_kpagecount(5)
- initrd(4)
- mouse(4)
- proc_stat(5)
- x25(7)
- proc_interrupts(5)
- fifo(7)
- repertoiremap(5)
- icmp(7)
- futex(7)
- feature_test_macros(7)
- lp(4)
- bpf-helpers(7)
- epoll(7)
- proc_sys_dev(5)
- namespaces(7)
- proc_sysrq-trigger(5)
- proc_bus(5)
- cp1251(7)
- proc_pid_maps(5)
- proc_sys_vm(5)
- proc_pid_projid_map(5)
- st(4)
- proc_pid(5)
- issue(5)
- pid_namespaces(7)
- unicode(7)
- inode(7)
- hosts.equiv(5)
- iso-8859-13(7)
- proc_fb(5)
- proc_modules(5)
- proc_pid_autogroup(5)
- keyrings(7)
- sysvipc(7)
- proc_kmsg(5)
- cgroups(7)
- latin6(7)
- proc_pid_uid_map(5)
- unix(7)
- proc_pid_io(5)
- pts(4)
- packet(7)
- ld-linux.so(8)
- tzselect(8)
- iconv(1)
- proc_pid_syscall(5)
- proc_pid_net(5)
- proc_pid_pagemap(5)
- tty(4)
- proc_profile(5)
- standards(7)
- proc_pid_mounts(5)
- filesystems(5)
- iso-8859-15(7)
- locale(5)
- iso_8859_3(7)
- xattr(7)
- iso-8859-2(7)
- proc_uptime(5)
- persistent-keyring(7)
- credentials(7)
- proc_pid_timers(5)
- utmpx(5)
- vcsa(4)
- proc_pid_exe(5)
- proc_net(5)
- proc_timer_stats(5)
- ip(7)
- proc_pid_fd(5)
- ptmx(4)
- user_namespaces(7)
- resolv.conf(5)
- url(7)
- iso_8859_5(7)
- iso_8859-8(7)
- urn(7)
- process-keyring(7)
- proc_pid_auxv(5)
- proc_ksyms(5)
- proc_ide(5)
- veth(4)
- ldd(1)
- proc_swaps(5)
- landlock(7)
- proc_vmstat(5)
- system_data_types(7)
- cp1252(7)
- lirc(4)
- proc_kpageflags(5)
- random(7)
- precedence(7)
- cpuset(7)
- proc_pid_ns(5)
- acct(5)
- latin4(7)
- proc_pid_cgroup(5)
- proc_cpuinfo(5)
- iso_8859-2(7)
- proc_keys(5)
- charsets(7)
- pldd(1)
- proc_pid_stat(5)
- rtnetlink(7)
- netlink(7)
- ram(4)
- mem(4)
- iso-8859-6(7)
- proc_key-users(5)
- iso_8859_15(7)
- fanotify(7)
- proc_sys_net(5)
- sysfs(5)
- math_error(7)
- latin1(7)
- proc_pid_root(5)
- nptl(7)
- proc_cgroups(5)
- proc_iomem(5)
- proc_pid_statm(5)
- sem_overview(7)
- hier(7)
- full(4)
- proc_pid_status(5)
- proc_pid_cwd(5)
- proc_pid_cpuset(5)
- proc_scsi(5)
- uri(7)
- proc_diskstats(5)
- iso_8859_6(7)
- latin2(7)
- latin5(7)
- man-pages(7)
- ld.so(8)
- uts_namespaces(7)
- proc_pid_mountstats(5)
- intro(3)
- proc_pid_seccomp(5)
- proc_pid_wchan(5)
- attributes(7)
- symlink(7)
- mount_namespaces(7)
- charmap(5)
- tis-620(7)
- iso-8859-10(7)
- getent(1)
- proc_buddyinfo(5)
- ttytype(5)
- rtc(4)
- proc_malloc(5)
- suffixes(7)
- sln(8)
- signal(7)
- proc_sys_abi(5)
- signal-safety(7)
- time_namespaces(7)
- proc_pid_comm(5)
- raw(7)
- gai.conf(5)
- proc_crypto(5)
- locale(1)
- iso-8859-3(7)
- motd(5)
- proc_meminfo(5)
- iso-8859-8(7)
- protocols(5)
- proc_pid_map_files(5)
- pthreads(7)
- null(4)
- proc(5)
- zdump(8)
- socket(7)
- proc_sys_kernel(5)
- ddp(7)
- memusagestat(1)
- hd(4)
- iso-8859-14(7)
- shells(5)
- pipe(7)
- glob(7)
- proc_self(5)
- network_namespaces(7)
- utmp(5)
- proc_kcore(5)
- nsswitch.conf(5)
- sd(4)
- iso-8859-5(7)
- iso_8859_16(7)
- man(7)
- iso_8859-6(7)
- dir_colors(5)
- mq_overview(7)
- vsock(7)
- ascii(7)
- thread-keyring(7)
- fs(5)
- proc_pid_attr(5)
- proc_sys_debug(5)
- proc_sys(5)
- proc_pid_cmdline(5)
- pty(7)
- services(5)
- cgroup_namespaces(7)
- securetty(5)
- netdevice(7)
- iso_8859_13(7)
- host.conf(5)
- proc_pid_setgroups(5)
- proc_slabinfo(5)
- sock_diag(7)
- iso_8859-14(7)
- iso-8859-11(7)
- iso_8859_11(7)
- operator(7)
- regex(7)
- wavelan(4)
- proc_sys_fs(5)
- nologin(5)
- proc_pci(5)
- koi8-r(7)
- erofs(5)
- intro(2)
- utf8(7)
- proc_kallsyms(5)
- proc_sysvipc(5)
- queue(7)
- proc_sys_sunrpc(5)
- intro(5)
- latin8(7)
- mtrace(1)
- ipc_namespaces(7)
- dsp56k(4)
- iso_8859_4(7)
- proc_pid_smaps(5)
- proc_cmdline(5)
- rpc(5)
- proc_tty(5)
- proc_version(5)
- smartpqi(4)
- proc_pid_timerslack_ns(5)
- aio(7)
- session-keyring(7)
- resolver(5)
- slabinfo(5)
- wtmp(5)
- iso_8859_9(7)
- proc_locks(5)
- mailaddr(7)
- proc_pid_oom_score(5)
- kmem(4)
- iconvconfig(8)
- iso_8859-7(7)
- glibc(7)
- hostname(7)
- proc_thread-self(5)
- ipv6(7)
- iso_8859_7(7)
- proc_kpagecgroup(5)
- core(5)
- time(7)
- units(7)
- proc_dma(5)
- loop(4)
- address_families(7)
- zero(4)
- intro(4)
- procfs(5)
- iso_8859-4(7)
- vdso(7)
- tmpfs(5)
- iso-8859-16(7)
- iso_8859_10(7)
- user-session-keyring(7)
- libc(7)
- proc_fs(5)
- koi8-u(7)
- latin3(7)
- proc_tid_children(5)
- proc_pid_limits(5)
- proc_pid_coredump_filter(5)
- iso_8859-15(7)
- arp(7)
- urandom(4)
- iso_8859-10(7)
- hpsa(4)
- proc_pid_environ(5)
- boot(7)
- ftm(7)
- ld-linux(8)
- proc_driver(5)
- loop-control(4)
- iso_8859-16(7)
- proc_filesystems(5)
- tzfile(5)
- sprof(1)
- proc_pid_task(5)
- proc_pid_oom_score_adj(5)
- proc_mounts(5)
- iso-8859-4(7)
- iso_8859-1(7)
- utf-8(7)
- iso_8859-13(7)
- intro(6)
- proc_timer_list(5)
- rtld-audit(7)
- iso_8859-3(7)
- group(5)
- sched(7)
- proc_pid_clear_refs(5)
- hosts(5)
- iso_8859-11(7)
- numa(7)
- iso_8859_2(7)
- locale(7)
- iso-8859-1(7)
- fuse(4)
- proc_tid(5)
- proc_execdomains(5)
- proc_pid_mountinfo(5)
- intro(8)
- iso_8859_8(7)
- proc_loadavg(5)
- proc_pid_oom_adj(5)
- re_format(7)
- iso_8859_14(7)
- zic(8)
- bootparam(7)
- inotify(7)
- posixoptions(7)
- proc_partitions(5)
- iso-8859-9(7)
- proc_pid_mem(5)
- networks(5)
- proc_sys_user(5)
- udp(7)
- proc_zoneinfo(5)
- latin10(7)
- proc_pid_fdinfo(5)
- proc_pid_stack(5)
- memusage(1)
- spufs(7)
- pkeys(7)
- path_resolution(7)
- proc_ioports(5)
- intro(1)
- ldconfig(8)
- msr(4)
- svipc(7)
- port(4)
- proc_pid_personality(5)
- cciss(4)
- latin9(7)
- capabilities(7)
- localedef(1)
- vcs(4)
- iso_8859-5(7)
- elf(5)
- proc_sys_proc(5)
- console_codes(4)
- random(4)
- iso-8859-7(7)
- termcap(5)
- cpuid(4)
- environ(7)
- string_copying(7)
- proc_pid_gid_map(5)
- queue(3)
- termio(7)
- user-keyring(7)
- complex(7)
- latin7(7)
- proc_config.gz(5)
- udplite(7)
- kernel_lockdown(7)
- proc_devices(5)
- proc_apm(5)
- iso_8859_1(7)
- proc_pid_numa_maps(5)
apt-get install manpages
Available languages:
en fr it pl cs ja ru zh_TW zh_CN deManual
signĂĄl
JMĂNOPOPIS
Dispozice signĂĄlĹŻ
Sending a signal
Waiting for a signal to be caught
Synchronously accepting a signal
Signal mask and pending signals
Execution of signal handlers
StandardnĂ SignĂĄly
Queueing and delivery semantics for standard signals
Signal numbering for standard signals
Real-time signĂĄly
PĹeruĹĄenĂ systĂŠmovĂ˝ch volĂĄnĂ a funkcĂ knihoven prostĹednictvĂm "signalhandlers"
PĹeruĹĄenĂ systĂŠmovĂĄch volĂĄnĂ a funkcĂ knihoven signĂĄly Stop
STANDARDY
POZNĂMKY
CHYBY
DALĹ Ă INFORMACE
PĹEKLAD
JMĂNO
signal - overview of signals
POPIS
V Linuxu jsou podporovĂĄny jak POSIX reliable signĂĄly (dĂĄle jen "standardnĂ signĂĄly"), tak POSIX real-time signĂĄly.
Dispozice signĂĄlĹŻ
KaĹždĂ˝ signĂĄl mĂĄ dispozici , kterĂĄ urÄuje, jak se proces zachovĂĄ pĹi jeho pĹijetĂ.
Ădaje ve sloupci "Akce" nĂĹže uvedenĂ˝ch tabulek urÄujĂ vĂ˝chozĂ dipozici kaĹždĂŠho signĂĄlu nĂĄsledujĂcnÄ:
|
Term |
VĂ˝chozĂ akcĂ je ukonÄenĂ procesu. |
||
|
Ign |
Výchozà akcà je ignorovånà signålu. |
||
|
Core |
VĂ˝chozĂ akcĂ je ukonÄenĂ procesu a vĂ˝pis pamÄti (core dump) (viz core (5)). |
||
|
Stop |
Výchozà akcà je zastavenà procesu. |
||
|
Cont |
VĂ˝chozĂ akcĂ je pokraÄovĂĄnĂ procesu, pokud je momentĂĄlnÄ zastavenĂ˝. |
A process can change the disposition of a signal using sigaction (2) or signal (2). (The latter is less portable when establishing a signal handler; see signal (2) for details.) Using these system calls, a process can elect one of the following behaviors to occur on delivery of the signal: perform the default action; ignore the signal; or catch the signal with a signal handler , a programmer-defined function that is automatically invoked when the signal is delivered.
By default, a signal handler is invoked on the normal process stack. It is possible to arrange that the signal handler uses an alternate stack; see sigaltstack (2) for a discussion of how to do this and when it might be useful.
Dispozice signĂĄlu je atribut procesu: v mnohovlĂĄknovĂ˝ch aplikacĂch je dispozice urÄitĂŠho signĂĄlu stejnĂĄ pro vĹĄechna vlĂĄkna.
A child created via fork (2) inherits a copy of its parentâs signal dispositions. During an execve (2), the dispositions of handled signals are reset to the default; the dispositions of ignored signals are left unchanged.
Sending a signal
The following
system calls and library functions allow the caller to send
a signal:
raise
(3)
Sends a signal to the calling thread.
kill (2)
Sends a signal to a specified process, to all members of a specified process group, or to all processes on the system.
pidfd_send_signal (2)
Sends a signal to a process identified by a PID file descriptor.
killpg (3)
Sends a signal to all of the members of a specified process group.
pthread_kill (3)
Sends a signal to a specified POSIX thread in the same process as the caller.
tgkill (2)
Sends a signal to a specified thread within a specific process. (This is the system call used to implement pthread_kill (3).)
sigqueue (3)
Sends a real-time signal with accompanying data to a specified process.
Waiting for a signal to be caught
The following
system calls suspend execution of the calling thread until a
signal is caught (or an unhandled signal terminates the
process):
pause
(2)
Suspends execution until any signal is caught.
sigsuspend (2)
Temporarily changes the signal mask (see below) and suspends execution until one of the unmasked signals is caught.
Synchronously accepting a signal
Rather than asynchronously catching a signal via a signal handler, it is possible to synchronously accept the signal, that is, to block execution until the signal is delivered, at which point the kernel returns information about the signal to the caller. There are two general ways to do this:
|
⢠|
sigwaitinfo (2), sigtimedwait (2), and sigwait (3) suspend execution until one of the signals in a specified set is delivered. Each of these calls returns information about the delivered signal. |
||
|
⢠|
signalfd (2) returns a file descriptor that can be used to read information about signals that are delivered to the caller. Each read (2) from this file descriptor blocks until one of the signals in the set specified in the signalfd (2) call is delivered to the caller. The buffer returned by read (2) contains a structure describing the signal. |
Signal mask and pending signals
A signal may be blocked , which means that it will not be delivered until it is later unblocked. Between the time when it is generated and when it is delivered a signal is said to be pending .
Each thread in a process has an independent signal mask , which indicates the set of signals that the thread is currently blocking. A thread can manipulate its signal mask using pthread_sigmask (3). In a traditional single-threaded application, sigprocmask (2) can be used to manipulate the signal mask.
A child created via fork (2) inherits a copy of its parentâs signal mask; the signal mask is preserved across execve (2).
A signal may be process-directed or thread-directed. A process-directed signal is one that is targeted at (and thus pending for) the process as a whole. A signal may be process-directed because it was generated by the kernel for reasons other than a hardware exception, or because it was sent using kill (2) or sigqueue (3). A thread-directed signal is one that is targeted at a specific thread. A signal may be thread-directed because it was generated as a consequence of executing a specific machine-language instruction that triggered a hardware exception (e.g., SIGSEGV for an invalid memory access, or SIGFPE for a math error), or because it was targeted at a specific thread using interfaces such as tgkill (2) or pthread_kill (3).
A process-directed signal may be delivered to any one of the threads that does not currently have the signal blocked. If more than one of the threads has the signal unblocked, then the kernel chooses an arbitrary thread to which to deliver the signal.
A thread can obtain the set of signals that it currently has pending using sigpending (2). This set will consist of the union of the set of pending process-directed signals and the set of signals pending for the calling thread.
A child created via fork (2) initially has an empty pending signal set; the pending signal set is preserved across an execve (2).
Execution of signal handlers
Whenever there is a transition from kernel-mode to user-mode execution (e.g., on return from a system call or scheduling of a thread onto the CPU), the kernel checks whether there is a pending unblocked signal for which the process has established a signal handler. If there is such a pending signal, the following steps occur:
|
(1) |
The kernel performs the necessary preparatory steps for execution of the signal handler: |
(1.1)
|
The signal is removed from the set of pending signals. |
|||
|
(1.2) |
If the signal handler was installed by a call to sigaction (2) that specified the SA_ONSTACK flag and the thread has defined an alternate signal stack (using sigaltstack (2)), then that stack is installed. |
||
|
(1.3) |
Various pieces of signal-related context are saved into a special frame that is created on the stack. The saved information includes: |
â˘
|
the program counter register (i.e., the address of the next instruction in the main program that should be executed when the signal handler returns); |
|||
|
⢠|
architecture-specific register state required for resuming the interrupted program; |
||
|
⢠|
the threadâs current signal mask; |
||
|
⢠|
the threadâs alternate signal stack settings. |
If the signal handler was installed using the sigaction (2) SA_SIGINFO flag, then the above information is accessible via the ucontext_t object that is pointed to by the third argument of the signal handler. This object reflects the state at which the signal is delivered, rather than in the handler; for example, the mask of blocked signals stored in this object will not contain the mask of new signals blocked through sigaction (2).
|
(1.4) |
Any signals specified in act->sa_mask when registering the handler with sigaction (2) are added to the threadâs signal mask. The signal being delivered is also added to the signal mask, unless SA_NODEFER was specified when registering the handler. These signals are thus blocked while the handler executes. |
||
|
(2) |
The kernel constructs a frame for the signal handler on the stack. The kernel sets the program counter for the thread to point to the first instruction of the signal handler function, and configures the return address for that function to point to a piece of user-space code known as the signal trampoline (described in sigreturn (2)).
|
(3) |
The kernel passes control back to user-space, where execution commences at the start of the signal handler function. |
||
|
(4) |
When the signal handler returns, control passes to the signal trampoline code. |
||
|
(5) |
The signal trampoline calls sigreturn (2), a system call that uses the information in the stack frame created in step 1 to restore the thread to its state before the signal handler was called. The threadâs signal mask and alternate signal stack settings are restored as part of this procedure. Upon completion of the call to sigreturn (2), the kernel transfers control back to user space, and the thread recommences execution at the point where it was interrupted by the signal handler. |
Note that if the signal handler does not return (e.g., control is transferred out of the handler using siglongjmp (3), or the handler executes a new program with execve (2)), then the final step is not performed. In particular, in such scenarios it is the programmerâs responsibility to restore the state of the signal mask (using sigprocmask (2)), if it is desired to unblock the signals that were blocked on entry to the signal handler. (Note that siglongjmp (3) may or may not restore the signal mask, depending on the savesigs value that was specified in the corresponding call to sigsetjmp (3).)
From the kernelâs point of view, execution of the signal handler code is exactly the same as the execution of any other user-space code. That is to say, the kernel does not record any special state information indicating that the thread is currently executing inside a signal handler. All necessary state information is maintained in user-space registers and the user-space stack. The depth to which nested signal handlers may be invoked is thus limited only by the user-space stack (and sensible software design!).
StandardnĂ SignĂĄly
Linux supports the standard signals listed below. The second column of the table indicates which standard (if any) specified the signal: "P1990" indicates that the signal is described in the original POSIX.1-1990 standard; "P2001" indicates that the signal was added in SUSv2 and POSIX.1-2001.
Signåly SIGKILL a SIGSTOP nemohou být zachyceny, blokovåny ani ignorovåny.
AĹž po Linux 2.2 vÄetnÄ bylo vĂ˝chozĂ chovĂĄnĂ pro SIGSYS , SIGXCPU , SIGXFSZ , a (na architekturĂĄch jinĂ˝ch neĹž SPARC a MIPS) SIGBUS ukonÄit proces (bez core dump). (Na nÄkterĂ˝ch jinĂ˝ch UNIXovĂ˝ch systĂŠmech bylo vĂ˝chozĂ akcĂ pro SIGXCPU a SIGXFSZ ukonÄenĂ procesu bez core dump.) Linux 2.4 splĹuje poĹžadavky POSIX.1-2001 pro tyto signĂĄly, ukonÄuje procesy s core dump.
SIGEMT nenĂ specifikovĂĄn v POSIX.1-2001, ale stejnÄ je pĹĂtomen na vÄtĹĄinÄ ostatnĂch UNIXovĂ˝ch systĂŠmĹŻ, kde je vĂ˝chozĂ akcĂ obvykle ukonÄenĂ procesu s core dump.
SIGPWR (nenĂ specifikovĂĄn v POSIX.1-2001) na vÄtĹĄinÄ ostatnĂch UNIXovĂ˝ch systĂŠmĹŻ, kde se objevuje, je obvykle ignorovĂĄn.
SIGIO (nenĂ specifikovĂĄn v POSIX.1-2001) na nÄkterĂ˝ch dalĹĄĂch UNIXech je jako vĂ˝chozĂ ignorovĂĄn.
Queueing and delivery semantics for standard signals
If multiple standard signals are pending for a process, the order in which the signals are delivered is unspecified.
Standard signals do not queue. If multiple instances of a standard signal are generated while that signal is blocked, then only one instance of the signal is marked as pending (and the signal will be delivered just once when it is unblocked). In the case where a standard signal is already pending, the siginfo_t structure (see sigaction (2)) associated with that signal is not overwritten on arrival of subsequent instances of the same signal. Thus, the process will receive the information associated with the first instance of the signal.
Signal numbering for standard signals
The numeric value for each signal is given in the table below. As shown in the table, many signals have different numeric values on different architectures. The first numeric value in each table row shows the signal number on x86, ARM, and most other architectures; the second value is for Alpha and SPARC; the third is for MIPS; and the last is for PARISC. A dash (-) denotes that a signal is absent on the corresponding architecture.
Note the following:
|
⢠|
Where defined, SIGUNUSED is synonymous with SIGSYS . Since glibc 2.26, SIGUNUSED is no longer defined on any architecture. |
||
|
⢠|
Signal 29 is SIGINFO / SIGPWR (synonyms for the same value) on Alpha but SIGLOST on SPARC. |
Real-time signĂĄly
Starting with Linux 2.2, Linux supports real-time signals as originally defined in the POSIX.1b real-time extensions (and now included in POSIX.1-2001). The range of supported real-time signals is defined by the macros SIGRTMIN and SIGRTMAX . POSIX.1-2001 requires that an implementation support at least _POSIX_RTSIG_MAX (8) real-time signals.
Linux podporuje 33 rĹŻznĂ˝ch real-time signĂĄlĹŻ oÄĂslovanĂ˝ch 32 aĹž 64. NicmĂŠnÄ implementace POSIX threads v glibc pouĹžĂvĂĄ internÄ dva (pro NPTL) nebo tĹi (pro LinuxThreads) real-time signĂĄly (viz pthreads (7)), a podle toho upravuje hodnotu SIGRTMIN (na 34 nebo 35). protoĹže rozsah dostupnĂ˝ch real-time signĂĄlĹŻ se liĹĄĂ v zĂĄvislosti na implementaci vlĂĄken v glibc (mĹŻĹže se mÄnit za bÄhu v zĂĄvislosti na jĂĄdĹe a glibc) a navĂc rozsah real-time signĂĄlĹŻ se mezi UNIXovĂ˝mi systĂŠmy liĹĄĂ, programy by nikdy nemÄly odkazovat na real-time signĂĄly pevnÄ danĂ˝mi ÄĂsly , mĂsto toho by mÄly pouĹžĂvat notaci SIGRTMIN +n, a za bÄhu kontrolovat, zda SIGRTMIN +n nepĹesahuje SIGRTMAX .
Na rozdĂl od standardnĂch signĂĄlĹŻ nemajĂ real-time signĂĄly stanovenĂ˝ vĂ˝znam: CelĂĄ sada real-time signĂĄlĹŻ mĹŻĹže bĂ˝t pouĹžita pro ĂşÄely definovanĂŠ aplikacĂ.
VĂ˝chozĂ akcĂ pro nezpracovanĂ˝ real-time signĂĄl je ukonÄenĂ procesu, kterĂ˝ jej pĹijal.
Real-time signĂĄly se liĹĄĂ nĂĄsledujĂcnÄ:
|
⢠|
VĂcero instancĂ real-time signĂĄlĹŻ mĹŻĹže bĂ˝t zaĹazeno do fronty. Naopak pokud je doruÄeno vĂcero instancĂ standardnĂho signĂĄlu, zatĂmco je signĂĄl blokovĂĄn, je do fronty zaĹazen jen jeden. |
||
|
⢠|
Pokud je signĂĄl poslĂĄn pomocĂ sigqueue (3), mĹŻĹže s nĂm bĂ˝t poslĂĄna doprovodnĂĄ hodnota (integer nebo pointer). Pokud pĹijĂmacĂ proces vytvoĹĂ pro tento signĂĄl handler pomocĂ vlajky SA_SIGINFO pro sigaction (2), tak mĹŻĹže tato data zĂskat v poli si_value struktury siginfo_t pĹedanĂŠ jako druhĂ˝ argument handleru. NavĂc mohou bĂ˝t pole si_pid a si_uid tĂŠto struktury pouĹžita k zĂskĂĄnĂ PID a real user ID procesu, kterĂ˝ signĂĄl poslal. |
||
|
⢠|
Real-time signĂĄly jsou doruÄeny v zaruÄenĂŠm poĹadĂ. VĂcero real-time signĂĄlĹŻ stejnĂŠho typu je doruÄeno v poĹadĂ, v jakĂŠm byly vyslĂĄny. Pokud jsou procesu poslĂĄny rĹŻznĂŠ real-time signĂĄly, jsou doruÄeny v poĹadĂ podle ÄĂsla, zaÄĂnajĂc nejniŞťĂm (tj. signĂĄly s nĂzkĂ˝m ÄĂslem majĂ vyĹĄĹĄĂ prioritu). Naopak, pokud na proces ÄekĂĄ vĂcero standardnĂch signĂĄlĹŻ, nenĂ poĹadĂ jejich doruÄenĂ definovĂĄno. |
Pokud mĂĄ proces nevyĹĂzenĂŠ zĂĄroveĹ real-time a standardnĂ signĂĄly, POSIX neurÄuje, kterĂŠ majĂ bĂ˝t doruÄeny jako prvnĂ. Linux, stejnÄ jako mnoho jinĂ˝ch implementacĂ, v takovĂŠm pĹĂpadÄ upĹednostĹĂ standardnĂ signĂĄly.
According to POSIX, an implementation should permit at least _POSIX_SIGQUEUE_MAX (32) real-time signals to be queued to a process. However, Linux does things differently. Up to and including Linux 2.6.7, Linux imposes a system-wide limit on the number of queued real-time signals for all processes. This limit can be viewed and (with privilege) changed via the /proc/sys/kernel/rtsig-max file. A related file, /proc/sys/kernel/rtsig-nr , can be used to find out how many real-time signals are currently queued. In Linux 2.6.8, these /proc interfaces were replaced by the RLIMIT_SIGPENDING resource limit, which specifies a per-user limit for queued signals; see setrlimit (2) for further details.
The addition of real-time signals required the widening of the signal set structure ( sigset_t ) from 32 to 64 bits. Consequently, various system calls were superseded by new system calls that supported the larger signal sets. The old and new system calls are as follows:
PĹeruĹĄenĂ systĂŠmovĂ˝ch volĂĄnĂ a funkcĂ knihoven prostĹednictvĂm "signalhandlers"
Pokud je signal handler vyvolĂĄn v okamĹžiku, kdy je systĂŠmovĂŠ volĂĄnĂ nebo funkce knihovny blokovĂĄna, pak:
|
⢠|
je volĂĄnĂ automaticky restartovĂĄno po nĂĄvratu signal handleru, nebo |
|||
|
⢠|
volĂĄnĂ selĹže s chybou EINTR . |
KterĂĄ z tÄchto moĹžnostĂ nastane, zĂĄleŞà na rozhranĂ a na tom, zda byl signal handler definovĂĄn s pomocĂ vlajky SA_RESTART (viz sigaction (2)). Podrobnosti se mezi UNIXovĂ˝mi systĂŠmy liĹĄĂ; dĂĄle jsou uvedeny pro Linux.
If a blocked call to one of the following interfaces is interrupted by a signal handler, then the call is automatically restarted after the signal handler returns if the SA_RESTART flag was used; otherwise the call fails with the error EINTR :
|
⢠|
read (2), readv (2), write (2), writev (2), and ioctl (2) calls on "slow" devices. A "slow" device is one where the I/O call may block for an indefinite time, for example, a terminal, pipe, or socket. If an I/O call on a slow device has already transferred some data by the time it is interrupted by a signal handler, then the call will return a success status (normally, the number of bytes transferred). Note that a (local) disk is not a slow device according to this definition; I/O operations on disk devices are not interrupted by signals. |
||
|
⢠|
open (2), v pĹĂpadÄ, Ĺže mĹŻĹže blokovat (napĹ. pĹi otevĂrĂĄnĂ FIFO; viz fifo (7)). |
||
|
⢠|
wait (2), wait3 (2), wait4 (2), waitid (2) a waitpid (2). |
||
|
⢠|
Socket interfaces: accept (2), connect (2), recv (2), recvfrom (2), recvmmsg (2), recvmsg (2), send (2), sendto (2), and sendmsg (2), unless a timeout has been set on the socket (see below). |
||
|
⢠|
File locking interfaces: flock (2) and the F_SETLKW and F_OFD_SETLKW operations of fcntl (2) |
||
|
⢠|
RozhranĂ pro POSIXovĂŠ fronty zprĂĄv: mq_receive (3), mq_timedreceive (3), mq_send (3) a mq_timedsend (3). |
||
|
⢠|
futex (2) FUTEX_WAIT (od jĂĄdra 2.6.22; pĹedtĂm vĹždycky selhalo s EINTR ). |
||
|
⢠|
getrandom (2). |
||
|
⢠|
pthread_mutex_lock (3), pthread_cond_wait (3), and related APIs. |
||
|
⢠|
futex (2) FUTEX_WAIT_BITSET . |
||
|
⢠|
RozhranĂ POSIXovĂ˝ch semaforĹŻ: sem_wait (3) a sem_timedwait (3) (od jĂĄdra 2.6.22; pĹedtĂm vĹždycky selhalo s EINTR ). |
||
|
⢠|
read (2) from an inotify (7) file descriptor (since Linux 3.8; beforehand, always failed with EINTR ). |
The following interfaces are never restarted after being interrupted by a signal handler, regardless of the use of SA_RESTART ; they always fail with the error EINTR when interrupted by a signal handler:
|
⢠|
"Input" socket interfaces, when a timeout ( SO_RCVTIMEO ) has been set on the socket using setsockopt (2): accept (2), recv (2), recvfrom (2), recvmmsg (2) (also with a non-NULL timeout argument), and recvmsg (2). |
||
|
⢠|
"Output" socket interfaces, when a timeout ( SO_RCVTIMEO ) has been set on the socket using setsockopt (2): connect (2), send (2), sendto (2), and sendmsg (2). |
||
|
⢠|
Interfaces used to wait for signals: pause (2), sigsuspend (2), sigtimedwait (2), and sigwaitinfo (2). |
||
|
⢠|
MultiplexujĂcĂ rozhranĂ popisovaÄĹŻ souborĹŻ: epoll_wait (2), epoll_pwait (2), poll (2), ppoll (2), select (2) a pselect (2). |
||
|
⢠|
System V IPC rozhranĂ: msgrcv (2), msgsnd (2), semop (2) a semtimedop (2). |
||
|
⢠|
RozhranĂ pro spĂĄnek: clock_nanosleep (2), nanosleep (2) a usleep (3). |
||
|
⢠|
io_getevents (2). |
Funkce sleep (3) se takĂŠ pĹi pĹeruĹĄenĂ signal handlerem nerestartuje, nĂ˝brĹž vrĂĄtĂ ĂşspÄch: poÄet sekund, kterĂŠ zbĂ˝vajĂ ke spanĂ.
In certain circumstances, the seccomp (2) user-space notification feature can lead to restarting of system calls that would otherwise never be restarted by SA_RESTART ; for details, see seccomp_unotify (2).
PĹeruĹĄenĂ systĂŠmovĂĄch volĂĄnĂ a funkcĂ knihoven signĂĄly Stop
V Linuxu mohou nÄkterĂĄ blokujĂcĂ rozhranĂ selhat s chybou EINTR i bez signal handlerĹŻ, pokud je proces zastaven jednĂm ze stop signĂĄlĹŻ a potĂŠ obnoven pomocĂ SIGCONT . Toto chovĂĄnĂ neodporuje POSIX.1 a neobjevuje se v jinĂ˝ch systĂŠmech.
LinuxovĂĄ rozhranĂ, v nichĹž se toto chovĂĄnĂ projevuje, jsou:
|
⢠|
"Input" socket interfaces, when a timeout ( SO_RCVTIMEO ) has been set on the socket using setsockopt (2): accept (2), recv (2), recvfrom (2), recvmmsg (2) (also with a non-NULL timeout argument), and recvmsg (2). |
||
|
⢠|
"Output" socket interfaces, when a timeout ( SO_RCVTIMEO ) has been set on the socket using setsockopt (2): connect (2), send (2), sendto (2), and sendmsg (2), if a send timeout ( SO_SNDTIMEO ) has been set. |
||
|
⢠|
epoll_wait (2), epoll_pwait (2). |
||
|
⢠|
semop (2), semtimedop (2). |
||
|
⢠|
sigtimedwait (2), sigwaitinfo (2). |
||
|
⢠|
JĂĄdro 3.7 a dĹĂvÄjĹĄĂ: read (2) z popisovaÄe souborĹŻ inotify (7). |
||
|
⢠|
JĂĄdro 2.6.21 a dĹĂvÄjĹĄĂ: futex (2) FUTEX_WAIT , sem_timedwait (3), sem_wait (3). |
||
|
⢠|
JĂĄdro 2.6.8 a dĹĂvÄjĹĄĂ: msgrcv (2), msgsnd (2). |
||
|
⢠|
JĂĄdro 2.4 a dĹĂvÄjĹĄĂ: nanosleep (2). |
STANDARDY
POSIX.1, s uvedenými výjimkami.
POZNĂMKY
For a discussion of async-signal-safe functions, see signal-safety (7).
The /proc/ pid /task/ tid /status file contains various fields that show the signals that a thread is blocking ( SigBlk ), catching ( SigCgt ), or ignoring ( SigIgn ). (The set of signals that are caught or ignored will be the same across all threads in a process.) Other fields show the set of pending signals that are directed to the thread ( SigPnd ) as well as the set of pending signals that are directed to the process as a whole ( ShdPnd ). The corresponding fields in /proc/ pid /status show the information for the main thread. See proc (5) for further details.
CHYBY
There are six signals that can be delivered as a consequence of a hardware exception: SIGBUS , SIGEMT , SIGFPE , SIGILL , SIGSEGV , and SIGTRAP . Which of these signals is delivered, for any given hardware exception, is not documented and does not always make sense.
For example, an invalid memory access that causes delivery of SIGSEGV on one CPU architecture may cause delivery of SIGBUS on another architecture, or vice versa.
For another example, using the x86 int instruction with a forbidden argument (any number other than 3 or 128) causes delivery of SIGSEGV , even though SIGILL would make more sense, because of how the CPU reports the forbidden operation to the kernel.
DALĹ Ă INFORMACE
kill (1), clone (2), getrlimit (2), kill (2), pidfd_send_signal (2), restart_syscall (2), rt_sigqueueinfo (2), setitimer (2), setrlimit (2), sgetmask (2), sigaction (2), sigaltstack (2), signal (2), signalfd (2), sigpending (2), sigprocmask (2), sigreturn (2), sigsuspend (2), sigwaitinfo (2), abort (3), bsd_signal (3), killpg (3), longjmp (3), pthread_sigqueue (3), raise (3), sigqueue (3), sigset (3), sigsetops (3), sigvec (3), sigwait (3), strsignal (3), swapcontext (3), sysv_signal (3), core (5), proc (5), nptl (7), pthreads (7), sigevent (3type)
PĹEKLAD
PĹeklad tĂŠto pĹĂruÄky do ÄeĹĄtiny vytvoĹili Marek Kubita <Kubitovi@mbox.lantanet.cz> a Pavel Heimlich <tropikhajma@gmail.com>
Tento pĹeklad je bezplatnĂĄ dokumentace; PĹeÄtÄte si GNU General Public License Version 3 nebo novÄjĹĄĂ ohlednÄ podmĂnek autorskĂ˝ch prĂĄv. Neexistuje Ĺ˝ĂDNĂ ODPOVÄDNOST.
Pokud narazĂte na nÄjakĂŠ chyby v pĹekladu tĂŠto pĹĂruÄky, poĹĄlete e-mail na adresu translation-team-cs@lists.sourceforge.net .