xref: /csrg-svn/lib/libc/gen/valloc.c (revision 35312)
121366Sdist /*
221366Sdist  * Copyright (c) 1980 Regents of the University of California.
3*35312Sbostic  * All rights reserved.
4*35312Sbostic  *
5*35312Sbostic  * Redistribution and use in source and binary forms are permitted
6*35312Sbostic  * provided that the above copyright notice and this paragraph are
7*35312Sbostic  * duplicated in all such forms and that any documentation,
8*35312Sbostic  * advertising materials, and other materials related to such
9*35312Sbostic  * distribution and use acknowledge that the software was developed
10*35312Sbostic  * by the University of California, Berkeley.  The name of the
11*35312Sbostic  * University may not be used to endorse or promote products derived
12*35312Sbostic  * from this software without specific prior written permission.
13*35312Sbostic  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14*35312Sbostic  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15*35312Sbostic  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
1621366Sdist  */
1721366Sdist 
1826611Sdonn #if defined(LIBC_SCCS) && !defined(lint)
19*35312Sbostic static char sccsid[] = "@(#)valloc.c	5.3 (Berkeley) 08/03/88";
20*35312Sbostic #endif /* LIBC_SCCS and not lint */
211996Swnj 
221996Swnj char	*malloc();
231996Swnj 
241996Swnj char *
251996Swnj valloc(i)
261996Swnj 	int i;
271996Swnj {
2813564Ssam 	int valsiz = getpagesize(), j;
2913582Ssam 	char *cp = malloc(i + (valsiz-1));
301996Swnj 
3113564Ssam 	j = ((int)cp + (valsiz-1)) &~ (valsiz-1);
321996Swnj 	return ((char *)j);
331996Swnj }
34