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