summaryrefslogtreecommitdiffstats
path: root/runtime/alloc.c
diff options
context:
space:
mode:
authorhunt <hunt>2005-07-01 19:05:46 +0000
committerhunt <hunt>2005-07-01 19:05:46 +0000
commit5c826f9de142a9d4558e0b3aefab9c90d70c8c54 (patch)
tree0c74c4aa71cf3d437604baf86efaaa2207d51785 /runtime/alloc.c
parenteb703a46c2c7118700a54f632d8eb3ae03c61681 (diff)
downloadsystemtap-steved-5c826f9de142a9d4558e0b3aefab9c90d70c8c54.tar.gz
systemtap-steved-5c826f9de142a9d4558e0b3aefab9c90d70c8c54.tar.xz
systemtap-steved-5c826f9de142a9d4558e0b3aefab9c90d70c8c54.zip
2005-07-01 Martin Hunt <hunt@redhat.com>
* alloc.c (_stp_alloc): Call _stp_error(). (_stp_valloc): Ditto. * io.c (_stp_warn): New function. (_stp_exit): New function. (_stp_error): New function. (_stp_dbug): New function. * runtime.h (dbug): Call _stp_dbug() if DEBUG is defined.
Diffstat (limited to 'runtime/alloc.c')
-rw-r--r--runtime/alloc.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/runtime/alloc.c b/runtime/alloc.c
index 480484d3..c9fb8354 100644
--- a/runtime/alloc.c
+++ b/runtime/alloc.c
@@ -1,4 +1,13 @@
-#ifndef _ALLOC_C_ /* -*- linux-c -*- */
+/* Memory allocation functions
+ * Copyright (C) 2005 Red Hat Inc.
+ *
+ * This file is part of systemtap, and is free software. You can
+ * redistribute it and/or modify it under the terms of the GNU General
+ * Public License (GPL); either version 2, or (at your option) any
+ * later version.
+ */
+
+#ifndef _ALLOC_C_
#define _ALLOC_C_
/** @file alloc.c
@@ -9,13 +18,9 @@
* that memory allocation errors will call a handler. The default will
* send a signal to the user-space daemon that will trigger the module to
* be unloaded.
- * @todo Need error handling for memory allocations
* @{
*/
-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.
@@ -28,7 +33,7 @@ void *_stp_alloc(size_t len)
{
void *ptr = kmalloc(len, GFP_ATOMIC);
if (unlikely(ptr == NULL))
- _stp_error = ERR_NO_MEM;
+ _stp_error("_stp_alloc failed.\n");
return ptr;
}
@@ -61,7 +66,7 @@ void *_stp_valloc(size_t len)
if (likely(ptr))
memset(ptr, 0, len);
else
- _stp_error = ERR_NO_MEM;
+ _stp_error("_stp_valloc failed.\n");
return ptr;
}