diff options
author | Frank Ch. Eigler <fche@elastic.org> | 2007-10-10 13:58:43 -0400 |
---|---|---|
committer | Frank Ch. Eigler <fche@elastic.org> | 2007-10-10 13:58:43 -0400 |
commit | 36c24cdba10c3d20638c78b52cc8e327a3a0b82d (patch) | |
tree | 24cbeb006365fdaa21dbf9cf3b44eae055684123 /runtime/user/alloc.c | |
parent | 38d7fc30b108ec4a9e74ddb33d945cce1bd5c4c6 (diff) | |
parent | d319669c3f77a3e451f1cad845471433e6d0dbfa (diff) | |
download | systemtap-steved-36c24cdba10c3d20638c78b52cc8e327a3a0b82d.tar.gz systemtap-steved-36c24cdba10c3d20638c78b52cc8e327a3a0b82d.tar.xz systemtap-steved-36c24cdba10c3d20638c78b52cc8e327a3a0b82d.zip |
Merge branch 'master' of git://sources.redhat.com/git/systemtap
Diffstat (limited to 'runtime/user/alloc.c')
-rw-r--r-- | runtime/user/alloc.c | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/runtime/user/alloc.c b/runtime/user/alloc.c deleted file mode 100644 index 361e7d98..00000000 --- a/runtime/user/alloc.c +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef _ALLOC_C_ -#define _ALLOC_C_ - -/* emulated memory allocation functions */ - -void *malloc(size_t size); -void free(void *ptr); - -enum errorcode { ERR_NONE=0, ERR_NO_MEM }; -enum errorcode _stp_errorcode = ERR_NONE; - -void *__kmalloc(size_t size, gfp_t flags) -{ - return malloc(size); -} - -void *_stp_alloc_percpu(size_t size) -{ - int i; - struct percpu_data *pdata = malloc(sizeof (*pdata)); - if (!pdata) - return NULL; - - for_each_cpu(i) { - pdata->ptrs[i] = malloc(size); - if (!pdata->ptrs[i]) - goto unwind_oom; - memset(pdata->ptrs[i], 0, size); - } - - /* Catch derefs w/o wrappers */ - return (void *) (~(unsigned long) pdata); - -unwind_oom: - while (--i >= 0) { - free(pdata->ptrs[i]); - } - free(pdata); - return NULL; -} - -void _stp_free_percpu(const void *objp) -{ - int i; - struct percpu_data *p = (struct percpu_data *) (~(unsigned long) objp); - - for_each_cpu(i) - free(p->ptrs[i]); - free(p); -} - -#endif /* _ALLOC_C_ */ |