macro and text revision (-mdoc version 3)
[unix-history] / usr / src / lib / libc / gen / valloc.c
CommitLineData
bb0cfa24
DF
1/*
2 * Copyright (c) 1980 Regents of the University of California.
21fad3ef
KB
3 * All rights reserved.
4 *
269a7923 5 * %sccs.include.redist.c%
bb0cfa24
DF
6 */
7
2ce81398 8#if defined(LIBC_SCCS) && !defined(lint)
c5980113 9static char sccsid[] = "@(#)valloc.c 5.5 (Berkeley) %G%";
21fad3ef 10#endif /* LIBC_SCCS and not lint */
feea7534 11
c5980113
DS
12#include <stdlib.h>
13#include <unistd.h>
feea7534 14
c5980113 15void *
feea7534 16valloc(i)
c5980113 17 size_t i;
feea7534 18{
8b4f574e 19 int valsiz = getpagesize(), j;
c5980113 20 void *cp = malloc(i + (valsiz-1));
feea7534 21
8b4f574e 22 j = ((int)cp + (valsiz-1)) &~ (valsiz-1);
c5980113 23 return ((void *)j);
feea7534 24}