From c66d2821b276e2a9c24b8ca563008854ee22ec2c Mon Sep 17 00:00:00 2001 From: Pierre-Marc Fournier Date: Sat, 7 Feb 2009 12:40:28 -0500 Subject: [PATCH] add files --- libmarkers/Makefile | 4 +++ libmarkers/compiler.h | 6 +++++ libmarkers/kernelcompat.h | 56 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 libmarkers/Makefile create mode 100644 libmarkers/compiler.h create mode 100644 libmarkers/kernelcompat.h diff --git a/libmarkers/Makefile b/libmarkers/Makefile new file mode 100644 index 0000000..15fecf1 --- /dev/null +++ b/libmarkers/Makefile @@ -0,0 +1,4 @@ +all: libmarkers.so + +libmarkers.so: marker.c *.c *.h + gcc -g -fPIC -I../share -I../libtracing -shared -o libmarkers.so marker.c diff --git a/libmarkers/compiler.h b/libmarkers/compiler.h new file mode 100644 index 0000000..dd8c75a --- /dev/null +++ b/libmarkers/compiler.h @@ -0,0 +1,6 @@ +#define __printf(a,b) __attribute__((format(printf,a,b))) + +#define likely(x) __builtin_expect(!!(x), 1) +#define unlikely(x) __builtin_expect(!!(x), 0) + +#define notrace __attribute__((no_instrument_function)) diff --git a/libmarkers/kernelcompat.h b/libmarkers/kernelcompat.h new file mode 100644 index 0000000..b6615ee --- /dev/null +++ b/libmarkers/kernelcompat.h @@ -0,0 +1,56 @@ +#ifndef KERNELCOMPAT_H +#define KERNELCOMPAT_H + +#include + +#define container_of(ptr, type, member) ({ \ + const typeof( ((type *)0)->member ) *__mptr = (ptr); \ + (type *)( (char *)__mptr - offsetof(type,member) );}) + +#define KERN_DEBUG +#define KERN_NOTICE + +static inline void *ERR_PTR(long error) +{ + return (void *) error; +} + + +#include + +typedef uint16_t u16; +typedef uint32_t u32; + + +#include + +#define DEFINE_MUTEX(m) pthread_mutex_t (m) = PTHREAD_MUTEX_INITIALIZER; + +#define mutex_lock(m) pthread_mutex_lock(m) + +#define mutex_unlock(m) pthread_mutex_unlock(m) + + +#include + +#define kmalloc(s, t) malloc(s) +#define kzalloc(s, t) malloc(s) +#define kfree(p) free((void *)p) +#define kstrdup(s, t) strdup(s) + + +#include +#define printk(fmt, args...) printf(fmt, ## args) + + + +#define smp_rmb() +#define smp_wmb() + + +#define read_barrier_depends() +#define smp_read_barrier_depends() + + +#define rcu_assign_pointer(a, b) +#endif /* KERNELCOMPAT_H */ -- 2.34.1