aboutsummaryrefslogtreecommitdiff
path: root/libc/src/unix/notbsd/android
diff options
context:
space:
mode:
authorDaniel Mueller <deso@posteo.net>2017-05-29 14:07:12 -0700
committerDaniel Mueller <deso@posteo.net>2017-05-29 14:07:12 -0700
commit684c4574c09a6f2cc5a208e4505e9306602b4abc (patch)
treedaaac715140748c82f801f2e4047c57780689bc0 /libc/src/unix/notbsd/android
parent436915453f7474117234aa0cedab6f97b3b3575f (diff)
downloadnitrocli-684c4574c09a6f2cc5a208e4505e9306602b4abc.tar.gz
nitrocli-684c4574c09a6f2cc5a208e4505e9306602b4abc.tar.bz2
Update libc crate to 0.2.23
The 'libc' create got a couple of updates. This change imports the new code and bumps the version to use. Import subrepo libc/:libc at 7db3fd570dfb41a38fb17116e93679307178103a
Diffstat (limited to 'libc/src/unix/notbsd/android')
-rw-r--r--libc/src/unix/notbsd/android/b32/mod.rs3
-rw-r--r--libc/src/unix/notbsd/android/b64/aarch64.rs56
-rw-r--r--libc/src/unix/notbsd/android/b64/mod.rs70
-rw-r--r--libc/src/unix/notbsd/android/b64/x86_64.rs50
-rw-r--r--libc/src/unix/notbsd/android/mod.rs13
5 files changed, 136 insertions, 56 deletions
diff --git a/libc/src/unix/notbsd/android/b32/mod.rs b/libc/src/unix/notbsd/android/b32/mod.rs
index 9efcd61..32f88e4 100644
--- a/libc/src/unix/notbsd/android/b32/mod.rs
+++ b/libc/src/unix/notbsd/android/b32/mod.rs
@@ -1,3 +1,6 @@
+// The following definitions are correct for arm and i686,
+// but may be wrong for mips
+
pub type c_long = i32;
pub type c_ulong = u32;
pub type mode_t = u16;
diff --git a/libc/src/unix/notbsd/android/b64/aarch64.rs b/libc/src/unix/notbsd/android/b64/aarch64.rs
new file mode 100644
index 0000000..89c505d
--- /dev/null
+++ b/libc/src/unix/notbsd/android/b64/aarch64.rs
@@ -0,0 +1,56 @@
+pub type c_char = u8;
+pub type wchar_t = u32;
+
+s! {
+ pub struct stat {
+ pub st_dev: ::dev_t,
+ pub 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: ::dev_t,
+ __pad1: ::c_ulong,
+ pub st_size: ::off64_t,
+ pub st_blksize: ::c_int,
+ __pad2: ::c_int,
+ pub st_blocks: ::c_long,
+ pub st_atime: ::time_t,
+ pub st_atime_nsec: ::c_ulong,
+ pub st_mtime: ::time_t,
+ pub st_mtime_nsec: ::c_ulong,
+ pub st_ctime: ::time_t,
+ pub st_ctime_nsec: ::c_ulong,
+ __unused4: ::c_uint,
+ __unused5: ::c_uint,
+ }
+
+ pub struct stat64 {
+ pub st_dev: ::dev_t,
+ pub 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: ::dev_t,
+ __pad1: ::c_ulong,
+ pub st_size: ::off64_t,
+ pub st_blksize: ::c_int,
+ __pad2: ::c_int,
+ pub st_blocks: ::c_long,
+ pub st_atime: ::time_t,
+ pub st_atime_nsec: ::c_ulong,
+ pub st_mtime: ::time_t,
+ pub st_mtime_nsec: ::c_ulong,
+ pub st_ctime: ::time_t,
+ pub st_ctime_nsec: ::c_ulong,
+ __unused4: ::c_uint,
+ __unused5: ::c_uint,
+ }
+}
+
+pub const O_DIRECT: ::c_int = 0x10000;
+pub const O_DIRECTORY: ::c_int = 0x4000;
+pub const O_NOFOLLOW: ::c_int = 0x8000;
+
+pub const SYS_gettid: ::c_long = 178;
diff --git a/libc/src/unix/notbsd/android/b64/mod.rs b/libc/src/unix/notbsd/android/b64/mod.rs
index 31a05d6..98a2f39 100644
--- a/libc/src/unix/notbsd/android/b64/mod.rs
+++ b/libc/src/unix/notbsd/android/b64/mod.rs
@@ -1,12 +1,11 @@
-// The following definitions are correct for aarch64 and may be wrong for x86_64
+// The following definitions are correct for aarch64 and x86_64,
+// but may be wrong for mips64
-pub type c_char = u8;
pub type c_long = i64;
pub type c_ulong = u64;
pub type mode_t = u32;
pub type off64_t = i64;
pub type socklen_t = u32;
-pub type wchar_t = u32;
s! {
pub struct sigset_t {
@@ -17,7 +16,7 @@ s! {
pub sa_flags: ::c_uint,
pub sa_sigaction: ::sighandler_t,
pub sa_mask: ::sigset_t,
- _restorer: *mut ::c_void,
+ pub sa_restorer: ::dox::Option<extern fn()>,
}
pub struct rlimit64 {
@@ -25,52 +24,6 @@ s! {
pub rlim_max: ::c_ulonglong,
}
- pub struct stat {
- pub st_dev: ::dev_t,
- pub 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: ::dev_t,
- __pad1: ::c_ulong,
- pub st_size: ::off64_t,
- pub st_blksize: ::c_int,
- __pad2: ::c_int,
- pub st_blocks: ::c_long,
- pub st_atime: ::time_t,
- pub st_atime_nsec: ::c_ulong,
- pub st_mtime: ::time_t,
- pub st_mtime_nsec: ::c_ulong,
- pub st_ctime: ::time_t,
- pub st_ctime_nsec: ::c_ulong,
- __unused4: ::c_uint,
- __unused5: ::c_uint,
- }
-
- pub struct stat64 {
- pub st_dev: ::dev_t,
- pub 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: ::dev_t,
- __pad1: ::c_ulong,
- pub st_size: ::off64_t,
- pub st_blksize: ::c_int,
- __pad2: ::c_int,
- pub st_blocks: ::c_long,
- pub st_atime: ::time_t,
- pub st_atime_nsec: ::c_ulong,
- pub st_mtime: ::time_t,
- pub st_mtime_nsec: ::c_ulong,
- pub st_ctime: ::time_t,
- pub st_ctime_nsec: ::c_ulong,
- __unused4: ::c_uint,
- __unused5: ::c_uint,
- }
-
pub struct pthread_attr_t {
pub flags: ::uint32_t,
pub stack_base: *mut ::c_void,
@@ -143,15 +96,10 @@ s! {
}
}
-pub const O_DIRECT: ::c_int = 0x10000;
-pub const O_DIRECTORY: ::c_int = 0x4000;
-pub const O_NOFOLLOW: ::c_int = 0x8000;
-
pub const RTLD_GLOBAL: ::c_int = 0x00100;
pub const RTLD_NOW: ::c_int = 2;
pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void;
-pub const SYS_gettid: ::c_long = 178;
pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
value: 0,
__reserved: [0; 36],
@@ -200,3 +148,15 @@ extern {
// the return type should be ::ssize_t, but it is c_int!
pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int) -> ::c_int;
}
+
+cfg_if! {
+ if #[cfg(target_arch = "x86_64")] {
+ mod x86_64;
+ pub use self::x86_64::*;
+ } else if #[cfg(target_arch = "aarch64")] {
+ mod aarch64;
+ pub use self::aarch64::*;
+ } else {
+ // Unknown target_arch
+ }
+}
diff --git a/libc/src/unix/notbsd/android/b64/x86_64.rs b/libc/src/unix/notbsd/android/b64/x86_64.rs
new file mode 100644
index 0000000..58d07e1
--- /dev/null
+++ b/libc/src/unix/notbsd/android/b64/x86_64.rs
@@ -0,0 +1,50 @@
+pub type c_char = i8;
+pub type wchar_t = i32;
+
+s! {
+ pub struct stat {
+ pub st_dev: ::dev_t,
+ pub st_ino: ::ino_t,
+ pub st_nlink: ::c_ulong,
+ pub st_mode: ::c_uint,
+ pub st_uid: ::uid_t,
+ pub st_gid: ::gid_t,
+ pub st_rdev: ::dev_t,
+ pub st_size: ::off64_t,
+ pub st_blksize: ::c_long,
+ pub st_blocks: ::c_long,
+ 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,
+ __unused: [::c_long; 3],
+ }
+
+ pub struct stat64 {
+ pub st_dev: ::dev_t,
+ pub st_ino: ::ino_t,
+ pub st_nlink: ::c_ulong,
+ pub st_mode: ::c_uint,
+ pub st_uid: ::uid_t,
+ pub st_gid: ::gid_t,
+ pub st_rdev: ::dev_t,
+ pub st_size: ::off64_t,
+ pub st_blksize: ::c_long,
+ pub st_blocks: ::c_long,
+ 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,
+ __unused: [::c_long; 3],
+ }
+}
+
+pub const O_DIRECT: ::c_int = 0x4000;
+pub const O_DIRECTORY: ::c_int = 0x10000;
+pub const O_NOFOLLOW: ::c_int = 0x20000;
+
+pub const SYS_gettid: ::c_long = 186;
diff --git a/libc/src/unix/notbsd/android/mod.rs b/libc/src/unix/notbsd/android/mod.rs
index cd20cb1..547d832 100644
--- a/libc/src/unix/notbsd/android/mod.rs
+++ b/libc/src/unix/notbsd/android/mod.rs
@@ -464,7 +464,6 @@ pub const TCSBRKP: ::c_int = 0x5425;
pub const TCSANOW: ::c_int = 0;
pub const TCSADRAIN: ::c_int = 0x1;
pub const TCSAFLUSH: ::c_int = 0x2;
-pub const IUTF8: ::tcflag_t = 0x00004000;
pub const VEOF: usize = 4;
pub const VEOL: usize = 11;
pub const VEOL2: usize = 16;
@@ -585,6 +584,7 @@ pub const MCL_CURRENT: ::c_int = 0x0001;
pub const MCL_FUTURE: ::c_int = 0x0002;
pub const SIGSTKSZ: ::size_t = 8192;
+pub const MINSIGSTKSZ: ::size_t = 2048;
pub const CBAUD: ::tcflag_t = 0o0010017;
pub const TAB1: ::c_int = 0x00000800;
pub const TAB2: ::c_int = 0x00001000;
@@ -753,6 +753,17 @@ f! {
pub fn CPU_EQUAL(set1: &cpu_set_t, set2: &cpu_set_t) -> bool {
set1.__bits == set2.__bits
}
+ pub fn major(dev: ::dev_t) -> ::c_int {
+ ((dev >> 8) & 0xfff) as ::c_int
+ }
+ pub fn minor(dev: ::dev_t) -> ::c_int {
+ ((dev & 0xff) | ((dev >> 12) & 0xfff00)) as ::c_int
+ }
+ pub fn makedev(ma: ::c_int, mi: ::c_int) -> ::dev_t {
+ let ma = ma as ::dev_t;
+ let mi = mi as ::dev_t;
+ ((ma & 0xfff) << 8) | (mi & 0xff) | ((mi & 0xfff00) << 12)
+ }
}
extern {