libc-rs/libc-test/build.rs

837 lines
30 KiB
Rust
Raw Normal View History

2015-09-17 02:44:40 +02:00
#![deny(warnings)]
2015-09-16 08:28:52 +02:00
extern crate ctest;
2015-09-10 07:46:19 +02:00
use std::env;
2015-09-16 08:28:52 +02:00
fn main() {
let target = env::var("TARGET").unwrap();
let aarch64 = target.contains("aarch64");
2017-07-22 09:37:22 +02:00
let i686 = target.contains("i686");
let x86_64 = target.contains("x86_64");
2017-10-18 16:08:36 +02:00
let x32 = target.ends_with("gnux32");
2015-09-16 08:28:52 +02:00
let windows = target.contains("windows");
let mingw = target.contains("windows-gnu");
2015-09-17 23:47:40 +02:00
let linux = target.contains("unknown-linux");
2015-09-18 00:09:02 +02:00
let android = target.contains("android");
2015-09-20 08:20:53 +02:00
let apple = target.contains("apple");
let emscripten = target.contains("asm");
let musl = target.contains("musl") || emscripten;
2017-04-20 08:34:50 +02:00
let uclibc = target.contains("uclibc");
2015-09-18 20:54:32 +02:00
let freebsd = target.contains("freebsd");
Squashed commit of the following: Running libc-test: PASSED 3426 tests commit 1a7ee714db34f17abd33dc9262d3e10275eec68d Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:30:56 2016 +0100 Fix RLIM_POSIXLOCKS -> RLIMIT_POSIXLOCKS commit 09c49a97ebebf087486659ef8277610d99e5c7b3 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:29:24 2016 +0100 Ignore signedness check for uuid_t on DragonFly commit aab4d11f59917686280c271683bf00ff34c8040d Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:23:21 2016 +0100 Move FreeBSD-only function into freebsd/mod.rs commit 9921f030b103dbccb37930ab1d64cf1dd587bd48 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:21:42 2016 +0100 Move POSIX_FADV_* to freebsd/mod.rs commit 2921c2db1e3d0314375aa371936bd227cc6c6e2a Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:20:11 2016 +0100 Fix signedness of blksize_t for DragonFly commit 65e817baee9e01d2d7c86c6202c63ee46d218914 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:19:02 2016 +0100 Fix Q_{GET,SET}QUOTA for DragonFly commit a0d2d63ef88206d321222140ae6b3d92c93b51bd Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:17:27 2016 +0100 Fix RLIMIT_* for DragonFly commit d04a1600a7c66a792a481e1524a1652234a69939 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:12:09 2016 +0100 Fix ELAST for DragonFly commit d120b9278426a76ee106e91e6c999885c1f5c7f4 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:10:28 2016 +0100 Fix F_GETLK, F_SETLK, F_SETLKW for DragonFly commit 963f7da270a14f4d12ea1a52301e363ce745c897 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:08:51 2016 +0100 Fix O_CLOEXEC for DragonFly commit f4d6c9d5991d690c7cb4460790a8e37e713bc034 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:07:18 2016 +0100 Fix RAND_MAX for DragonFly commit ba48336da7be613a49702ad9de445ab3850ebb7c Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:04:48 2016 +0100 Fix statvfs for DragonFly commit 9ae480c60a7d77b31a17d34320464f4179e40a4a Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 12:51:47 2016 +0100 Fix fd_set for DragonFly commit a15e027838288c4980371c503252cca7e32356c0 Author: Michael Neumann <mneumann@ntecs.de> 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 <mneumann@ntecs.de> 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 <mneumann@ntecs.de> Date: Sat Feb 20 12:21:01 2016 +0100 Use a constant in utsname commit 50484eda3c978a9c0a9652f6fc619c41ad349c2d Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 12:17:55 2016 +0100 Fix struct utsname commit 832e94248fabc91574d6d42630168da3542c153f Author: Michael Neumann <mneumann@ntecs.de> 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 <mneumann@ntecs.de> 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 <mneumann@ntecs.de> 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 <mneumann@ntecs.de> Date: Sat Feb 20 11:44:25 2016 +0100 struct utsname has a different size on DragonFly
2016-02-20 13:34:01 +01:00
let dragonfly = target.contains("dragonfly");
let mips = target.contains("mips");
2015-11-27 18:40:37 +01:00
let netbsd = target.contains("netbsd");
2015-12-21 17:26:41 +01:00
let openbsd = target.contains("openbsd");
2015-11-27 18:40:37 +01:00
let rumprun = target.contains("rumprun");
let solaris = target.contains("solaris");
Squashed commit of the following: Running libc-test: PASSED 3426 tests commit 1a7ee714db34f17abd33dc9262d3e10275eec68d Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:30:56 2016 +0100 Fix RLIM_POSIXLOCKS -> RLIMIT_POSIXLOCKS commit 09c49a97ebebf087486659ef8277610d99e5c7b3 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:29:24 2016 +0100 Ignore signedness check for uuid_t on DragonFly commit aab4d11f59917686280c271683bf00ff34c8040d Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:23:21 2016 +0100 Move FreeBSD-only function into freebsd/mod.rs commit 9921f030b103dbccb37930ab1d64cf1dd587bd48 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:21:42 2016 +0100 Move POSIX_FADV_* to freebsd/mod.rs commit 2921c2db1e3d0314375aa371936bd227cc6c6e2a Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:20:11 2016 +0100 Fix signedness of blksize_t for DragonFly commit 65e817baee9e01d2d7c86c6202c63ee46d218914 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:19:02 2016 +0100 Fix Q_{GET,SET}QUOTA for DragonFly commit a0d2d63ef88206d321222140ae6b3d92c93b51bd Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:17:27 2016 +0100 Fix RLIMIT_* for DragonFly commit d04a1600a7c66a792a481e1524a1652234a69939 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:12:09 2016 +0100 Fix ELAST for DragonFly commit d120b9278426a76ee106e91e6c999885c1f5c7f4 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:10:28 2016 +0100 Fix F_GETLK, F_SETLK, F_SETLKW for DragonFly commit 963f7da270a14f4d12ea1a52301e363ce745c897 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:08:51 2016 +0100 Fix O_CLOEXEC for DragonFly commit f4d6c9d5991d690c7cb4460790a8e37e713bc034 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:07:18 2016 +0100 Fix RAND_MAX for DragonFly commit ba48336da7be613a49702ad9de445ab3850ebb7c Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:04:48 2016 +0100 Fix statvfs for DragonFly commit 9ae480c60a7d77b31a17d34320464f4179e40a4a Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 12:51:47 2016 +0100 Fix fd_set for DragonFly commit a15e027838288c4980371c503252cca7e32356c0 Author: Michael Neumann <mneumann@ntecs.de> 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 <mneumann@ntecs.de> 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 <mneumann@ntecs.de> Date: Sat Feb 20 12:21:01 2016 +0100 Use a constant in utsname commit 50484eda3c978a9c0a9652f6fc619c41ad349c2d Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 12:17:55 2016 +0100 Fix struct utsname commit 832e94248fabc91574d6d42630168da3542c153f Author: Michael Neumann <mneumann@ntecs.de> 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 <mneumann@ntecs.de> 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 <mneumann@ntecs.de> 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 <mneumann@ntecs.de> Date: Sat Feb 20 11:44:25 2016 +0100 struct utsname has a different size on DragonFly
2016-02-20 13:34:01 +01:00
let bsdlike = freebsd || apple || netbsd || openbsd || dragonfly;
2015-09-16 08:28:52 +02:00
let mut cfg = ctest::TestGenerator::new();
// Pull in extra goodies
if linux || android || emscripten {
2015-09-16 08:28:52 +02:00
cfg.define("_GNU_SOURCE", None);
} else if netbsd {
cfg.define("_NETBSD_SOURCE", Some("1"));
} else if apple {
cfg.define("__APPLE_USE_RFC_3542", None);
2015-09-18 00:09:02 +02:00
} else if windows {
2015-09-16 08:28:52 +02:00
cfg.define("_WIN32_WINNT", Some("0x8000"));
} else if solaris {
2017-11-18 22:03:14 +01:00
cfg.define("_XOPEN_SOURCE", Some("700"));
cfg.define("__EXTENSIONS__", None);
cfg.define("_LCONV_C99", None);
2015-09-16 08:28:52 +02:00
}
2015-09-17 01:27:23 +02:00
// Android doesn't actually have in_port_t but it's much easier if we
// provide one for us to test against
2015-09-18 00:09:02 +02:00
if android {
2015-09-17 01:27:23 +02:00
cfg.define("in_port_t", Some("uint16_t"));
}
2015-09-16 08:28:52 +02:00
cfg.header("errno.h")
.header("fcntl.h")
.header("limits.h")
2016-03-30 08:13:55 +02:00
.header("locale.h")
2015-09-16 08:28:52 +02:00
.header("stddef.h")
.header("stdint.h")
.header("stdio.h")
.header("stdlib.h")
.header("sys/stat.h")
.header("sys/types.h")
.header("time.h")
.header("wchar.h");
2015-09-18 00:09:02 +02:00
if windows {
2015-09-16 08:28:52 +02:00
cfg.header("winsock2.h"); // must be before windows.h
cfg.header("direct.h");
cfg.header("io.h");
cfg.header("sys/utime.h");
cfg.header("windows.h");
cfg.header("process.h");
cfg.header("ws2ipdef.h");
if target.contains("gnu") {
cfg.header("ws2tcpip.h");
2015-09-10 19:56:31 +02:00
}
2015-09-16 08:28:52 +02:00
} else {
cfg.flag("-Wno-deprecated-declarations");
2015-09-16 08:28:52 +02:00
cfg.header("ctype.h");
cfg.header("dirent.h");
2015-12-21 17:26:41 +01:00
if openbsd {
cfg.header("sys/socket.h");
}
2015-09-16 08:28:52 +02:00
cfg.header("net/if.h");
2018-05-31 06:38:50 +02:00
cfg.header("net/route.h");
2018-05-29 10:44:06 +02:00
cfg.header("net/if_arp.h");
2015-09-16 08:28:52 +02:00
cfg.header("netdb.h");
cfg.header("netinet/in.h");
cfg.header("netinet/ip.h");
cfg.header("netinet/tcp.h");
2017-07-07 11:58:11 +02:00
cfg.header("netinet/udp.h");
Add binding for res_init. Some notes about the particularities of the changes: res_init has been deprecated in favor of res_ninit, and many (but not all) targets have therefore renamed the link name to __res_init. For example, this happened in glibc in version 2.2: https://bugzilla.redhat.com/show_bug.cgi?id=43822#c6 In these systems, res_init is #defined to __res_init in resolv.h, which lets existing C programs continue to be compiled. Unfortunately, this define doesn't automatically apply to our Rust code. We therefore need to manually map the link name of res_init as appropriate for each target: macOS and iOS use res_9_init: https://github.com/practicalswift/osx/blob/3908694d6328baa293f0d7fc337348c01d13ed8f/src/libresolv/resolv.h#L316 Solaris uses res_init: https://java.net/projects/solaris/sources/on-src/content/usr/src/head/resolv.h OpenBSD uses __res_init: https://github.com/openbsd/src/blob/f3b3b7c7ca9a921db3a5650eed40f2b2e4d731d8/include/resolv.h#L268 FreeBSD uses __res_init: https://github.com/freebsd/freebsd/blob/6911f4a88c9832e5985b788f5e84010424f9e020/include/resolv.h#L290 NetBSD uses __res_init: http://ftp.netbsd.org/pub/NetBSD/NetBSD-current/src/include/resolv.h glibc uses __res_init: https://github.com/lattera/glibc/blob/a2f34833b1042d5d8eeb263b4cf4caaea138c4ad/resolv/resolv.h#L259 eglibc uses __res_init: https://github.com/Xilinx/eglibc/blob/7f0bcce417c47aefad06ddfec7cd4ced3a4e10ff/resolv/resolv.h#L259 musl uses res_init: https://github.com/runtimejs/musl-libc/blob/0a11d7cb13e243782da36e2e5747b8b151933cca/include/resolv.h#L128 Android uses res_init: https://github.com/android/platform_bionic/blob/306ea559528255e19a5bcd68cc2a9b1afc2cfb27/libc/include/resolv.h#L57 One caveat here is that NetBSD doesn't seem to use the symbol name __res_init yet, despite the redefine being present in resolv.h. At least Travis fails for the netbsd target if __res_init is used. This may change in the future. iOS and macOS both unfortunately require linking with libresolv, despite the symbols technically being available without libresolv: resolv: http://blog.achernya.com/2013/03/os-x-has-silly-libsystem.html Android and OpenBSD fall in the same category.
2017-04-27 04:39:52 +02:00
cfg.header("resolv.h");
2015-09-16 08:28:52 +02:00
cfg.header("pthread.h");
2015-09-18 00:09:02 +02:00
cfg.header("dlfcn.h");
2015-09-16 08:28:52 +02:00
cfg.header("signal.h");
cfg.header("string.h");
cfg.header("sys/file.h");
cfg.header("sys/ioctl.h");
cfg.header("sys/mman.h");
cfg.header("sys/resource.h");
cfg.header("sys/socket.h");
if linux && !musl {
cfg.header("linux/if.h");
2018-01-19 12:11:14 +01:00
cfg.header("sys/auxv.h");
}
2015-09-16 08:28:52 +02:00
cfg.header("sys/time.h");
cfg.header("sys/un.h");
cfg.header("sys/wait.h");
cfg.header("unistd.h");
cfg.header("utime.h");
2015-09-17 23:47:40 +02:00
cfg.header("pwd.h");
cfg.header("grp.h");
cfg.header("sys/utsname.h");
if !solaris {
cfg.header("sys/ptrace.h");
}
cfg.header("sys/mount.h");
cfg.header("sys/uio.h");
cfg.header("sched.h");
cfg.header("termios.h");
cfg.header("poll.h");
cfg.header("syslog.h");
2016-06-04 06:02:56 +02:00
cfg.header("semaphore.h");
cfg.header("sys/statvfs.h");
cfg.header("sys/times.h");
2015-09-18 20:54:32 +02:00
}
2015-09-16 08:28:52 +02:00
2015-09-18 20:54:32 +02:00
if android {
2017-04-19 16:04:14 +02:00
if !aarch64 && !x86_64 {
// time64_t is not define for aarch64 and x86_64
// If included it will generate the error 'Your time_t is already 64-bit'
cfg.header("time64.h");
}
2015-09-18 20:54:32 +02:00
cfg.header("arpa/inet.h");
cfg.header("xlocale.h");
2016-07-27 13:42:36 +02:00
cfg.header("utmp.h");
2018-05-26 08:59:30 +02:00
cfg.header("ifaddrs.h");
2017-08-01 16:20:13 +02:00
if i686 || x86_64 {
cfg.header("sys/reg.h");
}
2015-09-18 20:54:32 +02:00
} else if !windows {
cfg.header("glob.h");
cfg.header("ifaddrs.h");
cfg.header("langinfo.h");
if !openbsd && !freebsd && !dragonfly && !solaris {
2015-12-21 17:26:41 +01:00
cfg.header("sys/quota.h");
}
2015-09-18 20:54:32 +02:00
if !musl && !x32 && !solaris {
2015-09-18 20:54:32 +02:00
cfg.header("sys/sysctl.h");
}
2017-10-18 16:08:36 +02:00
if !musl && !uclibc {
2015-11-27 18:40:37 +01:00
2017-04-20 08:34:50 +02:00
if !netbsd && !openbsd && !uclibc {
2015-11-27 18:40:37 +01:00
cfg.header("execinfo.h");
}
2016-07-27 13:42:36 +02:00
if openbsd {
cfg.header("utmp.h");
} else {
cfg.header("utmpx.h");
}
2015-09-18 00:47:44 +02:00
}
2015-09-18 20:54:32 +02:00
}
2015-09-18 00:47:44 +02:00
2015-09-20 08:20:53 +02:00
if apple {
2018-01-26 01:19:35 +01:00
cfg.header("spawn.h");
2015-09-18 20:54:32 +02:00
cfg.header("mach-o/dyld.h");
cfg.header("mach/mach_time.h");
cfg.header("malloc/malloc.h");
2016-02-27 20:58:43 +01:00
cfg.header("util.h");
2017-10-09 18:36:52 +02:00
cfg.header("xlocale.h");
2017-05-07 23:40:15 +02:00
cfg.header("sys/xattr.h");
2017-07-07 11:58:11 +02:00
cfg.header("sys/sys_domain.h");
cfg.header("net/if_utun.h");
2017-12-26 08:57:11 +01:00
cfg.header("net/bpf.h");
2015-09-20 08:20:53 +02:00
if target.starts_with("x86") {
cfg.header("crt_externs.h");
}
2017-07-19 00:16:45 +02:00
cfg.header("net/route.h");
2017-12-25 00:55:58 +01:00
cfg.header("netinet/if_ether.h");
cfg.header("netinet/in.h");
2017-07-19 00:16:45 +02:00
cfg.header("sys/proc_info.h");
2018-01-15 05:44:34 +01:00
cfg.header("sys/kern_control.h");
2018-02-02 17:07:12 +01:00
cfg.header("sys/ipc.h");
cfg.header("sys/shm.h");
2015-09-17 23:47:40 +02:00
}
2015-09-18 20:54:32 +02:00
if bsdlike {
cfg.header("sys/event.h");
2017-12-12 04:24:00 +01:00
cfg.header("net/if_dl.h");
if freebsd {
2017-12-26 09:02:17 +01:00
cfg.header("net/bpf.h");
cfg.header("libutil.h");
} else {
cfg.header("util.h");
}
}
if linux || emscripten {
cfg.header("mntent.h");
cfg.header("mqueue.h");
2016-02-22 20:11:01 +01:00
cfg.header("ucontext.h");
if !uclibc {
// optionally included in uclibc
cfg.header("sys/xattr.h");
}
2015-12-14 00:09:45 +01:00
cfg.header("sys/ipc.h");
cfg.header("sys/sem.h");
cfg.header("sys/msg.h");
2015-12-14 00:09:45 +01:00
cfg.header("sys/shm.h");
cfg.header("sys/user.h");
cfg.header("sys/timerfd.h");
2016-09-27 07:19:17 +02:00
cfg.header("shadow.h");
if !emscripten {
cfg.header("linux/input.h");
cfg.header("linux/falloc.h");
}
if x86_64 {
cfg.header("sys/io.h");
}
2017-07-22 09:37:22 +02:00
if i686 || x86_64 {
cfg.header("sys/reg.h");
}
}
2018-01-15 05:44:34 +01:00
if linux || android || emscripten {
2015-09-18 20:54:32 +02:00
cfg.header("malloc.h");
cfg.header("net/ethernet.h");
cfg.header("netpacket/packet.h");
cfg.header("sched.h");
cfg.header("sys/epoll.h");
cfg.header("sys/eventfd.h");
2015-09-17 23:47:40 +02:00
cfg.header("sys/prctl.h");
cfg.header("sys/sendfile.h");
2017-07-17 07:49:28 +02:00
cfg.header("sys/signalfd.h");
cfg.header("sys/vfs.h");
cfg.header("sys/syscall.h");
cfg.header("sys/personality.h");
cfg.header("sys/swap.h");
cfg.header("pty.h");
2017-04-20 08:34:50 +02:00
if !uclibc {
cfg.header("sys/sysinfo.h");
}
2016-07-12 12:22:51 +02:00
cfg.header("sys/reboot.h");
2017-08-27 18:07:18 +02:00
if !emscripten {
2018-05-30 12:08:28 +02:00
cfg.header("linux/sockios.h");
2018-02-22 14:52:46 +01:00
cfg.header("linux/netlink.h");
cfg.header("linux/genetlink.h");
2017-08-27 18:07:18 +02:00
cfg.header("linux/netfilter_ipv4.h");
cfg.header("linux/netfilter_ipv6.h");
cfg.header("linux/fs.h");
2017-08-27 18:07:18 +02:00
}
if !musl {
cfg.header("asm/mman.h");
cfg.header("linux/magic.h");
2016-07-12 12:22:51 +02:00
cfg.header("linux/reboot.h");
cfg.header("linux/netfilter/nf_tables.h");
if !mips {
cfg.header("linux/quota.h");
}
}
2015-09-10 19:56:31 +02:00
}
2018-01-11 16:25:00 +01:00
if solaris {
cfg.header("sys/epoll.h");
}
2015-09-10 19:56:31 +02:00
2017-09-19 03:41:34 +02:00
if linux || android {
cfg.header("sys/fsuid.h");
2017-12-19 10:11:33 +01:00
cfg.header("linux/seccomp.h");
2017-12-25 00:55:58 +01:00
cfg.header("linux/if_ether.h");
cfg.header("linux/if_tun.h");
2017-09-19 03:41:34 +02:00
// DCCP support
if !uclibc && !musl && !emscripten {
cfg.header("linux/dccp.h");
}
2017-11-05 22:13:35 +01:00
if !musl || mips {
cfg.header("linux/memfd.h");
}
2017-09-19 03:41:34 +02:00
}
if linux {
cfg.header("linux/random.h");
cfg.header("elf.h");
cfg.header("link.h");
2018-01-26 01:19:35 +01:00
cfg.header("spawn.h");
}
2015-09-18 20:54:32 +02:00
if freebsd {
cfg.header("mqueue.h");
2015-09-18 20:54:32 +02:00
cfg.header("pthread_np.h");
cfg.header("sched.h");
cfg.header("ufs/ufs/quota.h");
cfg.header("sys/jail.h");
Add IPC,SHM,MSG for Freebsd INFO for the patch: FREEBSD [https://github.com/freebsd/freebsd] /sys/sys/_types.h typedef long __key_t; /sys/sys/types.h typedef __key_t key_t; /sys/sys/ipc.h struct ipc_perm { uid_t cuid; gid_t cgid; uid_t uid; gid_t gid; mode_t mode; unsigned short seq; key_t key; }; key_t ftok(const char *, int); /sys/sys/msg.h typedef unsigned long msglen_t; typedef unsigned long msgqnum_t; struct msqid_ds { struct ipc_perm msg_perm; struct msg *msg_first; struct msg *msg_last; msglen_t msg_cbytes; msgqnum_t msg_qnum; msglen_t msg_qbytes; pid_t msg_lspid; pid_t msg_lrpid; time_t msg_stime; time_t msg_rtime; time_t msg_ctime; }; struct msg { struct msg *msg_next; long msg_type; u_short msg_ts; short msg_spot; struct label *label; }; struct msginfo { int msgmax, msgmni, msgmnb, msgtql, msgssz, msgseg; }; int msgctl(int, int, struct msqid_ds *); int msgget(key_t, int); ssize_t msgrcv(int, void *, size_t, long, int); int msgsnd(int, const void *, size_t, int); /sys/sys/shm.h typedef unsigned int shmatt_t; struct shmid_ds { struct ipc_perm shm_perm; size_t shm_segsz; pid_t shm_lpid; pid_t shm_cpid; shmatt_t shm_nattch; time_t shm_atime; time_t shm_dtime; time_t shm_ctime; }; void *shmat(int, const void *, int); int shmget(key_t, size_t, int); int shmctl(int, int, struct shmid_ds *); int shmdt(const void *); /sys/security/mac/mac_internal.h struct label { int l_flags; intptr_t l_perpolicy[MAC_MAX_SLOTS]; }; Update mod.rs Update mod.rs Update mod.rs Update mod.rs Update mod.rs Update mod.rs Update mod.rs Update mod.rs Update mod.rs Update build.rs Update mod.rs Update mod.rs Update build.rs Update mod.rs Update build.rs Update mod.rs Update mod.rs Update mod.rs Update mod.rs Update mod.rs Update mod.rs Update mod.rs Update mod.rs Update mod.rs Update mod.rs Update mod.rs Update mod.rs Update mod.rs Update mod.rs Update mod.rs Update mod.rs Update mod.rs Update mod.rs Update mod.rs Update build.rs Update build.rs Update mod.rs Update mod.rs
2017-03-28 11:30:53 +02:00
cfg.header("sys/ipc.h");
cfg.header("sys/msg.h");
cfg.header("sys/shm.h");
cfg.header("sys/procdesc.h");
cfg.header("sys/rtprio.h");
2018-02-27 01:36:13 +01:00
cfg.header("spawn.h");
2015-09-18 20:54:32 +02:00
}
if netbsd {
cfg.header("mqueue.h");
cfg.header("ufs/ufs/quota.h");
cfg.header("ufs/ufs/quota1.h");
cfg.header("sys/ioctl_compat.h");
2017-09-19 03:41:34 +02:00
// DCCP support
cfg.header("netinet/dccp.h");
}
2015-12-21 17:26:41 +01:00
if openbsd {
cfg.header("ufs/ufs/quota.h");
cfg.header("pthread_np.h");
cfg.header("sys/syscall.h");
}
Squashed commit of the following: Running libc-test: PASSED 3426 tests commit 1a7ee714db34f17abd33dc9262d3e10275eec68d Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:30:56 2016 +0100 Fix RLIM_POSIXLOCKS -> RLIMIT_POSIXLOCKS commit 09c49a97ebebf087486659ef8277610d99e5c7b3 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:29:24 2016 +0100 Ignore signedness check for uuid_t on DragonFly commit aab4d11f59917686280c271683bf00ff34c8040d Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:23:21 2016 +0100 Move FreeBSD-only function into freebsd/mod.rs commit 9921f030b103dbccb37930ab1d64cf1dd587bd48 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:21:42 2016 +0100 Move POSIX_FADV_* to freebsd/mod.rs commit 2921c2db1e3d0314375aa371936bd227cc6c6e2a Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:20:11 2016 +0100 Fix signedness of blksize_t for DragonFly commit 65e817baee9e01d2d7c86c6202c63ee46d218914 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:19:02 2016 +0100 Fix Q_{GET,SET}QUOTA for DragonFly commit a0d2d63ef88206d321222140ae6b3d92c93b51bd Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:17:27 2016 +0100 Fix RLIMIT_* for DragonFly commit d04a1600a7c66a792a481e1524a1652234a69939 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:12:09 2016 +0100 Fix ELAST for DragonFly commit d120b9278426a76ee106e91e6c999885c1f5c7f4 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:10:28 2016 +0100 Fix F_GETLK, F_SETLK, F_SETLKW for DragonFly commit 963f7da270a14f4d12ea1a52301e363ce745c897 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:08:51 2016 +0100 Fix O_CLOEXEC for DragonFly commit f4d6c9d5991d690c7cb4460790a8e37e713bc034 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:07:18 2016 +0100 Fix RAND_MAX for DragonFly commit ba48336da7be613a49702ad9de445ab3850ebb7c Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:04:48 2016 +0100 Fix statvfs for DragonFly commit 9ae480c60a7d77b31a17d34320464f4179e40a4a Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 12:51:47 2016 +0100 Fix fd_set for DragonFly commit a15e027838288c4980371c503252cca7e32356c0 Author: Michael Neumann <mneumann@ntecs.de> 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 <mneumann@ntecs.de> 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 <mneumann@ntecs.de> Date: Sat Feb 20 12:21:01 2016 +0100 Use a constant in utsname commit 50484eda3c978a9c0a9652f6fc619c41ad349c2d Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 12:17:55 2016 +0100 Fix struct utsname commit 832e94248fabc91574d6d42630168da3542c153f Author: Michael Neumann <mneumann@ntecs.de> 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 <mneumann@ntecs.de> 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 <mneumann@ntecs.de> 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 <mneumann@ntecs.de> Date: Sat Feb 20 11:44:25 2016 +0100 struct utsname has a different size on DragonFly
2016-02-20 13:34:01 +01:00
if dragonfly {
cfg.header("mqueue.h");
Squashed commit of the following: Running libc-test: PASSED 3426 tests commit 1a7ee714db34f17abd33dc9262d3e10275eec68d Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:30:56 2016 +0100 Fix RLIM_POSIXLOCKS -> RLIMIT_POSIXLOCKS commit 09c49a97ebebf087486659ef8277610d99e5c7b3 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:29:24 2016 +0100 Ignore signedness check for uuid_t on DragonFly commit aab4d11f59917686280c271683bf00ff34c8040d Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:23:21 2016 +0100 Move FreeBSD-only function into freebsd/mod.rs commit 9921f030b103dbccb37930ab1d64cf1dd587bd48 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:21:42 2016 +0100 Move POSIX_FADV_* to freebsd/mod.rs commit 2921c2db1e3d0314375aa371936bd227cc6c6e2a Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:20:11 2016 +0100 Fix signedness of blksize_t for DragonFly commit 65e817baee9e01d2d7c86c6202c63ee46d218914 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:19:02 2016 +0100 Fix Q_{GET,SET}QUOTA for DragonFly commit a0d2d63ef88206d321222140ae6b3d92c93b51bd Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:17:27 2016 +0100 Fix RLIMIT_* for DragonFly commit d04a1600a7c66a792a481e1524a1652234a69939 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:12:09 2016 +0100 Fix ELAST for DragonFly commit d120b9278426a76ee106e91e6c999885c1f5c7f4 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:10:28 2016 +0100 Fix F_GETLK, F_SETLK, F_SETLKW for DragonFly commit 963f7da270a14f4d12ea1a52301e363ce745c897 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:08:51 2016 +0100 Fix O_CLOEXEC for DragonFly commit f4d6c9d5991d690c7cb4460790a8e37e713bc034 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:07:18 2016 +0100 Fix RAND_MAX for DragonFly commit ba48336da7be613a49702ad9de445ab3850ebb7c Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:04:48 2016 +0100 Fix statvfs for DragonFly commit 9ae480c60a7d77b31a17d34320464f4179e40a4a Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 12:51:47 2016 +0100 Fix fd_set for DragonFly commit a15e027838288c4980371c503252cca7e32356c0 Author: Michael Neumann <mneumann@ntecs.de> 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 <mneumann@ntecs.de> 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 <mneumann@ntecs.de> Date: Sat Feb 20 12:21:01 2016 +0100 Use a constant in utsname commit 50484eda3c978a9c0a9652f6fc619c41ad349c2d Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 12:17:55 2016 +0100 Fix struct utsname commit 832e94248fabc91574d6d42630168da3542c153f Author: Michael Neumann <mneumann@ntecs.de> 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 <mneumann@ntecs.de> 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 <mneumann@ntecs.de> 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 <mneumann@ntecs.de> Date: Sat Feb 20 11:44:25 2016 +0100 struct utsname has a different size on DragonFly
2016-02-20 13:34:01 +01:00
cfg.header("ufs/ufs/quota.h");
cfg.header("pthread_np.h");
cfg.header("sys/ioctl_compat.h");
cfg.header("sys/rtprio.h");
Squashed commit of the following: Running libc-test: PASSED 3426 tests commit 1a7ee714db34f17abd33dc9262d3e10275eec68d Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:30:56 2016 +0100 Fix RLIM_POSIXLOCKS -> RLIMIT_POSIXLOCKS commit 09c49a97ebebf087486659ef8277610d99e5c7b3 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:29:24 2016 +0100 Ignore signedness check for uuid_t on DragonFly commit aab4d11f59917686280c271683bf00ff34c8040d Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:23:21 2016 +0100 Move FreeBSD-only function into freebsd/mod.rs commit 9921f030b103dbccb37930ab1d64cf1dd587bd48 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:21:42 2016 +0100 Move POSIX_FADV_* to freebsd/mod.rs commit 2921c2db1e3d0314375aa371936bd227cc6c6e2a Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:20:11 2016 +0100 Fix signedness of blksize_t for DragonFly commit 65e817baee9e01d2d7c86c6202c63ee46d218914 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:19:02 2016 +0100 Fix Q_{GET,SET}QUOTA for DragonFly commit a0d2d63ef88206d321222140ae6b3d92c93b51bd Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:17:27 2016 +0100 Fix RLIMIT_* for DragonFly commit d04a1600a7c66a792a481e1524a1652234a69939 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:12:09 2016 +0100 Fix ELAST for DragonFly commit d120b9278426a76ee106e91e6c999885c1f5c7f4 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:10:28 2016 +0100 Fix F_GETLK, F_SETLK, F_SETLKW for DragonFly commit 963f7da270a14f4d12ea1a52301e363ce745c897 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:08:51 2016 +0100 Fix O_CLOEXEC for DragonFly commit f4d6c9d5991d690c7cb4460790a8e37e713bc034 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:07:18 2016 +0100 Fix RAND_MAX for DragonFly commit ba48336da7be613a49702ad9de445ab3850ebb7c Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:04:48 2016 +0100 Fix statvfs for DragonFly commit 9ae480c60a7d77b31a17d34320464f4179e40a4a Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 12:51:47 2016 +0100 Fix fd_set for DragonFly commit a15e027838288c4980371c503252cca7e32356c0 Author: Michael Neumann <mneumann@ntecs.de> 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 <mneumann@ntecs.de> 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 <mneumann@ntecs.de> Date: Sat Feb 20 12:21:01 2016 +0100 Use a constant in utsname commit 50484eda3c978a9c0a9652f6fc619c41ad349c2d Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 12:17:55 2016 +0100 Fix struct utsname commit 832e94248fabc91574d6d42630168da3542c153f Author: Michael Neumann <mneumann@ntecs.de> 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 <mneumann@ntecs.de> 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 <mneumann@ntecs.de> 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 <mneumann@ntecs.de> Date: Sat Feb 20 11:44:25 2016 +0100 struct utsname has a different size on DragonFly
2016-02-20 13:34:01 +01:00
}
if solaris {
cfg.header("port.h");
cfg.header("ucontext.h");
cfg.header("sys/filio.h");
cfg.header("sys/loadavg.h");
}
if linux || freebsd || dragonfly || netbsd || apple || emscripten {
2017-04-20 08:34:50 +02:00
if !uclibc {
cfg.header("aio.h");
}
2016-11-13 16:07:45 +01:00
}
2015-09-16 08:28:52 +02:00
cfg.type_name(move |ty, is_struct| {
2015-09-10 19:56:31 +02:00
match ty {
2015-09-11 08:43:41 +02:00
// Just pass all these through, no need for a "struct" prefix
2015-09-11 04:59:23 +02:00
"FILE" |
"fd_set" |
2015-11-03 02:03:19 +01:00
"Dl_info" |
"DIR" |
"Elf32_Phdr" |
"Elf64_Phdr" => ty.to_string(),
2015-09-17 23:47:40 +02:00
// Fixup a few types on windows that don't actually exist.
"time64_t" if windows => "__time64_t".to_string(),
"ssize_t" if windows => "SSIZE_T".to_string(),
2015-09-18 00:47:44 +02:00
// OSX calls this something else
2015-09-18 20:54:32 +02:00
"sighandler_t" if bsdlike => "sig_t".to_string(),
2015-09-18 00:47:44 +02:00
2015-09-17 23:47:40 +02:00
t if t.ends_with("_t") => t.to_string(),
2015-09-10 19:56:31 +02:00
2015-09-11 08:43:41 +02:00
// Windows uppercase structs don't have `struct` in front, there's a
// few special cases for windows, and then otherwise put `struct` in
// front of everything.
2015-09-16 08:28:52 +02:00
t if is_struct => {
2015-09-11 03:10:58 +02:00
if windows && ty.chars().next().unwrap().is_uppercase() {
t.to_string()
} else if windows && t == "stat" {
"struct __stat64".to_string()
2015-09-11 05:57:14 +02:00
} else if windows && t == "utimbuf" {
"struct __utimbuf64".to_string()
2015-09-11 03:10:58 +02:00
} else {
format!("struct {}", t)
}
}
2015-09-10 19:56:31 +02:00
t => t.to_string(),
}
2015-09-16 08:28:52 +02:00
});
2015-09-10 19:56:31 +02:00
2015-09-16 08:28:52 +02:00
let target2 = target.clone();
cfg.field_name(move |struct_, field| {
2015-09-10 19:56:31 +02:00
match field {
"st_birthtime" if openbsd && struct_ == "stat" => "__st_birthtime".to_string(),
2015-12-21 17:26:41 +01:00
"st_birthtime_nsec" if openbsd && struct_ == "stat" => "__st_birthtimensec".to_string(),
2015-09-11 08:43:41 +02:00
// Our stat *_nsec fields normally don't actually exist but are part
// of a timeval struct
s if s.ends_with("_nsec") && struct_.starts_with("stat") => {
2015-09-20 08:20:53 +02:00
if target2.contains("apple") {
2015-09-10 19:56:31 +02:00
s.replace("_nsec", "spec.tv_nsec")
2015-09-16 08:28:52 +02:00
} else if target2.contains("android") {
2015-09-12 02:03:39 +02:00
s.to_string()
2015-09-10 19:56:31 +02:00
} else {
s.replace("e_nsec", ".tv_nsec")
}
}
"u64" if struct_ == "epoll_event" => "data.u64".to_string(),
"type_" if (linux || freebsd || dragonfly) &&
2017-06-13 17:26:14 +02:00
(struct_ == "input_event" || struct_ == "input_mask" ||
struct_ == "ff_effect" || struct_ == "rtprio") => "type".to_string(),
2015-09-10 19:56:31 +02:00
s => s.to_string(),
}
2015-09-16 08:28:52 +02:00
});
2015-09-11 08:43:41 +02:00
2015-09-16 08:28:52 +02:00
cfg.skip_type(move |ty| {
2015-09-10 19:56:31 +02:00
match ty {
2015-09-12 02:03:39 +02:00
// sighandler_t is crazy across platforms
2015-09-16 08:28:52 +02:00
"sighandler_t" => true,
2015-09-12 02:03:39 +02:00
2015-09-16 08:28:52 +02:00
_ => false
2015-09-10 19:56:31 +02:00
}
2015-09-16 08:28:52 +02:00
});
2015-09-10 08:21:27 +02:00
cfg.skip_struct(move |ty| {
match ty {
"sockaddr_nl" => musl,
2016-08-09 08:01:33 +02:00
// On Linux, the type of `ut_tv` field of `struct utmpx`
// can be an anonymous struct, so an extra struct,
// which is absent in glibc, has to be defined.
"__timeval" if linux => true,
2018-04-15 14:50:00 +02:00
// Fixed on stdbuild with repr(packed(4))
// Once repr_packed stabilizes we can fix this unconditionally
// and remove this check.
"kevent" | "shmid_ds" if apple && x86_64 => true,
2016-11-13 21:52:34 +01:00
// This is actually a union, not a struct
"sigval" => true,
2017-06-13 17:26:14 +02:00
// Linux kernel headers used on musl are too old to have this
// definition. Because it's tested on other Linux targets, skip it.
"input_mask" if musl => true,
// These structs have changed since unified headers in NDK r14b.
// `st_atime` and `st_atime_nsec` have changed sign.
// FIXME: unskip it for next major release
"stat" | "stat64" if android => true,
// These are tested as part of the linux_fcntl tests since there are
// header conflicts when including them with all the other structs.
"termios2" => true,
_ => false
}
});
Squashed commit of the following: Running libc-test: PASSED 3426 tests commit 1a7ee714db34f17abd33dc9262d3e10275eec68d Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:30:56 2016 +0100 Fix RLIM_POSIXLOCKS -> RLIMIT_POSIXLOCKS commit 09c49a97ebebf087486659ef8277610d99e5c7b3 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:29:24 2016 +0100 Ignore signedness check for uuid_t on DragonFly commit aab4d11f59917686280c271683bf00ff34c8040d Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:23:21 2016 +0100 Move FreeBSD-only function into freebsd/mod.rs commit 9921f030b103dbccb37930ab1d64cf1dd587bd48 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:21:42 2016 +0100 Move POSIX_FADV_* to freebsd/mod.rs commit 2921c2db1e3d0314375aa371936bd227cc6c6e2a Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:20:11 2016 +0100 Fix signedness of blksize_t for DragonFly commit 65e817baee9e01d2d7c86c6202c63ee46d218914 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:19:02 2016 +0100 Fix Q_{GET,SET}QUOTA for DragonFly commit a0d2d63ef88206d321222140ae6b3d92c93b51bd Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:17:27 2016 +0100 Fix RLIMIT_* for DragonFly commit d04a1600a7c66a792a481e1524a1652234a69939 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:12:09 2016 +0100 Fix ELAST for DragonFly commit d120b9278426a76ee106e91e6c999885c1f5c7f4 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:10:28 2016 +0100 Fix F_GETLK, F_SETLK, F_SETLKW for DragonFly commit 963f7da270a14f4d12ea1a52301e363ce745c897 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:08:51 2016 +0100 Fix O_CLOEXEC for DragonFly commit f4d6c9d5991d690c7cb4460790a8e37e713bc034 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:07:18 2016 +0100 Fix RAND_MAX for DragonFly commit ba48336da7be613a49702ad9de445ab3850ebb7c Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:04:48 2016 +0100 Fix statvfs for DragonFly commit 9ae480c60a7d77b31a17d34320464f4179e40a4a Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 12:51:47 2016 +0100 Fix fd_set for DragonFly commit a15e027838288c4980371c503252cca7e32356c0 Author: Michael Neumann <mneumann@ntecs.de> 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 <mneumann@ntecs.de> 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 <mneumann@ntecs.de> Date: Sat Feb 20 12:21:01 2016 +0100 Use a constant in utsname commit 50484eda3c978a9c0a9652f6fc619c41ad349c2d Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 12:17:55 2016 +0100 Fix struct utsname commit 832e94248fabc91574d6d42630168da3542c153f Author: Michael Neumann <mneumann@ntecs.de> 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 <mneumann@ntecs.de> 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 <mneumann@ntecs.de> 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 <mneumann@ntecs.de> Date: Sat Feb 20 11:44:25 2016 +0100 struct utsname has a different size on DragonFly
2016-02-20 13:34:01 +01:00
cfg.skip_signededness(move |c| {
2015-09-15 23:53:01 +02:00
match c {
2015-09-16 05:56:16 +02:00
"LARGE_INTEGER" |
"mach_timebase_info_data_t" |
2015-09-16 05:56:16 +02:00
"float" |
2015-09-16 08:28:52 +02:00
"double" => true,
// uuid_t is a struct, not an integer.
Squashed commit of the following: Running libc-test: PASSED 3426 tests commit 1a7ee714db34f17abd33dc9262d3e10275eec68d Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:30:56 2016 +0100 Fix RLIM_POSIXLOCKS -> RLIMIT_POSIXLOCKS commit 09c49a97ebebf087486659ef8277610d99e5c7b3 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:29:24 2016 +0100 Ignore signedness check for uuid_t on DragonFly commit aab4d11f59917686280c271683bf00ff34c8040d Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:23:21 2016 +0100 Move FreeBSD-only function into freebsd/mod.rs commit 9921f030b103dbccb37930ab1d64cf1dd587bd48 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:21:42 2016 +0100 Move POSIX_FADV_* to freebsd/mod.rs commit 2921c2db1e3d0314375aa371936bd227cc6c6e2a Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:20:11 2016 +0100 Fix signedness of blksize_t for DragonFly commit 65e817baee9e01d2d7c86c6202c63ee46d218914 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:19:02 2016 +0100 Fix Q_{GET,SET}QUOTA for DragonFly commit a0d2d63ef88206d321222140ae6b3d92c93b51bd Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:17:27 2016 +0100 Fix RLIMIT_* for DragonFly commit d04a1600a7c66a792a481e1524a1652234a69939 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:12:09 2016 +0100 Fix ELAST for DragonFly commit d120b9278426a76ee106e91e6c999885c1f5c7f4 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:10:28 2016 +0100 Fix F_GETLK, F_SETLK, F_SETLKW for DragonFly commit 963f7da270a14f4d12ea1a52301e363ce745c897 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:08:51 2016 +0100 Fix O_CLOEXEC for DragonFly commit f4d6c9d5991d690c7cb4460790a8e37e713bc034 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:07:18 2016 +0100 Fix RAND_MAX for DragonFly commit ba48336da7be613a49702ad9de445ab3850ebb7c Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:04:48 2016 +0100 Fix statvfs for DragonFly commit 9ae480c60a7d77b31a17d34320464f4179e40a4a Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 12:51:47 2016 +0100 Fix fd_set for DragonFly commit a15e027838288c4980371c503252cca7e32356c0 Author: Michael Neumann <mneumann@ntecs.de> 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 <mneumann@ntecs.de> 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 <mneumann@ntecs.de> Date: Sat Feb 20 12:21:01 2016 +0100 Use a constant in utsname commit 50484eda3c978a9c0a9652f6fc619c41ad349c2d Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 12:17:55 2016 +0100 Fix struct utsname commit 832e94248fabc91574d6d42630168da3542c153f Author: Michael Neumann <mneumann@ntecs.de> 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 <mneumann@ntecs.de> 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 <mneumann@ntecs.de> 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 <mneumann@ntecs.de> Date: Sat Feb 20 11:44:25 2016 +0100 struct utsname has a different size on DragonFly
2016-02-20 13:34:01 +01:00
"uuid_t" if dragonfly => true,
2015-09-16 08:28:52 +02:00
n if n.starts_with("pthread") => true,
2016-06-04 06:02:56 +02:00
// sem_t is a struct or pointer
"sem_t" if openbsd || freebsd || dragonfly || netbsd => true,
// mqd_t is a pointer on FreeBSD and DragonFly
"mqd_t" if freebsd || dragonfly => true,
2015-09-16 05:57:42 +02:00
2018-01-26 01:19:35 +01:00
// Just some typedefs on osx, no need to check their sign
"posix_spawnattr_t" |
"posix_spawn_file_actions_t" => true,
2015-09-16 05:57:42 +02:00
// windows-isms
2015-09-16 08:28:52 +02:00
n if n.starts_with("P") => true,
n if n.starts_with("H") => true,
n if n.starts_with("LP") => true,
_ => false,
2015-09-15 23:53:01 +02:00
}
2015-09-16 08:28:52 +02:00
});
2015-09-15 23:53:01 +02:00
2015-09-16 08:28:52 +02:00
cfg.skip_const(move |name| {
2015-09-11 08:43:41 +02:00
match name {
2015-09-17 23:47:40 +02:00
// Apparently these don't exist in mingw headers?
2015-09-11 08:43:41 +02:00
"MEM_RESET_UNDO" |
"FILE_ATTRIBUTE_NO_SCRUB_DATA" |
"FILE_ATTRIBUTE_INTEGRITY_STREAM" |
2015-09-16 08:28:52 +02:00
"ERROR_NOTHING_TO_TERMINATE" if mingw => true,
2015-09-17 23:47:40 +02:00
"SIG_DFL" |
"SIG_ERR" |
2015-09-16 08:28:52 +02:00
"SIG_IGN" => true, // sighandler_t weirdness
2017-10-09 18:36:52 +02:00
"SIGUNUSED" => true, // removed in glibc 2.26
2015-09-17 23:47:40 +02:00
2015-09-18 02:25:52 +02:00
// types on musl are defined a little differently
n if musl && n.contains("__SIZEOF_PTHREAD") => true,
2015-09-18 02:25:52 +02:00
// Skip constants not defined in MUSL but just passed down to the
// kernel regardless
"RLIMIT_NLIMITS" |
"TCP_COOKIE_TRANSACTIONS" |
"RLIMIT_RTTIME" |
"MSG_COPY" if musl => true,
// work around super old mips toolchain
2015-12-14 00:09:45 +01:00
"SCHED_IDLE" | "SHM_NORESERVE" => mips,
// weird signed extension or something like that?
"MS_NOUSER" => true,
"MS_RMT_MASK" => true, // updated in glibc 2.22 and musl 1.1.13
// These OSX constants are flagged as deprecated
"NOTE_EXIT_REPARENTED" |
"NOTE_REAP" if apple => true,
// These constants were removed in FreeBSD 11 (svn r273250) but will
// still be accepted and ignored at runtime.
"MAP_RENAME" |
"MAP_NORESERVE" if freebsd => true,
// These constants were removed in FreeBSD 11 (svn r262489),
// and they've never had any legitimate use outside of the
// base system anyway.
"CTL_MAXID" |
"KERN_MAXID" |
"HW_MAXID" |
2018-03-12 01:03:46 +01:00
"NET_MAXID" |
"USER_MAXID" if freebsd => true,
// These constants were added in FreeBSD 11
"EVFILT_PROCDESC" | "EVFILT_SENDFILE" | "EVFILT_EMPTY" |
"PD_CLOEXEC" | "PD_ALLOWED_AT_FORK" if freebsd => true,
2018-05-17 06:26:14 +02:00
// These constants were added in FreeBSD 12
"SF_USER_READAHEAD" if freebsd => true,
// These OSX constants are removed in Sierra.
// https://developer.apple.com/library/content/releasenotes/General/APIDiffsMacOS10_12/Swift/Darwin.html
"KERN_KDENABLE_BG_TRACE" if apple => true,
"KERN_KDDISABLE_BG_TRACE" if apple => true,
// These constants were removed in OpenBSD 6 (https://git.io/v7gBO
// https://git.io/v7gBq)
"KERN_USERMOUNT" |
"KERN_ARND" if openbsd => true,
// These constants were added in OpenBSD 6.2
"EV_RECEIPT" | "EV_DISPATCH" if openbsd => true,
// These constants were added in OpenBSD 6.3
"MAP_STACK" if openbsd => true,
// These are either unimplemented or optionally built into uClibc
2017-04-20 08:34:50 +02:00
"LC_CTYPE_MASK" | "LC_NUMERIC_MASK" | "LC_TIME_MASK" | "LC_COLLATE_MASK" | "LC_MONETARY_MASK" | "LC_MESSAGES_MASK" |
"MADV_MERGEABLE" | "MADV_UNMERGEABLE" | "MADV_HWPOISON" | "IPV6_ADD_MEMBERSHIP" | "IPV6_DROP_MEMBERSHIP" | "IPV6_MULTICAST_LOOP" | "IPV6_V6ONLY" |
"MAP_STACK" | "RTLD_DEEPBIND" | "SOL_IPV6" | "SOL_ICMPV6" if uclibc => true,
// Musl uses old, patched kernel headers
"FALLOC_FL_COLLAPSE_RANGE" | "FALLOC_FL_ZERO_RANGE" |
"FALLOC_FL_INSERT_RANGE" | "FALLOC_FL_UNSHARE_RANGE" |
"RENAME_NOREPLACE" | "RENAME_EXCHANGE" | "RENAME_WHITEOUT" if musl => true,
// Both android and musl use old kernel headers
// These are constants used in getrandom syscall
"GRND_NONBLOCK" | "GRND_RANDOM" if musl || android => true,
2017-05-15 17:15:53 +02:00
// Defined by libattr not libc on linux (hard to test).
// See constant definition for more details.
2018-07-04 18:43:48 +02:00
"ENOATTR" if android || linux => true,
2017-05-15 17:15:53 +02:00
// On mips*-unknown-linux-gnu* CMSPAR cannot be included with the set of headers we
// want to use here for testing. It's originally defined in asm/termbits.h, which is
// also included by asm/termios.h, but not the standard termios.h. There's no way to
// include both asm/termbits.h and termios.h and there's no way to include both
// asm/termios.h and ioctl.h (+ some other headers) because of redeclared types.
"CMSPAR" if mips && linux && !musl => true,
// On mips Linux targets, MADV_SOFT_OFFLINE is currently missing, though it's been added but CI has too old
// of a Linux version. Since it exists on all other Linux targets, just ignore this for now and remove once
// it's been fixed in CI.
"MADV_SOFT_OFFLINE" if mips && linux => true,
// These constants are tested in a separate test program generated below because there
// are header conflicts if we try to include the headers that define them here.
"F_CANCELLK" | "F_ADD_SEALS" | "F_GET_SEALS" => true,
"F_SEAL_SEAL" | "F_SEAL_SHRINK" | "F_SEAL_GROW" | "F_SEAL_WRITE" => true,
"QFMT_VFS_OLD" | "QFMT_VFS_V0" | "QFMT_VFS_V1" if mips && linux => true, // Only on MIPS
2017-10-19 03:26:59 +02:00
"BOTHER" => true,
"MFD_CLOEXEC" | "MFD_ALLOW_SEALING" if !mips && musl => true,
"DT_FIFO" | "DT_CHR" | "DT_DIR" | "DT_BLK" | "DT_REG" | "DT_LNK" | "DT_SOCK" if solaris => true,
"USRQUOTA" | "GRPQUOTA" if solaris => true,
"PRIO_MIN" | "PRIO_MAX" if solaris => true,
// These are defined for Solaris 11, but the crate is tested on illumos, where they are currently not defined
"EADI" | "PORT_SOURCE_POSTWAIT" | "PORT_SOURCE_SIGNAL" | "PTHREAD_STACK_MIN" => true,
// These change all the time from release to release of linux
// distros, let's just not bother trying to verify them. They
// shouldn't be used in code anyway...
"AF_MAX" | "PF_MAX" => true,
2015-09-16 08:28:52 +02:00
_ => false,
2015-09-11 08:43:41 +02:00
}
2015-09-16 08:28:52 +02:00
});
2015-09-11 08:43:41 +02:00
2015-09-17 23:47:40 +02:00
cfg.skip_fn(move |name| {
2016-01-13 01:28:07 +01:00
// skip those that are manually verified
2015-09-11 04:59:23 +02:00
match name {
2015-09-17 23:47:40 +02:00
"execv" | // crazy stuff with const/mut
2015-09-11 04:59:23 +02:00
"execve" |
"execvp" |
"execvpe" |
"fexecve" => true,
2015-09-17 23:47:40 +02:00
"getrlimit" | "getrlimit64" | // non-int in 1st arg
"setrlimit" | "setrlimit64" | // non-int in 1st arg
"prlimit" | "prlimit64" | // non-int in 2nd arg
2015-09-17 23:47:40 +02:00
"strerror_r" if linux => true, // actually xpg-something-or-other
// int vs uint. Sorry musl, your prototype declarations are "correct" in the sense that
// they match the interface defined by Linux verbatim, but they conflict with other
// send*/recv* syscalls
"sendmmsg" | "recvmmsg" if musl => true,
2015-09-18 00:09:02 +02:00
// typed 2nd arg on linux and android
Squashed commit of the following: Running libc-test: PASSED 3426 tests commit 1a7ee714db34f17abd33dc9262d3e10275eec68d Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:30:56 2016 +0100 Fix RLIM_POSIXLOCKS -> RLIMIT_POSIXLOCKS commit 09c49a97ebebf087486659ef8277610d99e5c7b3 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:29:24 2016 +0100 Ignore signedness check for uuid_t on DragonFly commit aab4d11f59917686280c271683bf00ff34c8040d Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:23:21 2016 +0100 Move FreeBSD-only function into freebsd/mod.rs commit 9921f030b103dbccb37930ab1d64cf1dd587bd48 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:21:42 2016 +0100 Move POSIX_FADV_* to freebsd/mod.rs commit 2921c2db1e3d0314375aa371936bd227cc6c6e2a Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:20:11 2016 +0100 Fix signedness of blksize_t for DragonFly commit 65e817baee9e01d2d7c86c6202c63ee46d218914 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:19:02 2016 +0100 Fix Q_{GET,SET}QUOTA for DragonFly commit a0d2d63ef88206d321222140ae6b3d92c93b51bd Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:17:27 2016 +0100 Fix RLIMIT_* for DragonFly commit d04a1600a7c66a792a481e1524a1652234a69939 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:12:09 2016 +0100 Fix ELAST for DragonFly commit d120b9278426a76ee106e91e6c999885c1f5c7f4 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:10:28 2016 +0100 Fix F_GETLK, F_SETLK, F_SETLKW for DragonFly commit 963f7da270a14f4d12ea1a52301e363ce745c897 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:08:51 2016 +0100 Fix O_CLOEXEC for DragonFly commit f4d6c9d5991d690c7cb4460790a8e37e713bc034 Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:07:18 2016 +0100 Fix RAND_MAX for DragonFly commit ba48336da7be613a49702ad9de445ab3850ebb7c Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 13:04:48 2016 +0100 Fix statvfs for DragonFly commit 9ae480c60a7d77b31a17d34320464f4179e40a4a Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 12:51:47 2016 +0100 Fix fd_set for DragonFly commit a15e027838288c4980371c503252cca7e32356c0 Author: Michael Neumann <mneumann@ntecs.de> 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 <mneumann@ntecs.de> 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 <mneumann@ntecs.de> Date: Sat Feb 20 12:21:01 2016 +0100 Use a constant in utsname commit 50484eda3c978a9c0a9652f6fc619c41ad349c2d Author: Michael Neumann <mneumann@ntecs.de> Date: Sat Feb 20 12:17:55 2016 +0100 Fix struct utsname commit 832e94248fabc91574d6d42630168da3542c153f Author: Michael Neumann <mneumann@ntecs.de> 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 <mneumann@ntecs.de> 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 <mneumann@ntecs.de> 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 <mneumann@ntecs.de> Date: Sat Feb 20 11:44:25 2016 +0100 struct utsname has a different size on DragonFly
2016-02-20 13:34:01 +01:00
"gettimeofday" if linux || android || freebsd || openbsd || dragonfly => true,
2015-09-18 00:09:02 +02:00
// not declared in newer android toolchains
"getdtablesize" if android => true,
2015-09-18 00:09:02 +02:00
"dlerror" if android => true, // const-ness is added
2017-11-18 22:03:14 +01:00
"dladdr" if musl || solaris => true, // const-ness only added recently
2015-09-18 00:09:02 +02:00
2015-11-03 23:18:52 +01:00
// OSX has 'struct tm *const' which we can't actually represent in
// Rust, but is close enough to *mut
"timegm" if apple => true,
// OSX's daemon is deprecated in 10.5 so we'll get a warning (which
// we turn into an error) so just ignore it.
"daemon" if apple => true,
2016-06-04 06:02:56 +02:00
// Deprecated on OSX
"sem_destroy" if apple => true,
"sem_init" if apple => true,
2015-11-27 18:40:37 +01:00
// These functions presumably exist on netbsd but don't look like
// they're implemented on rumprun yet, just let them slide for now.
// Some of them look like they have headers but then don't have
// corresponding actual definitions either...
"shm_open" |
"shm_unlink" |
"syscall" |
"mq_open" |
"mq_close" |
"mq_getattr" |
"mq_notify" |
"mq_receive" |
"mq_send" |
"mq_setattr" |
"mq_timedreceive" |
"mq_timedsend" |
"mq_unlink" |
"ptrace" |
2015-11-27 18:40:37 +01:00
"sigaltstack" if rumprun => true,
2016-01-13 01:28:07 +01:00
// There seems to be a small error in EGLIBC's eventfd.h header. The
// [underlying system call][1] always takes its first `count`
// argument as an `unsigned int`, but [EGLIBC's <sys/eventfd.h>
// header][2] declares it to take an `int`. [GLIBC's header][3]
// matches the kernel.
//
// EGLIBC is no longer actively developed, and Debian, the largest
// distribution that had been using it, switched back to GLIBC in
// April 2015. So effectively all Linux <sys/eventfd.h> headers will
// be using `unsigned int` soon.
//
// [1]: https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/fs/eventfd.c?id=refs/tags/v3.12.51#n397
// [2]: http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/trusty/eglibc/trusty/view/head:/sysdeps/unix/sysv/linux/sys/eventfd.h
// [3]: https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/sys/eventfd.h;h=6295f32e937e779e74318eb9d3bdbe76aef8a8f3;hb=4e42b5b8f89f0e288e68be7ad70f9525aebc2cff#l34
"eventfd" if linux => true,
2016-11-05 20:16:50 +01:00
// The `uname` function in freebsd is now an inline wrapper that
// delegates to another, but the symbol still exists, so don't check
// the symbol.
"uname" if freebsd => true,
2018-03-04 14:11:04 +01:00
// FIXME: need to upgrade FreeBSD version; see https://github.com/rust-lang/libc/issues/938
"setgrent" if freebsd => true,
2016-11-13 22:35:17 +01:00
// aio_waitcomplete's return type changed between FreeBSD 10 and 11.
"aio_waitcomplete" if freebsd => true,
2016-11-13 21:52:34 +01:00
// lio_listio confuses the checker, probably because one of its
// arguments is an array
"lio_listio" if freebsd => true,
2016-11-13 22:35:17 +01:00
"lio_listio" if musl => true,
2016-11-13 21:52:34 +01:00
// Apparently the NDK doesn't have this defined on android, but
// it's in a header file?
"endpwent" if android => true,
2017-05-05 04:08:48 +02:00
2017-04-20 08:34:50 +02:00
// These are either unimplemented or optionally built into uClibc
// or "sysinfo", where it's defined but the structs in linux/sysinfo.h and sys/sysinfo.h
// clash so it can't be tested
"getxattr" | "lgetxattr" | "fgetxattr" | "setxattr" | "lsetxattr" | "fsetxattr" |
"listxattr" | "llistxattr" | "flistxattr" | "removexattr" | "lremovexattr" |
"fremovexattr" |
"backtrace" |
"sysinfo" | "newlocale" | "duplocale" | "freelocale" | "uselocale" |
"nl_langinfo_l" | "wcslen" | "wcstombs" if uclibc => true,
2017-05-03 21:57:29 +02:00
// Apparently res_init exists on Android, but isn't defined in a header:
// https://mail.gnome.org/archives/commits-list/2013-May/msg01329.html
"res_init" if android => true,
2017-05-03 21:57:29 +02:00
// On macOS and iOS, res_init is available, but requires linking with libresolv:
// http://blog.achernya.com/2013/03/os-x-has-silly-libsystem.html
// See discussion for skipping here:
// https://github.com/rust-lang/libc/pull/585#discussion_r114561460
"res_init" if apple => true,
// On Mac we don't use the default `close()`, instead using their $NOCANCEL variants.
"close" if apple => true,
// Definition of those functions as changed since unified headers from NDK r14b
// These changes imply some API breaking changes but are still ABI compatible.
// We can wait for the next major release to be compliant with the new API.
// FIXME: unskip these for next major release
"strerror_r" | "madvise" | "msync" | "mprotect" | "recvfrom" | "getpriority" |
2017-11-18 22:03:14 +01:00
"setpriority" | "personality" if android || solaris => true,
// In Android 64 bits, these functions have been fixed since unified headers.
// Ignore these until next major version.
"bind" | "writev" | "readv" | "sendmsg" | "recvmsg" if android && (aarch64 || x86_64) => true,
// signal is defined with sighandler_t, so ignore
"signal" if solaris => true,
"cfmakeraw" | "cfsetspeed" if solaris => true,
2017-11-18 22:03:14 +01:00
// FIXME: mincore is defined with caddr_t on Solaris.
"mincore" if solaris => true,
2015-09-16 08:28:52 +02:00
_ => false,
2015-09-11 04:59:23 +02:00
}
2015-09-16 08:28:52 +02:00
});
2015-09-11 04:59:23 +02:00
cfg.skip_fn_ptrcheck(move |name| {
match name {
// dllimport weirdness?
_ if windows => true,
_ => false,
}
});
2015-09-18 02:25:52 +02:00
cfg.skip_field_type(move |struct_, field| {
2015-09-16 23:13:20 +02:00
// This is a weird union, don't check the type.
2015-09-17 23:47:40 +02:00
(struct_ == "ifaddrs" && field == "ifa_ifu") ||
// sighandler_t type is super weird
2016-08-09 08:01:33 +02:00
(struct_ == "sigaction" && field == "sa_sigaction") ||
// __timeval type is a patch which doesn't exist in glibc
2016-11-13 21:52:34 +01:00
(linux && struct_ == "utmpx" && field == "ut_tv") ||
// sigval is actually a union, but we pretend it's a struct
(struct_ == "sigevent" && field == "sigev_value") ||
// aio_buf is "volatile void*" and Rust doesn't understand volatile
(struct_ == "aiocb" && field == "aio_buf") ||
// stack_t.ss_sp's type changed from FreeBSD 10 to 11 in svn r294930
2017-06-13 17:26:14 +02:00
(freebsd && struct_ == "stack_t" && field == "ss_sp") ||
// type siginfo_t.si_addr changed from OpenBSD 6.0 to 6.1
(openbsd && struct_ == "siginfo_t" && field == "si_addr") ||
2017-06-13 17:26:14 +02:00
// this one is an anonymous union
(linux && struct_ == "ff_effect" && field == "u")
2015-09-17 23:47:40 +02:00
});
2015-09-18 02:25:52 +02:00
cfg.skip_field(move |struct_, field| {
2015-09-17 23:47:40 +02:00
// this is actually a union on linux, so we can't represent it well and
// just insert some padding.
2015-09-18 02:25:52 +02:00
(struct_ == "siginfo_t" && field == "_pad") ||
// musl names this __dummy1 but it's still there
(musl && struct_ == "glob_t" && field == "gl_flags") ||
// musl seems to define this as an *anonymous* bitfield
2016-11-13 21:52:34 +01:00
(musl && struct_ == "statvfs" && field == "__f_unused") ||
// sigev_notify_thread_id is actually part of a sigev_un union
(struct_ == "sigevent" && field == "sigev_notify_thread_id")
2015-09-16 23:13:20 +02:00
});
2015-11-27 18:40:37 +01:00
cfg.fn_cname(move |name, cname| {
if windows {
2015-11-27 18:40:37 +01:00
cname.unwrap_or(name).to_string()
} else {
2015-11-27 18:40:37 +01:00
name.to_string()
}
});
cfg.generate("../src/lib.rs", "main.rs");
// On Linux or Android also generate another script for testing linux/fcntl declarations.
// These cannot be tested normally because including both `linux/fcntl.h` and `fcntl.h`
// fails on a lot of platforms.
let mut cfg = ctest::TestGenerator::new();
cfg.skip_type(|_| true)
.skip_fn(|_| true);
if android || linux {
// musl defines these directly in `fcntl.h`
if musl {
cfg.header("fcntl.h");
} else {
cfg.header("linux/fcntl.h");
}
if !musl {
cfg.header("net/if.h");
cfg.header("linux/if.h");
}
cfg.header("linux/quota.h");
2017-10-19 03:26:59 +02:00
cfg.header("asm/termbits.h");
cfg.skip_const(move |name| {
match name {
"F_CANCELLK" | "F_ADD_SEALS" | "F_GET_SEALS" => false,
"F_SEAL_SEAL" | "F_SEAL_SHRINK" | "F_SEAL_GROW" | "F_SEAL_WRITE" => false,
"QFMT_VFS_OLD" | "QFMT_VFS_V0" | "QFMT_VFS_V1" if mips && linux => false,
2017-10-19 03:26:59 +02:00
"BOTHER" => false,
_ => true,
}
});
cfg.skip_struct(|s| {
s != "termios2"
});
cfg.type_name(move |ty, is_struct| {
match ty {
t if is_struct => format!("struct {}", t),
t => t.to_string(),
}
});
} else {
cfg.skip_const(|_| true);
cfg.skip_struct(|_| true);
}
cfg.generate("../src/lib.rs", "linux_fcntl.rs");
2015-09-10 19:56:31 +02:00
}