xref: /drstd/dlibc/src/unix/platform/dragonos/musl/b64/mod.rs (revision 86982c5e9b2eaa583327251616ee822c36288824)
1 pub type c_long = i64;
2 pub type c_ulong = u64;
3 pub type regoff_t = ::c_long;
4 
5 
6 #[cfg(not(target_os = "dragonos"))]
7 #[derive(Copy,Clone)]
8 pub struct sigset_t {
9     __val: [::c_ulong; 16],
10 }
11 
12 s! {
13     pub struct statfs64 {
14         pub f_type: ::c_ulong,
15         pub f_bsize: ::c_ulong,
16         pub f_blocks: ::fsblkcnt_t,
17         pub f_bfree: ::fsblkcnt_t,
18         pub f_bavail: ::fsblkcnt_t,
19         pub f_files: ::fsfilcnt_t,
20         pub f_ffree: ::fsfilcnt_t,
21         pub f_fsid: ::fsid_t,
22         pub f_namelen: ::c_ulong,
23         pub f_frsize: ::c_ulong,
24         pub f_flags: ::c_ulong,
25         pub f_spare: [::c_ulong; 4],
26     }
27 
28     pub struct statvfs64 {
29         pub f_bsize: ::c_ulong,
30         pub f_frsize: ::c_ulong,
31         pub f_blocks: u64,
32         pub f_bfree: u64,
33         pub f_bavail: u64,
34         pub f_files: u64,
35         pub f_ffree: u64,
36         pub f_favail: u64,
37         pub f_fsid: ::c_ulong,
38         pub f_flag: ::c_ulong,
39         pub f_namemax: ::c_ulong,
40         __f_spare: [::c_int; 6],
41     }
42 
43     pub struct stack_t {
44         pub ss_sp: *mut ::c_void,
45         pub ss_flags: ::c_int,
46         pub ss_size: ::size_t
47     }
48 
49     pub struct pthread_attr_t {
50         __size: [u64; 7]
51     }
52 
53     pub struct shmid_ds {
54         pub shm_perm: ::ipc_perm,
55         pub shm_segsz: ::size_t,
56         pub shm_atime: ::time_t,
57         pub shm_dtime: ::time_t,
58         pub shm_ctime: ::time_t,
59         pub shm_cpid: ::pid_t,
60         pub shm_lpid: ::pid_t,
61         pub shm_nattch: ::c_ulong,
62         __pad1: ::c_ulong,
63         __pad2: ::c_ulong,
64     }
65 
66     pub struct msqid_ds {
67         pub msg_perm: ::ipc_perm,
68         pub msg_stime: ::time_t,
69         pub msg_rtime: ::time_t,
70         pub msg_ctime: ::time_t,
71         __msg_cbytes: ::c_ulong,
72         pub msg_qnum: ::msgqnum_t,
73         pub msg_qbytes: ::msglen_t,
74         pub msg_lspid: ::pid_t,
75         pub msg_lrpid: ::pid_t,
76         __pad1: ::c_ulong,
77         __pad2: ::c_ulong,
78     }
79 
80     pub struct statfs {
81         pub f_type: ::c_ulong,
82         pub f_bsize: ::c_ulong,
83         pub f_blocks: ::fsblkcnt_t,
84         pub f_bfree: ::fsblkcnt_t,
85         pub f_bavail: ::fsblkcnt_t,
86         pub f_files: ::fsfilcnt_t,
87         pub f_ffree: ::fsfilcnt_t,
88         pub f_fsid: ::fsid_t,
89         pub f_namelen: ::c_ulong,
90         pub f_frsize: ::c_ulong,
91         pub f_flags: ::c_ulong,
92         pub f_spare: [::c_ulong; 4],
93     }
94 
95     pub struct msghdr {
96         pub msg_name: *mut ::c_void,
97         pub msg_namelen: ::socklen_t,
98         pub msg_iov: *mut ::iovec,
99         #[cfg(target_endian = "big")]
100         __pad1: ::c_int,
101         pub msg_iovlen: ::c_int,
102         #[cfg(target_endian = "little")]
103         __pad1: ::c_int,
104         pub msg_control: *mut ::c_void,
105         #[cfg(target_endian = "big")]
106         __pad2: ::c_int,
107         pub msg_controllen: ::socklen_t,
108         #[cfg(target_endian = "little")]
109         __pad2: ::c_int,
110         pub msg_flags: ::c_int,
111     }
112 
113     pub struct cmsghdr {
114         #[cfg(target_endian = "big")]
115         pub __pad1: ::c_int,
116         pub cmsg_len: ::socklen_t,
117         #[cfg(target_endian = "little")]
118         pub __pad1: ::c_int,
119         pub cmsg_level: ::c_int,
120         pub cmsg_type: ::c_int,
121     }
122 
123     pub struct sem_t {
124         __val: [::c_int; 8],
125     }
126 
127     pub struct siginfo_t {
128         pub si_signo: ::c_int,
129         pub si_errno: ::c_int,
130         pub si_code: ::c_int,
131         pub _pad: [::c_int; 29],
132         _align: [usize; 0],
133     }
134 }
135 
136 pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;
137 pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40;
138 pub const __SIZEOF_PTHREAD_BARRIER_T: usize = 32;
139 
140 pub const SOCK_NONBLOCK: ::c_int = 2048;
141 
142 pub const SOCK_SEQPACKET: ::c_int = 5;
143 
144 extern "C" {
145     pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t;
146 }
147 
148 cfg_if! {
149     if #[cfg(target_arch = "aarch64")] {
150         mod aarch64;
151         pub use self::aarch64::*;
152     } else if #[cfg(target_arch = "mips64")] {
153         mod mips64;
154         pub use self::mips64::*;
155     } else if #[cfg(any(target_arch = "powerpc64"))] {
156         mod powerpc64;
157         pub use self::powerpc64::*;
158     } else if #[cfg(any(target_arch = "s390x"))] {
159         mod s390x;
160         pub use self::s390x::*;
161     } else if #[cfg(any(target_arch = "x86_64"))] {
162         mod x86_64;
163         pub use self::x86_64::*;
164     } else if #[cfg(any(target_arch = "riscv64"))] {
165         mod riscv64;
166         pub use self::riscv64::*;
167     } else {
168         // Unknown target_arch
169     }
170 }
171