libc/fuchsia/
x86_64.rs

1use crate::off_t;
2use crate::prelude::*;
3
4pub type wchar_t = i32;
5pub type nlink_t = u64;
6pub type blksize_t = c_long;
7pub type __u64 = c_ulonglong;
8
9s! {
10    pub struct stat {
11        pub st_dev: crate::dev_t,
12        pub st_ino: crate::ino_t,
13        pub st_nlink: crate::nlink_t,
14        pub st_mode: crate::mode_t,
15        pub st_uid: crate::uid_t,
16        pub st_gid: crate::gid_t,
17        __pad0: c_int,
18        pub st_rdev: crate::dev_t,
19        pub st_size: off_t,
20        pub st_blksize: crate::blksize_t,
21        pub st_blocks: crate::blkcnt_t,
22        pub st_atime: crate::time_t,
23        pub st_atime_nsec: c_long,
24        pub st_mtime: crate::time_t,
25        pub st_mtime_nsec: c_long,
26        pub st_ctime: crate::time_t,
27        pub st_ctime_nsec: c_long,
28        __unused: [c_long; 3],
29    }
30
31    pub struct stat64 {
32        pub st_dev: crate::dev_t,
33        pub st_ino: crate::ino64_t,
34        pub st_nlink: crate::nlink_t,
35        pub st_mode: crate::mode_t,
36        pub st_uid: crate::uid_t,
37        pub st_gid: crate::gid_t,
38        __pad0: c_int,
39        pub st_rdev: crate::dev_t,
40        pub st_size: off_t,
41        pub st_blksize: crate::blksize_t,
42        pub st_blocks: crate::blkcnt64_t,
43        pub st_atime: crate::time_t,
44        pub st_atime_nsec: c_long,
45        pub st_mtime: crate::time_t,
46        pub st_mtime_nsec: c_long,
47        pub st_ctime: crate::time_t,
48        pub st_ctime_nsec: c_long,
49        __reserved: [c_long; 3],
50    }
51
52    pub struct mcontext_t {
53        __private: [u64; 32],
54    }
55
56    pub struct ipc_perm {
57        pub __ipc_perm_key: crate::key_t,
58        pub uid: crate::uid_t,
59        pub gid: crate::gid_t,
60        pub cuid: crate::uid_t,
61        pub cgid: crate::gid_t,
62        pub mode: crate::mode_t,
63        pub __seq: c_int,
64        __unused1: c_long,
65        __unused2: c_long,
66    }
67}
68
69s_no_extra_traits! {
70    pub struct ucontext_t {
71        pub uc_flags: c_ulong,
72        pub uc_link: *mut ucontext_t,
73        pub uc_stack: crate::stack_t,
74        pub uc_mcontext: mcontext_t,
75        pub uc_sigmask: crate::sigset_t,
76        __private: [u8; 512],
77    }
78}
79
80cfg_if! {
81    if #[cfg(feature = "extra_traits")] {
82        impl PartialEq for ucontext_t {
83            fn eq(&self, other: &ucontext_t) -> bool {
84                self.uc_flags == other.uc_flags
85                    && self.uc_link == other.uc_link
86                    && self.uc_stack == other.uc_stack
87                    && self.uc_mcontext == other.uc_mcontext
88                    && self.uc_sigmask == other.uc_sigmask
89                    && self
90                        .__private
91                        .iter()
92                        .zip(other.__private.iter())
93                        .all(|(a, b)| a == b)
94            }
95        }
96        impl Eq for ucontext_t {}
97        impl fmt::Debug for ucontext_t {
98            fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
99                f.debug_struct("ucontext_t")
100                    .field("uc_flags", &self.uc_flags)
101                    .field("uc_link", &self.uc_link)
102                    .field("uc_stack", &self.uc_stack)
103                    .field("uc_mcontext", &self.uc_mcontext)
104                    .field("uc_sigmask", &self.uc_sigmask)
105                    // FIXME(debug): .field("__private", &self.__private)
106                    .finish()
107            }
108        }
109        impl hash::Hash for ucontext_t {
110            fn hash<H: hash::Hasher>(&self, state: &mut H) {
111                self.uc_flags.hash(state);
112                self.uc_link.hash(state);
113                self.uc_stack.hash(state);
114                self.uc_mcontext.hash(state);
115                self.uc_sigmask.hash(state);
116                self.__private.hash(state);
117            }
118        }
119    }
120}
121
122// offsets in user_regs_structs, from sys/reg.h
123pub const R15: c_int = 0;
124pub const R14: c_int = 1;
125pub const R13: c_int = 2;
126pub const R12: c_int = 3;
127pub const RBP: c_int = 4;
128pub const RBX: c_int = 5;
129pub const R11: c_int = 6;
130pub const R10: c_int = 7;
131pub const R9: c_int = 8;
132pub const R8: c_int = 9;
133pub const RAX: c_int = 10;
134pub const RCX: c_int = 11;
135pub const RDX: c_int = 12;
136pub const RSI: c_int = 13;
137pub const RDI: c_int = 14;
138pub const ORIG_RAX: c_int = 15;
139pub const RIP: c_int = 16;
140pub const CS: c_int = 17;
141pub const EFLAGS: c_int = 18;
142pub const RSP: c_int = 19;
143pub const SS: c_int = 20;
144pub const FS_BASE: c_int = 21;
145pub const GS_BASE: c_int = 22;
146pub const DS: c_int = 23;
147pub const ES: c_int = 24;
148pub const FS: c_int = 25;
149pub const GS: c_int = 26;
150
151pub const MAP_32BIT: c_int = 0x0040;
152
153pub const SIGSTKSZ: size_t = 8192;
154pub const MINSIGSTKSZ: size_t = 2048;