102bc52beSkchow /*
202bc52beSkchow * CDDL HEADER START
302bc52beSkchow *
402bc52beSkchow * The contents of this file are subject to the terms of the
502bc52beSkchow * Common Development and Distribution License (the "License").
602bc52beSkchow * You may not use this file except in compliance with the License.
702bc52beSkchow *
802bc52beSkchow * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
902bc52beSkchow * or http://www.opensolaris.org/os/licensing.
1002bc52beSkchow * See the License for the specific language governing permissions
1102bc52beSkchow * and limitations under the License.
1202bc52beSkchow *
1302bc52beSkchow * When distributing Covered Code, include this CDDL HEADER in each
1402bc52beSkchow * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1502bc52beSkchow * If applicable, add the following below this CDDL HEADER, with the
1602bc52beSkchow * fields enclosed by brackets "[]" replaced with your own identifying
1702bc52beSkchow * information: Portions Copyright [yyyy] [name of copyright owner]
1802bc52beSkchow *
1902bc52beSkchow * CDDL HEADER END
2002bc52beSkchow */
21*7257d1b4Sraf
2202bc52beSkchow /*
23*7257d1b4Sraf * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
2402bc52beSkchow * Use is subject to license terms.
2502bc52beSkchow */
2602bc52beSkchow
27*7257d1b4Sraf #include "lint.h"
2802bc52beSkchow #include <sys/types.h>
2902bc52beSkchow #include <unistd.h>
3002bc52beSkchow #include <sys/syscall.h>
3102bc52beSkchow
3202bc52beSkchow /*
3302bc52beSkchow * mman.h contains "#pragma redefine_extname getpagesizes getpagesizes2".
3402bc52beSkchow * Applications that are still calling getpagesizes() instead of
3502bc52beSkchow * getpagesizes2() are 'legacy' applications that have not been recompiled
3602bc52beSkchow * since the #pragma redefine_extname change.
3702bc52beSkchow *
3802bc52beSkchow * Depending on the platform, 'legacy' applications may not be given the full
3902bc52beSkchow * set of supported page sizes to prevent them from inadvertantly using 'new'
4002bc52beSkchow * large pagesizes that might cause application failure or low system memory
4102bc52beSkchow * conditions.
4202bc52beSkchow *
4302bc52beSkchow * The first parameter to the SYS_getpagesizes syscall is effectively
4402bc52beSkchow * a 'legacy' boolean flag used as such in the kernel.
4502bc52beSkchow */
4602bc52beSkchow int
getpagesizes(size_t pagesize[],int nelem)4702bc52beSkchow getpagesizes(size_t pagesize[], int nelem)
4802bc52beSkchow {
4902bc52beSkchow return (syscall(SYS_getpagesizes, 1, pagesize, nelem));
5002bc52beSkchow }
5102bc52beSkchow
5202bc52beSkchow int
getpagesizes2(size_t pagesize[],int nelem)5302bc52beSkchow getpagesizes2(size_t pagesize[], int nelem)
5402bc52beSkchow {
5502bc52beSkchow return (syscall(SYS_getpagesizes, 0, pagesize, nelem));
5602bc52beSkchow }
57