xref: /onnv-gate/usr/src/lib/libc/port/sys/getpagesizes.c (revision 6812:febeba71273d)
15349Skchow /*
25349Skchow  * CDDL HEADER START
35349Skchow  *
45349Skchow  * The contents of this file are subject to the terms of the
55349Skchow  * Common Development and Distribution License (the "License").
65349Skchow  * You may not use this file except in compliance with the License.
75349Skchow  *
85349Skchow  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
95349Skchow  * or http://www.opensolaris.org/os/licensing.
105349Skchow  * See the License for the specific language governing permissions
115349Skchow  * and limitations under the License.
125349Skchow  *
135349Skchow  * When distributing Covered Code, include this CDDL HEADER in each
145349Skchow  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
155349Skchow  * If applicable, add the following below this CDDL HEADER, with the
165349Skchow  * fields enclosed by brackets "[]" replaced with your own identifying
175349Skchow  * information: Portions Copyright [yyyy] [name of copyright owner]
185349Skchow  *
195349Skchow  * CDDL HEADER END
205349Skchow  */
21*6812Sraf 
225349Skchow /*
23*6812Sraf  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
245349Skchow  * Use is subject to license terms.
255349Skchow  */
265349Skchow 
275349Skchow #pragma ident	"%Z%%M%	%I%	%E% SMI"
285349Skchow 
29*6812Sraf #include "lint.h"
305349Skchow #include <sys/types.h>
315349Skchow #include <unistd.h>
325349Skchow #include <sys/syscall.h>
335349Skchow 
345349Skchow /*
355349Skchow  * mman.h contains "#pragma redefine_extname getpagesizes getpagesizes2".
365349Skchow  * Applications that are still calling getpagesizes() instead of
375349Skchow  * getpagesizes2() are 'legacy' applications that have not been recompiled
385349Skchow  * since the #pragma redefine_extname change.
395349Skchow  *
405349Skchow  * Depending on the platform, 'legacy' applications may not be given the full
415349Skchow  * set of supported page sizes to prevent them from inadvertantly using 'new'
425349Skchow  * large pagesizes that might cause application failure or low system memory
435349Skchow  * conditions.
445349Skchow  *
455349Skchow  * The first parameter to the SYS_getpagesizes syscall is effectively
465349Skchow  * a 'legacy' boolean flag used as such in the kernel.
475349Skchow  */
485349Skchow int
getpagesizes(size_t pagesize[],int nelem)495349Skchow getpagesizes(size_t pagesize[], int nelem)
505349Skchow {
515349Skchow 	return (syscall(SYS_getpagesizes, 1, pagesize, nelem));
525349Skchow }
535349Skchow 
545349Skchow int
getpagesizes2(size_t pagesize[],int nelem)555349Skchow getpagesizes2(size_t pagesize[], int nelem)
565349Skchow {
575349Skchow 	return (syscall(SYS_getpagesizes, 0, pagesize, nelem));
585349Skchow }
59