From b9c556e44326b40b2c927a0a5b5626332a8c9587 Mon Sep 17 00:00:00 2001 From: hunt Date: Tue, 22 Mar 2005 08:57:11 +0000 Subject: *** empty log message *** --- runtime/docs/html/alloc_8h-source.html | 124 ++++++++++++++++++++------------- 1 file changed, 77 insertions(+), 47 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 42be2b62..7d2a3310 100644 --- a/runtime/docs/html/alloc_8h-source.html +++ b/runtime/docs/html/alloc_8h-source.html @@ -1,53 +1,83 @@ -SystemTap: SystemTap Runtime Library +SystemTap: alloc.h Source File -
Intro | Functions | Defines | Enumerations | Enumeration Values
- -

alloc.h

Go to the documentation of this file.
00001 enum errorcode { ERR_NONE=0, ERR_NO_MEM };
-00002 enum errorcode _stp_error = ERR_NONE;
-00003 
-00012 inline void *_stp_alloc(size_t len)
-00013 {
-00014         void *ptr = kmalloc(len, GFP_ATOMIC);
-00015         if (ptr == NULL)
-00016                 _stp_error = ERR_NO_MEM;
-00017         return ptr;
-00018 }
-00019 
-00028 inline void *_stp_calloc(size_t len)
-00029 {
-00030         void *ptr = _stp_alloc(len);
-00031         if (ptr)
-00032                 memset(ptr, 0, len);
-00033         return ptr;
-00034 }
-00035 
-00043 inline void *_stp_valloc(size_t len)
-00044 {
-00045         void *ptr = vmalloc(len);
-00046         if (ptr)
-00047                 memset(ptr, 0, len);
-00048         else
-00049                 _stp_error = ERR_NO_MEM;
-00050         return ptr;
-00051 }
-00052 
-00057 inline void _stp_free(void *ptr)
-00058 {
-00059         if (ptr)
-00060                 kfree(ptr);
-00061 }
-00062 
-00067 inline void _stp_vfree(void *ptr)
-00068 {
-00069         if (ptr)
-00070                 vfree(ptr);
-00071 }
-

Generated on Mon Mar 21 13:29:45 2005 for SystemTap by  - -doxygen 1.4.1
- +
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 }
+

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