xref: /original-bsd/lib/libc/gen/valloc.c (revision fa921481)
1 /*
2  * Copyright (c) 1980 Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  */
7 
8 #if defined(LIBC_SCCS) && !defined(lint)
9 static char sccsid[] = "@(#)valloc.c	5.4 (Berkeley) 06/01/90";
10 #endif /* LIBC_SCCS and not lint */
11 
12 char	*malloc();
13 
14 char *
15 valloc(i)
16 	int i;
17 {
18 	int valsiz = getpagesize(), j;
19 	char *cp = malloc(i + (valsiz-1));
20 
21 	j = ((int)cp + (valsiz-1)) &~ (valsiz-1);
22 	return ((char *)j);
23 }
24