2012-12-10 17:44:02 -06:00
|
|
|
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
2012-04-02 22:18:01 -05:00
|
|
|
|
|
|
|
#include "rust_kernel.h"
|
2011-03-11 06:30:18 -06:00
|
|
|
|
2012-02-07 20:55:02 -06:00
|
|
|
#ifdef __APPLE__
|
|
|
|
#include <crt_externs.h>
|
|
|
|
#endif
|
|
|
|
|
2011-03-11 06:30:18 -06:00
|
|
|
#if defined(__WIN32__)
|
|
|
|
|
2013-04-30 17:00:07 -05:00
|
|
|
extern "C" CDECL void
|
|
|
|
rust_unset_sigprocmask() {
|
|
|
|
// empty stub for windows to keep linker happy
|
2012-01-23 20:37:26 -06:00
|
|
|
}
|
|
|
|
|
2013-04-30 17:00:07 -05:00
|
|
|
extern "C" CDECL void
|
|
|
|
rust_set_environ(void* envp) {
|
|
|
|
// empty stub for windows to keep linker happy
|
2011-03-11 06:30:18 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
#elif defined(__GNUC__)
|
|
|
|
|
|
|
|
#include <signal.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
2012-02-09 00:08:24 -06:00
|
|
|
#ifdef __FreeBSD__
|
|
|
|
extern char **environ;
|
|
|
|
#endif
|
|
|
|
|
2013-04-30 17:00:07 -05:00
|
|
|
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
|
2011-03-11 06:30:18 -06:00
|
|
|
sigset_t sset;
|
|
|
|
sigemptyset(&sset);
|
|
|
|
sigprocmask(SIG_SETMASK, &sset, NULL);
|
2013-04-30 17:00:07 -05:00
|
|
|
}
|
2011-03-11 06:30:18 -06:00
|
|
|
|
2013-04-30 17:00:07 -05:00
|
|
|
extern "C" CDECL void
|
|
|
|
rust_set_environ(void* envp) {
|
|
|
|
// FIXME: this could actually be converted to rust (see issue #2674)
|
2012-03-28 22:28:35 -05:00
|
|
|
#ifdef __APPLE__
|
2013-04-30 17:00:07 -05:00
|
|
|
*_NSGetEnviron() = (char **) envp;
|
2012-02-07 20:55:02 -06:00
|
|
|
#else
|
2013-04-30 17:00:07 -05:00
|
|
|
environ = (char **) envp;
|
2012-02-07 20:55:02 -06:00
|
|
|
#endif
|
2011-03-25 02:09:20 -05:00
|
|
|
}
|
|
|
|
|
2011-03-11 06:30:18 -06:00
|
|
|
#else
|
|
|
|
#error "Platform not supported."
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//
|
|
|
|
// Local Variables:
|
|
|
|
// mode: C++
|
|
|
|
// fill-column: 78;
|
|
|
|
// indent-tabs-mode: nil
|
|
|
|
// c-basic-offset: 4
|
|
|
|
// buffer-file-coding-system: utf-8-unix
|
2011-07-13 15:51:20 -05:00
|
|
|
// compile-command: "make -k -C $RBUILD 2>&1 | sed -e 's/\\/x\\//x:\\//g'";
|
2011-03-11 06:30:18 -06:00
|
|
|
// End:
|
|
|
|
//
|