Commit 2d4dd93b authored by erik.corry@gmail.com's avatar erik.corry@gmail.com

Misc. portability fixes.

Review URL: http://codereview.chromium.org/42337

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1538 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent db13f138
...@@ -26,9 +26,10 @@ ...@@ -26,9 +26,10 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <v8.h> #include <v8.h>
#include <cstring> #include <fcntl.h>
#include <cstdio> #include <string.h>
#include <cstdlib> #include <stdio.h>
#include <stdlib.h>
void RunShell(v8::Handle<v8::Context> context); void RunShell(v8::Handle<v8::Context> context);
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <math.h> #include <math.h>
#include <float.h> // required for DBL_MAX and on Win32 for finite() #include <float.h> // required for DBL_MAX and on Win32 for finite()
#include <stdarg.h>
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Extra POSIX/ANSI functions for Win32/MSVC. // Extra POSIX/ANSI functions for Win32/MSVC.
......
...@@ -42,8 +42,8 @@ ...@@ -42,8 +42,8 @@
#include <sys/types.h> // mmap & munmap #include <sys/types.h> // mmap & munmap
#include <sys/mman.h> // mmap & munmap #include <sys/mman.h> // mmap & munmap
#include <sys/stat.h> // open #include <sys/stat.h> // open
#include <sys/fcntl.h> // open #include <fcntl.h> // open
#include <unistd.h> // getpagesize #include <unistd.h> // sysconf
#include <execinfo.h> // backtrace, backtrace_symbols #include <execinfo.h> // backtrace, backtrace_symbols
#include <strings.h> // index #include <strings.h> // index
#include <errno.h> #include <errno.h>
...@@ -230,14 +230,14 @@ bool OS::IsOutsideAllocatedSpace(void* address) { ...@@ -230,14 +230,14 @@ bool OS::IsOutsideAllocatedSpace(void* address) {
size_t OS::AllocateAlignment() { size_t OS::AllocateAlignment() {
return getpagesize(); return sysconf(_SC_PAGESIZE);
} }
void* OS::Allocate(const size_t requested, void* OS::Allocate(const size_t requested,
size_t* allocated, size_t* allocated,
bool executable) { bool executable) {
const size_t msize = RoundUp(requested, getpagesize()); const size_t msize = RoundUp(requested, sysconf(_SC_PAGESIZE));
int prot = PROT_READ | PROT_WRITE | (executable ? PROT_EXEC : 0); int prot = PROT_READ | PROT_WRITE | (executable ? PROT_EXEC : 0);
void* mbase = mmap(NULL, msize, prot, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); void* mbase = mmap(NULL, msize, prot, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
if (mbase == MAP_FAILED) { if (mbase == MAP_FAILED) {
......
...@@ -28,8 +28,8 @@ ...@@ -28,8 +28,8 @@
// This file was generated at 2008-11-25 16:02:40.592795 // This file was generated at 2008-11-25 16:02:40.592795
#include "unicode-inl.h" #include "unicode-inl.h"
#include <cstdlib> #include <stdlib.h>
#include <cstdio> #include <stdio.h>
namespace unibrow { namespace unibrow {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment