Add #[repr(C)] to all the things!

This commit is contained in:
Corey Richardson
2014-05-27 18:37:49 -07:00
parent 6e8ff99958
commit bc19a77631
5 changed files with 125 additions and 2 deletions

View File

@@ -91,6 +91,7 @@ extern {
mod select {
pub static FD_SETSIZE: uint = 1024;
#[repr(C)]
pub struct fd_set {
fds_bits: [i32, ..(FD_SETSIZE / 32)]
}
@@ -109,6 +110,7 @@ mod select {
pub static FD_SETSIZE: uint = 1024;
#[repr(C)]
pub struct fd_set {
// FIXME: shouldn't this be a c_ulong?
fds_bits: [uint, ..(FD_SETSIZE / uint::BITS)]
@@ -139,6 +141,7 @@ mod signal {
// This definition is not as accurate as it could be, {pid, uid, status} is
// actually a giant union. Currently we're only interested in these fields,
// however.
#[repr(C)]
pub struct siginfo {
si_signo: libc::c_int,
si_errno: libc::c_int,
@@ -148,6 +151,7 @@ mod signal {
pub status: libc::c_int,
}
#[repr(C)]
pub struct sigaction {
pub sa_handler: extern fn(libc::c_int),
pub sa_mask: sigset_t,
@@ -155,10 +159,13 @@ mod signal {
sa_restorer: *mut libc::c_void,
}
#[repr(C)]
#[cfg(target_word_size = "32")]
pub struct sigset_t {
__val: [libc::c_ulong, ..32],
}
#[repr(C)]
#[cfg(target_word_size = "64")]
pub struct sigset_t {
__val: [libc::c_ulong, ..16],
@@ -182,6 +189,7 @@ mod signal {
// This definition is not as accurate as it could be, {pid, uid, status} is
// actually a giant union. Currently we're only interested in these fields,
// however.
#[repr(C)]
pub struct siginfo {
si_signo: libc::c_int,
si_code: libc::c_int,
@@ -191,6 +199,7 @@ mod signal {
pub status: libc::c_int,
}
#[repr(C)]
pub struct sigaction {
pub sa_flags: libc::c_uint,
pub sa_handler: extern fn(libc::c_int),
@@ -199,6 +208,7 @@ mod signal {
sa_resv: [libc::c_int, ..1],
}
#[repr(C)]
pub struct sigset_t {
__val: [libc::c_ulong, ..32],
}
@@ -231,6 +241,7 @@ mod signal {
// This structure has more fields, but we're not all that interested in
// them.
#[repr(C)]
pub struct siginfo {
pub si_signo: libc::c_int,
pub si_errno: libc::c_int,
@@ -242,6 +253,7 @@ mod signal {
#[cfg(target_os = "macos")]
#[cfg(target_os = "ios")]
#[repr(C)]
pub struct sigaction {
pub sa_handler: extern fn(libc::c_int),
sa_tramp: *mut libc::c_void,
@@ -251,6 +263,7 @@ mod signal {
#[cfg(target_os = "freebsd")]
#[cfg(target_os = "dragonfly")]
#[repr(C)]
pub struct sigaction {
pub sa_handler: extern fn(libc::c_int),
pub sa_flags: libc::c_int,