Skip to content

Commit

Permalink
Fix uclibc l4re
Browse files Browse the repository at this point in the history
  • Loading branch information
gnzlbg committed Mar 3, 2019
1 parent 5179441 commit 183c51b
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 63 deletions.
58 changes: 30 additions & 28 deletions src/unix/uclibc/align.rs
@@ -1,34 +1,6 @@
macro_rules! expand_align {
() => {
s! {
#[cfg_attr(all(target_pointer_width = "32",
any(target_arch = "mips",
target_arch = "arm",
target_arch = "powerpc")),
repr(align(4)))]
#[cfg_attr(any(target_pointer_width = "64",
not(any(target_arch = "mips",
target_arch = "arm",
target_arch = "powerpc"))),
repr(align(8)))]
pub struct pthread_mutex_t {
size: [u8; ::__SIZEOF_PTHREAD_MUTEX_T],
}

#[cfg_attr(all(target_pointer_width = "32",
any(target_arch = "mips",
target_arch = "arm",
target_arch = "powerpc")),
repr(align(4)))]
#[cfg_attr(any(target_pointer_width = "64",
not(any(target_arch = "mips",
target_arch = "arm",
target_arch = "powerpc"))),
repr(align(8)))]
pub struct pthread_rwlock_t {
size: [u8; ::__SIZEOF_PTHREAD_RWLOCK_T],
}

#[cfg_attr(any(target_pointer_width = "32",
target_arch = "x86_64",
target_arch = "powerpc64",
Expand Down Expand Up @@ -59,6 +31,36 @@ macro_rules! expand_align {
pub struct pthread_cond_t {
size: [u8; ::__SIZEOF_PTHREAD_COND_T],
}

#[cfg_attr(all(target_pointer_width = "32",
any(target_arch = "mips",
target_arch = "arm",
target_arch = "powerpc")),
repr(align(4)))]
#[cfg_attr(any(target_pointer_width = "64",
not(any(target_arch = "mips",
target_arch = "arm",
target_arch = "powerpc"))),
repr(align(8)))]
#[allow(missing_debug_implementations)]
pub struct pthread_mutex_t {
size: [u8; ::__SIZEOF_PTHREAD_MUTEX_T],
}

#[cfg_attr(all(target_pointer_width = "32",
any(target_arch = "mips",
target_arch = "arm",
target_arch = "powerpc")),
repr(align(4)))]
#[cfg_attr(any(target_pointer_width = "64",
not(any(target_arch = "mips",
target_arch = "arm",
target_arch = "powerpc"))),
repr(align(8)))]
#[allow(missing_debug_implementations)]
pub struct pthread_rwlock_t {
size: [u8; ::__SIZEOF_PTHREAD_RWLOCK_T],
}
}
}
}
43 changes: 24 additions & 19 deletions src/unix/uclibc/x86_64/align.rs
Expand Up @@ -12,20 +12,6 @@ macro_rules! expand_align {
__size: [::c_char; 32],
}

#[cfg_attr(all(target_pointer_width = "32",
any(target_arch = "mips",
target_arch = "arm",
target_arch = "powerpc")),
repr(align(4)))]
#[cfg_attr(all(any(target_pointer_width = "64",
not(any(target_arch = "mips",
target_arch = "arm",
target_arch = "powerpc")))),
repr(align(8)))]
pub struct pthread_mutex_t { // ToDo
size: [u8; ::__SIZEOF_PTHREAD_MUTEX_T],
}

#[cfg_attr(any(target_pointer_width = "32",
target_arch = "x86_64",
target_arch = "powerpc64",
Expand All @@ -44,15 +30,33 @@ macro_rules! expand_align {
size: [u8; ::__SIZEOF_PTHREAD_MUTEXATTR_T],
}

#[repr(align(8))]
pub struct pthread_cond_t { // ToDo
size: [u8; ::__SIZEOF_PTHREAD_COND_T],
}

#[repr(align(4))]
pub struct pthread_condattr_t { // ToDo
size: [u8; ::__SIZEOF_PTHREAD_CONDATTR_T],
}
}

s_no_extra_traits! {
#[cfg_attr(all(target_pointer_width = "32",
any(target_arch = "mips",
target_arch = "arm",
target_arch = "powerpc")),
repr(align(4)))]
#[cfg_attr(all(any(target_pointer_width = "64",
not(any(target_arch = "mips",
target_arch = "arm",
target_arch = "powerpc")))),
repr(align(8)))]
#[allow(missing_debug_implementations)]
pub struct pthread_mutex_t { // ToDo
size: [u8; ::__SIZEOF_PTHREAD_MUTEX_T],
}

#[repr(align(8))]
#[allow(missing_debug_implementations)]
pub struct pthread_cond_t { // ToDo
size: [u8; ::__SIZEOF_PTHREAD_COND_T],
}

#[cfg_attr(all(target_pointer_width = "32",
any(target_arch = "mips",
Expand All @@ -64,6 +68,7 @@ macro_rules! expand_align {
target_arch = "arm",
target_arch = "powerpc"))),
repr(align(8)))]
#[allow(missing_debug_implementations)]
pub struct pthread_rwlock_t { // ToDo
size: [u8; ::__SIZEOF_PTHREAD_RWLOCK_T],
}
Expand Down
1 change: 1 addition & 0 deletions src/unix/uclibc/x86_64/l4re.rs
Expand Up @@ -27,6 +27,7 @@ s! {
}

#[cfg(target_os = "l4re")]
#[allow(missing_debug_implementations)]
pub struct pthread_attr_t {
pub __detachstate: ::c_int,
pub __schedpolicy: ::c_int,
Expand Down
35 changes: 19 additions & 16 deletions src/unix/uclibc/x86_64/mod.rs
Expand Up @@ -20,22 +20,6 @@ pub type time_t = ::c_int;
pub type wchar_t = ::c_int;

s! {
pub struct dirent {
pub d_ino: ::ino64_t,
pub d_off: ::off64_t,
pub d_reclen: u16,
pub d_type: u8,
pub d_name: [::c_char; 256],
}

pub struct dirent64 {
pub d_ino: ::ino64_t,
pub d_off: ::off64_t,
pub d_reclen: u16,
pub d_type: u8,
pub d_name: [::c_char; 256],
}

pub struct ipc_perm {
pub __key: ::key_t,
pub uid: ::uid_t,
Expand Down Expand Up @@ -252,6 +236,25 @@ s! {
}
}

s_no_extra_traits! {
#[allow(missing_debug_implementations)]
pub struct dirent {
pub d_ino: ::ino64_t,
pub d_off: ::off64_t,
pub d_reclen: u16,
pub d_type: u8,
pub d_name: [::c_char; 256],
}
#[allow(missing_debug_implementations)]
pub struct dirent64 {
pub d_ino: ::ino64_t,
pub d_off: ::off64_t,
pub d_reclen: u16,
pub d_type: u8,
pub d_name: [::c_char; 256],
}
}

// constants
pub const EADDRINUSE: ::c_int = 98; // Address already in use
pub const EADDRNOTAVAIL: ::c_int = 99; // Cannot assign requested address
Expand Down

0 comments on commit 183c51b

Please sign in to comment.