Use AT_PAGESZ for sysconf(_SC_PAGE_SIZE).

Bug: http://b/18342333
Change-Id: Id12ed4e85a0f35d7d27202f7792df42a65a74b4e
This commit is contained in:
Elliott Hughes 2015-07-24 23:22:07 -07:00
parent a3a619835d
commit 189394b885
2 changed files with 4 additions and 1 deletions

View File

@ -98,7 +98,8 @@ long sysconf(int name) {
case _SC_IOV_MAX: return UIO_MAXIOV;
case _SC_PAGESIZE: // Fall through, PAGESIZE and PAGE_SIZE always hold the same value.
case _SC_PAGE_SIZE: return PAGE_SIZE;
case _SC_PAGE_SIZE: return static_cast<long>(getauxval(AT_PAGESZ));
case _SC_XOPEN_UNIX: return _XOPEN_UNIX;
case _SC_AIO_LISTIO_MAX: return _POSIX_AIO_LISTIO_MAX; // Minimum requirement.
case _SC_AIO_MAX: return _POSIX_AIO_MAX; // Minimum requirement.

View File

@ -694,6 +694,8 @@ TEST(unistd, sysconf) {
VERIFY_SYSCONF_POSITIVE(_SC_IOV_MAX);
VERIFY_SYSCONF_POSITIVE(_SC_PAGESIZE);
VERIFY_SYSCONF_POSITIVE(_SC_PAGE_SIZE);
VerifySysconf(_SC_PAGE_SIZE, "_SC_PAGE_SIZE",
[](long v){return v == sysconf(_SC_PAGESIZE) && v == getpagesize();});
VERIFY_SYSCONF_POSITIVE(_SC_XOPEN_UNIX);
VERIFY_SYSCONF_POSITIVE(_SC_AIO_LISTIO_MAX);
VERIFY_SYSCONF_POSITIVE(_SC_AIO_MAX);