aboutsummaryrefslogtreecommitdiffhomepage
path: root/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'io.c')
-rw-r--r--io.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/io.c b/io.c
index 9156d27..cc94a08 100644
--- a/io.c
+++ b/io.c
@@ -671,14 +671,6 @@ Err:
}
void
-_assertfmt(const char *file, int line, const char *func, const char *expr)
-{
- ioflush(&bstdout);
- efmt("%s:%d: %s: Assertion `%s' failed.\n", file, line, func, expr);
- ioflush(&bstderr);
-}
-
-void
mapclose(struct memfile *f)
{
assert(f->p);
@@ -686,6 +678,21 @@ mapclose(struct memfile *f)
memset(f, 0, sizeof *f);
}
+void *
+mapzeros(uint N)
+{
+ void *p = mmap(NULL, N, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
+ return p == MAP_FAILED ? NULL : p;
+}
+
+void
+_assertfmt(const char *file, int line, const char *func, const char *expr)
+{
+ ioflush(&bstdout);
+ efmt("%s:%d: %s: Assertion `%s' failed.\n", file, line, func, expr);
+ ioflush(&bstderr);
+}
+
static struct file {
const char *path;
struct memfile f;