Skip to content

Commit a6a64d1

Browse files
committed
Squashed commit of the following:
Running libc-test: PASSED 3426 tests commit 1a7ee714db34f17abd33dc9262d3e10275eec68d Author: Michael Neumann <[email protected]> Date: Sat Feb 20 13:30:56 2016 +0100 Fix RLIM_POSIXLOCKS -> RLIMIT_POSIXLOCKS commit 09c49a97ebebf087486659ef8277610d99e5c7b3 Author: Michael Neumann <[email protected]> Date: Sat Feb 20 13:29:24 2016 +0100 Ignore signedness check for uuid_t on DragonFly commit aab4d11f59917686280c271683bf00ff34c8040d Author: Michael Neumann <[email protected]> Date: Sat Feb 20 13:23:21 2016 +0100 Move FreeBSD-only function into freebsd/mod.rs commit 9921f030b103dbccb37930ab1d64cf1dd587bd48 Author: Michael Neumann <[email protected]> Date: Sat Feb 20 13:21:42 2016 +0100 Move POSIX_FADV_* to freebsd/mod.rs commit 2921c2db1e3d0314375aa371936bd227cc6c6e2a Author: Michael Neumann <[email protected]> Date: Sat Feb 20 13:20:11 2016 +0100 Fix signedness of blksize_t for DragonFly commit 65e817baee9e01d2d7c86c6202c63ee46d218914 Author: Michael Neumann <[email protected]> Date: Sat Feb 20 13:19:02 2016 +0100 Fix Q_{GET,SET}QUOTA for DragonFly commit a0d2d63ef88206d321222140ae6b3d92c93b51bd Author: Michael Neumann <[email protected]> Date: Sat Feb 20 13:17:27 2016 +0100 Fix RLIMIT_* for DragonFly commit d04a1600a7c66a792a481e1524a1652234a69939 Author: Michael Neumann <[email protected]> Date: Sat Feb 20 13:12:09 2016 +0100 Fix ELAST for DragonFly commit d120b9278426a76ee106e91e6c999885c1f5c7f4 Author: Michael Neumann <[email protected]> Date: Sat Feb 20 13:10:28 2016 +0100 Fix F_GETLK, F_SETLK, F_SETLKW for DragonFly commit 963f7da270a14f4d12ea1a52301e363ce745c897 Author: Michael Neumann <[email protected]> Date: Sat Feb 20 13:08:51 2016 +0100 Fix O_CLOEXEC for DragonFly commit f4d6c9d5991d690c7cb4460790a8e37e713bc034 Author: Michael Neumann <[email protected]> Date: Sat Feb 20 13:07:18 2016 +0100 Fix RAND_MAX for DragonFly commit ba48336da7be613a49702ad9de445ab3850ebb7c Author: Michael Neumann <[email protected]> Date: Sat Feb 20 13:04:48 2016 +0100 Fix statvfs for DragonFly commit 9ae480c60a7d77b31a17d34320464f4179e40a4a Author: Michael Neumann <[email protected]> Date: Sat Feb 20 12:51:47 2016 +0100 Fix fd_set for DragonFly commit a15e027838288c4980371c503252cca7e32356c0 Author: Michael Neumann <[email protected]> Date: Sat Feb 20 12:42:24 2016 +0100 Fix all remaining issues on DragonFly Missing functions and missing constats. commit 3966e4fce0cb81bd0b3ed8cdf50611e6982f7767 Author: Michael Neumann <[email protected]> Date: Sat Feb 20 12:27:14 2016 +0100 Use a macro instead of a constant. When using a constant, the libc-test thinks this constant exists as an C equivalent. commit 9b5659aaf54419f317250cb3a4692a1c14fdbc33 Author: Michael Neumann <[email protected]> Date: Sat Feb 20 12:21:01 2016 +0100 Use a constant in utsname commit 50484eda3c978a9c0a9652f6fc619c41ad349c2d Author: Michael Neumann <[email protected]> Date: Sat Feb 20 12:17:55 2016 +0100 Fix struct utsname commit 832e94248fabc91574d6d42630168da3542c153f Author: Michael Neumann <[email protected]> Date: Sat Feb 20 12:07:08 2016 +0100 DragonFly has different stat, dirent, clock_t, ino_t, nlink_t, blksize_t commit f3152a369d75ae8c1558afa5a59aa55e33b33ec6 Author: Michael Neumann <[email protected]> Date: Sat Feb 20 11:52:54 2016 +0100 Move DragonFly related stuff into dragonfly/* Replicate x86_64.rs from FreeBSD. Need some twists. commit 9fe35124064aa92303171d019004df119f948223 Author: Michael Neumann <[email protected]> Date: Sat Feb 20 11:49:38 2016 +0100 Move FreeBSD code under freebsd/*. Next commit will replicate some of the architecture dependent stuff for DragonFly. commit e91983df8deb14004f7a0fe47878f0e4eb31198d Author: Michael Neumann <[email protected]> Date: Sat Feb 20 11:44:25 2016 +0100 struct utsname has a different size on DragonFly
1 parent 054147a commit a6a64d1

File tree

10 files changed

+225
-100
lines changed

10 files changed

+225
-100
lines changed

libc-test/build.rs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@ fn main() {
1414
let apple = target.contains("apple");
1515
let musl = target.contains("musl");
1616
let freebsd = target.contains("freebsd");
17+
let dragonfly = target.contains("dragonfly");
1718
let mips = target.contains("mips");
1819
let netbsd = target.contains("netbsd");
1920
let openbsd = target.contains("openbsd");
2021
let rumprun = target.contains("rumprun");
21-
let bsdlike = freebsd || apple || netbsd || openbsd;
22+
let bsdlike = freebsd || apple || netbsd || openbsd || dragonfly;
2223
let mut cfg = ctest::TestGenerator::new();
2324

2425
// Pull in extra goodies on linux/mingw
@@ -103,7 +104,7 @@ fn main() {
103104
cfg.header("ifaddrs.h");
104105
cfg.header("sys/statvfs.h");
105106

106-
if !openbsd && !freebsd {
107+
if !openbsd && !freebsd && !dragonfly {
107108
cfg.header("sys/quota.h");
108109
}
109110

@@ -177,6 +178,12 @@ fn main() {
177178
cfg.header("sys/syscall.h");
178179
}
179180

181+
if dragonfly {
182+
cfg.header("ufs/ufs/quota.h");
183+
cfg.header("pthread_np.h");
184+
cfg.header("sys/ioctl_compat.h");
185+
}
186+
180187
cfg.type_name(move |ty, is_struct| {
181188
match ty {
182189
// Just pass all these through, no need for a "struct" prefix
@@ -192,6 +199,9 @@ fn main() {
192199
// OSX calls this something else
193200
"sighandler_t" if bsdlike => "sig_t".to_string(),
194201

202+
// does not exist on DragonFly
203+
"fflags_t" if dragonfly => "uint32_t".to_string(),
204+
195205
t if t.ends_with("_t") => t.to_string(),
196206

197207
// Windows uppercase structs don't have `struct` in front, there's a
@@ -254,12 +264,13 @@ fn main() {
254264
}
255265
});
256266

257-
cfg.skip_signededness(|c| {
267+
cfg.skip_signededness(move |c| {
258268
match c {
259269
"LARGE_INTEGER" |
260270
"mach_timebase_info_data_t" |
261271
"float" |
262272
"double" => true,
273+
"uuid_t" if dragonfly => true,
263274
n if n.starts_with("pthread") => true,
264275

265276
// windows-isms
@@ -321,7 +332,7 @@ fn main() {
321332
"strerror_r" if linux => true, // actually xpg-something-or-other
322333

323334
// typed 2nd arg on linux and android
324-
"gettimeofday" if linux || android || freebsd || openbsd => true,
335+
"gettimeofday" if linux || android || freebsd || openbsd || dragonfly => true,
325336

326337
// not declared in newer android toolchains
327338
"getdtablesize" if android => true,

src/unix/bsd/freebsdlike/dragonfly.rs

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
cfg_if! {
2+
if #[cfg(target_arch = "x86_64")] {
3+
mod x86_64;
4+
pub use self::x86_64::*;
5+
} else {
6+
// ...
7+
}
8+
}
9+
10+
pub type clock_t = u64;
11+
pub type ino_t = u64;
12+
pub type nlink_t = u32;
13+
pub type blksize_t = i64;
14+
15+
s! {
16+
pub struct dirent {
17+
pub d_fileno: ::ino_t,
18+
pub d_namlen: u16,
19+
pub d_type: u8,
20+
__unused1: u8,
21+
__unused2: u32,
22+
pub d_name: [::c_char; 256],
23+
}
24+
25+
pub struct uuid {
26+
time_low: u32,
27+
time_mid: u16,
28+
time_hi_and_version: u16,
29+
clock_seq_hi_and_reserved: u8,
30+
clock_seq_low: u8,
31+
node: [u8; 6],
32+
}
33+
34+
pub struct statvfs {
35+
pub f_bsize: ::c_ulong,
36+
pub f_frsize: ::c_ulong,
37+
pub f_blocks: ::fsblkcnt_t,
38+
pub f_bfree: ::fsblkcnt_t,
39+
pub f_bavail: ::fsblkcnt_t,
40+
pub f_files: ::fsfilcnt_t,
41+
pub f_ffree: ::fsfilcnt_t,
42+
pub f_favail: ::fsfilcnt_t,
43+
pub f_fsid: ::c_ulong,
44+
pub f_flag: ::c_ulong,
45+
pub f_namemax: ::c_ulong,
46+
pub f_owner: ::uid_t,
47+
pub f_type: ::c_uint,
48+
pub f_syncreads: u64,
49+
pub f_syncwrites: u64,
50+
pub f_asyncreads: u64,
51+
pub f_asyncwrites: u64,
52+
pub f_fsid_uuid: ::uuid_t,
53+
pub f_uid_uuid: ::uuid_t,
54+
}
55+
}
56+
57+
pub type uuid_t = ::uuid;
58+
59+
pub type fsblkcnt_t = u64;
60+
pub type fsfilcnt_t = u64;
61+
62+
pub const RAND_MAX: ::c_int = 0x7fff_ffff;
63+
pub const PTHREAD_STACK_MIN: ::size_t = 1024;
64+
pub const KERN_PROC_PATHNAME: ::c_int = 9;
65+
pub const SIGSTKSZ: ::size_t = 40960;
66+
pub const MADV_INVAL: ::c_int = 10;
67+
pub const O_CLOEXEC: ::c_int = 0x00020000;
68+
pub const F_GETLK: ::c_int = 7;
69+
pub const F_SETLK: ::c_int = 8;
70+
pub const F_SETLKW: ::c_int = 9;
71+
pub const ELAST: ::c_int = 99;
72+
pub const RLIMIT_POSIXLOCKS: ::c_int = 11;
73+
pub const RLIM_NLIMITS: ::rlim_t = 12;
74+
75+
pub const Q_GETQUOTA: ::c_int = 0x300;
76+
pub const Q_SETQUOTA: ::c_int = 0x400;
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
pub type c_long = i64;
2+
pub type c_ulong = u64;
3+
pub type time_t = i64;
4+
pub type suseconds_t = i64;
5+
6+
s! {
7+
pub struct stat {
8+
pub st_ino: ::ino_t,
9+
pub st_nlink: ::nlink_t,
10+
pub st_dev: ::dev_t,
11+
pub st_mode: ::mode_t,
12+
pub st_padding1: ::uint16_t,
13+
pub st_uid: ::uid_t,
14+
pub st_gid: ::gid_t,
15+
pub st_rdev: ::dev_t,
16+
pub st_atime: ::time_t,
17+
pub st_atime_nsec: ::c_long,
18+
pub st_mtime: ::time_t,
19+
pub st_mtime_nsec: ::c_long,
20+
pub st_ctime: ::time_t,
21+
pub st_ctime_nsec: ::c_long,
22+
pub st_size: ::off_t,
23+
pub st_blocks: ::int64_t,
24+
pub st_blksize: ::uint32_t,
25+
pub st_flags: ::fflags_t,
26+
pub st_gen: ::uint32_t,
27+
pub st_lspare: ::int32_t,
28+
pub st_qspare1: ::int64_t,
29+
pub st_qspare2: ::int64_t,
30+
}
31+
}

src/unix/bsd/freebsdlike/freebsd.rs

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
cfg_if! {
2+
if #[cfg(target_arch = "x86")] {
3+
mod x86;
4+
pub use self::x86::*;
5+
} else if #[cfg(target_arch = "x86_64")] {
6+
mod x86_64;
7+
pub use self::x86_64::*;
8+
} else {
9+
// ...
10+
}
11+
}
12+
13+
pub type clock_t = i32;
14+
pub type ino_t = u32;
15+
pub type nlink_t = u16;
16+
pub type blksize_t = u32;
17+
18+
s! {
19+
pub struct dirent {
20+
pub d_fileno: u32,
21+
pub d_reclen: u16,
22+
pub d_type: u8,
23+
pub d_namlen: u8,
24+
pub d_name: [::c_char; 256],
25+
}
26+
27+
pub struct statvfs {
28+
pub f_bavail: ::fsblkcnt_t,
29+
pub f_bfree: ::fsblkcnt_t,
30+
pub f_blocks: ::fsblkcnt_t,
31+
pub f_favail: ::fsfilcnt_t,
32+
pub f_ffree: ::fsfilcnt_t,
33+
pub f_files: ::fsfilcnt_t,
34+
pub f_bsize: ::c_ulong,
35+
pub f_flag: ::c_ulong,
36+
pub f_frsize: ::c_ulong,
37+
pub f_fsid: ::c_ulong,
38+
pub f_namemax: ::c_ulong,
39+
}
40+
}
41+
42+
pub type fsblkcnt_t = ::uint64_t;
43+
pub type fsfilcnt_t = ::uint64_t;
44+
45+
pub const RAND_MAX: ::c_int = 0x7fff_fffd;
46+
pub const PTHREAD_STACK_MIN: ::size_t = 2048;
47+
pub const KERN_PROC_PATHNAME: ::c_int = 12;
48+
pub const SIGSTKSZ: ::size_t = 34816;
49+
pub const SF_NODISKIO: ::c_int = 0x00000001;
50+
pub const SF_MNOWAIT: ::c_int = 0x00000002;
51+
pub const SF_SYNC: ::c_int = 0x00000004;
52+
pub const O_CLOEXEC: ::c_int = 0x00100000;
53+
pub const F_GETLK: ::c_int = 11;
54+
pub const F_SETLK: ::c_int = 12;
55+
pub const F_SETLKW: ::c_int = 13;
56+
pub const ELAST: ::c_int = 96;
57+
pub const RLIMIT_NPTS: ::c_int = 11;
58+
pub const RLIMIT_SWAP: ::c_int = 12;
59+
pub const RLIM_NLIMITS: ::rlim_t = 13;
60+
61+
pub const Q_GETQUOTA: ::c_int = 0x700;
62+
pub const Q_SETQUOTA: ::c_int = 0x800;
63+
64+
pub const POSIX_FADV_NORMAL: ::c_int = 0;
65+
pub const POSIX_FADV_RANDOM: ::c_int = 1;
66+
pub const POSIX_FADV_SEQUENTIAL: ::c_int = 2;
67+
pub const POSIX_FADV_WILLNEED: ::c_int = 3;
68+
pub const POSIX_FADV_DONTNEED: ::c_int = 4;
69+
pub const POSIX_FADV_NOREUSE: ::c_int = 5;
70+
71+
extern {
72+
pub fn __error() -> *mut ::c_int;
73+
74+
pub fn posix_fallocate(fd: ::c_int, offset: ::off_t,
75+
len: ::off_t) -> ::c_int;
76+
pub fn posix_fadvise(fd: ::c_int, offset: ::off_t, len: ::off_t,
77+
advise: ::c_int) -> ::c_int;
78+
pub fn mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int;
79+
pub fn mkostemps(template: *mut ::c_char, suffixlen: ::c_int, flags: ::c_int) -> ::c_int;
80+
}

0 commit comments

Comments
 (0)