2 * include/linux/signalfd.h
4 * Copyright (C) 2007 Davide Libenzi <davidel@xmailserver.org>
8 #ifndef _LINUX_SIGNALFD_H
9 #define _LINUX_SIGNALFD_H
12 struct signalfd_siginfo
{
31 * Pad strcture to 128 bytes. Remember to update the
32 * pad size when you add new memebers. 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).
45 #ifdef CONFIG_SIGNALFD
48 * Deliver the signal to listening signalfd. This must be called
49 * with the sighand lock held. Same are the following that end up
50 * calling signalfd_deliver().
52 void signalfd_deliver(struct task_struct
*tsk
, int sig
);
55 * No need to fall inside signalfd_deliver() if no signal listeners
58 static inline void signalfd_notify(struct task_struct
*tsk
, int sig
)
60 if (unlikely(!list_empty(&tsk
->sighand
->signalfd_list
)))
61 signalfd_deliver(tsk
, sig
);
65 * The signal -1 is used to notify the signalfd that the sighand
66 * is on its way to be detached.
68 static inline void signalfd_detach_locked(struct task_struct
*tsk
)
70 if (unlikely(!list_empty(&tsk
->sighand
->signalfd_list
)))
71 signalfd_deliver(tsk
, -1);
74 static inline void signalfd_detach(struct task_struct
*tsk
)
76 struct sighand_struct
*sighand
= tsk
->sighand
;
78 if (unlikely(!list_empty(&sighand
->signalfd_list
))) {
79 spin_lock_irq(&sighand
->siglock
);
80 signalfd_deliver(tsk
, -1);
81 spin_unlock_irq(&sighand
->siglock
);
85 #else /* CONFIG_SIGNALFD */
87 #define signalfd_deliver(t, s) do { } while (0)
88 #define signalfd_notify(t, s) do { } while (0)
89 #define signalfd_detach_locked(t) do { } while (0)
90 #define signalfd_detach(t) do { } while (0)
92 #endif /* CONFIG_SIGNALFD */
94 #endif /* __KERNEL__ */
96 #endif /* _LINUX_SIGNALFD_H */