Skip to content

Commit 494fc86

Browse files
Add fixes from libc-test results
1 parent 4affb62 commit 494fc86

File tree

2 files changed

+61
-26
lines changed

2 files changed

+61
-26
lines changed

src/unix/newlib/horizon/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ pub type c_ulong = u32;
66

77
pub type wchar_t = ::c_uint;
88

9-
pub type in_port_t = ::c_ushort;
109
pub type u_register_t = ::c_uint;
1110
pub type u_char = ::c_uchar;
1211
pub type u_short = ::c_ushort;
@@ -34,8 +33,9 @@ s! {
3433

3534
pub struct sockaddr_in {
3635
pub sin_family: ::sa_family_t,
37-
pub sin_port: in_port_t,
36+
pub sin_port: ::in_port_t,
3837
pub sin_addr: ::in_addr,
38+
pub sin_zero: [::c_uchar; 8],
3939
}
4040

4141
pub struct sockaddr_in6 {

src/unix/newlib/mod.rs

+59-24
Original file line numberDiff line numberDiff line change
@@ -129,25 +129,6 @@ s! {
129129
pub tm_isdst: ::c_int,
130130
}
131131

132-
pub struct stat {
133-
pub st_dev: ::dev_t,
134-
pub st_ino: ::ino_t,
135-
pub st_mode: ::mode_t,
136-
pub st_nlink: ::nlink_t,
137-
pub st_uid: ::uid_t,
138-
pub st_gid: ::gid_t,
139-
pub st_rdev: dev_t,
140-
pub st_size: off_t,
141-
pub st_atime: time_t,
142-
pub st_spare1: ::c_long,
143-
pub st_mtime: time_t,
144-
pub st_spare2: ::c_long,
145-
pub st_ctime: time_t,
146-
pub st_spare3: ::c_long,
147-
pub st_blksize: blksize_t,
148-
pub st_blocks: blkcnt_t,
149-
pub st_spare4: [::c_long; 2usize],
150-
}
151132

152133
pub struct statvfs {
153134
pub f_bsize: ::c_ulong,
@@ -163,10 +144,6 @@ s! {
163144
pub f_namemax: ::c_ulong,
164145
}
165146

166-
pub struct sigset_t {
167-
__val: [::c_ulong; 16],
168-
}
169-
170147
pub struct sigaction {
171148
pub sa_handler: extern fn(arg1: ::c_int),
172149
pub sa_mask: sigset_t,
@@ -242,6 +219,57 @@ s! {
242219
}
243220
}
244221

222+
cfg_if! {
223+
if #[cfg(target_os = "horizon")] {
224+
pub type sigset_t = ::c_ulong;
225+
226+
s! {
227+
pub struct stat {
228+
pub st_dev: ::dev_t,
229+
pub st_ino: ::ino_t,
230+
pub st_mode: ::mode_t,
231+
pub st_nlink: ::nlink_t,
232+
pub st_uid: ::uid_t,
233+
pub st_gid: ::gid_t,
234+
pub st_rdev: dev_t,
235+
pub st_size: off_t,
236+
pub st_atim: ::timespec,
237+
pub st_mtim: ::timespec,
238+
pub st_ctim: ::timespec,
239+
pub st_blksize: blksize_t,
240+
pub st_blocks: blkcnt_t,
241+
pub st_spare4: [::c_long; 2usize],
242+
}
243+
}
244+
} else {
245+
s! {
246+
pub struct sigset_t {
247+
__val: [::c_ulong; 16],
248+
}
249+
250+
pub struct stat {
251+
pub st_dev: ::dev_t,
252+
pub st_ino: ::ino_t,
253+
pub st_mode: ::mode_t,
254+
pub st_nlink: ::nlink_t,
255+
pub st_uid: ::uid_t,
256+
pub st_gid: ::gid_t,
257+
pub st_rdev: dev_t,
258+
pub st_size: off_t,
259+
pub st_atime: time_t,
260+
pub st_spare1: ::c_long,
261+
pub st_mtime: time_t,
262+
pub st_spare2: ::c_long,
263+
pub st_ctime: time_t,
264+
pub st_spare3: ::c_long,
265+
pub st_blksize: blksize_t,
266+
pub st_blocks: blkcnt_t,
267+
pub st_spare4: [::c_long; 2usize],
268+
}
269+
}
270+
}
271+
}
272+
245273
// unverified constants
246274
align_const! {
247275
pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
@@ -283,7 +311,14 @@ pub const __PTHREAD_RWLOCK_INT_FLAGS_SHARED: usize = 1;
283311
pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0;
284312
pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1;
285313
pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2;
286-
pub const FD_SETSIZE: usize = 1024;
314+
315+
cfg_if! {
316+
if #[cfg(target_os = "horizon")] {
317+
pub const FD_SETSIZE: usize = 64;
318+
} else {
319+
pub const FD_SETSIZE: usize = 1024;
320+
}
321+
}
287322
// intentionally not public, only used for fd_set
288323
const ULONG_SIZE: usize = 32;
289324

0 commit comments

Comments
 (0)