From e680089c477ee4b1dbc1bd64b7f2cb6eac61adfc Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Sat, 4 Oct 2008 00:02:54 +0200 Subject: procfs dir_entry count warning on removal depends on kernel version. --- runtime/procfs.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'runtime/procfs.c') diff --git a/runtime/procfs.c b/runtime/procfs.c index 1b1d5447..8aeda14c 100644 --- a/runtime/procfs.c +++ b/runtime/procfs.c @@ -24,15 +24,22 @@ static struct proc_dir_entry *_stp_proc_root = NULL; void _stp_close_procfs(void); +// 2.6.24 fixed proc_dir_entry refcounting. +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) +#define LAST_ENTRY_COUNT 0 +#else +#define LAST_ENTRY_COUNT 1 +#endif + /* * Removes /proc/systemtap/{module_name} and /proc/systemtap (if empty) */ void _stp_rmdir_proc_module(void) { if (_stp_proc_root && _stp_proc_root->subdir == NULL) { - if (atomic_read(&_stp_proc_root->count)) - _stp_warn("Removal of /proc/systemtap/%s\nis deferred until it is no longer in use.\n" - "Systemtap module removal will block.\n", THIS_MODULE->name); + if (atomic_read(&_stp_proc_root->count) != LAST_ENTRY_COUNT) + _stp_warn("(%d,%d)Removal of /proc/systemtap/%s\nis deferred until it is no longer in use.\n" + "Systemtap module removal will block.\n", atomic_read(&_stp_proc_root->count), LAST_ENTRY_COUNT, THIS_MODULE->name); remove_proc_entry(THIS_MODULE->name, _stp_proc_stap); _stp_proc_root = NULL; } -- cgit