Skip to content

Remove rust_run_program.cpp #9280

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 19, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion mk/rt.mk
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ RUNTIME_CXXS_$(1)_$(2) := \
rt/sync/lock_and_signal.cpp \
rt/sync/rust_thread.cpp \
rt/rust_builtin.cpp \
rt/rust_run_program.cpp \
rt/rust_rng.cpp \
rt/rust_upcall.cpp \
rt/rust_uv.cpp \
Expand Down
21 changes: 17 additions & 4 deletions src/libstd/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -643,15 +643,28 @@ fn spawn_process_os(prog: &str, args: &[~str],
use libc::funcs::bsd44::getdtablesize;

mod rustrt {
use libc::c_void;

#[abi = "cdecl"]
extern {
pub fn rust_unset_sigprocmask();
pub fn rust_set_environ(envp: *c_void);
}
}

#[cfg(windows)]
unsafe fn set_environ(_envp: *c_void) {}
#[cfg(target_os = "macos")]
unsafe fn set_environ(envp: *c_void) {
externfn!(fn _NSGetEnviron() -> *mut *c_void);

*_NSGetEnviron() = envp;
}
#[cfg(not(target_os = "macos"), not(windows))]
unsafe fn set_environ(envp: *c_void) {
extern {
static mut environ: *c_void;
}
environ = envp;
}

unsafe {

let pid = fork();
Expand Down Expand Up @@ -685,7 +698,7 @@ fn spawn_process_os(prog: &str, args: &[~str],

do with_envp(env) |envp| {
if !envp.is_null() {
rustrt::rust_set_environ(envp);
set_environ(envp);
}
do with_argv(prog, args) |argv| {
execvp(*argv, argv);
Expand Down
23 changes: 23 additions & 0 deletions src/rt/rust_builtin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,29 @@ rust_valgrind_stack_deregister(unsigned int id) {
VALGRIND_STACK_DEREGISTER(id);
}

#if defined(__WIN32__)

extern "C" CDECL void
rust_unset_sigprocmask() {
// empty stub for windows to keep linker happy
}

#else

#include <signal.h>
#include <unistd.h>

extern "C" CDECL void
rust_unset_sigprocmask() {
// this can't be safely converted to rust code because the
// representation of sigset_t is platform-dependent
sigset_t sset;
sigemptyset(&sset);
sigprocmask(SIG_SETMASK, &sset, NULL);
}

#endif

//
// Local Variables:
// mode: C++
Expand Down
71 changes: 0 additions & 71 deletions src/rt/rust_run_program.cpp

This file was deleted.

1 change: 0 additions & 1 deletion src/rt/rustrt.def.in
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ rust_list_dir_wfd_fp_buf
rust_log_console_on
rust_log_console_off
rust_should_log_console
rust_set_environ
rust_unset_sigprocmask
rust_env_pairs
upcall_rust_personality
Expand Down