免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 4403 | 回复: 1
打印 上一主题 下一主题

[系统] siginfo_t是什么类型的?在哪能找到呀? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2015-03-17 11:08 |只看该作者 |倒序浏览
怎么都找不到siginfo_t这个类型 是怎么定义的,用grep 找到的好像都不是,百度也没有发现这个词条。。求教~谢谢啦

论坛徽章:
1
2015年辞旧岁徽章
日期:2015-03-03 16:54:15
2 [报告]
发表于 2015-03-17 16:56 |只看该作者
回复 1# 清心宁神
man sigaction中就有定义啊:
……
The siginfo_t argument to sa_sigaction is a struct with the following elements:

           siginfo_t {
               int      si_signo;    /* Signal number */
               int      si_errno;    /* An errno value */
               int      si_code;     /* Signal code */
               int      si_trapno;   /* Trap number that caused
                                        hardware-generated signal
                                        (unused on most architectures) */
               pid_t    si_pid;      /* Sending process ID */
               uid_t    si_uid;      /* Real user ID of sending process */
               int      si_status;   /* Exit value or signal */
               clock_t  si_utime;    /* User time consumed */
               clock_t  si_stime;    /* System time consumed */
               sigval_t si_value;    /* Signal value */
               int      si_int;      /* POSIX.1b signal */
               void    *si_ptr;      /* POSIX.1b signal */
               int      si_overrun;  /* Timer overrun count; POSIX.1b timers */
               int      si_timerid;  /* Timer ID; POSIX.1b timers */
               void    *si_addr;     /* Memory location which caused fault */
               long     si_band;     /* Band event (was int in
                                        glibc 2.3.2 and earlier) */
               int      si_fd;       /* File descriptor */
               short    si_addr_lsb; /* Least significant bit of address
                                        (since Linux 2.6.32) */
           }

       si_signo,  si_errno  and  si_code are defined for all signals.  (si_errno is generally unused on Linux.)  The rest of the struct may be a union, so that one should read only the
       fields that are meaningful for the given signal:
……

另外,我的ubuntu,在/usr/inculde/i386-linux-gnu/bits/siginfo.h中有以下定义:
typedef struct
  {
    int si_signo;                /* Signal number.  */
    int si_errno;                /* If non-zero, an errno value associated with
                                   this signal, as defined in <errno.h>.  */
    int si_code;                /* Signal code.  */

    union
      {
        int _pad[__SI_PAD_SIZE];

         /* kill().  */
        struct
          {
            __pid_t si_pid;        /* Sending process ID.  */
            __uid_t si_uid;        /* Real user ID of sending process.  */
          } _kill;

        /* POSIX.1b timers.  */
        struct
          {
            int si_tid;                /* Timer ID.  */
            int si_overrun;        /* Overrun count.  */
            sigval_t si_sigval;        /* Signal value.  */
          } _timer;

        /* POSIX.1b signals.  */
        struct
          {
            __pid_t si_pid;        /* Sending process ID.  */
            __uid_t si_uid;        /* Real user ID of sending process.  */
            sigval_t si_sigval;        /* Signal value.  */
          } _rt;

        /* SIGCHLD.  */
        struct
          {
            __pid_t si_pid;        /* Which child.  */
            __uid_t si_uid;        /* Real user ID of sending process.  */
            int si_status;        /* Exit value or signal.  */
            __sigchld_clock_t si_utime;
            __sigchld_clock_t si_stime;
          } _sigchld;

        /* SIGILL, SIGFPE, SIGSEGV, SIGBUS.  */
        struct
          {
            void *si_addr;        /* Faulting insn/memory ref.  */
            short int si_addr_lsb;        /* Valid LSB of the reported address.  */
          } _sigfault;

        /* SIGPOLL.  */
        struct
          {
            long int si_band;        /* Band event for SIGPOLL.  */
            int si_fd;
          } _sigpoll;

        /* SIGSYS.  */
        struct
          {
            void *_call_addr;        /* Calling user insn.  */
            int _syscall;        /* Triggering system call number.  */
            unsigned int _arch; /* AUDIT_ARCH_* of syscall.  */
          } _sigsys;
      } _sifields;
  } siginfo_t __SI_ALIGNMENT;

   
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP