Author: kib
Date: Wed Apr 26 14:25:01 2017
New Revision: 317436
URL: https://svnweb.freebsd.org/changeset/base/317436

Log:
  getpagesize(3) cannot fail.
  
  The sysctl(HW_PAGESIZE) call cannot fail on FreeBSD kernels at least.
  And even if it failed for some improbable reason, PAGE_SIZE is a safe
  value to return.
  
  Discussed with:       jilles
  Sponsored by: The FreeBSD Foundation
  MFC after:    1 week

Modified:
  head/lib/libc/gen/getpagesize.c

Modified: head/lib/libc/gen/getpagesize.c
==============================================================================
--- head/lib/libc/gen/getpagesize.c     Wed Apr 26 06:20:58 2017        
(r317435)
+++ head/lib/libc/gen/getpagesize.c     Wed Apr 26 14:25:01 2017        
(r317436)
@@ -69,7 +69,7 @@ getpagesize(void)
        mib[1] = HW_PAGESIZE;
        size = sizeof value;
        if (sysctl(mib, nitems(mib), &value, &size, NULL, 0) == -1)
-               return (-1);
+               return (PAGE_SIZE);
 
        return (value);
 }
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to