1 //! Definitions for uclibc on 64bit systems
3 pub type blkcnt_t
= i64;
4 pub type blksize_t
= i64;
5 pub type clock_t
= i64;
8 pub type c_ulong
= u64;
9 pub type fsblkcnt_t
= ::c_ulong
;
10 pub type fsfilcnt_t
= ::c_ulong
;
11 pub type fsword_t
= ::c_long
;
12 pub type ino_t
= ::c_ulong
;
13 pub type nlink_t
= ::c_uint
;
14 pub type off_t
= ::c_long
;
15 pub type rlim_t
= c_ulong
;
16 pub type rlim64_t
= u64;
17 // [uClibc docs] Note stat64 has the same shape as stat for x86-64.
18 pub type stat64
= stat
;
19 pub type suseconds_t
= ::c_long
;
20 pub type time_t
= ::c_int
;
21 pub type wchar_t
= ::c_int
;
23 pub type nfds_t
= ::c_ulong
;
31 pub d_name
: [::c_char
; 256],
39 pub d_name
: [::c_char
; 256],
48 pub mode
: ::c_ushort
, // read / write
50 pub __seq
: ::c_ushort
,
56 #[cfg(not(target_os = "l4re"))]
57 pub struct pthread_attr_t
{
58 __detachstate
: ::c_int
,
59 __schedpolicy
: ::c_int
,
60 __schedparam
: __sched_param
,
61 __inheritsched
: ::c_int
,
63 __guardsize
: ::size_t
,
64 __stackaddr_set
: ::c_int
,
65 __stackaddr
: *mut ::c_void
, // better don't use it
66 __stacksize
: ::size_t
,
69 pub struct __sched_param
{
70 __sched_priority
: ::c_int
,
73 pub struct siginfo_t
{
74 si_signo
: ::c_int
, // signal number
75 si_errno
: ::c_int
, // if not zero: error value of signal, see errno.h
76 si_code
: ::c_int
, // signal code
77 pub _pad
: [::c_int
; 28], // unported union
82 pub shm_perm
: ::ipc_perm
,
83 pub shm_segsz
: ::size_t
, // segment size in bytes
84 pub shm_atime
: ::time_t
, // time of last shmat()
85 pub shm_dtime
: ::time_t
,
86 pub shm_ctime
: ::time_t
,
87 pub shm_cpid
: ::pid_t
,
88 pub shm_lpid
: ::pid_t
,
89 pub shm_nattch
: ::shmatt_t
,
95 pub msg_perm
: ::ipc_perm
,
96 pub msg_stime
: ::time_t
,
97 pub msg_rtime
: ::time_t
,
98 pub msg_ctime
: ::time_t
,
99 __msg_cbytes
: ::c_ulong
,
100 pub msg_qnum
: ::msgqnum_t
,
101 pub msg_qbytes
: ::msglen_t
,
102 pub msg_lspid
: ::pid_t
,
103 pub msg_lrpid
: ::pid_t
,
104 __ignored1
: ::c_ulong
,
105 __ignored2
: ::c_ulong
,
108 pub struct sockaddr
{
109 pub sa_family
: ::sa_family_t
,
110 pub sa_data
: [::c_char
; 14],
113 pub struct sockaddr_in
{
114 pub sin_family
: ::sa_family_t
,
115 pub sin_port
: ::in_port_t
,
116 pub sin_addr
: ::in_addr
,
117 pub sin_zero
: [u8; 8],
120 pub struct sockaddr_in6
{
121 pub sin6_family
: ::sa_family_t
,
122 pub sin6_port
: ::in_port_t
,
123 pub sin6_flowinfo
: u32,
124 pub sin6_addr
: ::in6_addr
,
125 pub sin6_scope_id
: u32,
128 // ------------------------------------------------------------
129 // definitions below are *unverified* and might **break** the software
130 // pub struct in_addr {
131 // pub s_addr: in_addr_t,
134 // pub struct in6_addr {
135 // pub s6_addr: [u8; 16],
136 // __align: [u32; 0],
140 pub st_dev
: ::c_ulong
,
142 // According to uclibc/libc/sysdeps/linux/x86_64/bits/stat.h, order of
143 // nlink and mode are swapped on 64 bit systems.
144 pub st_nlink
: ::nlink_t
,
145 pub st_mode
: ::mode_t
,
148 pub st_rdev
: ::c_ulong
, // dev_t
149 pub st_size
: off_t
, // file size
150 pub st_blksize
: ::blksize_t
,
151 pub st_blocks
: ::blkcnt_t
,
152 pub st_atime
: ::time_t
,
153 pub st_atime_nsec
: ::c_ulong
,
154 pub st_mtime
: ::time_t
,
155 pub st_mtime_nsec
: ::c_ulong
,
156 pub st_ctime
: ::time_t
,
157 pub st_ctime_nsec
: ::c_ulong
,
158 st_pad4
: [::c_long
; 3]
161 pub struct sigaction
{
162 pub sa_handler
: ::sighandler_t
,
163 pub sa_flags
: ::c_ulong
,
164 pub sa_restorer
: *mut ::c_void
,
165 pub sa_mask
: ::sigset_t
,
168 pub struct stack_t
{ // ToDo
169 pub ss_sp
: *mut ::c_void
,
170 pub ss_flags
: ::c_int
,
171 pub ss_size
: ::size_t
174 pub struct statfs
{ // ToDo
175 pub f_type
: fsword_t
,
176 pub f_bsize
: fsword_t
,
177 pub f_blocks
: ::fsblkcnt_t
,
178 pub f_bfree
: ::fsblkcnt_t
,
179 pub f_bavail
: ::fsblkcnt_t
,
180 pub f_files
: ::fsfilcnt_t
,
181 pub f_ffree
: ::fsfilcnt_t
,
182 pub f_fsid
: ::fsid_t
,
183 pub f_namelen
: fsword_t
,
184 pub f_frsize
: fsword_t
,
185 f_spare
: [fsword_t
; 5],
188 pub struct msghdr
{ // ToDo
189 pub msg_name
: *mut ::c_void
,
190 pub msg_namelen
: ::socklen_t
,
191 pub msg_iov
: *mut ::iovec
,
192 pub msg_iovlen
: ::size_t
,
193 pub msg_control
: *mut ::c_void
,
194 pub msg_controllen
: ::size_t
,
195 pub msg_flags
: ::c_int
,
198 pub struct termios
{ // ToDo
199 pub c_iflag
: ::tcflag_t
,
200 pub c_oflag
: ::tcflag_t
,
201 pub c_cflag
: ::tcflag_t
,
202 pub c_lflag
: ::tcflag_t
,
204 pub c_cc
: [::cc_t
; ::NCCS
],
207 pub struct sem_t
{ // ToDo
208 #[cfg(target_pointer_width = "32")]
209 __size
: [::c_char
; 16],
210 #[cfg(target_pointer_width = "64")]
211 __size
: [::c_char
; 32],
212 __align
: [::c_long
; 0],
215 pub struct pthread_mutex_t
{ // ToDo
216 #[cfg(any(target_arch = "mips", target_arch = "arm",
217 target_arch
= "powerpc"))]
218 __align
: [::c_long
; 0],
219 #[cfg(not(any(target_arch = "mips", target_arch = "arm",
220 target_arch
= "powerpc")))]
221 __align
: [::c_longlong
; 0],
222 size
: [u8; __SIZEOF_PTHREAD_MUTEX_T
],
225 pub struct pthread_mutexattr_t
{ // ToDo
226 #[cfg(any(target_arch = "x86_64", target_arch = "powerpc64",
227 target_arch
= "mips64", target_arch
= "s390x",
228 target_arch
= "sparc64"))]
229 __align
: [::c_int
; 0],
230 #[cfg(not(any(target_arch = "x86_64", target_arch = "powerpc64",
231 target_arch
= "mips64", target_arch
= "s390x",
232 target_arch
= "sparc64")))]
233 __align
: [::c_long
; 0],
234 size
: [u8; __SIZEOF_PTHREAD_MUTEXATTR_T
],
237 pub struct pthread_cond_t
{ // ToDo
238 __align
: [::c_longlong
; 0],
239 size
: [u8; __SIZEOF_PTHREAD_COND_T
],
242 pub struct pthread_condattr_t
{ // ToDo
243 __align
: [::c_int
; 0],
244 size
: [u8; __SIZEOF_PTHREAD_CONDATTR_T
],
247 pub struct pthread_rwlock_t
{ // ToDo
248 #[cfg(any(target_arch = "mips", target_arch = "arm",
249 target_arch
= "powerpc"))]
250 __align
: [::c_long
; 0],
251 #[cfg(not(any(target_arch = "mips", target_arch = "arm",
252 target_arch
= "powerpc")))]
253 __align
: [::c_longlong
; 0],
254 size
: [u8; __SIZEOF_PTHREAD_RWLOCK_T
],
257 pub struct sigset_t
{ // ToDo
258 __val
: [::c_ulong
; 16],
261 pub struct sysinfo
{ // ToDo
262 pub uptime
: ::c_long
,
263 pub loads
: [::c_ulong
; 3],
264 pub totalram
: ::c_ulong
,
265 pub freeram
: ::c_ulong
,
266 pub sharedram
: ::c_ulong
,
267 pub bufferram
: ::c_ulong
,
268 pub totalswap
: ::c_ulong
,
269 pub freeswap
: ::c_ulong
,
270 pub procs
: ::c_ushort
,
272 pub totalhigh
: ::c_ulong
,
273 pub freehigh
: ::c_ulong
,
274 pub mem_unit
: ::c_uint
,
275 pub _f
: [::c_char
; 0],
278 pub struct glob_t
{ // ToDo
279 pub gl_pathc
: ::size_t
,
280 pub gl_pathv
: *mut *mut c_char
,
281 pub gl_offs
: ::size_t
,
282 pub gl_flags
: ::c_int
,
283 __unused1
: *mut ::c_void
,
284 __unused2
: *mut ::c_void
,
285 __unused3
: *mut ::c_void
,
286 __unused4
: *mut ::c_void
,
287 __unused5
: *mut ::c_void
,
290 pub struct rlimit64
{ // ToDo
291 pub rlim_cur
: rlim64_t
,
292 pub rlim_max
: rlim64_t
,
295 pub struct cpu_set_t
{ // ToDo
296 #[cfg(target_pointer_width = "32")]
298 #[cfg(target_pointer_width = "64")]
302 pub struct fsid_t
{ // ToDo
308 pub const EADDRINUSE
: ::c_int
= 98; // Address already in use
309 pub const EADDRNOTAVAIL
: ::c_int
= 99; // Cannot assign requested address
310 pub const ECONNABORTED
: ::c_int
= 103; // Software caused connection abort
311 pub const ECONNREFUSED
: ::c_int
= 111; // Connection refused
312 pub const ECONNRESET
: ::c_int
= 104; // Connection reset by peer
313 pub const EDEADLK
: ::c_int
= 35; // Resource deadlock would occur
314 pub const ENOSYS
: ::c_int
= 38; // Function not implemented
315 pub const ENOTCONN
: ::c_int
= 107; // Transport endpoint is not connected
316 pub const ETIMEDOUT
: ::c_int
= 110; // connection timed out
317 pub const O_APPEND
: ::c_int
= 02000;
318 pub const O_ACCMODE
: ::c_int
= 0003;
319 pub const O_CLOEXEC
: ::c_int
= 0x80000;
320 pub const O_CREAT
: ::c_int
= 0100;
321 pub const O_DIRECTORY
: ::c_int
= 0200000;
322 pub const O_EXCL
: ::c_int
= 0200;
323 pub const O_NONBLOCK
: ::c_int
= 04000;
324 pub const O_TRUNC
: ::c_int
= 01000;
325 pub const NCCS
: usize = 32;
326 pub const SIG_SETMASK
: ::c_int
= 2; // Set the set of blocked signals
327 pub const PTHREAD_STACK_MIN
: usize = 16384;
328 pub const __SIZEOF_PTHREAD_MUTEX_T
: usize = 40;
329 pub const __SIZEOF_PTHREAD_MUTEXATTR_T
: usize = 4;
330 pub const SO_BROADCAST
: ::c_int
= 6;
331 pub const SOCK_DGRAM
: ::c_int
= 2; // connectionless, unreliable datagrams
332 pub const SOCK_STREAM
: ::c_int
= 1; // …/common/bits/socket_type.h
333 pub const SO_ERROR
: ::c_int
= 4;
334 pub const SOL_SOCKET
: ::c_int
= 1;
335 pub const SO_RCVTIMEO
: ::c_int
= 20;
336 pub const SO_REUSEADDR
: ::c_int
= 2;
337 pub const SO_SNDTIMEO
: ::c_int
= 21;
338 pub const PTHREAD_MUTEX_NORMAL
: ::c_int
= 0;
339 pub const PTHREAD_MUTEX_RECURSIVE
: ::c_int
= 1;
340 pub const PTHREAD_MUTEX_ERRORCHECK
: ::c_int
= 2;
341 pub const PTHREAD_MUTEX_DEFAULT
: ::c_int
= PTHREAD_MUTEX_NORMAL
;
342 pub const RLIM_INFINITY
: u64 = 0xffffffffffffffff;
343 pub const __SIZEOF_PTHREAD_COND_T
: usize = 48;
344 pub const __SIZEOF_PTHREAD_CONDATTR_T
: usize = 4;
345 pub const __SIZEOF_PTHREAD_RWLOCK_T
: usize = 56;
348 pub fn memalign(align
: ::size_t
, size
: ::size_t
) -> *mut ::c_void
;
352 if #[cfg(target_os = "l4re")] {
354 pub use self::l4re
::*;