[Devel] [PATCH RHEL7 COMMIT] proc connector: use generic event helper for fork event
Konstantin Khorenko
khorenko at virtuozzo.com
Thu Aug 31 17:40:32 MSK 2017
The commit is pushed to "branch-rh7-3.10.0-514.26.1.vz7.35.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-514.26.1.vz7.35.5
------>
commit b9b0ba3dfa697a80078cbef06b13caf3c14ec249
Author: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
Date: Thu Aug 31 17:40:32 2017 +0300
proc connector: use generic event helper for fork event
Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
Reviewed-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
drivers/connector/cn_proc.c | 30 +++++++-----------------------
1 file changed, 7 insertions(+), 23 deletions(-)
diff --git a/drivers/connector/cn_proc.c b/drivers/connector/cn_proc.c
index 808b22a..ffda79b 100644
--- a/drivers/connector/cn_proc.c
+++ b/drivers/connector/cn_proc.c
@@ -112,26 +112,11 @@ static void proc_event_connector(struct task_struct *task,
cn_netlink_send(msg, CN_IDX_PROC, GFP_KERNEL);
}
-void proc_fork_connector(struct task_struct *task)
+static bool fill_fork_event(struct proc_event *ev, struct task_struct *task,
+ int unused)
{
- struct cn_msg *msg;
- struct proc_event *ev;
- __u8 buffer[CN_PROC_MSG_SIZE] __aligned(8);
- struct timespec ts;
struct task_struct *parent;
- (void) proc_event_connector;
-
- if (atomic_read(&proc_event_num_listeners) < 1)
- return;
-
- msg = buffer_to_cn_msg(buffer);
- ev = (struct proc_event *)msg->data;
- memset(&ev->event_data, 0, sizeof(ev->event_data));
- get_seq(&msg->seq, &ev->cpu);
- ktime_get_ts(&ts); /* get high res monotonic timestamp */
- ev->timestamp_ns = timespec_to_ns(&ts);
- ev->what = PROC_EVENT_FORK;
rcu_read_lock();
parent = rcu_dereference(task->real_parent);
ev->event_data.fork.parent_pid = parent->pid;
@@ -139,13 +124,12 @@ void proc_fork_connector(struct task_struct *task)
rcu_read_unlock();
ev->event_data.fork.child_pid = task->pid;
ev->event_data.fork.child_tgid = task->tgid;
+ return true;
+}
- memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id));
- msg->ack = 0; /* not used */
- msg->len = sizeof(*ev);
- msg->flags = 0; /* not used */
- /* If cn_netlink_send() failed, the data is not sent */
- cn_netlink_send(msg, CN_IDX_PROC, GFP_KERNEL);
+void proc_fork_connector(struct task_struct *task)
+{
+ proc_event_connector(task, PROC_EVENT_FORK, 0, fill_fork_event);
}
void proc_exec_connector(struct task_struct *task)
More information about the Devel
mailing list