struct siginfo {
int si_signo; /* signal number */
int si_errno; /* if nonzero, errno value from <errno.h> */
int si_code; /* additional info (depends on signal) */
pid_t si_pid; /* sending process ID */
uid_t si_uid; /* sending process real user ID */
void *si_addr; /* address that caused the fault */
int si_status; /* exit value or signal number */
long si_band; /* band number for SIGPOLL */
/* possibly other fields also */
};
我不明白si_band
。
最佳答案
如果您查看 Linux 联机帮助页 sigaction
,你会看到:
SIGPOLL/SIGIO
fills insi_band
andsi_fd
. Thesi_band
event is a bit mask containing the same values as are filled in the revents field by poll(2). Thesi_fd
field indicates the file descriptor for which the I/O event occurred.
该位掩码含义的解释可以在链接的手册页中找到 - 本质上,它告诉信号处理程序触发信号的事件类型(至少在 Linux 中,您还可以获得相应的文件描述符。)
我不确定它的便携性如何。 si_band
似乎在 POSIX 中,但不是 si_fd
。引用:POSIX <signal.h>
, POSIX poll(2)
关于c - SIGPOLL 的频段号是多少?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9546729/