about summary refs log tree commit diff
path: root/src/rt
diff options
context:
space:
mode:
authorJyun-Yan You <jyyou@cs.nctu.edu.tw>2012-02-09 14:08:24 +0800
committerBrian Anderson <banderson@mozilla.com>2012-02-09 18:41:57 -0800
commitb778dac1976c3d4f33bf8ee8c7c3208ca8af2563 (patch)
treeb0333951d4303a493e50de070a9507cb1092ecee /src/rt
parent372cf4954c501b8a2068cfceaa826ead77f377fd (diff)
downloadrust-b778dac1976c3d4f33bf8ee8c7c3208ca8af2563.tar.gz
rust-b778dac1976c3d4f33bf8ee8c7c3208ca8af2563.zip
fix build on freebsd
Diffstat (limited to 'src/rt')
-rw-r--r--src/rt/rust_builtin.cpp4
-rw-r--r--src/rt/rust_kernel.cpp5
-rw-r--r--src/rt/rust_kernel.h2
-rw-r--r--src/rt/rust_run_program.cpp7
4 files changed, 17 insertions, 1 deletions
diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp
index 19295167518..65e5b82f505 100644
--- a/src/rt/rust_builtin.cpp
+++ b/src/rt/rust_builtin.cpp
@@ -15,6 +15,10 @@
 #include <sys/time.h>
 #endif
 
+#ifdef __FreeBSD__
+extern char **environ;
+#endif
+
 extern "C" CDECL rust_str*
 last_os_error() {
     rust_task *task = rust_task_thread::get_task();
diff --git a/src/rt/rust_kernel.cpp b/src/rt/rust_kernel.cpp
index d014877c278..e210289cdb8 100644
--- a/src/rt/rust_kernel.cpp
+++ b/src/rt/rust_kernel.cpp
@@ -1,3 +1,8 @@
+// A workaround that makes INTPTR_MAX be visible
+#ifdef __FreeBSD__
+#define __STDC_LIMIT_MACROS 1
+#endif
+
 #include <vector>
 #include "rust_internal.h"
 #include "rust_util.h"
diff --git a/src/rt/rust_kernel.h b/src/rt/rust_kernel.h
index 2b7662220fd..6ea66592b33 100644
--- a/src/rt/rust_kernel.h
+++ b/src/rt/rust_kernel.h
@@ -7,7 +7,7 @@
 #include "rust_log.h"
 
 struct rust_task_thread;
-struct rust_scheduler;
+class rust_scheduler;
 
 typedef std::map<rust_sched_id, rust_scheduler*> sched_map;
 
diff --git a/src/rt/rust_run_program.cpp b/src/rt/rust_run_program.cpp
index a1a9e8d6189..7ccecb2f99a 100644
--- a/src/rt/rust_run_program.cpp
+++ b/src/rt/rust_run_program.cpp
@@ -136,6 +136,10 @@ rust_process_wait(int proc) {
 #include <unistd.h>
 #include <termios.h>
 
+#ifdef __FreeBSD__
+extern char **environ;
+#endif
+
 extern "C" CDECL int
 rust_run_program(const char* argv[],
                  void* envp,
@@ -164,6 +168,9 @@ rust_run_program(const char* argv[],
         *_NSGetEnviron() = (char **)envp;
     }
     execvp(argv[0], (char * const *)argv);
+#elif __FreeBSD__
+    if (envp) { environ = (char **)envp; }
+    execvp(argv[0], (char * const *)argv);
 #else
     if (!envp) { envp = environ; }
     execvpe(argv[0], (char * const *)argv, (char * const *)envp);