[SCSI] drivers/scsi: Use ARRAY_SIZE macro
[linux-2.6/kvm.git] / include / linux / cn_proc.h
blob1417de93505788152005b978c85fce08b22f5c21
1 /*
2 * cn_proc.h - process events connector
4 * Copyright (C) Matt Helsley, IBM Corp. 2005
5 * Based on cn_fork.h by Nguyen Anh Quynh and Guillaume Thouvenin
6 * Original copyright notice follows:
7 * Copyright (C) 2005 Nguyen Anh Quynh <aquynh@gmail.com>
8 * Copyright (C) 2005 Guillaume Thouvenin <guillaume.thouvenin@bull.net>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 #ifndef CN_PROC_H
26 #define CN_PROC_H
28 #include <linux/types.h>
29 #include <linux/time.h>
30 #include <linux/connector.h>
33 * Userspace sends this enum to register with the kernel that it is listening
34 * for events on the connector.
36 enum proc_cn_mcast_op {
37 PROC_CN_MCAST_LISTEN = 1,
38 PROC_CN_MCAST_IGNORE = 2
42 * From the user's point of view, the process
43 * ID is the thread group ID and thread ID is the internal
44 * kernel "pid". So, fields are assigned as follow:
46 * In user space - In kernel space
48 * parent process ID = parent->tgid
49 * parent thread ID = parent->pid
50 * child process ID = child->tgid
51 * child thread ID = child->pid
54 struct proc_event {
55 enum what {
56 /* Use successive bits so the enums can be used to record
57 * sets of events as well
59 PROC_EVENT_NONE = 0x00000000,
60 PROC_EVENT_FORK = 0x00000001,
61 PROC_EVENT_EXEC = 0x00000002,
62 PROC_EVENT_UID = 0x00000004,
63 PROC_EVENT_GID = 0x00000040,
64 /* "next" should be 0x00000400 */
65 /* "last" is the last process event: exit */
66 PROC_EVENT_EXIT = 0x80000000
67 } what;
68 __u32 cpu;
69 struct timespec timestamp;
70 union { /* must be last field of proc_event struct */
71 struct {
72 __u32 err;
73 } ack;
75 struct fork_proc_event {
76 pid_t parent_pid;
77 pid_t parent_tgid;
78 pid_t child_pid;
79 pid_t child_tgid;
80 } fork;
82 struct exec_proc_event {
83 pid_t process_pid;
84 pid_t process_tgid;
85 } exec;
87 struct id_proc_event {
88 pid_t process_pid;
89 pid_t process_tgid;
90 union {
91 __u32 ruid; /* task uid */
92 __u32 rgid; /* task gid */
93 } r;
94 union {
95 __u32 euid;
96 __u32 egid;
97 } e;
98 } id;
100 struct exit_proc_event {
101 pid_t process_pid;
102 pid_t process_tgid;
103 __u32 exit_code, exit_signal;
104 } exit;
105 } event_data;
108 #ifdef __KERNEL__
109 #ifdef CONFIG_PROC_EVENTS
110 void proc_fork_connector(struct task_struct *task);
111 void proc_exec_connector(struct task_struct *task);
112 void proc_id_connector(struct task_struct *task, int which_id);
113 void proc_exit_connector(struct task_struct *task);
114 #else
115 static inline void proc_fork_connector(struct task_struct *task)
118 static inline void proc_exec_connector(struct task_struct *task)
121 static inline void proc_id_connector(struct task_struct *task,
122 int which_id)
125 static inline void proc_exit_connector(struct task_struct *task)
127 #endif /* CONFIG_PROC_EVENTS */
128 #endif /* __KERNEL__ */
129 #endif /* CN_PROC_H */