diff options
Diffstat (limited to 'io.c')
| -rw-r--r-- | io.c | 23 |
1 files changed, 15 insertions, 8 deletions
@@ -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; |