summaryrefslogtreecommitdiff
path: root/utils/ld/Plan9.c
diff options
context:
space:
mode:
authorforsyth <forsyth@lavoro.terzarima.net>2013-06-03 21:01:14 +0000
committerforsyth <forsyth@lavoro.terzarima.net>2013-06-03 21:01:14 +0000
commit45a20ab721a513710138340faff3d59a31c3e01e (patch)
treeeea29d2684c51cc73725b8992a2125bede48e118 /utils/ld/Plan9.c
parentcd8e99851af33e52bcdf8faf34f9d4e62fa0cbaf (diff)
sync compilers with Plan 9
remove 1[acl] 2[acl]
Diffstat (limited to 'utils/ld/Plan9.c')
-rw-r--r--utils/ld/Plan9.c66
1 files changed, 66 insertions, 0 deletions
diff --git a/utils/ld/Plan9.c b/utils/ld/Plan9.c
new file mode 100644
index 00000000..ef08b158
--- /dev/null
+++ b/utils/ld/Plan9.c
@@ -0,0 +1,66 @@
+#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)
+{
+}
+
+int
+fileexists(char *s)
+{
+ uchar dirbuf[400];
+
+ /* it's fine if stat result doesn't fit in dirbuf, since even then the file exists */
+ return stat(s, dirbuf, sizeof(dirbuf)) >= 0;
+}