added EPOLL(5) for Illumos (Solaris fork)
EPOLL(5) is being used in crates like mio and iovec , this change allows those crates and other that depends on EPOLL(5) to be built in illumos systems.
These aren't exposed on non-MIPS musl targets, but since they're
part of a kernel API, they're still applicable, so we just don't
test them there but expose them anyways.
Initial fixes for linux x32
Tested with a local build of rustc. The main test can be compiled but fails to execute (receives SIGTRAP, which I think in this case indicates memory violation, I will open an issue in the rustc repo).
This PR is important because it fixes the definition of `c_long` and `c_ulong`. Without these fixes, rustc crash with the error:
```
Cannot emit physreg copy instruction
UNREACHABLE executed at /checkout/src/llvm/lib/Target/X86/X86InstrInfo.cpp:5778!
```
Related https://github.com/rust-lang/rust/issues/37976
Rebase of #610 and also move emscripten up much higher in the hierarchy to
ensure that it doesn't have too much of a ripple effect on other platforms.
This involved moving down a good number of definitions, but hopefully was done
with care to not break anything!
We now create an additional binary `linux_fcntl` for testing this
since there are header conflicts when including all necessary headers.
This binary is run on all platforms even though it's empty on all non-
Android/non-Linux platforms.
Testing has been switched from a custom binary to using a runner-less
test (or pair of tests). This means that for local development a simple
`cd libc-test && cargo test` will run all the tests. CI has also been
updated here to reflect that.
It's now broken due to changes in the `gcc` crate and having a too-old compiler,
and in general it's unfortunately architecturally so different from the other
test frameworks that it's difficult to maintain over time.
Add KERN_USERMOUNT and KERN_ARND to don't check list on OpenBSD
These [two constants are no longer in OpenBSD](3f376b0849/sys/sys/sysctl.h (L133-L140)). They were preventing the the tests from passing. With this change the test now pass:
```
CC=egcc cargo run
Compiling libc v0.2.29 (file:///home/vagrant/libc)
Compiling libc-test v0.1.0 (file:///home/vagrant/libc/libc-test)
Finished debug [unoptimized + debuginfo] target(s) in 11.7 secs
Running `/home/vagrant/libc/target/debug/libc-test`
RUNNING ALL TESTS
PASSED 5935 tests
```
They are still present in bitrig so I moved them there.
It needs to be skipped during testing because there's no way to include
a combination of headers that will expose it without giving a "type has
already been defined" error.
Adding missing structs from linux/user.h
Adding structs from linux/user.h (or sys/user.h depending on OS version). This adds the linux user_regs_struct and user struct from sys/user.h into libc for x86 and x86_64. Also, bumping the version number.
As an aside, I was wondering if this was also the right place to add the bit offsets for the [EFLAGS register ](https://en.wikibooks.org/wiki/X86_Assembly/X86_Architecture#EFLAGS_Register)? These aren't defined anywhere in the linux system libraries instead the definition seems to just be in the x86 and x86_64 documentation but they are useful for anyone looking to interpret eflags. If libc is the right place for these constants I'd like the opportunity to add them before it's merged in. :)
Fixed the issues that prevented the libc_tests that are generated from passing. Also, fixed struct names and types to be representative of the linux source files.
Use NOCANCEL variants for close on Mac
The default `close()` on OS X does not provide clear errors, instead the `$NOCANCEL` variants should be used. These are available as of OS X 10.6 onwards.
Fixes#595.
Steps towards support for musl-unknown-linux-uclibc
Hello! I've been working towards resolving https://github.com/rust-lang/libc/issues/361 , this PR compiles successfully with a newish compiler (with some minor fixes in `gcc`, `ctest`), and all the tests pass for `libc-ctest`. Basically most of the undefined functions, constants, and structs were just removed from the ctest, and then any constants that weren't correct were fixed. Would it make more sense to conditionally remove them from libc? I wasn't sure when it was appropriate to skip the test for it instead of removing the function/constants, so I just removed all the tests for now because that was a little easier than hunting them down. I'm also guessing the way some of the constants were conditionally set wasn't the correct style, would you guys have any advice on how to do it more correctly? Lemme know how it looks!
There is a compatibility issue regarding the type of a flag parameter:
int vs uint. Linux does declare the syscall to use uint and musl
followed it, but it is incompatible with other POSIX recv*/send*
syscalls. So it seems to be wise to follow the glibc version of
prototypes with int.
Signed-off-by: NODA, Kai <nodakai@gmail.com>
Add x86_64-linux-android support
When rust add support for x86_64-linux-android, the tests may be run with:
`rustup target add x86_64-linux-android && bash ci/run-docker.sh x86_64-linux-android`.
Android x86_64 emulator does not work without hardware acceleration, so we are not able to run tests on travis.
- some tests are failing
- remove readlink, timegm and sig* functions in favor of the
unix/mod.rs definitions
- remove time64_t (it is not defined for aarch64)
- move some definitions to android/b32.rs and create appropriated
definitions in android/b64.rs
This helps caching between runs and can help speed up turnaround time for
various operations. The old android container didn't work out for some reason
due to permissions so the definition has now been vendored locally to just
rebuild it each time.
FreeBSD svn r262489 removed some *_MAXID definitions in sys/sysctl.h. They never
should've been used outside of the FreeBSD base system anyway. Mark them as
deprecated, hide them from the API docs, and disable their tests.
r273250 removed MAP_RENAME and MAP_NORESERVE, flags used by mmap(2), but old
binaries that use them will still work. Suppress their test errors.
r294930 changed stack_t.ss_sp from a char* to a void*. Suppress its test error.
Add more architectures to libc-test
* `i686-unknown-linux-musl`
* `powerpc-unknown-linux-gnu`
* `powerpc64-unknown-linux-gnu`
cc @japaric
cc https://github.com/rust-lang/rust/issues/36006
Sadly, the sysinfo struct varies slightly between Musl and Glibc / Bionic.
This means that users need to be careful when using the uptime, and should
always cast it to a signed value. Why uptime can be signed is beyond me...
Removed CODE, as its definition and name varies too wildy and I
have no current code using it to test permutations with.
Moved LOG_NFACILITIES down, as Mac OS X defines this value
differently.
Added Mac OS X specific LOG_* facilities.
Added FreeBSD / DragonFly BSD specific LOG_* facilities.
Moved LOG_PERROR down, as all platforms bar Solaris define this.
Moved LOG_CRON down, as Solaris defines this with a different value.
Moved LOG_AUTHPRIV and LOG_FTP down, as all platforms bar Solaris
define these.
Looks like Solaris is suffering from the bit rot of commercial Unix...
As with `getrlimit` and `setrlimit`, the glibc wrappers have a non-`int`
for the `resource` argument, eg:
extern int prlimit (__pid_t __pid, enum __rlimit_resource __resource,
const struct rlimit *__new_limit,
struct rlimit *__old_limit) __THROW;
in order to advise contributors to locally test their patches.
Also update ctest to include a fix on rerun-if-changed so that human
developers doing trial & error can properly test their latest code.
Signed-off-by: NODA, Kai <nodakai@gmail.com>
Use now available link name "signal" instead of "bsd_signal"
On android, the `bsd_signal` is gone, the `signal` is available.
While this is the most obvious solution, I am not sure of a few things:
- How are we going to keep compatibility with older NDKs where `signal` does not exist;
- Was something dependent on this being different on android and thus would break (for example, the rust compiler uses this function, so it may break somewhere).
Fixes#236.
There are many constants defined by langinfo, but we have the
new types, locale_t and nl_item.
We also have several functions, not all of which exist for every
platform:
nl_langinfo
nl_langinfo_l
newlocale
duplocale
freelocale
uselocale
querylocale
It was updated recently, so the test is known to fail depending on the
libc version of the test environment.
Signed-off-by: NODA, Kai <nodakai@gmail.com>
The functions were added for Apple in #202. Adding them to other
platforms was pending an amendment to RFC 1291 to expand the scope of
libc to include libutil. The amendment was merged as
https://github.com/rust-lang/rfcs/pull/1529
See comments https://github.com/rust-lang/libc/pull/194.
Note on struct utsname: Neither using a constant, nor a conditional
macro seems to work, so I just created an ugly utsname with conditions
on each field. This should also fix the CI fallout. #[cfg] on macros
doesn't work?
As DragonFly only supports one platform, I merged x86_64.rs into
dragonfly/mod.rs.
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
I've tested x86 against C locally, but not arm or asmjs.
I added the arm definitions because asmjs's C is derived from arms.
Mysteriously, my locally-built musl does not contain a
definition for _SC_2_C_VERSION, so I just removed it.
* The `flock` structure has an extra field
* Some `flock`-related constants have different value
* Some constants like `TABN` don't exist
* The `fsblkcnt_t` and `fsfilcnt_t` type definitions are u64 for x86_64 FreeBSD
* The `d_namelen` field in `dirent` was renamed correctly to `d_namlen`
* The alignment of `fd_set` was off, and the macros were updated to not always
assume a 32-bit integer is used.
This commit adds support to test all libc definitions on both OpenBSD and
FreeBSD via QEMU userspace emulation. Specially prepared images for each OS are
used which are essentially intended to run a script on startup and then exit.
Documentation has been added to the `ci/README.md` file describing this new
system.