summaryrefslogtreecommitdiffstats
path: root/runtime/alloc.h
diff options
context:
space:
mode:
authorhunt <hunt>2005-03-29 18:07:58 +0000
committerhunt <hunt>2005-03-29 18:07:58 +0000
commite32551b18f4560056d2d482f5e1505b1b98fa82a (patch)
tree4e9e07a9b46a4fd5dea27732571cbb04c0ef5dee /runtime/alloc.h
parent13b35bb112459702e7371ecc89d7deb789818a86 (diff)
downloadsystemtap-steved-e32551b18f4560056d2d482f5e1505b1b98fa82a.tar.gz
systemtap-steved-e32551b18f4560056d2d482f5e1505b1b98fa82a.tar.xz
systemtap-steved-e32551b18f4560056d2d482f5e1505b1b98fa82a.zip
*** empty log message ***
Diffstat (limited to 'runtime/alloc.h')
-rw-r--r--runtime/alloc.h77
1 files changed, 0 insertions, 77 deletions
diff --git a/runtime/alloc.h b/runtime/alloc.h
deleted file mode 100644
index b6abc848..00000000
--- a/runtime/alloc.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* -*- linux-c -*- */
-/** @file alloc.h
- * @brief Memory allocation functions.
- * @todo Should really be alloc.c for consistency.
- */
-
-enum errorcode { ERR_NONE=0, ERR_NO_MEM };
-enum errorcode _stp_error = 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 = kmalloc(len, GFP_ATOMIC);
- if (unlikely(ptr == NULL))
- _stp_error = ERR_NO_MEM;
- return ptr;
-}
-
-/** 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 = _stp_alloc(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 = vmalloc(len);
- if (likely(ptr))
- memset(ptr, 0, len);
- else
- _stp_error = ERR_NO_MEM;
- return ptr;
-}
-
-/** Frees memory allocated by _stp_alloc or _stp_calloc.
- * @param ptr pointer to memory to free
- */
-
-void _stp_free(void *ptr)
-{
- if (likely(ptr))
- kfree(ptr);
-}
-
-/** Frees memory allocated by _stp_valloc.
- * @param ptr pointer to memory to free
- */
-
-void _stp_vfree(void *ptr)
-{
- if (likely(ptr))
- vfree(ptr);
-}