summaryrefslogtreecommitdiff
path: root/libc/src/unix/notbsd/android/b32
diff options
context:
space:
mode:
authorDaniel Mueller <deso@posteo.net>2017-03-26 17:07:34 -0700
committerDaniel Mueller <deso@posteo.net>2017-03-26 17:07:34 -0700
commitcb39828ecd7ea5d2eac3076ad3dd1b6ef05e10d3 (patch)
treeee9b7fb3e686a2154a95487e404b605d141b9258 /libc/src/unix/notbsd/android/b32
parent86415f23a86b5a44aa000d513500a9d1d0df4bba (diff)
downloadnitrocli-cb39828ecd7ea5d2eac3076ad3dd1b6ef05e10d3.tar.gz
nitrocli-cb39828ecd7ea5d2eac3076ad3dd1b6ef05e10d3.tar.bz2
Import subrepo libc/:libc at 05a2d197356ef253dfd985166576619ac9b6947f
Diffstat (limited to 'libc/src/unix/notbsd/android/b32')
-rw-r--r--libc/src/unix/notbsd/android/b32/arm.rs6
-rw-r--r--libc/src/unix/notbsd/android/b32/mod.rs196
-rw-r--r--libc/src/unix/notbsd/android/b32/x86.rs6
3 files changed, 208 insertions, 0 deletions
diff --git a/libc/src/unix/notbsd/android/b32/arm.rs b/libc/src/unix/notbsd/android/b32/arm.rs
new file mode 100644
index 0000000..1c9d033
--- /dev/null
+++ b/libc/src/unix/notbsd/android/b32/arm.rs
@@ -0,0 +1,6 @@
+pub type c_char = u8;
+pub type wchar_t = u32;
+
+pub const O_DIRECT: ::c_int = 0x10000;
+pub const O_DIRECTORY: ::c_int = 0x4000;
+pub const O_NOFOLLOW: ::c_int = 0x8000;
diff --git a/libc/src/unix/notbsd/android/b32/mod.rs b/libc/src/unix/notbsd/android/b32/mod.rs
new file mode 100644
index 0000000..9efcd61
--- /dev/null
+++ b/libc/src/unix/notbsd/android/b32/mod.rs
@@ -0,0 +1,196 @@
+pub type c_long = i32;
+pub type c_ulong = u32;
+pub type mode_t = u16;
+pub type off64_t = ::c_longlong;
+pub type sigset_t = ::c_ulong;
+pub type socklen_t = i32;
+pub type time64_t = i64;
+
+s! {
+ pub struct sigaction {
+ pub sa_sigaction: ::sighandler_t,
+ pub sa_mask: ::sigset_t,
+ pub sa_flags: ::c_ulong,
+ pub sa_restorer: ::dox::Option<extern fn()>,
+ }
+
+ pub struct rlimit64 {
+ pub rlim_cur: u64,
+ pub rlim_max: u64,
+ }
+
+ pub struct stat {
+ pub st_dev: ::c_ulonglong,
+ __pad0: [::c_uchar; 4],
+ __st_ino: ::ino_t,
+ pub st_mode: ::c_uint,
+ pub st_nlink: ::c_uint,
+ pub st_uid: ::uid_t,
+ pub st_gid: ::gid_t,
+ pub st_rdev: ::c_ulonglong,
+ __pad3: [::c_uchar; 4],
+ pub st_size: ::c_longlong,
+ pub st_blksize: ::blksize_t,
+ pub st_blocks: ::c_ulonglong,
+ pub st_atime: ::c_ulong,
+ pub st_atime_nsec: ::c_ulong,
+ pub st_mtime: ::c_ulong,
+ pub st_mtime_nsec: ::c_ulong,
+ pub st_ctime: ::c_ulong,
+ pub st_ctime_nsec: ::c_ulong,
+ pub st_ino: ::c_ulonglong,
+ }
+
+ pub struct stat64 {
+ pub st_dev: ::c_ulonglong,
+ __pad0: [::c_uchar; 4],
+ __st_ino: ::ino_t,
+ pub st_mode: ::c_uint,
+ pub st_nlink: ::c_uint,
+ pub st_uid: ::uid_t,
+ pub st_gid: ::gid_t,
+ pub st_rdev: ::c_ulonglong,
+ __pad3: [::c_uchar; 4],
+ pub st_size: ::c_longlong,
+ pub st_blksize: ::blksize_t,
+ pub st_blocks: ::c_ulonglong,
+ pub st_atime: ::c_ulong,
+ pub st_atime_nsec: ::c_ulong,
+ pub st_mtime: ::c_ulong,
+ pub st_mtime_nsec: ::c_ulong,
+ pub st_ctime: ::c_ulong,
+ pub st_ctime_nsec: ::c_ulong,
+ pub st_ino: ::c_ulonglong,
+ }
+
+ pub struct pthread_attr_t {
+ pub flags: ::uint32_t,
+ pub stack_base: *mut ::c_void,
+ pub stack_size: ::size_t,
+ pub guard_size: ::size_t,
+ pub sched_policy: ::int32_t,
+ pub sched_priority: ::int32_t,
+ }
+
+ pub struct pthread_mutex_t { value: ::c_int }
+
+ pub struct pthread_cond_t { value: ::c_int }
+
+ pub struct pthread_rwlock_t {
+ lock: pthread_mutex_t,
+ cond: pthread_cond_t,
+ numLocks: ::c_int,
+ writerThreadId: ::c_int,
+ pendingReaders: ::c_int,
+ pendingWriters: ::c_int,
+ attr: i32,
+ __reserved: [::c_char; 12],
+ }
+
+ pub struct passwd {
+ pub pw_name: *mut ::c_char,
+ pub pw_passwd: *mut ::c_char,
+ pub pw_uid: ::uid_t,
+ pub pw_gid: ::gid_t,
+ pub pw_dir: *mut ::c_char,
+ pub pw_shell: *mut ::c_char,
+ }
+
+ pub struct statfs {
+ pub f_type: ::uint32_t,
+ pub f_bsize: ::uint32_t,
+ pub f_blocks: ::uint64_t,
+ pub f_bfree: ::uint64_t,
+ pub f_bavail: ::uint64_t,
+ pub f_files: ::uint64_t,
+ pub f_ffree: ::uint64_t,
+ pub f_fsid: ::__fsid_t,
+ pub f_namelen: ::uint32_t,
+ pub f_frsize: ::uint32_t,
+ pub f_flags: ::uint32_t,
+ pub f_spare: [::uint32_t; 4],
+ }
+
+ pub struct sysinfo {
+ pub uptime: ::c_long,
+ pub loads: [::c_ulong; 3],
+ pub totalram: ::c_ulong,
+ pub freeram: ::c_ulong,
+ pub sharedram: ::c_ulong,
+ pub bufferram: ::c_ulong,
+ pub totalswap: ::c_ulong,
+ pub freeswap: ::c_ulong,
+ pub procs: ::c_ushort,
+ pub pad: ::c_ushort,
+ pub totalhigh: ::c_ulong,
+ pub freehigh: ::c_ulong,
+ pub mem_unit: ::c_uint,
+ pub _f: [::c_char; 8],
+ }
+}
+
+pub const RTLD_GLOBAL: ::c_int = 2;
+pub const RTLD_NOW: ::c_int = 0;
+pub const RTLD_DEFAULT: *mut ::c_void = -1isize as *mut ::c_void;
+
+pub const PTRACE_GETFPREGS: ::c_int = 14;
+pub const PTRACE_SETFPREGS: ::c_int = 15;
+pub const PTRACE_GETREGS: ::c_int = 12;
+pub const PTRACE_SETREGS: ::c_int = 13;
+
+pub const SYS_gettid: ::c_long = 224;
+pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
+ value: 0,
+};
+pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
+ value: 0,
+};
+pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
+ lock: PTHREAD_MUTEX_INITIALIZER,
+ cond: PTHREAD_COND_INITIALIZER,
+ numLocks: 0,
+ writerThreadId: 0,
+ pendingReaders: 0,
+ pendingWriters: 0,
+ attr: 0,
+ __reserved: [0; 12],
+};
+pub const PTHREAD_STACK_MIN: ::size_t = 4096 * 2;
+pub const CPU_SETSIZE: ::size_t = 32;
+pub const __CPU_BITS: ::size_t = 32;
+
+pub const UT_LINESIZE: usize = 8;
+pub const UT_NAMESIZE: usize = 8;
+pub const UT_HOSTSIZE: usize = 16;
+
+extern {
+ pub fn bind(socket: ::c_int, address: *const ::sockaddr,
+ address_len: socklen_t) -> ::c_int;
+
+ pub fn writev(fd: ::c_int,
+ iov: *const ::iovec,
+ iovcnt: ::c_int) -> ::ssize_t;
+ pub fn readv(fd: ::c_int,
+ iov: *const ::iovec,
+ iovcnt: ::c_int) -> ::ssize_t;
+
+ pub fn sendmsg(fd: ::c_int,
+ msg: *const ::msghdr,
+ flags: ::c_int) -> ::ssize_t;
+ pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int)
+ -> ::ssize_t;
+
+ pub fn timegm64(tm: *const ::tm) -> ::time64_t;
+}
+
+cfg_if! {
+ if #[cfg(target_arch = "x86")] {
+ mod x86;
+ pub use self::x86::*;
+ } else if #[cfg(target_arch = "arm")] {
+ mod arm;
+ pub use self::arm::*;
+ } else {
+ // Unknown target_arch
+ }
+}
diff --git a/libc/src/unix/notbsd/android/b32/x86.rs b/libc/src/unix/notbsd/android/b32/x86.rs
new file mode 100644
index 0000000..c4b8197
--- /dev/null
+++ b/libc/src/unix/notbsd/android/b32/x86.rs
@@ -0,0 +1,6 @@
+pub type c_char = i8;
+pub type wchar_t = i32;
+
+pub const O_DIRECT: ::c_int = 0x4000;
+pub const O_DIRECTORY: ::c_int = 0x10000;
+pub const O_NOFOLLOW: ::c_int = 0x20000;