blob: bef0c46d4713cb82a041907fe62b21c71175d930 [file] [log] [blame]
Davide Libenzifba2afa2007-05-10 22:23:13 -07001/*
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
Ulrich Drepper5fb5e042008-07-23 21:29:37 -070011/* For O_CLOEXEC and O_NONBLOCK */
Ulrich Drepper9deb27b2008-07-23 21:29:24 -070012#include <linux/fcntl.h>
13
14/* Flags for signalfd4. */
15#define SFD_CLOEXEC O_CLOEXEC
Ulrich Drepper5fb5e042008-07-23 21:29:37 -070016#define SFD_NONBLOCK O_NONBLOCK
Davide Libenzifba2afa2007-05-10 22:23:13 -070017
18struct signalfd_siginfo {
Davide Libenzi96358de2007-10-16 23:30:23 -070019 __u32 ssi_signo;
20 __s32 ssi_errno;
21 __s32 ssi_code;
22 __u32 ssi_pid;
23 __u32 ssi_uid;
24 __s32 ssi_fd;
25 __u32 ssi_tid;
26 __u32 ssi_band;
27 __u32 ssi_overrun;
28 __u32 ssi_trapno;
29 __s32 ssi_status;
30 __s32 ssi_int;
31 __u64 ssi_ptr;
32 __u64 ssi_utime;
33 __u64 ssi_stime;
34 __u64 ssi_addr;
Davide Libenzifba2afa2007-05-10 22:23:13 -070035
36 /*
37 * Pad strcture to 128 bytes. Remember to update the
Robert P. J. Day14e4a0f2008-02-03 15:12:15 +020038 * pad size when you add new members. We use a fixed
Davide Libenzifba2afa2007-05-10 22:23:13 -070039 * size structure to avoid compatibility problems with
40 * future versions, and we leave extra space for additional
41 * members. We use fixed size members because this strcture
42 * comes out of a read(2) and we really don't want to have
43 * a compat on read(2).
44 */
45 __u8 __pad[48];
46};
47
48
49#ifdef __KERNEL__
50
51#ifdef CONFIG_SIGNALFD
52
53/*
Davide Libenzib8fceee2007-09-20 12:40:16 -070054 * Deliver the signal to listening signalfd.
Davide Libenzifba2afa2007-05-10 22:23:13 -070055 */
56static inline void signalfd_notify(struct task_struct *tsk, int sig)
57{
Davide Libenzib8fceee2007-09-20 12:40:16 -070058 if (unlikely(waitqueue_active(&tsk->sighand->signalfd_wqh)))
59 wake_up(&tsk->sighand->signalfd_wqh);
Davide Libenzifba2afa2007-05-10 22:23:13 -070060}
61
62#else /* CONFIG_SIGNALFD */
63
Davide Libenzib8fceee2007-09-20 12:40:16 -070064static inline void signalfd_notify(struct task_struct *tsk, int sig) { }
Davide Libenzifba2afa2007-05-10 22:23:13 -070065
66#endif /* CONFIG_SIGNALFD */
67
68#endif /* __KERNEL__ */
69
70#endif /* _LINUX_SIGNALFD_H */
71