diff options
author | hunt <hunt> | 2005-12-07 20:05:59 +0000 |
---|---|---|
committer | hunt <hunt> | 2005-12-07 20:05:59 +0000 |
commit | 24d3d033246170e700172532e0fddcd6448d8c56 (patch) | |
tree | 37da96fdfe620b08f6d332dfdfd781999d8b5118 /runtime | |
parent | 953c5ad1c72d55e3c017e7975becfa175ccdf7f5 (diff) | |
download | systemtap-steved-24d3d033246170e700172532e0fddcd6448d8c56.tar.gz systemtap-steved-24d3d033246170e700172532e0fddcd6448d8c56.tar.xz systemtap-steved-24d3d033246170e700172532e0fddcd6448d8c56.zip |
2005-12-07 Martin Hunt <hunt@redhat.com>
* alloc.c: Remove all unused functions.
* io.c: Add vprintf() prototype.
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/user/ChangeLog | 5 | ||||
-rw-r--r-- | runtime/user/alloc.c | 98 | ||||
-rw-r--r-- | runtime/user/io.c | 1 |
3 files changed, 9 insertions, 95 deletions
diff --git a/runtime/user/ChangeLog b/runtime/user/ChangeLog index 2cad6671..f55340f2 100644 --- a/runtime/user/ChangeLog +++ b/runtime/user/ChangeLog @@ -1,3 +1,8 @@ +2005-12-07 Martin Hunt <hunt@redhat.com> + + * alloc.c: Remove all unused functions. + * io.c: Add vprintf() prototype. + 2005-11-29 Martin Hunt <hunt@redhat.com> * recreate_links: Remove links to deleted files. diff --git a/runtime/user/alloc.c b/runtime/user/alloc.c index 2691a36a..9ba720ab 100644 --- a/runtime/user/alloc.c +++ b/runtime/user/alloc.c @@ -1,21 +1,7 @@ #ifndef _ALLOC_C_ #define _ALLOC_C_ -/* -*- linux-c -*- */ -/** @file alloc.c - * @brief Memory functions. - */ -/** @addtogroup alloc Memory Functions - * Basic malloc/calloc/free functions. These will be changed so - * that memory allocation errors will call a handler. The default will - * send a signal to the user-space daemon that will trigger the module to - * be unloaded. - * @todo Need error handling for memory allocations - * @todo Some of these currently use kmalloc (GFP_ATOMIC) for - * small allocations. This should be evaluated for performance - * and stability. - * @{ - */ +/* emulated memory allocation functions */ void *malloc(size_t size); void free(void *ptr); @@ -23,87 +9,9 @@ void free(void *ptr); enum errorcode { ERR_NONE=0, ERR_NO_MEM }; enum errorcode _stp_errorcode = ERR_NONE; -/** Allocates memory within a probe. - * This is used for small allocations from within a running - * probe where the process cannot sleep. - * @param len Number of bytes to allocate. - * @return a valid pointer on success or NULL on failure. - * @bug Currently uses kmalloc (GFP_ATOMIC). - */ - -void *_stp_alloc(size_t len) -{ - void *ptr = malloc(len); - if (unlikely(ptr == NULL)) - _stp_errorcode = ERR_NO_MEM; - return ptr; -} -#define _stp_alloc_cpu(len, cpu) _stp_alloc(len) - -/** Allocates and clears memory within a probe. - * This is used for small allocations from within a running - * probe where the process cannot sleep. - * @param len Number of bytes to allocate. - * @return a valid pointer on success or NULL on failure. - * @bug Currently uses kmalloc (GFP_ATOMIC). - */ - -void *_stp_calloc(size_t len) -{ - void *ptr = malloc(len); - if (likely(ptr)) - memset(ptr, 0, len); - return ptr; -} - -/** Allocates and clears memory outside a probe. - * This is typically used in the module initialization to - * allocate new maps, lists, etc. - * @param len Number of bytes to allocate. - * @return a valid pointer on success or NULL on failure. - */ - -void *_stp_valloc(size_t len) -{ - void *ptr = malloc(len); - if (likely(ptr)) - memset(ptr, 0, len); - else - _stp_errorcode = ERR_NO_MEM; - return ptr; -} -#define _stp_valloc_cpu(len, cpu) _stp_valloc(len) -#define __stp_valloc_percpu(size,align) __alloc_percpu(size,align) -#define _stp_vfree_percpu(objp) free_percpu(objp) -#define _stp_valloc_percpu(type) \ - ((type *)(__stp_valloc_percpu(sizeof(type), __alignof__(type)))) -#define _stp_percpu_dptr(ptr) (((struct percpu_data *)~(unsigned long)(ptr))->blkp) -#define _stp_per_cpu_ptr(ptr, cpu) \ -({ \ - struct percpu_data *__p = (struct percpu_data *)~(unsigned long)(ptr); \ - (__typeof__(ptr))__p->ptrs[(cpu)]; \ -}) - - -/** Frees memory allocated by _stp_alloc or _stp_calloc. - * @param ptr pointer to memory to free - */ - -void _stp_free(void *ptr) -{ - if (likely(ptr)) - free(ptr); -} - -/** Frees memory allocated by _stp_valloc. - * @param ptr pointer to memory to free - */ - -void _stp_vfree(void *ptr) +void *__kmalloc(size_t size, gfp_t flags) { - if (likely(ptr)) - free(ptr); + return malloc(size); } -/** @} */ #endif /* _ALLOC_C_ */ diff --git a/runtime/user/io.c b/runtime/user/io.c index 2da0de82..ff4a06a7 100644 --- a/runtime/user/io.c +++ b/runtime/user/io.c @@ -9,6 +9,7 @@ #ifndef _IO_C_ #define _IO_C_ +int vprintf(const char *format, va_list ap); /** Logs Data. * This function sends the message immediately to stpd. It |