]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/connector/cn_proc.c
[ARM] remove 'prot_pte_ext' from memory type table
[linux-2.6-omap-h63xx.git] / drivers / connector / cn_proc.c
index fcdf0fff13a6cc449e431957e061e67d253eefbe..5c9f67f98d10b43e58b2736d07ca76b8f498faac 100644 (file)
 
 #include <linux/module.h>
 #include <linux/kernel.h>
+#include <linux/ktime.h>
 #include <linux/init.h>
+#include <linux/connector.h>
 #include <asm/atomic.h>
+#include <asm/unaligned.h>
 
 #include <linux/cn_proc.h>
 
 static atomic_t proc_event_num_listeners = ATOMIC_INIT(0);
 static struct cb_id cn_proc_event_id = { CN_IDX_PROC, CN_VAL_PROC };
 
-/* proc_counts is used as the sequence number of the netlink message */
+/* proc_event_counts is used as the sequence number of the netlink message */
 static DEFINE_PER_CPU(__u32, proc_event_counts) = { 0 };
 
 static inline void get_seq(__u32 *ts, int *cpu)
 {
        *ts = get_cpu_var(proc_event_counts)++;
        *cpu = smp_processor_id();
-       put_cpu_var(proc_counts);
+       put_cpu_var(proc_event_counts);
 }
 
 void proc_fork_connector(struct task_struct *task)
@@ -49,6 +52,7 @@ void proc_fork_connector(struct task_struct *task)
        struct cn_msg *msg;
        struct proc_event *ev;
        __u8 buffer[CN_PROC_MSG_SIZE];
+       struct timespec ts;
 
        if (atomic_read(&proc_event_num_listeners) < 1)
                return;
@@ -56,6 +60,8 @@ void proc_fork_connector(struct task_struct *task)
        msg = (struct cn_msg*)buffer;
        ev = (struct proc_event*)msg->data;
        get_seq(&msg->seq, &ev->cpu);
+       ktime_get_ts(&ts); /* get high res monotonic timestamp */
+       put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns);
        ev->what = PROC_EVENT_FORK;
        ev->event_data.fork.parent_pid = task->real_parent->pid;
        ev->event_data.fork.parent_tgid = task->real_parent->tgid;
@@ -73,6 +79,7 @@ void proc_exec_connector(struct task_struct *task)
 {
        struct cn_msg *msg;
        struct proc_event *ev;
+       struct timespec ts;
        __u8 buffer[CN_PROC_MSG_SIZE];
 
        if (atomic_read(&proc_event_num_listeners) < 1)
@@ -81,6 +88,8 @@ void proc_exec_connector(struct task_struct *task)
        msg = (struct cn_msg*)buffer;
        ev = (struct proc_event*)msg->data;
        get_seq(&msg->seq, &ev->cpu);
+       ktime_get_ts(&ts); /* get high res monotonic timestamp */
+       put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns);
        ev->what = PROC_EVENT_EXEC;
        ev->event_data.exec.process_pid = task->pid;
        ev->event_data.exec.process_tgid = task->tgid;
@@ -96,6 +105,7 @@ void proc_id_connector(struct task_struct *task, int which_id)
        struct cn_msg *msg;
        struct proc_event *ev;
        __u8 buffer[CN_PROC_MSG_SIZE];
+       struct timespec ts;
 
        if (atomic_read(&proc_event_num_listeners) < 1)
                return;
@@ -114,6 +124,8 @@ void proc_id_connector(struct task_struct *task, int which_id)
        } else
                return;
        get_seq(&msg->seq, &ev->cpu);
+       ktime_get_ts(&ts); /* get high res monotonic timestamp */
+       put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns);
 
        memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id));
        msg->ack = 0; /* not used */
@@ -126,6 +138,7 @@ void proc_exit_connector(struct task_struct *task)
        struct cn_msg *msg;
        struct proc_event *ev;
        __u8 buffer[CN_PROC_MSG_SIZE];
+       struct timespec ts;
 
        if (atomic_read(&proc_event_num_listeners) < 1)
                return;
@@ -133,6 +146,8 @@ void proc_exit_connector(struct task_struct *task)
        msg = (struct cn_msg*)buffer;
        ev = (struct proc_event*)msg->data;
        get_seq(&msg->seq, &ev->cpu);
+       ktime_get_ts(&ts); /* get high res monotonic timestamp */
+       put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns);
        ev->what = PROC_EVENT_EXIT;
        ev->event_data.exit.process_pid = task->pid;
        ev->event_data.exit.process_tgid = task->tgid;
@@ -158,6 +173,7 @@ static void cn_proc_ack(int err, int rcvd_seq, int rcvd_ack)
        struct cn_msg *msg;
        struct proc_event *ev;
        __u8 buffer[CN_PROC_MSG_SIZE];
+       struct timespec ts;
 
        if (atomic_read(&proc_event_num_listeners) < 1)
                return;
@@ -165,6 +181,8 @@ static void cn_proc_ack(int err, int rcvd_seq, int rcvd_ack)
        msg = (struct cn_msg*)buffer;
        ev = (struct proc_event*)msg->data;
        msg->seq = rcvd_seq;
+       ktime_get_ts(&ts); /* get high res monotonic timestamp */
+       put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns);
        ev->cpu = -1;
        ev->what = PROC_EVENT_NONE;
        ev->event_data.ack.err = err;