| Davide Libenzi | fba2afa | 2007-05-10 22:23:13 -0700 | [diff] [blame] | 1 | /* | 
 | 2 |  *  include/linux/signalfd.h | 
 | 3 |  * | 
 | 4 |  *  Copyright (C) 2007  Davide Libenzi <davidel@xmailserver.org> | 
 | 5 |  * | 
 | 6 |  */ | 
 | 7 |  | 
 | 8 | #ifndef _LINUX_SIGNALFD_H | 
 | 9 | #define _LINUX_SIGNALFD_H | 
 | 10 |  | 
| Jaswinder Singh Rajput | a788fd5 | 2009-01-30 22:14:02 +0530 | [diff] [blame] | 11 | #include <linux/types.h> | 
| Ulrich Drepper | 5fb5e04 | 2008-07-23 21:29:37 -0700 | [diff] [blame] | 12 | /* For O_CLOEXEC and O_NONBLOCK */ | 
| Ulrich Drepper | 9deb27b | 2008-07-23 21:29:24 -0700 | [diff] [blame] | 13 | #include <linux/fcntl.h> | 
 | 14 |  | 
 | 15 | /* Flags for signalfd4.  */ | 
 | 16 | #define SFD_CLOEXEC O_CLOEXEC | 
| Ulrich Drepper | 5fb5e04 | 2008-07-23 21:29:37 -0700 | [diff] [blame] | 17 | #define SFD_NONBLOCK O_NONBLOCK | 
| Davide Libenzi | fba2afa | 2007-05-10 22:23:13 -0700 | [diff] [blame] | 18 |  | 
 | 19 | struct signalfd_siginfo { | 
| Davide Libenzi | 96358de | 2007-10-16 23:30:23 -0700 | [diff] [blame] | 20 | 	__u32 ssi_signo; | 
 | 21 | 	__s32 ssi_errno; | 
 | 22 | 	__s32 ssi_code; | 
 | 23 | 	__u32 ssi_pid; | 
 | 24 | 	__u32 ssi_uid; | 
 | 25 | 	__s32 ssi_fd; | 
 | 26 | 	__u32 ssi_tid; | 
 | 27 | 	__u32 ssi_band; | 
 | 28 | 	__u32 ssi_overrun; | 
 | 29 | 	__u32 ssi_trapno; | 
 | 30 | 	__s32 ssi_status; | 
 | 31 | 	__s32 ssi_int; | 
 | 32 | 	__u64 ssi_ptr; | 
 | 33 | 	__u64 ssi_utime; | 
 | 34 | 	__u64 ssi_stime; | 
 | 35 | 	__u64 ssi_addr; | 
| Hidetoshi Seto | b8aeec3 | 2010-10-07 15:31:31 +0900 | [diff] [blame] | 36 | 	__u16 ssi_addr_lsb; | 
| Davide Libenzi | fba2afa | 2007-05-10 22:23:13 -0700 | [diff] [blame] | 37 |  | 
 | 38 | 	/* | 
 | 39 | 	 * Pad strcture to 128 bytes. Remember to update the | 
| Robert P. J. Day | 14e4a0f | 2008-02-03 15:12:15 +0200 | [diff] [blame] | 40 | 	 * pad size when you add new members. We use a fixed | 
| Davide Libenzi | fba2afa | 2007-05-10 22:23:13 -0700 | [diff] [blame] | 41 | 	 * size structure to avoid compatibility problems with | 
 | 42 | 	 * future versions, and we leave extra space for additional | 
 | 43 | 	 * members. We use fixed size members because this strcture | 
 | 44 | 	 * comes out of a read(2) and we really don't want to have | 
 | 45 | 	 * a compat on read(2). | 
 | 46 | 	 */ | 
| Hidetoshi Seto | b8aeec3 | 2010-10-07 15:31:31 +0900 | [diff] [blame] | 47 | 	__u8 __pad[46]; | 
| Davide Libenzi | fba2afa | 2007-05-10 22:23:13 -0700 | [diff] [blame] | 48 | }; | 
 | 49 |  | 
 | 50 |  | 
 | 51 | #ifdef __KERNEL__ | 
 | 52 |  | 
 | 53 | #ifdef CONFIG_SIGNALFD | 
 | 54 |  | 
 | 55 | /* | 
| Davide Libenzi | b8fceee | 2007-09-20 12:40:16 -0700 | [diff] [blame] | 56 |  * Deliver the signal to listening signalfd. | 
| Davide Libenzi | fba2afa | 2007-05-10 22:23:13 -0700 | [diff] [blame] | 57 |  */ | 
 | 58 | static inline void signalfd_notify(struct task_struct *tsk, int sig) | 
 | 59 | { | 
| Davide Libenzi | b8fceee | 2007-09-20 12:40:16 -0700 | [diff] [blame] | 60 | 	if (unlikely(waitqueue_active(&tsk->sighand->signalfd_wqh))) | 
 | 61 | 		wake_up(&tsk->sighand->signalfd_wqh); | 
| Davide Libenzi | fba2afa | 2007-05-10 22:23:13 -0700 | [diff] [blame] | 62 | } | 
 | 63 |  | 
 | 64 | #else /* CONFIG_SIGNALFD */ | 
 | 65 |  | 
| Davide Libenzi | b8fceee | 2007-09-20 12:40:16 -0700 | [diff] [blame] | 66 | static inline void signalfd_notify(struct task_struct *tsk, int sig) { } | 
| Davide Libenzi | fba2afa | 2007-05-10 22:23:13 -0700 | [diff] [blame] | 67 |  | 
 | 68 | #endif /* CONFIG_SIGNALFD */ | 
 | 69 |  | 
 | 70 | #endif /* __KERNEL__ */ | 
 | 71 |  | 
 | 72 | #endif /* _LINUX_SIGNALFD_H */ | 
 | 73 |  |