From: John L. <mov...@us...> - 2001-08-11 01:38:31
|
Update of /cvsroot/oprofile/oprofile In directory usw-pr-cvs1:/tmp/cvs-serv29470 Modified Files: ChangeLog README oprofile.c oprofile.h Log Message: support 2.4.7 and above Index: ChangeLog =================================================================== RCS file: /cvsroot/oprofile/oprofile/ChangeLog,v retrieving revision 1.71 retrieving revision 1.72 diff -u -d -r1.71 -r1.72 --- ChangeLog 2001/08/11 01:29:07 1.71 +++ ChangeLog 2001/08/11 01:38:29 1.72 @@ -1,3 +1,9 @@ +2001-08-11 Dave Jones <da...@su...> + + * oprofile.h: + * oprofile.c: back-compat code and use of new struct completion + for the thread + 2001-08-11 John Levon <mo...@co...> * oprofile.c: corner case where an a miss against a full count, Index: README =================================================================== RCS file: /cvsroot/oprofile/oprofile/README,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- README 2001/06/29 20:19:28 1.10 +++ README 2001/08/11 01:38:29 1.11 @@ -10,3 +10,6 @@ Philippe Elie <ph...@cl...> contributed many bug fixes, wrote the tcl/tk oprofile interface and the source annotation facility, and more. + +Dave Jones <da...@su...> and Bob Montgomery <bo...@fc...> provided +bug fixes and useful testing. Index: oprofile.c =================================================================== RCS file: /cvsroot/oprofile/oprofile/oprofile.c,v retrieving revision 1.69 retrieving revision 1.70 diff -u -d -r1.69 -r1.70 --- oprofile.c 2001/08/11 01:29:07 1.69 +++ oprofile.c 2001/08/11 01:38:29 1.70 @@ -419,7 +419,8 @@ u32 diethreaddie; pid_t threadpid; -DECLARE_MUTEX_LOCKED(threadstopsem); + +DECLARE_COMPLETION(threadstop); /* we have to have another thread because we can't * do wake_up() from NMI due to no locking @@ -452,12 +453,13 @@ break; } - up_and_exit(&threadstopsem,0); + complete_and_exit(&threadstop,0); return 0; } void oprof_start_thread(void) { + init_completion(&threadstop); diethreaddie = 0; if (kernel_thread(oprof_thread, NULL, CLONE_FS|CLONE_FILES|CLONE_SIGHAND)<0) printk(KERN_ERR "oprofile: couldn't spawn wakeup thread.\n"); @@ -467,7 +469,7 @@ { diethreaddie = 1; kill_proc(SIGKILL, threadpid, 1); - down(&threadstopsem); + wait_for_completion(&threadstop); } #define wrap_nextbuf() do { \ Index: oprofile.h =================================================================== RCS file: /cvsroot/oprofile/oprofile/oprofile.h,v retrieving revision 1.42 retrieving revision 1.43 diff -u -d -r1.42 -r1.43 --- oprofile.h 2001/08/11 01:29:07 1.42 +++ oprofile.h 2001/08/11 01:38:29 1.43 @@ -19,7 +19,7 @@ #include <linux/kernel.h> #include <linux/module.h> #include <linux/init.h> -#include <linux/malloc.h> +#include <linux/slab.h> #include <linux/delay.h> #include <linux/vmalloc.h> #include <linux/sched.h> @@ -171,6 +171,14 @@ #else #define take_mmap_sem(mm) down_read(&mm->mmap_sem) #define release_mmap_sem(mm) up_read(&mm->mmap_sem) +#endif + +// 2.4.7 introduced completions. +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,7) +#define DECLARE_COMPLETION(x) DECLARE_MUTEX_LOCKED(x) +#define init_completion(x) +#define complete_and_exit(x, y) up_and_exit((x), (y)) +#define wait_for_completion(x) down(x) #endif int oprof_init(void); |