Skip to content

Commit 457f02a

Browse files
committed
Auto merge of #626 - humenda:master, r=alexcrichton
[uclibc] add more structs to x86_64 This adds more structs to the uclibc/x86_64 port.
2 parents a38631f + c7a7cd8 commit 457f02a

File tree

1 file changed

+64
-15
lines changed

1 file changed

+64
-15
lines changed

src/unix/uclibc/x86_64/mod.rs

+64-15
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
33
pub type blkcnt_t = i64;
44
pub type blksize_t = i64;
5+
pub type clock_t = i64;
56
pub type c_char = u8;
67
pub type c_long = i64;
78
pub type c_ulong = u64;
@@ -22,39 +23,86 @@ pub type wchar_t = ::c_int;
2223
pub type nfds_t = ::c_ulong;
2324

2425
s! {
25-
// ------------------------------------------------------------
26-
// networking
27-
pub struct in_addr {
28-
pub s_addr: in_addr_t,
26+
pub struct ipc_perm {
27+
pub __key: ::key_t,
28+
pub uid: ::uid_t,
29+
pub gid: ::gid_t,
30+
pub cuid: ::uid_t,
31+
pub cgid: ::gid_t,
32+
pub mode: ::c_ushort, // read / write
33+
__pad1: ::c_ushort,
34+
pub __seq: ::c_ushort,
35+
__pad2: ::c_ushort,
36+
__unused1: ::c_ulong,
37+
__unused2: ::c_ulong
38+
}
39+
40+
pub struct siginfo_t {
41+
si_signo: ::c_int, // signal number
42+
si_errno: ::c_int, // if not zero: error value of signal, see errno.h
43+
si_code: ::c_int, // signal code
44+
pub _pad: [::c_int; 28], // unported union
45+
_align: [usize; 0],
2946
}
3047

31-
pub struct in6_addr {
32-
pub s6_addr: [u8; 16],
33-
__align: [u32; 0],
48+
pub struct shmid_ds {
49+
pub shm_perm: ::ipc_perm,
50+
pub shm_segsz: ::size_t, // segment size in bytes
51+
pub shm_atime: ::time_t, // time of last shmat()
52+
pub shm_dtime: ::time_t,
53+
pub shm_ctime: ::time_t,
54+
pub shm_cpid: ::pid_t,
55+
pub shm_lpid: ::pid_t,
56+
pub shm_nattch: ::shmatt_t,
57+
__unused1: ::c_ulong,
58+
__unused2: ::c_ulong
59+
}
60+
61+
pub struct msqid_ds {
62+
pub msg_perm: ::ipc_perm,
63+
pub msg_stime: ::time_t,
64+
pub msg_rtime: ::time_t,
65+
pub msg_ctime: ::time_t,
66+
__msg_cbytes: ::c_ulong,
67+
pub msg_qnum: ::msgqnum_t,
68+
pub msg_qbytes: ::msglen_t,
69+
pub msg_lspid: ::pid_t,
70+
pub msg_lrpid: ::pid_t,
71+
__ignored1: ::c_ulong,
72+
__ignored2: ::c_ulong,
3473
}
3574

3675
pub struct sockaddr {
37-
pub sa_family: sa_family_t,
76+
pub sa_family: ::sa_family_t,
3877
pub sa_data: [::c_char; 14],
3978
}
4079

4180
pub struct sockaddr_in {
42-
pub sin_family: sa_family_t,
81+
pub sin_family: ::sa_family_t,
4382
pub sin_port: ::in_port_t,
4483
pub sin_addr: ::in_addr,
4584
pub sin_zero: [u8; 8],
4685
}
4786

4887
pub struct sockaddr_in6 {
49-
pub sin6_family: sa_family_t,
50-
pub sin6_port: in_port_t,
88+
pub sin6_family: ::sa_family_t,
89+
pub sin6_port: ::in_port_t,
5190
pub sin6_flowinfo: u32,
5291
pub sin6_addr: ::in6_addr,
5392
pub sin6_scope_id: u32,
5493
}
5594

5695
// ------------------------------------------------------------
5796
// definitions below are *unverified* and might **break** the software
97+
// pub struct in_addr {
98+
// pub s_addr: in_addr_t,
99+
// }
100+
//
101+
// pub struct in6_addr {
102+
// pub s6_addr: [u8; 16],
103+
// __align: [u32; 0],
104+
// }
105+
58106
pub struct stat { // ToDo
59107
pub st_dev: ::c_ulong,
60108
st_pad1: [::c_long; 2],
@@ -100,16 +148,16 @@ s! {
100148
}
101149

102150
pub struct dirent { // Todo
103-
pub d_ino: ino_64_t,
104-
pub d_off: off64_t,
151+
pub d_ino: ::ino64_t,
152+
pub d_off: ::off64_t,
105153
d_reclen: u16,
106154
pub d_type: u8,
107155
pub d_name: [i8; 256],
108156
}
109157

110158
pub struct dirent64 { //
111-
pub d_ino: ino64_t,
112-
pub d_off: off64_t,
159+
pub d_ino: ::ino64_t,
160+
pub d_off: ::off64_t,
113161
pub d_reclen: u16,
114162
pub d_type: u8,
115163
pub d_name: [i8; 256],
@@ -303,6 +351,7 @@ pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0;
303351
pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1;
304352
pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2;
305353
pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL;
354+
pub const RLIM_INFINITY: u64 = 0xffffffffffffffff;
306355
pub const __SIZEOF_PTHREAD_COND_T: usize = 48;
307356
pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
308357
pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;

0 commit comments

Comments
 (0)