1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00

Optimize __getpagesize a bit.

This commit is contained in:
Ulrich Drepper
2010-03-27 06:19:50 -07:00
parent 0a164fe03e
commit 8f4a5048ee
2 changed files with 20 additions and 10 deletions

View File

@ -1,5 +1,8 @@
2010-03-27 Ulrich Drepper <drepper@redhat.com> 2010-03-27 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/getpagesize.c (__getpagesize): If
__ASSUME_AT_PAGESIZE we can rely on the value being set.
* include/wchar.h: Undefine __need_mbstate_t and __need_wint_t * include/wchar.h: Undefine __need_mbstate_t and __need_wint_t
unconditionally in the end. unconditionally in the end.

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991,1992,1995-1997,2000,2002,2004 /* Copyright (C) 1991,1992,1995-1997,2000,2002,2004,2010
Free Software Foundation, Inc. Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
@ -17,30 +17,37 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */ 02111-1307 USA. */
#include <assert.h>
#include <unistd.h> #include <unistd.h>
#include <sys/param.h> #include <sys/param.h>
#include <ldsodefs.h> #include <ldsodefs.h>
#include <kernel-features.h>
/* Return the system page size. */ /* Return the system page size. */
int int
__getpagesize () __getpagesize ()
{ {
#ifdef __ASSUME_AT_PAGESIZE
assert (GLRO(dl_pagesize) != 0);
return GLRO(dl_pagesize);
#else
if (GLRO(dl_pagesize) != 0) if (GLRO(dl_pagesize) != 0)
return GLRO(dl_pagesize); return GLRO(dl_pagesize);
#ifdef EXEC_PAGESIZE # ifdef EXEC_PAGESIZE
return EXEC_PAGESIZE; return EXEC_PAGESIZE;
#else /* No EXEC_PAGESIZE. */ # else /* No EXEC_PAGESIZE. */
#ifdef NBPG # ifdef NBPG
#ifndef CLSIZE # ifndef CLSIZE
#define CLSIZE 1 # define CLSIZE 1
#endif /* No CLSIZE. */ # endif /* No CLSIZE. */
return NBPG * CLSIZE; return NBPG * CLSIZE;
#else /* No NBPG. */ # else /* No NBPG. */
return NBPC; return NBPC;
#endif /* NBPG. */ # endif /* NBPG. */
#endif /* EXEC_PAGESIZE. */ # endif /* EXEC_PAGESIZE. */
#endif
} }
libc_hidden_def (__getpagesize) libc_hidden_def (__getpagesize)
weak_alias (__getpagesize, getpagesize) weak_alias (__getpagesize, getpagesize)