aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/connector
diff options
context:
space:
mode:
authorJesper Derehag <jderehag@hotmail.com>2013-03-19 16:50:05 -0400
committerDavid S. Miller <davem@davemloft.net>2013-03-20 13:23:21 -0400
commit2b5faa4c553f90ee2dde1d976b220b1ca9741ef0 (patch)
tree91d6d907a0bc8ef659fee414d5415a84aee7b58b /drivers/connector
parent800c644bcd0f2b29020c0dd6b661596c14c0f34f (diff)
connector: Added coredumping event to the process connector
Process connector can now also detect coredumping events. Main aim of patch is get notified at start of coredumping, instead of having to wait for it to finish and then being notified through EXIT event. Could be used for instance by process-managers that want to get notified as soon as possible about process failures, and not necessarily beeing notified after coredump, which could be in the order of minutes depending on size of coredump, piping and so on. Signed-off-by: Jesper Derehag <jderehag@hotmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/connector')
-rw-r--r--drivers/connector/cn_proc.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/connector/cn_proc.c b/drivers/connector/cn_proc.c
index 1110478dd0fd..08ae128cce9b 100644
--- a/drivers/connector/cn_proc.c
+++ b/drivers/connector/cn_proc.c
@@ -232,6 +232,31 @@ void proc_comm_connector(struct task_struct *task)
232 cn_netlink_send(msg, CN_IDX_PROC, GFP_KERNEL); 232 cn_netlink_send(msg, CN_IDX_PROC, GFP_KERNEL);
233} 233}
234 234
235void proc_coredump_connector(struct task_struct *task)
236{
237 struct cn_msg *msg;
238 struct proc_event *ev;
239 __u8 buffer[CN_PROC_MSG_SIZE];
240 struct timespec ts;
241
242 if (atomic_read(&proc_event_num_listeners) < 1)
243 return;
244
245 msg = (struct cn_msg *)buffer;
246 ev = (struct proc_event *)msg->data;
247 get_seq(&msg->seq, &ev->cpu);
248 ktime_get_ts(&ts); /* get high res monotonic timestamp */
249 put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns);
250 ev->what = PROC_EVENT_COREDUMP;
251 ev->event_data.coredump.process_pid = task->pid;
252 ev->event_data.coredump.process_tgid = task->tgid;
253
254 memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id));
255 msg->ack = 0; /* not used */
256 msg->len = sizeof(*ev);
257 cn_netlink_send(msg, CN_IDX_PROC, GFP_KERNEL);
258}
259
235void proc_exit_connector(struct task_struct *task) 260void proc_exit_connector(struct task_struct *task)
236{ 261{
237 struct cn_msg *msg; 262 struct cn_msg *msg;