Skip to content

Commit 70bef1c

Browse files
committed
fuchsia: clean up module
There are type definitions that do not exist upstream. There are records with wrong fields. There are records with wrong alignment. There are incorrect pollyfils for macros. This patch fixes most of it. But there's stuff I've missed.
1 parent 6300136 commit 70bef1c

4 files changed

Lines changed: 365 additions & 226 deletions

File tree

src/fuchsia/aarch64.rs

Lines changed: 37 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
use crate::off_t;
22
use crate::prelude::*;
33

4+
#[deprecated(
5+
since = "0.2.187",
6+
note = "This type doesn't exist. The Fuchsia SDK doesn't ship it."
7+
)]
48
pub type __u64 = c_ulonglong;
5-
pub type wchar_t = u32;
6-
pub type nlink_t = c_ulong;
7-
pub type blksize_t = c_long;
89

910
s! {
1011
pub struct stat {
@@ -15,20 +16,21 @@ s! {
1516
pub st_uid: crate::uid_t,
1617
pub st_gid: crate::gid_t,
1718
pub st_rdev: crate::dev_t,
18-
__pad0: Padding<c_ulong>,
19+
__pad: Padding<c_ulong>,
1920
pub st_size: off_t,
2021
pub st_blksize: crate::blksize_t,
21-
__pad1: Padding<c_int>,
22+
__pad2: Padding<c_int>,
2223
pub st_blocks: crate::blkcnt_t,
23-
pub st_atime: crate::time_t,
24-
pub st_atime_nsec: c_long,
25-
pub st_mtime: crate::time_t,
26-
pub st_mtime_nsec: c_long,
27-
pub st_ctime: crate::time_t,
28-
pub st_ctime_nsec: c_long,
29-
__unused: Padding<[c_uint; 2]>,
24+
pub st_atim: crate::timespec,
25+
pub st_mtim: crate::timespec,
26+
pub st_ctim: crate::timespec,
27+
__unused1: Padding<[c_uint; 2]>,
3028
}
3129

30+
#[deprecated(
31+
since = "0.2.187",
32+
note = "This type doesn't exist. It's not part of the Fuchsia SDK."
33+
)]
3234
pub struct stat64 {
3335
pub st_dev: crate::dev_t,
3436
pub st_ino: crate::ino_t,
@@ -51,6 +53,10 @@ s! {
5153
__unused: Padding<[c_uint; 2]>,
5254
}
5355

56+
#[deprecated(
57+
since = "0.2.187",
58+
note = "This type doesn't exist. It's not part of the Fuchsia SDK."
59+
)]
5460
pub struct ipc_perm {
5561
pub __ipc_perm_key: crate::key_t,
5662
pub uid: crate::uid_t,
@@ -62,6 +68,25 @@ s! {
6268
__unused1: Padding<c_ulong>,
6369
__unused2: Padding<c_ulong>,
6470
}
71+
72+
// FIXME(i128): __reserved is meant to be an array of `long double`s. That
73+
// requires native support for `i128`. This is currently missing.
74+
pub struct mcontext_t {
75+
pub fault_address: c_ulong,
76+
pub regs: [c_ulong; 31],
77+
pub sp: c_ulong,
78+
pub pc: c_ulong,
79+
pub pstate: c_ulong,
80+
__reserved: Padding<[c_longlong; 256]>,
81+
}
82+
83+
pub struct ucontext_t {
84+
pub uc_flags: c_ulong,
85+
pub uc_link: *mut crate::ucontext_t,
86+
pub uc_stack: crate::stack_t,
87+
pub uc_sigmask: crate::sigset_t,
88+
pub uc_mcontext: crate::mcontext_t,
89+
}
6590
}
6691

6792
// From https://cs.opensource.google/fuchsia/fuchsia/+/main:zircon/third_party/ulib/musl/include/bits/signal.h;l=20-21;drc=0827b18ab9540c46f8037f407d17ea15a79e9ba7

0 commit comments

Comments
 (0)