summaryrefslogtreecommitdiff
path: root/utils/kl/Plan9.c
diff options
context:
space:
mode:
authorCharles.Forsyth <devnull@localhost>2006-12-22 21:39:35 +0000
committerCharles.Forsyth <devnull@localhost>2006-12-22 21:39:35 +0000
commit74a4d8c26dd3c1e9febcb717cfd6cb6512991a7a (patch)
treec6e220ba61db3a6ea4052e6841296d829654e664 /utils/kl/Plan9.c
parent46439007cf417cbd9ac8049bb4122c890097a0fa (diff)
20060303
Diffstat (limited to 'utils/kl/Plan9.c')
-rw-r--r--utils/kl/Plan9.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/utils/kl/Plan9.c b/utils/kl/Plan9.c
new file mode 100644
index 00000000..f4cf23f4
--- /dev/null
+++ b/utils/kl/Plan9.c
@@ -0,0 +1,57 @@
+#include "l.h"
+
+/*
+ * fake malloc
+ */
+void*
+malloc(ulong n)
+{
+ void *p;
+
+ while(n & 7)
+ n++;
+ while(nhunk < n)
+ gethunk();
+ p = hunk;
+ nhunk -= n;
+ hunk += n;
+ return p;
+}
+
+void
+free(void *p)
+{
+ USED(p);
+}
+
+void*
+calloc(ulong m, ulong n)
+{
+ void *p;
+
+ n *= m;
+ p = malloc(n);
+ memset(p, 0, n);
+ return p;
+}
+
+void*
+realloc(void *p, ulong n)
+{
+ USED(p);
+ USED(n);
+ fprint(2, "realloc called\n");
+ abort();
+ return 0;
+}
+
+void*
+mysbrk(ulong size)
+{
+ return sbrk(size);
+}
+
+void
+setmalloctag(void*, ulong)
+{
+}