mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
more ifdef's to make it work with Red Hat Enterprise Linux 4's 2.6.9-based
2006-02-17 Bastien Nocera <hadess@hadess.net> * configure.ac: * module/sysprof-module.c: (timer_notify), (sysprof_open), (sysprof_release): more ifdef's to make it work with Red Hat Enterprise Linux 4's 2.6.9-based kernel
This commit is contained in:
committed by
Bastien Nocera
parent
58a1cf37ef
commit
0a592c152a
@ -1,3 +1,10 @@
|
|||||||
|
2006-02-17 Bastien Nocera <hadess@hadess.net>
|
||||||
|
|
||||||
|
* configure.ac:
|
||||||
|
* module/sysprof-module.c: (timer_notify), (sysprof_open),
|
||||||
|
(sysprof_release): more ifdef's to make it work with Red Hat
|
||||||
|
Enterprise Linux 4's 2.6.9-based kernel
|
||||||
|
|
||||||
Sat Feb 4 23:53:05 2006 Søren Sandmann <sandmann@redhat.com>
|
Sat Feb 4 23:53:05 2006 Søren Sandmann <sandmann@redhat.com>
|
||||||
|
|
||||||
* sysprof.glade: Remove ancestors pane in favor of radiobuttons in
|
* sysprof.glade: Remove ancestors pane in favor of radiobuttons in
|
||||||
|
|||||||
@ -61,9 +61,9 @@ if test $kernel_module = "yes"; then
|
|||||||
KMINOR=`uname -r | cut -d"." -f 2`
|
KMINOR=`uname -r | cut -d"." -f 2`
|
||||||
KMICRO=`uname -r | cut -d"." -f 3 | cut -d"-" -f 1`
|
KMICRO=`uname -r | cut -d"." -f 3 | cut -d"-" -f 1`
|
||||||
|
|
||||||
if [[ $KMICRO -lt 11 ]] ; then
|
if [[ $KMICRO -lt 9 ]] ; then
|
||||||
echo \*
|
echo \*
|
||||||
echo \* Linux \>= 2.6.11 is required
|
echo \* Linux \>= 2.6.9 is required
|
||||||
echo \*
|
echo \*
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
@ -40,9 +40,15 @@
|
|||||||
#include "sysprof-module.h"
|
#include "sysprof-module.h"
|
||||||
|
|
||||||
#include <linux/version.h>
|
#include <linux/version.h>
|
||||||
#if (KERNEL_VERSION(2,6,11) > LINUX_VERSION_CODE) || (!CONFIG_PROFILING)
|
#if (KERNEL_VERSION(2,6,9) > LINUX_VERSION_CODE) || (!CONFIG_PROFILING)
|
||||||
# error Sysprof needs a Linux 2.6.11 kernel or later, with profiling support compiled in.
|
# error Sysprof needs a Linux 2.6.9 kernel or later, with profiling support compiled in.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if (KERNEL_VERSION(2,6,11) > LINUX_VERSION_CODE)
|
||||||
|
#define OLD_PROFILE
|
||||||
|
#include <linux/notifier.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <linux/kallsyms.h>
|
#include <linux/kallsyms.h>
|
||||||
|
|
||||||
MODULE_LICENSE("GPL");
|
MODULE_LICENSE("GPL");
|
||||||
@ -101,9 +107,16 @@ read_frame (void *frame_pointer, StackFrame *frame)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef OLD_PROFILE
|
||||||
|
static int timer_notify(struct notifier_block * self, unsigned long val, void * data)
|
||||||
|
#else
|
||||||
static int
|
static int
|
||||||
timer_notify (struct pt_regs *regs)
|
timer_notify (struct pt_regs *regs)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
|
#ifdef OLD_PROFILE
|
||||||
|
struct pt_regs * regs = (struct pt_regs *)data;
|
||||||
|
#endif
|
||||||
void *frame_pointer;
|
void *frame_pointer;
|
||||||
static int n_samples;
|
static int n_samples;
|
||||||
SysprofStackTrace *trace = head;
|
SysprofStackTrace *trace = head;
|
||||||
@ -161,6 +174,14 @@ timer_notify (struct pt_regs *regs)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef OLD_PROFILE
|
||||||
|
static struct notifier_block timer_notifier = {
|
||||||
|
.notifier_call = timer_notify,
|
||||||
|
NULL,
|
||||||
|
0
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
static int
|
static int
|
||||||
sysprof_read(struct file *file, char *buffer, size_t count, loff_t *offset)
|
sysprof_read(struct file *file, char *buffer, size_t count, loff_t *offset)
|
||||||
{
|
{
|
||||||
@ -208,8 +229,13 @@ sysprof_open(struct inode *inode, struct file *file)
|
|||||||
{
|
{
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
|
|
||||||
if (atomic_inc_return(&client_count) == 1)
|
if (atomic_inc_return(&client_count) == 1) {
|
||||||
|
#ifndef OLD_PROFILE
|
||||||
retval = register_timer_hook (timer_notify);
|
retval = register_timer_hook (timer_notify);
|
||||||
|
#else
|
||||||
|
retval = register_profile_notifier (&timer_notifier);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
file->private_data = head;
|
file->private_data = head;
|
||||||
|
|
||||||
@ -219,8 +245,13 @@ sysprof_open(struct inode *inode, struct file *file)
|
|||||||
static int
|
static int
|
||||||
sysprof_release(struct inode *inode, struct file *file)
|
sysprof_release(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
if (atomic_dec_return(&client_count) == 0)
|
if (atomic_dec_return(&client_count) == 0) {
|
||||||
|
#ifndef OLD_PROFILE
|
||||||
unregister_timer_hook (timer_notify);
|
unregister_timer_hook (timer_notify);
|
||||||
|
#else
|
||||||
|
unregister_profile_notifier (&timer_notifier);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user