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 | |
| 11 | |
| 12 | struct signalfd_siginfo { |
Davide Libenzi | 96358de | 2007-10-16 23:30:23 -0700 | [diff] [blame] | 13 | __u32 ssi_signo; |
| 14 | __s32 ssi_errno; |
| 15 | __s32 ssi_code; |
| 16 | __u32 ssi_pid; |
| 17 | __u32 ssi_uid; |
| 18 | __s32 ssi_fd; |
| 19 | __u32 ssi_tid; |
| 20 | __u32 ssi_band; |
| 21 | __u32 ssi_overrun; |
| 22 | __u32 ssi_trapno; |
| 23 | __s32 ssi_status; |
| 24 | __s32 ssi_int; |
| 25 | __u64 ssi_ptr; |
| 26 | __u64 ssi_utime; |
| 27 | __u64 ssi_stime; |
| 28 | __u64 ssi_addr; |
Davide Libenzi | fba2afa | 2007-05-10 22:23:13 -0700 | [diff] [blame] | 29 | |
| 30 | /* |
| 31 | * Pad strcture to 128 bytes. Remember to update the |
Robert P. J. Day | 14e4a0f | 2008-02-03 15:12:15 +0200 | [diff] [blame] | 32 | * pad size when you add new members. We use a fixed |
Davide Libenzi | fba2afa | 2007-05-10 22:23:13 -0700 | [diff] [blame] | 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 | |
| 42 | |
| 43 | #ifdef __KERNEL__ |
| 44 | |
| 45 | #ifdef CONFIG_SIGNALFD |
| 46 | |
| 47 | /* |
Davide Libenzi | b8fceee | 2007-09-20 12:40:16 -0700 | [diff] [blame] | 48 | * Deliver the signal to listening signalfd. |
Davide Libenzi | fba2afa | 2007-05-10 22:23:13 -0700 | [diff] [blame] | 49 | */ |
| 50 | static inline void signalfd_notify(struct task_struct *tsk, int sig) |
| 51 | { |
Davide Libenzi | b8fceee | 2007-09-20 12:40:16 -0700 | [diff] [blame] | 52 | if (unlikely(waitqueue_active(&tsk->sighand->signalfd_wqh))) |
| 53 | wake_up(&tsk->sighand->signalfd_wqh); |
Davide Libenzi | fba2afa | 2007-05-10 22:23:13 -0700 | [diff] [blame] | 54 | } |
| 55 | |
| 56 | #else /* CONFIG_SIGNALFD */ |
| 57 | |
Davide Libenzi | b8fceee | 2007-09-20 12:40:16 -0700 | [diff] [blame] | 58 | static inline void signalfd_notify(struct task_struct *tsk, int sig) { } |
Davide Libenzi | fba2afa | 2007-05-10 22:23:13 -0700 | [diff] [blame] | 59 | |
| 60 | #endif /* CONFIG_SIGNALFD */ |
| 61 | |
| 62 | #endif /* __KERNEL__ */ |
| 63 | |
| 64 | #endif /* _LINUX_SIGNALFD_H */ |
| 65 | |