From: Christopher Dykes <cdykes@fb.com> Date: Wed, 21 Dec 2016 21:04:24 +0000 (-0800) Subject: Fix the return type for sysconf in the unistd portability header X-Git-Tag: v2017.03.06.00~174 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=b9e7600760578ea5bd09fbfd1d98a91663a57c34;p=folly.git Fix the return type for sysconf in the unistd portability header Summary: It was incorrectly typed. Reviewed By: yfeldblum Differential Revision: D4351015 fbshipit-source-id: b0114d536db66ff4429fa135e9ed7b2051a42d6e --- diff --git a/folly/portability/Unistd.cpp b/folly/portability/Unistd.cpp index df382dca..c83688a0 100755 --- a/folly/portability/Unistd.cpp +++ b/folly/portability/Unistd.cpp @@ -235,20 +235,20 @@ unsigned int sleep(unsigned int seconds) { return 0; } -size_t sysconf(int tp) { +long sysconf(int tp) { switch (tp) { case _SC_PAGESIZE: { SYSTEM_INFO inf; GetSystemInfo(&inf); - return (size_t)inf.dwPageSize; + return (long)inf.dwPageSize; } case _SC_NPROCESSORS_ONLN: { SYSTEM_INFO inf; GetSystemInfo(&inf); - return (size_t)inf.dwNumberOfProcessors; + return (long)inf.dwNumberOfProcessors; } default: - return (size_t)-1; + return -1L; } } diff --git a/folly/portability/Unistd.h b/folly/portability/Unistd.h index 364fca9d..6e99fdfd 100755 --- a/folly/portability/Unistd.h +++ b/folly/portability/Unistd.h @@ -78,7 +78,7 @@ ssize_t readlink(const char* path, char* buf, size_t buflen); int setmode(int fh, int md); void* sbrk(intptr_t i); unsigned int sleep(unsigned int seconds); -size_t sysconf(int tp); +long sysconf(int tp); long tell(int fh); int truncate(const char* path, off_t len); int usleep(unsigned int ms);