Merge "Use AT_PAGESZ for sysconf(_SC_PAGE_SIZE)."
This commit is contained in:
commit
adc5795fb7
2 changed files with 4 additions and 1 deletions
|
@ -98,7 +98,8 @@ long sysconf(int name) {
|
||||||
case _SC_IOV_MAX: return UIO_MAXIOV;
|
case _SC_IOV_MAX: return UIO_MAXIOV;
|
||||||
|
|
||||||
case _SC_PAGESIZE: // Fall through, PAGESIZE and PAGE_SIZE always hold the same value.
|
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_XOPEN_UNIX: return _XOPEN_UNIX;
|
||||||
case _SC_AIO_LISTIO_MAX: return _POSIX_AIO_LISTIO_MAX; // Minimum requirement.
|
case _SC_AIO_LISTIO_MAX: return _POSIX_AIO_LISTIO_MAX; // Minimum requirement.
|
||||||
case _SC_AIO_MAX: return _POSIX_AIO_MAX; // Minimum requirement.
|
case _SC_AIO_MAX: return _POSIX_AIO_MAX; // Minimum requirement.
|
||||||
|
|
|
@ -694,6 +694,8 @@ TEST(unistd, sysconf) {
|
||||||
VERIFY_SYSCONF_POSITIVE(_SC_IOV_MAX);
|
VERIFY_SYSCONF_POSITIVE(_SC_IOV_MAX);
|
||||||
VERIFY_SYSCONF_POSITIVE(_SC_PAGESIZE);
|
VERIFY_SYSCONF_POSITIVE(_SC_PAGESIZE);
|
||||||
VERIFY_SYSCONF_POSITIVE(_SC_PAGE_SIZE);
|
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_XOPEN_UNIX);
|
||||||
VERIFY_SYSCONF_POSITIVE(_SC_AIO_LISTIO_MAX);
|
VERIFY_SYSCONF_POSITIVE(_SC_AIO_LISTIO_MAX);
|
||||||
VERIFY_SYSCONF_POSITIVE(_SC_AIO_MAX);
|
VERIFY_SYSCONF_POSITIVE(_SC_AIO_MAX);
|
||||||
|
|
Loading…
Reference in a new issue