am adc5795f: Merge "Use AT_PAGESZ for sysconf(_SC_PAGE_SIZE)."

* commit 'adc5795fb7b674e6d40d1f190c675607c1379343':
  Use AT_PAGESZ for sysconf(_SC_PAGE_SIZE).
This commit is contained in:
Elliott Hughes 2015-07-25 18:58:57 +00:00 committed by Android Git Automerger
commit 7835c65ca7
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);