From 5e2c688d8d5fb28d0be4bcdee01e496e20660b29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Sandmann=20Pedersen?= Date: Thu, 17 Jun 2004 19:32:03 +0000 Subject: [PATCH] fix read and poll --- sysprof-module.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sysprof-module.c b/sysprof-module.c index 955987e9..fdee2247 100644 --- a/sysprof-module.c +++ b/sysprof-module.c @@ -20,7 +20,7 @@ MODULE_LICENSE("GPL"); MODULE_AUTHOR("Soeren Sandmann (sandmann@daimi.au.dk)"); -#define SAMPLES_PER_SECOND (50) +#define SAMPLES_PER_SECOND (20) #define INTERVAL (HZ / SAMPLES_PER_SECOND) #define N_TRACES 256 @@ -187,16 +187,13 @@ procfile_read(char *buffer, int *eof, void *data) { - wait_event_interruptible(wait_for_trace, head != tail); - if (buffer_len < sizeof (SysprofStackTrace)) return -ENOMEM; - memcpy (buffer, (char *)tail, sizeof (SysprofStackTrace)); + wait_event_interruptible (wait_for_trace, head != tail); + *buffer_location = (char *)tail; if (tail++ == &stack_traces[N_TRACES - 1]) tail = &stack_traces[0]; - *buffer_location = buffer; - return sizeof (SysprofStackTrace); } @@ -204,6 +201,9 @@ struct proc_dir_entry *trace_proc_file; static unsigned int procfile_poll(struct file *filp, poll_table *poll_table) { + if (head != tail) { + return POLLIN | POLLRDNORM; + } poll_wait(filp, &wait_for_trace, poll_table); if (head != tail) { return POLLIN | POLLRDNORM;