当前位置: 技术问答>linux和unix
linux下面的信号都已经是"可靠信号"了吗,已经没有了不可靠信号?
来源: 互联网 发布时间:2017-02-28
本文导语: 如题,apue里面说的"不可靠信号"的讲法是不是都已经过时了,现在linux(>2.6版本)信号都是可靠信号呢? | 没有这个事。 Real-time Signals Linux supports real-time signals as originally defined in the PO...
如题,apue里面说的"不可靠信号"的讲法是不是都已经过时了,现在linux(>2.6版本)信号都是可靠信号呢?
|
没有这个事。
更多请man 7 siganl
Real-time Signals
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.
The Linux kernel supports a range of 32 different real-time signals, numbered 33 to 64. However, the glibc POSIX threads implementation internally uses
two (for NPTL) or three (for LinuxThreads) real-time signals (see pthreads(7)), and adjusts the value of SIGRTMIN suitably (to 34 or 35). Because the
range of available real-time signals varies according to the glibc threading implementation (and this variation can occur at run time according to the
available kernel and glibc), and indeed the range of real-time signals varies across UNIX systems, programs should never refer to real-time signals
using hard-coded numbers, but instead should always refer to real-time signals using the notation SIGRTMIN+n, and include suitable (run-time) checks
that SIGRTMIN+n does not exceed SIGRTMAX.
Unlike standard signals, real-time signals have no predefined meanings: the entire set of real-time signals can be used for application-defined pur-
poses. (Note, however, that the LinuxThreads implementation uses the first three real-time signals.)
The default action for an unhandled real-time signal is to terminate the receiving process.
Real-time signals are distinguished by the following:
1. Multiple instances of real-time signals can be queued. By contrast, if multiple instances of a standard signal are delivered while that signal is
currently blocked, then only one instance is queued.
2. If the signal is sent using sigqueue(2), an accompanying value (either an integer or a pointer) can be sent with the signal. If the receiving pro-
cess establishes a handler for this signal using the SA_SIGINFO flag to sigaction(2) then it can obtain this data via the si_value field of the sig-
info_t structure passed as the second argument to the handler. Furthermore, the si_pid and si_uid fields of this structure can be used to obtain
the PID and real user ID of the process sending the signal.
3. Real-time signals are delivered in a guaranteed order. Multiple real-time signals of the same type are delivered in the order they were sent. If
different real-time signals are sent to a process, they are delivered starting with the lowest-numbered signal. (I.e., low-numbered signals have
highest priority.) By contrast, if multiple standard signals are pending for a process, the order in which they are delivered is unspecified.
更多请man 7 siganl