blob: 9a47c380bda8b1310d7d287cdddcf61e095daf1e [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Davide Libenzifba2afa2007-05-10 22:23:13 -07002/*
3 * include/linux/signalfd.h
4 *
5 * Copyright (C) 2007 Davide Libenzi <davidel@xmailserver.org>
6 *
7 */
Davide Libenzifba2afa2007-05-10 22:23:13 -07008#ifndef _LINUX_SIGNALFD_H
9#define _LINUX_SIGNALFD_H
10
David Howells607ca462012-10-13 10:46:48 +010011#include <uapi/linux/signalfd.h>
Ingo Molnar3f07c012017-02-08 18:51:30 +010012#include <linux/sched/signal.h>
Davide Libenzifba2afa2007-05-10 22:23:13 -070013
14#ifdef CONFIG_SIGNALFD
15
16/*
Davide Libenzib8fceee2007-09-20 12:40:16 -070017 * Deliver the signal to listening signalfd.
Davide Libenzifba2afa2007-05-10 22:23:13 -070018 */
19static inline void signalfd_notify(struct task_struct *tsk, int sig)
20{
Davide Libenzib8fceee2007-09-20 12:40:16 -070021 if (unlikely(waitqueue_active(&tsk->sighand->signalfd_wqh)))
22 wake_up(&tsk->sighand->signalfd_wqh);
Davide Libenzifba2afa2007-05-10 22:23:13 -070023}
24
Oleg Nesterovd80e7312012-02-24 20:07:11 +010025extern void signalfd_cleanup(struct sighand_struct *sighand);
26
Davide Libenzifba2afa2007-05-10 22:23:13 -070027#else /* CONFIG_SIGNALFD */
28
Davide Libenzib8fceee2007-09-20 12:40:16 -070029static inline void signalfd_notify(struct task_struct *tsk, int sig) { }
Davide Libenzifba2afa2007-05-10 22:23:13 -070030
Oleg Nesterovd80e7312012-02-24 20:07:11 +010031static inline void signalfd_cleanup(struct sighand_struct *sighand) { }
32
Davide Libenzifba2afa2007-05-10 22:23:13 -070033#endif /* CONFIG_SIGNALFD */
34
Davide Libenzifba2afa2007-05-10 22:23:13 -070035#endif /* _LINUX_SIGNALFD_H */