diff options
author | peter <peter@FreeBSD.org> | 1996-08-20 23:46:10 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1996-08-20 23:46:10 +0000 |
commit | 8982e501c77217c860f79bba431f46a62b607a21 (patch) | |
tree | 70187fdf5be4cbefd0baf46bddac7e5e32c13c24 /contrib/cvs/lib/valloc.c | |
parent | 01ee40fd6a76f6ff7ef247fc1b2cf6e337f216c5 (diff) | |
download | FreeBSD-src-8982e501c77217c860f79bba431f46a62b607a21.zip FreeBSD-src-8982e501c77217c860f79bba431f46a62b607a21.tar.gz |
Import of slightly trimmed cvs-1.8 distribution. Generated files
and non-unix code has been left out.
Diffstat (limited to 'contrib/cvs/lib/valloc.c')
-rw-r--r-- | contrib/cvs/lib/valloc.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/contrib/cvs/lib/valloc.c b/contrib/cvs/lib/valloc.c new file mode 100644 index 0000000..674b60f --- /dev/null +++ b/contrib/cvs/lib/valloc.c @@ -0,0 +1,25 @@ +/* valloc -- return memory aligned to the page size. */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "system.h" + +#ifndef HAVE_GETPAGESIZE +#define getpagesize() 4096 +#endif + +void * +valloc (bytes) + size_t bytes; +{ + long pagesize; + char *ret; + + pagesize = getpagesize (); + ret = (char *) malloc (bytes + pagesize - 1); + if (ret) + ret = (char *) ((long) (ret + pagesize - 1) &~ (pagesize - 1)); + return ret; +} |