signalfd.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * include/linux/signalfd.h
  3. *
  4. * Copyright (C) 2007 Davide Libenzi <davidel@xmailserver.org>
  5. *
  6. */
  7. #ifndef _LINUX_SIGNALFD_H
  8. #define _LINUX_SIGNALFD_H
  9. /* For O_CLOEXEC */
  10. #include <linux/fcntl.h>
  11. /* Flags for signalfd4. */
  12. #define SFD_CLOEXEC O_CLOEXEC
  13. struct signalfd_siginfo {
  14. __u32 ssi_signo;
  15. __s32 ssi_errno;
  16. __s32 ssi_code;
  17. __u32 ssi_pid;
  18. __u32 ssi_uid;
  19. __s32 ssi_fd;
  20. __u32 ssi_tid;
  21. __u32 ssi_band;
  22. __u32 ssi_overrun;
  23. __u32 ssi_trapno;
  24. __s32 ssi_status;
  25. __s32 ssi_int;
  26. __u64 ssi_ptr;
  27. __u64 ssi_utime;
  28. __u64 ssi_stime;
  29. __u64 ssi_addr;
  30. /*
  31. * Pad strcture to 128 bytes. Remember to update the
  32. * pad size when you add new members. We use a fixed
  33. * size structure to avoid compatibility problems with
  34. * future versions, and we leave extra space for additional
  35. * members. We use fixed size members because this strcture
  36. * comes out of a read(2) and we really don't want to have
  37. * a compat on read(2).
  38. */
  39. __u8 __pad[48];
  40. };
  41. #ifdef __KERNEL__
  42. #ifdef CONFIG_SIGNALFD
  43. /*
  44. * Deliver the signal to listening signalfd.
  45. */
  46. static inline void signalfd_notify(struct task_struct *tsk, int sig)
  47. {
  48. if (unlikely(waitqueue_active(&tsk->sighand->signalfd_wqh)))
  49. wake_up(&tsk->sighand->signalfd_wqh);
  50. }
  51. #else /* CONFIG_SIGNALFD */
  52. static inline void signalfd_notify(struct task_struct *tsk, int sig) { }
  53. #endif /* CONFIG_SIGNALFD */
  54. #endif /* __KERNEL__ */
  55. #endif /* _LINUX_SIGNALFD_H */