c - SIGPOLL 的频段号是多少?

标签 c unix signals

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 in si_band and si_fd. The si_band event is a bit mask containing the same values as are filled in the revents field by poll(2). The si_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/

相关文章:

macos - 在 MacOS 上的 sed 中用换行符替换逗号?

python - 中断阻塞的 evdev 读取

c - 循环条件中的三元运算符 : evaluation order/op. 优先级不明确

c - scanf 给出随机行为

linux - 如何忽略进入 stderr 的警告

linux - Linux 上的 wget 没有 svn?

c - popen 函数调用后 sleep 在子进程中不起作用

c++ - 信号处理程序中不允许使用对象或函数

c - VC11中如何获取floor()的地址?

c - 将二维数组划分为所有可能的 nxn 正方形