From e94cb46c2219da504a559d49eeda3e4134b96453 Mon Sep 17 00:00:00 2001 From: hunt Date: Tue, 22 Mar 2005 18:36:50 +0000 Subject: *** empty log message *** --- runtime/docs/html/alloc_8h-source.html | 152 +++++++++++++++++---------------- 1 file changed, 78 insertions(+), 74 deletions(-) (limited to 'runtime/docs/html/alloc_8h-source.html') diff --git a/runtime/docs/html/alloc_8h-source.html b/runtime/docs/html/alloc_8h-source.html index 7d2a3310..e68fbb86 100644 --- a/runtime/docs/html/alloc_8h-source.html +++ b/runtime/docs/html/alloc_8h-source.html @@ -5,79 +5,83 @@
Main Page | Data Structures | Directories | File List | Data Fields | Globals | Related Pages
-

alloc.h

00001 /* -*- linux-c -*- */
-00002 
-00003 enum errorcode { ERR_NONE=0, ERR_NO_MEM };
-00004 enum errorcode _stp_error = ERR_NONE;
-00005 
-00006 /** Allocates memory within a probe.
-00007  * This is used for small allocations from within a running
-00008  * probe where the process cannot sleep. 
-00009  * @param len Number of bytes to allocate.
-00010  * @return a valid pointer on success or NULL on failure.
-00011  * @bug Currently uses kmalloc (GFP_ATOMIC).
-00012  */
-00013 
-00014 void *_stp_alloc(size_t len)
-00015 {
-00016         void *ptr = kmalloc(len, GFP_ATOMIC);
-00017         if (unlikely(ptr == NULL))
-00018                 _stp_error = ERR_NO_MEM;
-00019         return ptr;
-00020 }
-00021 
-00022 /** Allocates and clears memory within a probe.
-00023  * This is used for small allocations from within a running
-00024  * probe where the process cannot sleep. 
-00025  * @param len Number of bytes to allocate.
-00026  * @return a valid pointer on success or NULL on failure.
-00027  * @bug Currently uses kmalloc (GFP_ATOMIC).
-00028  */
-00029 
-00030 void *_stp_calloc(size_t len)
-00031 {
-00032         void *ptr = _stp_alloc(len);
-00033         if (likely(ptr))
-00034                 memset(ptr, 0, len);
-00035         return ptr;
-00036 }
-00037 
-00038 /** Allocates and clears memory outside a probe.
-00039  * This is typically used in the module initialization to
-00040  * allocate new maps, lists, etc.
-00041  * @param len Number of bytes to allocate.
-00042  * @return a valid pointer on success or NULL on failure.
-00043  */
-00044 
-00045 void *_stp_valloc(size_t len)
-00046 {
-00047         void *ptr = vmalloc(len);
-00048         if (likely(ptr))
-00049                 memset(ptr, 0, len);
-00050         else
-00051                 _stp_error = ERR_NO_MEM;
-00052         return ptr;
-00053 }
-00054 
-00055 /** Frees memory allocated by _stp_alloc or _stp_calloc.
-00056  * @param ptr pointer to memory to free
-00057  */
-00058 
-00059 void _stp_free(void *ptr)
-00060 {
-00061         if (likely(ptr))
-00062                 kfree(ptr);
-00063 }
-00064 
-00065 /** Frees memory allocated by _stp_valloc.
-00066  * @param ptr pointer to memory to free
-00067  */
-00068 
-00069 void _stp_vfree(void *ptr)
-00070 {
-00071         if (likely(ptr))
-00072                 vfree(ptr);
-00073 }
+

alloc.h

Go to the documentation of this file.
00001 /* -*- linux-c -*- */
+00002 /** @file alloc.h
+00003  * @brief Memory allocation functions.
+00004  * @todo Should really be alloc.c for consistency.
+00005  */
+00006 
+00007 enum errorcode { ERR_NONE=0, ERR_NO_MEM };
+00008 enum errorcode _stp_error = ERR_NONE;
+00009 
+00010 /** Allocates memory within a probe.
+00011  * This is used for small allocations from within a running
+00012  * probe where the process cannot sleep. 
+00013  * @param len Number of bytes to allocate.
+00014  * @return a valid pointer on success or NULL on failure.
+00015  * @bug Currently uses kmalloc (GFP_ATOMIC).
+00016  */
+00017 
+00018 void *_stp_alloc(size_t len)
+00019 {
+00020         void *ptr = kmalloc(len, GFP_ATOMIC);
+00021         if (unlikely(ptr == NULL))
+00022                 _stp_error = ERR_NO_MEM;
+00023         return ptr;
+00024 }
+00025 
+00026 /** Allocates and clears memory within a probe.
+00027  * This is used for small allocations from within a running
+00028  * probe where the process cannot sleep. 
+00029  * @param len Number of bytes to allocate.
+00030  * @return a valid pointer on success or NULL on failure.
+00031  * @bug Currently uses kmalloc (GFP_ATOMIC).
+00032  */
+00033 
+00034 void *_stp_calloc(size_t len)
+00035 {
+00036         void *ptr = _stp_alloc(len);
+00037         if (likely(ptr))
+00038                 memset(ptr, 0, len);
+00039         return ptr;
+00040 }
+00041 
+00042 /** Allocates and clears memory outside a probe.
+00043  * This is typically used in the module initialization to
+00044  * allocate new maps, lists, etc.
+00045  * @param len Number of bytes to allocate.
+00046  * @return a valid pointer on success or NULL on failure.
+00047  */
+00048 
+00049 void *_stp_valloc(size_t len)
+00050 {
+00051         void *ptr = vmalloc(len);
+00052         if (likely(ptr))
+00053                 memset(ptr, 0, len);
+00054         else
+00055                 _stp_error = ERR_NO_MEM;
+00056         return ptr;
+00057 }
+00058 
+00059 /** Frees memory allocated by _stp_alloc or _stp_calloc.
+00060  * @param ptr pointer to memory to free
+00061  */
+00062 
+00063 void _stp_free(void *ptr)
+00064 {
+00065         if (likely(ptr))
+00066                 kfree(ptr);
+00067 }
+00068 
+00069 /** Frees memory allocated by _stp_valloc.
+00070  * @param ptr pointer to memory to free
+00071  */
+00072 
+00073 void _stp_vfree(void *ptr)
+00074 {
+00075         if (likely(ptr))
+00076                 vfree(ptr);
+00077 }
 

-Generated on Tue Mar 22 00:32:02 2005 for SystemTap. +Generated on Tue Mar 22 10:27:36 2005 for SystemTap. -- cgit