]> git.proxmox.com Git - rustc.git/blame - vendor/libc/src/unix/uclibc/x86_64/mod.rs
New upstream version 1.51.0+dfsg1
[rustc.git] / vendor / libc / src / unix / uclibc / x86_64 / mod.rs
CommitLineData
ea8adc8c 1//! Definitions for uclibc on 64bit systems
041b39d2
XL
2pub type blkcnt_t = i64;
3pub type blksize_t = i64;
4pub type clock_t = i64;
5pub type c_char = u8;
6pub type c_long = i64;
7pub type c_ulong = u64;
8pub type fsblkcnt_t = ::c_ulong;
9pub type fsfilcnt_t = ::c_ulong;
10pub type fsword_t = ::c_long;
11pub type ino_t = ::c_ulong;
12pub type nlink_t = ::c_uint;
13pub type off_t = ::c_long;
14pub type rlim_t = c_ulong;
15pub type rlim64_t = u64;
ea8adc8c
XL
16// [uClibc docs] Note stat64 has the same shape as stat for x86-64.
17pub type stat64 = stat;
041b39d2
XL
18pub type suseconds_t = ::c_long;
19pub type time_t = ::c_int;
20pub type wchar_t = ::c_int;
21
041b39d2
XL
22s! {
23 pub struct ipc_perm {
24 pub __key: ::key_t,
25 pub uid: ::uid_t,
26 pub gid: ::gid_t,
27 pub cuid: ::uid_t,
28 pub cgid: ::gid_t,
29 pub mode: ::c_ushort, // read / write
30 __pad1: ::c_ushort,
31 pub __seq: ::c_ushort,
32 __pad2: ::c_ushort,
33 __unused1: ::c_ulong,
34 __unused2: ::c_ulong
35 }
36
ea8adc8c
XL
37 #[cfg(not(target_os = "l4re"))]
38 pub struct pthread_attr_t {
39 __detachstate: ::c_int,
40 __schedpolicy: ::c_int,
41 __schedparam: __sched_param,
42 __inheritsched: ::c_int,
43 __scope: ::c_int,
44 __guardsize: ::size_t,
45 __stackaddr_set: ::c_int,
46 __stackaddr: *mut ::c_void, // better don't use it
47 __stacksize: ::size_t,
48 }
49
50 pub struct __sched_param {
51 __sched_priority: ::c_int,
52 }
53
041b39d2
XL
54 pub struct siginfo_t {
55 si_signo: ::c_int, // signal number
56 si_errno: ::c_int, // if not zero: error value of signal, see errno.h
57 si_code: ::c_int, // signal code
58 pub _pad: [::c_int; 28], // unported union
59 _align: [usize; 0],
60 }
61
62 pub struct shmid_ds {
63 pub shm_perm: ::ipc_perm,
64 pub shm_segsz: ::size_t, // segment size in bytes
65 pub shm_atime: ::time_t, // time of last shmat()
66 pub shm_dtime: ::time_t,
67 pub shm_ctime: ::time_t,
68 pub shm_cpid: ::pid_t,
69 pub shm_lpid: ::pid_t,
70 pub shm_nattch: ::shmatt_t,
71 __unused1: ::c_ulong,
72 __unused2: ::c_ulong
73 }
74
75 pub struct msqid_ds {
76 pub msg_perm: ::ipc_perm,
77 pub msg_stime: ::time_t,
78 pub msg_rtime: ::time_t,
79 pub msg_ctime: ::time_t,
80 __msg_cbytes: ::c_ulong,
81 pub msg_qnum: ::msgqnum_t,
82 pub msg_qbytes: ::msglen_t,
83 pub msg_lspid: ::pid_t,
84 pub msg_lrpid: ::pid_t,
85 __ignored1: ::c_ulong,
86 __ignored2: ::c_ulong,
87 }
88
89 pub struct sockaddr {
90 pub sa_family: ::sa_family_t,
91 pub sa_data: [::c_char; 14],
92 }
93
94 pub struct sockaddr_in {
95 pub sin_family: ::sa_family_t,
96 pub sin_port: ::in_port_t,
97 pub sin_addr: ::in_addr,
98 pub sin_zero: [u8; 8],
99 }
100
101 pub struct sockaddr_in6 {
102 pub sin6_family: ::sa_family_t,
103 pub sin6_port: ::in_port_t,
104 pub sin6_flowinfo: u32,
105 pub sin6_addr: ::in6_addr,
106 pub sin6_scope_id: u32,
107 }
108
109 // ------------------------------------------------------------
110 // definitions below are *unverified* and might **break** the software
111// pub struct in_addr {
112// pub s_addr: in_addr_t,
113// }
114//
115// pub struct in6_addr {
116// pub s6_addr: [u8; 16],
532ac7d7 117// #[cfg(not(libc_align))]
041b39d2
XL
118// __align: [u32; 0],
119// }
120
ea8adc8c 121 pub struct stat {
041b39d2 122 pub st_dev: ::c_ulong,
041b39d2 123 pub st_ino: ::ino_t,
ea8adc8c
XL
124 // According to uclibc/libc/sysdeps/linux/x86_64/bits/stat.h, order of
125 // nlink and mode are swapped on 64 bit systems.
041b39d2 126 pub st_nlink: ::nlink_t,
ea8adc8c 127 pub st_mode: ::mode_t,
041b39d2
XL
128 pub st_uid: ::uid_t,
129 pub st_gid: ::gid_t,
ea8adc8c
XL
130 pub st_rdev: ::c_ulong, // dev_t
131 pub st_size: off_t, // file size
132 pub st_blksize: ::blksize_t,
133 pub st_blocks: ::blkcnt_t,
041b39d2 134 pub st_atime: ::time_t,
ea8adc8c 135 pub st_atime_nsec: ::c_ulong,
041b39d2 136 pub st_mtime: ::time_t,
ea8adc8c 137 pub st_mtime_nsec: ::c_ulong,
041b39d2 138 pub st_ctime: ::time_t,
ea8adc8c
XL
139 pub st_ctime_nsec: ::c_ulong,
140 st_pad4: [::c_long; 3]
041b39d2
XL
141 }
142
ea8adc8c
XL
143 pub struct sigaction {
144 pub sa_handler: ::sighandler_t,
145 pub sa_flags: ::c_ulong,
146 pub sa_restorer: *mut ::c_void,
041b39d2 147 pub sa_mask: ::sigset_t,
041b39d2
XL
148 }
149
ba9703b0 150 pub struct stack_t { // FIXME
041b39d2
XL
151 pub ss_sp: *mut ::c_void,
152 pub ss_flags: ::c_int,
153 pub ss_size: ::size_t
154 }
155
ba9703b0 156 pub struct statfs { // FIXME
041b39d2
XL
157 pub f_type: fsword_t,
158 pub f_bsize: fsword_t,
159 pub f_blocks: ::fsblkcnt_t,
160 pub f_bfree: ::fsblkcnt_t,
161 pub f_bavail: ::fsblkcnt_t,
162 pub f_files: ::fsfilcnt_t,
163 pub f_ffree: ::fsfilcnt_t,
164 pub f_fsid: ::fsid_t,
165 pub f_namelen: fsword_t,
166 pub f_frsize: fsword_t,
167 f_spare: [fsword_t; 5],
168 }
169
ba9703b0 170 pub struct msghdr { // FIXME
041b39d2
XL
171 pub msg_name: *mut ::c_void,
172 pub msg_namelen: ::socklen_t,
173 pub msg_iov: *mut ::iovec,
174 pub msg_iovlen: ::size_t,
175 pub msg_control: *mut ::c_void,
176 pub msg_controllen: ::size_t,
177 pub msg_flags: ::c_int,
178 }
179
ba9703b0 180 pub struct termios { // FIXME
041b39d2
XL
181 pub c_iflag: ::tcflag_t,
182 pub c_oflag: ::tcflag_t,
183 pub c_cflag: ::tcflag_t,
184 pub c_lflag: ::tcflag_t,
185 pub c_line: ::cc_t,
186 pub c_cc: [::cc_t; ::NCCS],
187 }
188
ba9703b0 189 pub struct sigset_t { // FIXME
041b39d2
XL
190 __val: [::c_ulong; 16],
191 }
192
ba9703b0 193 pub struct sysinfo { // FIXME
041b39d2
XL
194 pub uptime: ::c_long,
195 pub loads: [::c_ulong; 3],
196 pub totalram: ::c_ulong,
197 pub freeram: ::c_ulong,
198 pub sharedram: ::c_ulong,
199 pub bufferram: ::c_ulong,
200 pub totalswap: ::c_ulong,
201 pub freeswap: ::c_ulong,
202 pub procs: ::c_ushort,
203 pub pad: ::c_ushort,
204 pub totalhigh: ::c_ulong,
205 pub freehigh: ::c_ulong,
206 pub mem_unit: ::c_uint,
207 pub _f: [::c_char; 0],
208 }
209
ba9703b0 210 pub struct glob_t { // FIXME
041b39d2
XL
211 pub gl_pathc: ::size_t,
212 pub gl_pathv: *mut *mut c_char,
213 pub gl_offs: ::size_t,
214 pub gl_flags: ::c_int,
215 __unused1: *mut ::c_void,
216 __unused2: *mut ::c_void,
217 __unused3: *mut ::c_void,
218 __unused4: *mut ::c_void,
219 __unused5: *mut ::c_void,
220 }
221
ba9703b0 222 pub struct rlimit64 { // FIXME
041b39d2
XL
223 pub rlim_cur: rlim64_t,
224 pub rlim_max: rlim64_t,
225 }
226
ba9703b0 227 pub struct cpu_set_t { // FIXME
041b39d2
XL
228 #[cfg(target_pointer_width = "32")]
229 bits: [u32; 32],
230 #[cfg(target_pointer_width = "64")]
231 bits: [u64; 16],
232 }
233
ba9703b0 234 pub struct fsid_t { // FIXME
041b39d2
XL
235 __val: [::c_int; 2],
236 }
237}
238
532ac7d7
XL
239s_no_extra_traits! {
240 #[allow(missing_debug_implementations)]
241 pub struct dirent {
242 pub d_ino: ::ino64_t,
243 pub d_off: ::off64_t,
244 pub d_reclen: u16,
245 pub d_type: u8,
246 pub d_name: [::c_char; 256],
247 }
248 #[allow(missing_debug_implementations)]
249 pub struct dirent64 {
250 pub d_ino: ::ino64_t,
251 pub d_off: ::off64_t,
252 pub d_reclen: u16,
253 pub d_type: u8,
254 pub d_name: [::c_char; 256],
255 }
256}
257
041b39d2 258// constants
ea8adc8c
XL
259pub const EADDRINUSE: ::c_int = 98; // Address already in use
260pub const EADDRNOTAVAIL: ::c_int = 99; // Cannot assign requested address
261pub const ECONNABORTED: ::c_int = 103; // Software caused connection abort
262pub const ECONNREFUSED: ::c_int = 111; // Connection refused
263pub const ECONNRESET: ::c_int = 104; // Connection reset by peer
264pub const EDEADLK: ::c_int = 35; // Resource deadlock would occur
265pub const ENOSYS: ::c_int = 38; // Function not implemented
266pub const ENOTCONN: ::c_int = 107; // Transport endpoint is not connected
267pub const ETIMEDOUT: ::c_int = 110; // connection timed out
268pub const O_APPEND: ::c_int = 02000;
269pub const O_ACCMODE: ::c_int = 0003;
041b39d2 270pub const O_CLOEXEC: ::c_int = 0x80000;
ea8adc8c 271pub const O_CREAT: ::c_int = 0100;
041b39d2 272pub const O_DIRECTORY: ::c_int = 0200000;
ea8adc8c
XL
273pub const O_EXCL: ::c_int = 0200;
274pub const O_NONBLOCK: ::c_int = 04000;
275pub const O_TRUNC: ::c_int = 01000;
041b39d2 276pub const NCCS: usize = 32;
ea8adc8c 277pub const SIG_SETMASK: ::c_int = 2; // Set the set of blocked signals
041b39d2
XL
278pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40;
279pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
ea8adc8c
XL
280pub const SO_BROADCAST: ::c_int = 6;
281pub const SOCK_DGRAM: ::c_int = 2; // connectionless, unreliable datagrams
282pub const SOCK_STREAM: ::c_int = 1; // …/common/bits/socket_type.h
283pub const SO_ERROR: ::c_int = 4;
284pub const SOL_SOCKET: ::c_int = 1;
285pub const SO_RCVTIMEO: ::c_int = 20;
286pub const SO_REUSEADDR: ::c_int = 2;
287pub const SO_SNDTIMEO: ::c_int = 21;
041b39d2
XL
288pub const RLIM_INFINITY: u64 = 0xffffffffffffffff;
289pub const __SIZEOF_PTHREAD_COND_T: usize = 48;
290pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
291pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;
292
ea8adc8c
XL
293cfg_if! {
294 if #[cfg(target_os = "l4re")] {
295 mod l4re;
296 pub use self::l4re::*;
0531ce1d
XL
297 } else {
298 mod other;
299 pub use other::*;
300 }
ea8adc8c
XL
301}
302
532ac7d7
XL
303cfg_if! {
304 if #[cfg(libc_align)] {
305 #[macro_use]
306 mod align;
307 } else {
308 #[macro_use]
309 mod no_align;
310 }
311}
312expand_align!();