aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/cn_proc.h
diff options
context:
space:
mode:
authorScott James Remnant <scott@ubuntu.com>2009-09-22 19:43:44 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-23 10:39:29 -0400
commit02b51df1b07b4e9ca823c89284e704cadb323cd1 (patch)
treec68de4809f261d742f597c686826cdc9d047fb4a /include/linux/cn_proc.h
parent88e9d34c727883d7d6f02cf1475b3ec98b8480c7 (diff)
proc connector: add event for process becoming session leader
The act of a process becoming a session leader is a useful signal to a supervising init daemon such as Upstart. While a daemon will normally do this as part of the process of becoming a daemon, it is rare for its children to do so. When the children do, it is nearly always a sign that the child should be considered detached from the parent and not supervised along with it. The poster-child example is OpenSSH; the per-login children call setsid() so that they may control the pty connected to them. If the primary daemon dies or is restarted, we do not want to consider the per-login children and want to respawn the primary daemon without killing the children. This patch adds a new PROC_SID_EVENT and associated structure to the proc_event event_data union, it arranges for this to be emitted when the special PIDTYPE_SID pid is set. [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: Scott James Remnant <scott@ubuntu.com> Acked-by: Matt Helsley <matthltc@us.ibm.com> Cc: Oleg Nesterov <oleg@tv-sign.ru> Cc: Evgeniy Polyakov <johnpol@2ka.mipt.ru> Acked-by: "David S. Miller" <davem@davemloft.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/cn_proc.h')
-rw-r--r--include/linux/cn_proc.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/cn_proc.h b/include/linux/cn_proc.h
index b8125b2eb665..47dac5ea8d3a 100644
--- a/include/linux/cn_proc.h
+++ b/include/linux/cn_proc.h
@@ -52,6 +52,7 @@ struct proc_event {
52 PROC_EVENT_EXEC = 0x00000002, 52 PROC_EVENT_EXEC = 0x00000002,
53 PROC_EVENT_UID = 0x00000004, 53 PROC_EVENT_UID = 0x00000004,
54 PROC_EVENT_GID = 0x00000040, 54 PROC_EVENT_GID = 0x00000040,
55 PROC_EVENT_SID = 0x00000080,
55 /* "next" should be 0x00000400 */ 56 /* "next" should be 0x00000400 */
56 /* "last" is the last process event: exit */ 57 /* "last" is the last process event: exit */
57 PROC_EVENT_EXIT = 0x80000000 58 PROC_EVENT_EXIT = 0x80000000
@@ -89,6 +90,11 @@ struct proc_event {
89 } e; 90 } e;
90 } id; 91 } id;
91 92
93 struct sid_proc_event {
94 __kernel_pid_t process_pid;
95 __kernel_pid_t process_tgid;
96 } sid;
97
92 struct exit_proc_event { 98 struct exit_proc_event {
93 __kernel_pid_t process_pid; 99 __kernel_pid_t process_pid;
94 __kernel_pid_t process_tgid; 100 __kernel_pid_t process_tgid;
@@ -102,6 +108,7 @@ struct proc_event {
102void proc_fork_connector(struct task_struct *task); 108void proc_fork_connector(struct task_struct *task);
103void proc_exec_connector(struct task_struct *task); 109void proc_exec_connector(struct task_struct *task);
104void proc_id_connector(struct task_struct *task, int which_id); 110void proc_id_connector(struct task_struct *task, int which_id);
111void proc_sid_connector(struct task_struct *task);
105void proc_exit_connector(struct task_struct *task); 112void proc_exit_connector(struct task_struct *task);
106#else 113#else
107static inline void proc_fork_connector(struct task_struct *task) 114static inline void proc_fork_connector(struct task_struct *task)
@@ -114,6 +121,9 @@ static inline void proc_id_connector(struct task_struct *task,
114 int which_id) 121 int which_id)
115{} 122{}
116 123
124static inline void proc_sid_connector(struct task_struct *task)
125{}
126
117static inline void proc_exit_connector(struct task_struct *task) 127static inline void proc_exit_connector(struct task_struct *task)
118{} 128{}
119#endif /* CONFIG_PROC_EVENTS */ 129#endif /* CONFIG_PROC_EVENTS */