Explorar el Código

signal: Make constants visible from C

jD91mZM2 hace 6 años
padre
commit
5fc1459eb9
Se han modificado 3 ficheros con 84 adiciones y 80 borrados
  1. 4 0
      src/signal/src/lib.rs
  2. 42 42
      src/signal/src/linux.rs
  3. 38 38
      src/signal/src/redox.rs

+ 4 - 0
src/signal/src/lib.rs

@@ -12,6 +12,10 @@ pub mod sys;
 #[path = "redox.rs"]
 pub mod sys;
 
+#[no_mangle] pub static SIG_BLOCK: c_int = 0;
+#[no_mangle] pub static SIG_UNBLOCK: c_int = 1;
+#[no_mangle] pub static SIG_SETMASK: c_int = 2;
+
 pub use sys::*;
 
 use platform::types::*;

+ 42 - 42
src/signal/src/linux.rs

@@ -3,46 +3,46 @@ pub struct sys_sigset_t {
     pub bits: [u64; 16],
 }
 
-pub const SIGHUP: usize = 1;
-pub const SIGINT: usize = 2;
-pub const SIGQUIT: usize = 3;
-pub const SIGILL: usize = 4;
-pub const SIGTRAP: usize = 5;
-pub const SIGABRT: usize = 6;
-pub const SIGIOT: usize = SIGABRT;
-pub const SIGBUS: usize = 7;
-pub const SIGFPE: usize = 8;
-pub const SIGKILL: usize = 9;
-pub const SIGUSR1: usize = 10;
-pub const SIGSEGV: usize = 11;
-pub const SIGUSR2: usize = 12;
-pub const SIGPIPE: usize = 13;
-pub const SIGALRM: usize = 14;
-pub const SIGTERM: usize = 15;
-pub const SIGSTKFLT: usize = 16;
-pub const SIGCHLD: usize = 17;
-pub const SIGCONT: usize = 18;
-pub const SIGSTOP: usize = 19;
-pub const SIGTSTP: usize = 20;
-pub const SIGTTIN: usize = 21;
-pub const SIGTTOU: usize = 22;
-pub const SIGURG: usize = 23;
-pub const SIGXCPU: usize = 24;
-pub const SIGXFSZ: usize = 25;
-pub const SIGVTALRM: usize = 26;
-pub const SIGPROF: usize = 27;
-pub const SIGWINCH: usize = 28;
-pub const SIGIO: usize = 29;
-pub const SIGPOLL: usize = 29;
-pub const SIGPWR: usize = 30;
-pub const SIGSYS: usize = 31;
-pub const SIGUNUSED: usize = SIGSYS;
+#[no_mangle] pub static SIGHUP: usize = 1;
+#[no_mangle] pub static SIGINT: usize = 2;
+#[no_mangle] pub static SIGQUIT: usize = 3;
+#[no_mangle] pub static SIGILL: usize = 4;
+#[no_mangle] pub static SIGTRAP: usize = 5;
+#[no_mangle] pub static SIGABRT: usize = 6;
+#[no_mangle] pub static SIGIOT: usize = 6;
+#[no_mangle] pub static SIGBUS: usize = 7;
+#[no_mangle] pub static SIGFPE: usize = 8;
+#[no_mangle] pub static SIGKILL: usize = 9;
+#[no_mangle] pub static SIGUSR1: usize = 10;
+#[no_mangle] pub static SIGSEGV: usize = 11;
+#[no_mangle] pub static SIGUSR2: usize = 12;
+#[no_mangle] pub static SIGPIPE: usize = 13;
+#[no_mangle] pub static SIGALRM: usize = 14;
+#[no_mangle] pub static SIGTERM: usize = 15;
+#[no_mangle] pub static SIGSTKFLT: usize = 16;
+#[no_mangle] pub static SIGCHLD: usize = 17;
+#[no_mangle] pub static SIGCONT: usize = 18;
+#[no_mangle] pub static SIGSTOP: usize = 19;
+#[no_mangle] pub static SIGTSTP: usize = 20;
+#[no_mangle] pub static SIGTTIN: usize = 21;
+#[no_mangle] pub static SIGTTOU: usize = 22;
+#[no_mangle] pub static SIGURG: usize = 23;
+#[no_mangle] pub static SIGXCPU: usize = 24;
+#[no_mangle] pub static SIGXFSZ: usize = 25;
+#[no_mangle] pub static SIGVTALRM: usize = 26;
+#[no_mangle] pub static SIGPROF: usize = 27;
+#[no_mangle] pub static SIGWINCH: usize = 28;
+#[no_mangle] pub static SIGIO: usize = 29;
+#[no_mangle] pub static SIGPOLL: usize = 29;
+#[no_mangle] pub static SIGPWR: usize = 30;
+#[no_mangle] pub static SIGSYS: usize = 31;
+#[no_mangle] pub static SIGUNUSED: usize = 31;
 
-pub const SA_NOCLDSTOP: usize = 1;
-pub const SA_NOCLDWAIT: usize = 2;
-pub const SA_SIGINFO: usize = 4;
-pub const SA_ONSTACK: usize = 0x08000000;
-pub const SA_RESTART: usize = 0x10000000;
-pub const SA_NODEFER: usize = 0x40000000;
-pub const SA_RESETHAND: usize = 0x80000000;
-pub const SA_RESTORER: usize = 0x04000000;
+#[no_mangle] pub static SA_NOCLDSTOP: usize = 1;
+#[no_mangle] pub static SA_NOCLDWAIT: usize = 2;
+#[no_mangle] pub static SA_SIGINFO: usize = 4;
+#[no_mangle] pub static SA_ONSTACK: usize = 0x08000000;
+#[no_mangle] pub static SA_RESTART: usize = 0x10000000;
+#[no_mangle] pub static SA_NODEFER: usize = 0x40000000;
+#[no_mangle] pub static SA_RESETHAND: usize = 0x80000000;
+#[no_mangle] pub static SA_RESTORER: usize = 0x04000000;

+ 38 - 38
src/signal/src/redox.rs

@@ -3,42 +3,42 @@ pub struct sys_sigset_t {
     pub bits: [u64; 2],
 }
 
-pub const SIGHUP: usize = 1;
-pub const SIGINT: usize = 2;
-pub const SIGQUIT: usize = 3;
-pub const SIGILL: usize = 4;
-pub const SIGTRAP: usize = 5;
-pub const SIGBUS: usize = 7;
-pub const SIGFPE: usize = 8;
-pub const SIGKILL: usize = 9;
-pub const SIGUSR1: usize = 10;
-pub const SIGSEGV: usize = 11;
-pub const SIGUSR2: usize = 12;
-pub const SIGPIPE: usize = 13;
-pub const SIGALRM: usize = 14;
-pub const SIGTERM: usize = 15;
-pub const SIGSTKFLT: usize = 16;
-pub const SIGCHLD: usize = 17;
-pub const SIGCONT: usize = 18;
-pub const SIGSTOP: usize = 19;
-pub const SIGTSTP: usize = 20;
-pub const SIGTTIN: usize = 21;
-pub const SIGTTOU: usize = 22;
-pub const SIGURG: usize = 23;
-pub const SIGXCPU: usize = 24;
-pub const SIGXFSZ: usize = 25;
-pub const SIGVTALRM: usize = 26;
-pub const SIGPROF: usize = 27;
-pub const SIGWINCH: usize = 28;
-pub const SIGIO: usize = 29;
-pub const SIGPWR: usize = 30;
-pub const SIGSYS: usize = 31;
+#[no_mangle] pub static SIGHUP: usize = 1;
+#[no_mangle] pub static SIGINT: usize = 2;
+#[no_mangle] pub static SIGQUIT: usize = 3;
+#[no_mangle] pub static SIGILL: usize = 4;
+#[no_mangle] pub static SIGTRAP: usize = 5;
+#[no_mangle] pub static SIGBUS: usize = 7;
+#[no_mangle] pub static SIGFPE: usize = 8;
+#[no_mangle] pub static SIGKILL: usize = 9;
+#[no_mangle] pub static SIGUSR1: usize = 10;
+#[no_mangle] pub static SIGSEGV: usize = 11;
+#[no_mangle] pub static SIGUSR2: usize = 12;
+#[no_mangle] pub static SIGPIPE: usize = 13;
+#[no_mangle] pub static SIGALRM: usize = 14;
+#[no_mangle] pub static SIGTERM: usize = 15;
+#[no_mangle] pub static SIGSTKFLT: usize = 16;
+#[no_mangle] pub static SIGCHLD: usize = 17;
+#[no_mangle] pub static SIGCONT: usize = 18;
+#[no_mangle] pub static SIGSTOP: usize = 19;
+#[no_mangle] pub static SIGTSTP: usize = 20;
+#[no_mangle] pub static SIGTTIN: usize = 21;
+#[no_mangle] pub static SIGTTOU: usize = 22;
+#[no_mangle] pub static SIGURG: usize = 23;
+#[no_mangle] pub static SIGXCPU: usize = 24;
+#[no_mangle] pub static SIGXFSZ: usize = 25;
+#[no_mangle] pub static SIGVTALRM: usize = 26;
+#[no_mangle] pub static SIGPROF: usize = 27;
+#[no_mangle] pub static SIGWINCH: usize = 28;
+#[no_mangle] pub static SIGIO: usize = 29;
+#[no_mangle] pub static SIGPWR: usize = 30;
+#[no_mangle] pub static SIGSYS: usize = 31;
 
-pub const SA_NOCLDSTOP: usize = 0x00000001;
-pub const SA_NOCLDWAIT: usize = 0x00000002;
-pub const SA_SIGINFO: usize = 0x00000004;
-pub const SA_RESTORER: usize = 0x04000000;
-pub const SA_ONSTACK: usize = 0x08000000;
-pub const SA_RESTART: usize = 0x10000000;
-pub const SA_NODEFER: usize = 0x40000000;
-pub const SA_RESETHAND: usize = 0x80000000;
+#[no_mangle] pub static SA_NOCLDSTOP: usize = 0x00000001;
+#[no_mangle] pub static SA_NOCLDWAIT: usize = 0x00000002;
+#[no_mangle] pub static SA_SIGINFO: usize = 0x00000004;
+#[no_mangle] pub static SA_RESTORER: usize = 0x04000000;
+#[no_mangle] pub static SA_ONSTACK: usize = 0x08000000;
+#[no_mangle] pub static SA_RESTART: usize = 0x10000000;
+#[no_mangle] pub static SA_NODEFER: usize = 0x40000000;
+#[no_mangle] pub static SA_RESETHAND: usize = 0x80000000;