1 /*
   2  * This file and its contents are supplied under the terms of the
   3  * Common Development and Distribution License ("CDDL"), version 1.0.
   4  * You may only use this file in accordance with the terms of version
   5  * 1.0 of the CDDL.
   6  *
   7  * A full copy of the text of the CDDL should have accompanied this
   8  * source.  A copy of the CDDL is also available via the Internet at
   9  * http://www.illumos.org/license/CDDL.
  10  */
  11 
  12 /*
  13  * Copyright 2015 Joyent, Inc.
  14  */
  15 
  16 /*
  17  * Header file to support the signalfd facility. Note that this facility
  18  * is designed to be binary compatible with the Linux signalfd facility, modulo
  19  * the signals themselves; values for constants here should therefore exactly
  20  * match those found in Linux, and this facility shouldn't be extended
  21  * independently of Linux.
  22  */
  23 
  24 #ifndef _SYS_SIGNALFD_H
  25 #define _SYS_SIGNALFD_H
  26 
  27 #include <sys/types.h>
  28 
  29 #ifdef  __cplusplus
  30 extern "C" {
  31 #endif
  32 
  33 /*
 
  58         uint32_t ssi_trapno;    /* trap number that caused signal */
  59         int32_t  ssi_status;    /* exit status or signal (SIGCHLD) */
  60         int32_t  ssi_int;       /* unused */
  61         uint64_t ssi_ptr;       /* unused */
  62         uint64_t ssi_utime;     /* user CPU time consumed (SIGCHLD) */
  63         uint64_t ssi_stime;     /* system CPU time consumed (SIGCHLD) */
  64         uint64_t ssi_addr;      /* address that generated signal */
  65         uint8_t  ssi_pad[48];   /* Pad size to 128 bytes to allow for */
  66                                 /* additional fields in the future. */
  67 } signalfd_siginfo_t;
  68 
  69 #ifndef _KERNEL
  70 
  71 extern int signalfd(int, const sigset_t *, int);
  72 
  73 #else
  74 
  75 #define SIGNALFDMNRN_SIGNALFD   0
  76 #define SIGNALFDMNRN_CLONE      1
  77 
  78 typedef struct sigfd_wake_list {
  79         list_node_t sigfd_wl_lst;
  80         void *sigfd_wl_state;
  81 } sigfd_wake_list_t;
  82 
  83 /*
  84  * This holds the proc_t state for a process which is using signalfd.
  85  */
  86 typedef struct sigfd_proc_state {
  87         void (*sigfd_pollwake_cb)(void *, int);
  88         list_t sigfd_list;
  89 } sigfd_proc_state_t;
  90 
  91 
  92 extern void (*sigfd_exit_helper)();
  93 
  94 #endif /* _KERNEL */
  95 
  96 #ifdef  __cplusplus
  97 }
  98 #endif
  99 
 100 #endif  /* _SYS_SIGNALFD_H */
 | 
   1 /*
   2  * This file and its contents are supplied under the terms of the
   3  * Common Development and Distribution License ("CDDL"), version 1.0.
   4  * You may only use this file in accordance with the terms of version
   5  * 1.0 of the CDDL.
   6  *
   7  * A full copy of the text of the CDDL should have accompanied this
   8  * source.  A copy of the CDDL is also available via the Internet at
   9  * http://www.illumos.org/license/CDDL.
  10  */
  11 
  12 /*
  13  * Copyright 2016 Joyent, Inc.
  14  */
  15 
  16 /*
  17  * Header file to support the signalfd facility. Note that this facility
  18  * is designed to be binary compatible with the Linux signalfd facility, modulo
  19  * the signals themselves; values for constants here should therefore exactly
  20  * match those found in Linux, and this facility shouldn't be extended
  21  * independently of Linux.
  22  */
  23 
  24 #ifndef _SYS_SIGNALFD_H
  25 #define _SYS_SIGNALFD_H
  26 
  27 #include <sys/types.h>
  28 
  29 #ifdef  __cplusplus
  30 extern "C" {
  31 #endif
  32 
  33 /*
 
  58         uint32_t ssi_trapno;    /* trap number that caused signal */
  59         int32_t  ssi_status;    /* exit status or signal (SIGCHLD) */
  60         int32_t  ssi_int;       /* unused */
  61         uint64_t ssi_ptr;       /* unused */
  62         uint64_t ssi_utime;     /* user CPU time consumed (SIGCHLD) */
  63         uint64_t ssi_stime;     /* system CPU time consumed (SIGCHLD) */
  64         uint64_t ssi_addr;      /* address that generated signal */
  65         uint8_t  ssi_pad[48];   /* Pad size to 128 bytes to allow for */
  66                                 /* additional fields in the future. */
  67 } signalfd_siginfo_t;
  68 
  69 #ifndef _KERNEL
  70 
  71 extern int signalfd(int, const sigset_t *, int);
  72 
  73 #else
  74 
  75 #define SIGNALFDMNRN_SIGNALFD   0
  76 #define SIGNALFDMNRN_CLONE      1
  77 
  78 /*
  79  * This holds the proc_t state for a process which is using signalfd.
  80  * Its presence and contents are protected by p_lock.
  81  */
  82 typedef struct sigfd_proc_state {
  83         void (*sigfd_pollwake_cb)(void *, int);
  84         list_t sigfd_list;
  85 } sigfd_proc_state_t;
  86 
  87 
  88 extern void (*sigfd_exit_helper)();
  89 
  90 #endif /* _KERNEL */
  91 
  92 #ifdef  __cplusplus
  93 }
  94 #endif
  95 
  96 #endif  /* _SYS_SIGNALFD_H */
 |