diff --git a/src/header/unistd/mod.rs b/src/header/unistd/mod.rs
index 6145c2c79d2b2005966e8181b05c8acb02170df0..100c9e6c8081ddd41d80b0b2c022469b3b2f2e31 100644
--- a/src/header/unistd/mod.rs
+++ b/src/header/unistd/mod.rs
@@ -1,5 +1,6 @@
 //! unistd implementation for Redox, following http://pubs.opengroup.org/onlinepubs/7908799/xsh/unistd.h.html
 
+use core::convert::TryFrom;
 use core::{mem, ptr, slice};
 
 use alloc::collections::LinkedList;
@@ -360,7 +361,21 @@ pub extern "C" fn getlogin_r(name: *mut c_char, namesize: size_t) -> c_int {
 
 #[no_mangle]
 pub extern "C" fn getpagesize() -> c_int {
-    sysconf(_SC_PAGESIZE) as c_int
+    match c_int::try_from(sysconf(_SC_PAGESIZE)) {
+        Ok(page_size) => page_size,
+        Err(_) => {
+            /* Behavior not specified by POSIX for this case. The -1
+             * value mimics sysconf()'s behavior, though.
+             *
+             * As specified for the limits.h header, the minimum
+             * acceptable value for {PAGESIZE} is 1. The -1 value thus
+             * cannot be mistaken for an acceptable value.
+             *
+             * POSIX does not specify any possible errors for this
+             * function, hence no errno setting. */
+            -1
+        }
+    }
 }
 
 // #[no_mangle]
diff --git a/tests/Makefile b/tests/Makefile
index 6ec43980308ff813fcc09ea149205e22f3f4e904..0dfc628505958a63f4e001428a5ae5a01fbababd 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -114,6 +114,7 @@ NAMES=\
 	unistd/getcwd \
 	unistd/gethostname \
 	unistd/getid \
+	unistd/getpagesize \
 	unistd/link \
 	unistd/pathconf \
 	unistd/setid \
diff --git a/tests/unistd/getpagesize.c b/tests/unistd/getpagesize.c
new file mode 100644
index 0000000000000000000000000000000000000000..f26f7be21cce998d52b7b35d4b4afe7d4d48ec25
--- /dev/null
+++ b/tests/unistd/getpagesize.c
@@ -0,0 +1,14 @@
+#include <stdio.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include "test_helpers.h"
+
+int main(void) {
+    errno = 0;
+    int getpagesize_result = getpagesize();
+    int getpagesize_errno = errno;
+    
+    printf("getpagesize(): %d, errno: %d = %s\n", getpagesize_result,
+        getpagesize_errno, strerror(getpagesize_errno));
+}