Skip to content
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
5 changes: 5 additions & 0 deletions src/new/bionic_libc/kernel_uapi/linux/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//! Directory: `bionic/libc/kernel/uapi/linux/`
//!
//! <https://cs.android.com/android/platform/superproject/main/+/main:bionic/libc/kernel/uapi/linux/>

pub(crate) mod types;
21 changes: 21 additions & 0 deletions src/new/bionic_libc/kernel_uapi/linux/types.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//! * Header: `bionic/libc/kernel/uapi/linux/types.h`
//! * Header: `bionic/libc/kernel/uapi/asm-generic/int-ll64.h`

use crate::prelude::*;

/* Definitions from `asm/types.h` -> `asm-generic/types.h` -> `asm-generic/int-ll64.h` */

pub type __u8 = c_uchar;

pub type __u16 = c_ushort;
pub type __s16 = c_short;

pub type __u32 = c_uint;
pub type __s32 = c_int;

pub type __s64 = c_longlong;
pub type __u64 = c_ulonglong;

/* From `uapi/linux/types.h` */

pub type __be16 = __u16;
3 changes: 3 additions & 0 deletions src/new/bionic_libc/kernel_uapi/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
//! Directory: `bionic/libc/kernel/uapi`

pub(crate) mod linux;
7 changes: 5 additions & 2 deletions src/new/bionic_libc/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
//! This directory maps to `bionic/libc/include` in the Android source.
//! This directory maps to `bionic/libc/include` in the Android source. `bionic/libc/kernel` is
//! the source of UAPI definitions, which are a cleaned form of the default Linux headers.
//!
//! <https://cs.android.com/android/platform/superproject/main/+/main:bionic/libc/include/>
//! <https://cs.android.com/android/platform/superproject/main/+/main:bionic/libc/include/>,
//! <https://cs.android.com/android/platform/superproject/main/+/main:bionic/libc/kernel/uapi/>

pub(crate) mod kernel_uapi;
pub(crate) mod pthread;
pub(crate) mod sys;
pub(crate) mod unistd;
1 change: 1 addition & 0 deletions src/new/linux_uapi/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ pub(crate) mod netlink;
pub(crate) mod pidfd;
pub(crate) mod sctp;
pub(crate) mod tls;
pub(crate) mod types;
17 changes: 17 additions & 0 deletions src/new/linux_uapi/linux/types.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//! * Header: `uapi/linux/types.h`
//! * Header: `uapi/asm-generic/int-ll64.h`

use crate::prelude::*;

/* Definitions from `asm/types.h` -> `asm-generic/types.h` -> `asm-generic/int-ll64.h` */

pub type __u8 = c_uchar;

pub type __u16 = c_ushort;
pub type __s16 = c_short;

pub type __u32 = c_uint;
pub type __s32 = c_int;

pub type __s64 = c_longlong;
pub type __u64 = c_ulonglong;
3 changes: 3 additions & 0 deletions src/new/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ cfg_if! {
// Per-OS headers we export
cfg_if! {
if #[cfg(target_os = "android")] {
use bionic_libc::kernel_uapi::linux;
pub use linux::types::*;
pub use sys::socket::*;
} else if #[cfg(target_os = "linux")] {
pub use linux::can::bcm::*;
Expand All @@ -190,6 +192,7 @@ cfg_if! {
pub use linux::pidfd::*;
pub use linux::sctp::*;
pub use linux::tls::*;
pub use linux::types::*;
#[cfg(target_env = "gnu")]
pub use net::route::*;
} else if #[cfg(target_vendor = "apple")] {
Expand Down
2 changes: 0 additions & 2 deletions src/unix/linux_like/android/b32/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ pub type off64_t = c_longlong;
pub type sigset_t = c_ulong;
pub type socklen_t = i32;
pub type time64_t = i64;
pub type __u64 = c_ulonglong;
pub type __s64 = c_longlong;

s! {
// FIXME(1.0): This should not implement `PartialEq`
Expand Down
2 changes: 0 additions & 2 deletions src/unix/linux_like/android/b64/aarch64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ use crate::off64_t;
use crate::prelude::*;

pub type wchar_t = u32;
pub type __u64 = c_ulonglong;
pub type __s64 = c_longlong;

s! {
pub struct stat {
Expand Down
2 changes: 0 additions & 2 deletions src/unix/linux_like/android/b64/riscv64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ use crate::prelude::*;

pub type wchar_t = u32;
pub type greg_t = i64;
pub type __u64 = c_ulonglong;
pub type __s64 = c_longlong;

s! {
pub struct stat {
Expand Down
2 changes: 0 additions & 2 deletions src/unix/linux_like/android/b64/x86_64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ use crate::prelude::*;

pub type wchar_t = i32;
pub type greg_t = i64;
pub type __u64 = c_ulonglong;
pub type __s64 = c_longlong;

s! {
pub struct stat {
Expand Down
7 changes: 0 additions & 7 deletions src/unix/linux_like/android/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,6 @@ pub type loff_t = c_longlong;
pub type __kernel_loff_t = c_longlong;
pub type __kernel_pid_t = c_int;

pub type __u8 = c_uchar;
pub type __u16 = c_ushort;
pub type __s16 = c_short;
pub type __u32 = c_uint;
pub type __s32 = c_int;
pub type __be16 = __u16;

// linux/elf.h

pub type Elf32_Addr = u32;
Expand Down
2 changes: 0 additions & 2 deletions src/unix/linux_like/linux/gnu/b32/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ pub type shmatt_t = c_ulong;
pub type msgqnum_t = c_ulong;
pub type msglen_t = c_ulong;
pub type nlink_t = u32;
pub type __u64 = c_ulonglong;
pub type __s64 = c_longlong;
pub type __fsword_t = i32;
pub type fsblkcnt64_t = u64;
pub type fsfilcnt64_t = u64;
Expand Down
2 changes: 0 additions & 2 deletions src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ pub type wchar_t = u32;
pub type nlink_t = u32;
pub type blksize_t = i32;
pub type suseconds_t = i64;
pub type __u64 = c_ulonglong;
pub type __s64 = c_longlong;

s! {
// FIXME(1.0): This should not implement `PartialEq`
Expand Down
2 changes: 0 additions & 2 deletions src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ pub type wchar_t = i32;
pub type blksize_t = i32;
pub type nlink_t = u32;
pub type suseconds_t = i64;
pub type __u64 = c_ulonglong;
pub type __s64 = c_longlong;

s! {
pub struct stat {
Expand Down
2 changes: 0 additions & 2 deletions src/unix/linux_like/linux/gnu/b64/mips64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ pub type blksize_t = i64;
pub type nlink_t = u64;
pub type suseconds_t = i64;
pub type wchar_t = i32;
pub type __u64 = c_ulong;
pub type __s64 = c_long;

s! {
pub struct stat {
Expand Down
2 changes: 0 additions & 2 deletions src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ pub type wchar_t = i32;
pub type nlink_t = u64;
pub type blksize_t = i64;
pub type suseconds_t = i64;
pub type __u64 = c_ulong;
pub type __s64 = c_long;
pub type gregset_t = [c_ulong; __NGREG];
pub type fpregset_t = [c_ulong; __NFPREG];

Expand Down
2 changes: 0 additions & 2 deletions src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ pub type blksize_t = c_int;
pub type fsblkcnt64_t = c_ulong;
pub type fsfilcnt64_t = c_ulong;
pub type suseconds_t = i64;
pub type __u64 = c_ulonglong;
pub type __s64 = c_longlong;

s! {
pub struct pthread_attr_t {
Expand Down
2 changes: 0 additions & 2 deletions src/unix/linux_like/linux/gnu/b64/s390x.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ pub type nlink_t = u64;
pub type suseconds_t = i64;
pub type wchar_t = i32;
pub type greg_t = u64;
pub type __u64 = u64;
pub type __s64 = i64;

s! {
// FIXME(1.0): This should not implement `PartialEq`
Expand Down
2 changes: 0 additions & 2 deletions src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ pub type wchar_t = i32;
pub type nlink_t = u32;
pub type blksize_t = i64;
pub type suseconds_t = i32;
pub type __u64 = c_ulonglong;
pub type __s64 = c_longlong;

s! {
// FIXME(1.0): This should not implement `PartialEq`
Expand Down
2 changes: 0 additions & 2 deletions src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ pub type nlink_t = u64;
pub type blksize_t = i64;
pub type greg_t = i64;
pub type suseconds_t = i64;
pub type __u64 = c_ulonglong;
pub type __s64 = c_longlong;

s! {
// FIXME(1.0): This should not implement `PartialEq`
Expand Down
12 changes: 6 additions & 6 deletions src/unix/linux_like/linux/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
//! Linux-specific definitions for linux-like values
use crate::prelude::*;
use crate::{
__s16,
__s32,
__u16,
__u32,
__u64,
__u8,
sock_filter,
_IO,
_IOR,
Expand All @@ -26,12 +32,6 @@ pub type pthread_spinlock_t = c_int;
pub type __kernel_fsid_t = __c_anonymous__kernel_fsid_t;
pub type __kernel_clockid_t = c_int;

pub type __u8 = c_uchar;
pub type __u16 = c_ushort;
pub type __s16 = c_short;
pub type __u32 = c_uint;
pub type __s32 = c_int;

pub type eventfd_t = u64;

c_enum! {
Expand Down
2 changes: 0 additions & 2 deletions src/unix/linux_like/linux/musl/b32/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ use crate::prelude::*;

pub type nlink_t = u32;
pub type blksize_t = c_long;
pub type __u64 = c_ulonglong;
pub type __s64 = c_longlong;
pub type regoff_t = c_int;

s! {
Expand Down
2 changes: 0 additions & 2 deletions src/unix/linux_like/linux/musl/b64/aarch64/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
use crate::off_t;
use crate::prelude::*;

pub type __u64 = c_ulonglong;
pub type __s64 = c_longlong;
pub type wchar_t = u32;
pub type nlink_t = u32;
pub type blksize_t = c_int;
Expand Down
2 changes: 0 additions & 2 deletions src/unix/linux_like/linux/musl/b64/loongarch64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ pub type wchar_t = c_int;

pub type nlink_t = c_uint;
pub type blksize_t = c_int;
pub type __u64 = c_ulonglong;
pub type __s64 = c_longlong;

pub type stat64 = stat;

Expand Down
2 changes: 0 additions & 2 deletions src/unix/linux_like/linux/musl/b64/mips64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ use crate::off_t;
use crate::prelude::*;

pub type wchar_t = i32;
pub type __u64 = c_ulong;
pub type __s64 = c_long;
pub type nlink_t = c_uint;
pub type blksize_t = i64;

Expand Down
2 changes: 0 additions & 2 deletions src/unix/linux_like/linux/musl/b64/powerpc64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ use crate::off_t;
use crate::prelude::*;

pub type wchar_t = i32;
pub type __u64 = c_ulong;
pub type __s64 = c_long;
pub type nlink_t = u64;
pub type blksize_t = c_long;

Expand Down
2 changes: 0 additions & 2 deletions src/unix/linux_like/linux/musl/b64/riscv64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ pub type wchar_t = c_int;

pub type nlink_t = c_uint;
pub type blksize_t = c_int;
pub type __u64 = c_ulonglong;
pub type __s64 = c_longlong;

pub type stat64 = stat;

Expand Down
2 changes: 0 additions & 2 deletions src/unix/linux_like/linux/musl/b64/s390x.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ pub type blksize_t = i64;
pub type nlink_t = u64;
pub type wchar_t = i32;
pub type greg_t = u64;
pub type __u64 = u64;
pub type __s64 = i64;
pub type statfs64 = statfs;
pub type stat64 = stat;

Expand Down
2 changes: 0 additions & 2 deletions src/unix/linux_like/linux/musl/b64/wasm32/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ use crate::prelude::*;
pub type wchar_t = i32;
pub type nlink_t = u64;
pub type blksize_t = c_long;
pub type __u64 = c_ulonglong;
pub type __s64 = c_longlong;

pub type stat64 = stat;

Expand Down
2 changes: 0 additions & 2 deletions src/unix/linux_like/linux/musl/b64/x86_64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ use crate::prelude::*;
pub type wchar_t = i32;
pub type nlink_t = u64;
pub type blksize_t = c_long;
pub type __u64 = c_ulonglong;
pub type __s64 = c_longlong;
pub type greg_t = i64;

pub type stat64 = stat;
Expand Down
2 changes: 0 additions & 2 deletions src/unix/linux_like/linux/uclibc/arm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ pub type blkcnt_t = c_long;

pub type fsblkcnt64_t = u64;
pub type fsfilcnt64_t = u64;
pub type __u64 = c_ulonglong;
pub type __s64 = c_longlong;

s! {
pub struct cmsghdr {
Expand Down
2 changes: 0 additions & 2 deletions src/unix/linux_like/linux/uclibc/mips/mips32/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ pub type blksize_t = i32;
pub type nlink_t = u32;
pub type fsblkcnt_t = c_ulong;
pub type fsfilcnt_t = c_ulong;
pub type __u64 = c_ulonglong;
pub type __s64 = c_longlong;
pub type fsblkcnt64_t = u64;
pub type fsfilcnt64_t = u64;

Expand Down
2 changes: 0 additions & 2 deletions src/unix/linux_like/linux/uclibc/x86_64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ pub type pthread_t = c_ulong;

pub type fsblkcnt64_t = u64;
pub type fsfilcnt64_t = u64;
pub type __u64 = c_ulong;
pub type __s64 = c_long;

s! {
pub struct ipc_perm {
Expand Down
8 changes: 4 additions & 4 deletions src/unix/linux_like/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,10 @@ cfg_if! {

// linux/filter.h
pub struct sock_filter {
pub code: __u16,
pub jt: __u8,
pub jf: __u8,
pub k: __u32,
pub code: crate::__u16,
pub jt: crate::__u8,
pub jf: crate::__u8,
pub k: crate::__u32,
}

pub struct sock_fprog {
Expand Down