Skip to content

Various MIPS cleanups #618

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 3 commits into from
Jun 15, 2017
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
53 changes: 0 additions & 53 deletions src/unix/notbsd/linux/mips/mips32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ pub type ino_t = u32;
pub type blkcnt_t = i32;
pub type blksize_t = i32;
pub type nlink_t = u32;
pub type fsblkcnt_t = ::c_ulong;
pub type fsfilcnt_t = ::c_ulong;
pub type rlim_t = c_ulong;

s! {
pub struct aiocb {
Expand Down Expand Up @@ -107,19 +104,6 @@ s! {
pub _pad: [::c_int; 29],
}

pub struct glob64_t {
pub gl_pathc: ::size_t,
pub gl_pathv: *mut *mut ::c_char,
pub gl_offs: ::size_t,
pub gl_flags: ::c_int,

__unused1: *mut ::c_void,
__unused2: *mut ::c_void,
__unused3: *mut ::c_void,
__unused4: *mut ::c_void,
__unused5: *mut ::c_void,
}

pub struct ipc_perm {
pub __key: ::key_t,
pub uid: ::uid_t,
Expand Down Expand Up @@ -238,15 +222,6 @@ s! {
pub mem_unit: ::c_uint,
pub _f: [::c_char; 8],
}

// FIXME this is actually a union
pub struct sem_t {
#[cfg(target_pointer_width = "32")]
__size: [::c_char; 16],
#[cfg(target_pointer_width = "64")]
__size: [::c_char; 32],
__align: [::c_long; 0],
}
}

pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
Expand All @@ -257,31 +232,3 @@ pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
pub const RLIM_INFINITY: ::rlim_t = 0x7fffffff;

pub const SYS_gettid: ::c_long = 4222; // Valid for O32

#[link(name = "util")]
extern {
pub fn sysctl(name: *mut ::c_int,
namelen: ::c_int,
oldp: *mut ::c_void,
oldlenp: *mut ::size_t,
newp: *mut ::c_void,
newlen: ::size_t)
-> ::c_int;
pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int;
pub fn backtrace(buf: *mut *mut ::c_void,
sz: ::c_int) -> ::c_int;
pub fn glob64(pattern: *const ::c_char,
flags: ::c_int,
errfunc: ::dox::Option<extern fn(epath: *const ::c_char,
errno: ::c_int)
-> ::c_int>,
pglob: *mut glob64_t) -> ::c_int;
pub fn globfree64(pglob: *mut glob64_t);
pub fn ptrace(request: ::c_uint, ...) -> ::c_long;
pub fn pthread_attr_getaffinity_np(attr: *const ::pthread_attr_t,
cpusetsize: ::size_t,
cpuset: *mut ::cpu_set_t) -> ::c_int;
pub fn pthread_attr_setaffinity_np(attr: *mut ::pthread_attr_t,
cpusetsize: ::size_t,
cpuset: *const ::cpu_set_t) -> ::c_int;
}
22 changes: 8 additions & 14 deletions src/unix/notbsd/linux/mips/mips64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@ pub type blksize_t = i64;
pub type c_char = i8;
pub type c_long = i64;
pub type c_ulong = u64;
pub type fsblkcnt_t = ::c_ulong;
pub type fsfilcnt_t = ::c_ulong;
pub type ino_t = u64;
pub type nlink_t = u64;
pub type off_t = i64;
pub type rlim_t = ::c_ulong;
pub type suseconds_t = i64;
pub type time_t = i64;
pub type wchar_t = i32;
Expand Down Expand Up @@ -187,6 +184,14 @@ s! {
pub c_cc: [::cc_t; ::NCCS],
}

pub struct flock {
pub l_type: ::c_short,
pub l_whence: ::c_short,
pub l_start: ::off_t,
pub l_len: ::off_t,
pub l_pid: ::pid_t,
}

pub struct sysinfo {
pub uptime: ::c_long,
pub loads: [::c_ulong; 3],
Expand All @@ -203,12 +208,6 @@ s! {
pub mem_unit: ::c_uint,
pub _f: [::c_char; 0],
}

// FIXME this is actually a union
pub struct sem_t {
__size: [::c_char; 32],
__align: [::c_long; 0],
}
}

pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
Expand All @@ -219,8 +218,3 @@ pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;
pub const RLIM_INFINITY: ::rlim_t = 0xffff_ffff_ffff_ffff;

pub const SYS_gettid: ::c_long = 5178; // Valid for n64

#[link(name = "util")]
extern {
pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int;
}
67 changes: 67 additions & 0 deletions src/unix/notbsd/linux/mips/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,32 @@
pub type fsblkcnt_t = ::c_ulong;
pub type fsfilcnt_t = ::c_ulong;
pub type rlim_t = c_ulong;
pub type __priority_which_t = ::c_uint;

s! {
pub struct glob64_t {
pub gl_pathc: ::size_t,
pub gl_pathv: *mut *mut ::c_char,
pub gl_offs: ::size_t,
pub gl_flags: ::c_int,

__unused1: *mut ::c_void,
__unused2: *mut ::c_void,
__unused3: *mut ::c_void,
__unused4: *mut ::c_void,
__unused5: *mut ::c_void,
}

// FIXME this is actually a union
pub struct sem_t {
#[cfg(target_pointer_width = "32")]
__size: [::c_char; 16],
#[cfg(target_pointer_width = "64")]
__size: [::c_char; 32],
__align: [::c_long; 0],
}
}

pub const CLONE_NEWCGROUP: ::c_int = 0x02000000;

pub const SFD_CLOEXEC: ::c_int = 0x080000;
Expand Down Expand Up @@ -496,6 +525,44 @@ pub const B3000000: ::speed_t = 0o010015;
pub const B3500000: ::speed_t = 0o010016;
pub const B4000000: ::speed_t = 0o010017;

#[link(name = "util")]
extern {
pub fn sysctl(name: *mut ::c_int,
namelen: ::c_int,
oldp: *mut ::c_void,
oldlenp: *mut ::size_t,
newp: *mut ::c_void,
newlen: ::size_t)
-> ::c_int;
pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int;
pub fn backtrace(buf: *mut *mut ::c_void,
sz: ::c_int) -> ::c_int;
pub fn glob64(pattern: *const ::c_char,
flags: ::c_int,
errfunc: ::dox::Option<extern fn(epath: *const ::c_char,
errno: ::c_int)
-> ::c_int>,
pglob: *mut glob64_t) -> ::c_int;
pub fn globfree64(pglob: *mut glob64_t);
pub fn ptrace(request: ::c_uint, ...) -> ::c_long;
pub fn pthread_attr_getaffinity_np(attr: *const ::pthread_attr_t,
cpusetsize: ::size_t,
cpuset: *mut ::cpu_set_t) -> ::c_int;
pub fn pthread_attr_setaffinity_np(attr: *mut ::pthread_attr_t,
cpusetsize: ::size_t,
cpuset: *const ::cpu_set_t) -> ::c_int;
pub fn getpriority(which: ::__priority_which_t, who: ::id_t) -> ::c_int;
pub fn setpriority(which: ::__priority_which_t, who: ::id_t,
prio: ::c_int) -> ::c_int;
pub fn pthread_getaffinity_np(thread: ::pthread_t,
cpusetsize: ::size_t,
cpuset: *mut ::cpu_set_t) -> ::c_int;
pub fn pthread_setaffinity_np(thread: ::pthread_t,
cpusetsize: ::size_t,
cpuset: *const ::cpu_set_t) -> ::c_int;
pub fn sched_getcpu() -> ::c_int;
}

cfg_if! {
if #[cfg(target_arch = "mips")] {
mod mips32;
Expand Down