Commit Graph

182 Commits

Author SHA1 Message Date
bors
0dae0e75bd Auto merge of #708 - wezm:remove-missing-openbsd-constants, r=alexcrichton
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.
2017-08-04 10:40:32 +00:00
Wesley Moore
58c772bd51 Add KERN_ARND and KERN_USERMOUNT to don't check list on OpenBSD 2017-08-03 18:14:15 +10:00
Marcin Mielniczuk
b9166f42ff Include sys/reg.h on Android. 2017-08-01 16:20:13 +02:00
bors
0b7abd9bb3 Auto merge of #689 - lucab:ups/fexecve, r=alexcrichton
unix: add fexecve()

Add missing fexecve() - execute program specified via file descriptor.

Reference: http://pubs.opengroup.org/onlinepubs/9699919799/functions/fexecve.html
2017-07-23 15:18:51 +00:00
bors
9bbfe4b0ee Auto merge of #686 - marmistrz:regs, r=alexcrichton
Add offsets in user_regs_struct from sys/reg.h
2017-07-22 17:01:15 +00:00
Luca Bruno
858d47cd95
unix: add fexecve()
Add missing fexecve() - execute program specified via file descriptor.

Reference: http://pubs.opengroup.org/onlinepubs/9699919799/functions/fexecve.html
2017-07-22 08:12:10 +00:00
Marcin Mielniczuk
2a5976727f Define i686 when TARGET=i686* 2017-07-22 09:37:22 +02:00
Marcin Mielniczuk
37b4e73a10 include sys/regs.h only on x86 and x86_64 2017-07-21 21:55:47 +02:00
Marcin Mielniczuk
1535ee8703 Include sys/user.h in the automatic test 2017-07-21 17:11:30 +02:00
bors
516df7f773 Auto merge of #671 - Susurrus:signalfd_android, r=alexcrichton
Add signalfd and related to android
2017-07-20 19:05:46 +00:00
Bryant Mairs
83ab9a341f Add signalfd and related to android 2017-07-20 08:56:06 -07:00
bors
57413b8b14 Auto merge of #673 - g2p:fallocate-flags, r=alexcrichton
Add all current fallocate flags

Also move them to the common Linux module, as they are not platform-specific.
See include/uapi/linux/falloc.h.
2017-07-20 14:05:21 +00:00
Gabriel
f60ff2db55 Ignore newer kernel constants if building with musl 2017-07-20 00:28:08 +02:00
Guillaume Gomez
100f3f29cf Add mac structs 2017-07-19 20:54:24 +02:00
Gabriel
75e3696eca Include linux/falloc.h directly
glibc support is behind, as indicated by
https://github.com/karelzak/util-linux/blob/master/sys-utils/fallocate.c
2017-07-19 06:52:12 +02:00
Guillaume Gomez
e7df808d68 Add header for mac targets 2017-07-16 22:22:32 +02:00
Bryant Mairs
f04b44292e Add CMSPAR to linux/mips
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.
2017-07-13 11:18:00 -07:00
Nicolas Dusart
9f5766fb3f add missing socket constants 2017-07-10 10:52:20 +02:00
Nicolas Dusart
4abc3cefef Update to NDK r15b (with unified headers) and add missing symbols needed by nix crate 2017-07-03 13:26:35 +02:00
Mateusz Sieczko
60d93226ff Add structs defined in linux/input.h 2017-06-14 21:48:41 +02:00
bors
439a4d7d4b Auto merge of #608 - Uplifting:unix, r=alexcrichton
add a number of linux syscalls

vfork, wait4, getresuid, getresgid, personality, vhangup,
swapon, swapoff, getdomainname, setdomainname, iopl, ioperm
2017-06-08 15:56:42 +00:00
Andrew Salmon
553c5dc877 sys/io.h only in linux x86_64
Make changes to reflect this
2017-06-07 19:27:14 -07:00
Andrew Salmon
c98b9f7d4e add a number of syscalls
vfork, wait4, getresuid, getresgid, personality, vhangup,
swapon, swapoff, getdomainname, setdomainname, iopl, ioperm
2017-06-07 16:26:42 -07:00
bors
80e1422851 Auto merge of #599 - xd009642:master, r=alexcrichton
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. :)
2017-05-30 13:57:31 +00:00
Daniel McKenna
6acbf873db Fixed issues in test and struct names.
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.
2017-05-29 18:27:27 +01:00
Andrew Salmon
6fb7c90ad0 sys/times.h, setreuid/setregid, and sigpending 2017-05-26 15:24:54 -07:00
Andrew Salmon
bc48202e14 remove getitimer and setitimer
_GNU_SOURCE works differently than other libraries and creates
function pointer issues
2017-05-26 12:47:53 -07:00
bors
fda4049c11 Auto merge of #596 - Susurrus:master, r=alexcrichton
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.
2017-05-19 14:10:33 +00:00
Bryant Mairs
9b9f36aefc Use NOCANCEL variants for close on Mac
The default  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.
2017-05-18 12:04:28 -07:00
Lee Bousfield
98889cf243 Add ENOATTR for Linux 2017-05-18 09:02:25 -06:00
bors
19f3be3638 Auto merge of #578 - cactorium:master, r=alexcrichton
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!
2017-05-08 14:49:12 +00:00
Lee Bousfield
fdbfe8fc91 Add xattr functions for OSX 2017-05-07 17:05:51 -06:00
Kelvin Ly
c0bec43234 Remove MAP_HUGETLB from mips-unknown-linux-uclibc 2017-05-06 02:49:54 -04:00
Kelvin Ly
96a830648d Merge branch 'master' into master 2017-05-04 22:08:48 -04:00
bors
03562b0cb2 Auto merge of #585 - jonhoo:res_init, r=alexcrichton
Add res_init

The `res_init` function, while deprecated, is critical for making networked applications work correctly when switching between networks, or between being offline and online. By default, `getaddrinfo` and friends use a cached version of `/etc/resolv.conf`, which means that network changes are not picked up by applications after they first start up. This has bitten [Firefox](https://bugzilla.mozilla.org/show_bug.cgi?id=214538), [Pidgin](https://developer.pidgin.im/ticket/2825), [MongoDB](https://jira.mongodb.org/browse/DOCS-5700), and more in the past.

The logic behind exposing only `res_init` is that it is the only `res_*` function that is frequently called directly by user applications. The other `res_*` functions provide low-level access to domain lookups, whereas `res_init` is useful even if the application itself is not concerned with doing lookups.

Behind the scenes, `getaddrinfo` in glibc [ultimately calls](a2f34833b1/resolv/nss_dns/dns-host.c (L196)) `res_nsearch` with `&_res`. `res_init` operates directly on this global reference, and is thus more useful to expose for most applications than the non-deprecated `res_ninit` function (which operators on an arbitrary `res_state`).

As far as I can tell, `res_init` is available in [FreeBSD](https://www.freebsd.org/cgi/man.cgi?query=res_init&manpath=SuSE+Linux/i386+11.3), [NetBSD](http://netbsd.gw.com/cgi-bin/man-cgi?res_init+3+NetBSD-6.1), [OpenBSD](http://man.openbsd.org/resolver.3), [Solaris](http://www.polarhome.com/service/man/?qf=res_init&tf=2&of=Solaris&sf=), [Linux](https://linux.die.net/man/3/res_init), and [macOS](https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man3/res_init.3.html).
2017-05-03 22:30:49 +00:00
Jon Gjengset
be7e45f6f5
Skip res_init test on macOS/iOS 2017-05-03 15:57:39 -04:00
NODA, Kai
61c23fb927
Add Linux-specific recvmmsg(2) and sendmmsg(2)
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>
2017-05-02 07:46:52 -04:00
Jon Gjengset
afebd98131
Android doesn't expose res_init in header file 2017-04-28 22:23:33 -04:00
Jon Gjengset
ef20ddbc57
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: 3908694d63/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: f3b3b7c7ca/include/resolv.h (L268)
FreeBSD uses __res_init: 6911f4a88c/include/resolv.h (L290)
NetBSD uses __res_init: http://ftp.netbsd.org/pub/NetBSD/NetBSD-current/src/include/resolv.h
glibc uses __res_init: a2f34833b1/resolv/resolv.h (L259)
eglibc uses __res_init: 7f0bcce417/resolv/resolv.h (L259)
musl uses res_init: 0a11d7cb13/include/resolv.h (L128)
Android uses res_init: 306ea55952/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-28 10:58:25 -04:00
Kelvin Ly
c14178c305 Fix indentation, remove more constants that don't work for uclibc 2017-04-26 23:01:05 -04:00
Kelvin Ly
2a9b6470d6 Remove extra comment 2017-04-21 18:34:12 -04:00
Kelvin Ly
26670c77b7 Fix build errors for mips-unknown-linux-uclibc 2017-04-21 18:20:08 -04:00
Kelvin Ly
2d6c7dad20 Fix more stuff after updating libc 2017-04-20 18:42:59 -04:00
bors
c34a802d1e Auto merge of #572 - malbarbo:android-x86_64, r=alexcrichton
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.
2017-04-20 14:46:39 +00:00
Kelvin Ly
9a835580a6 Add changes to allow uclibc to build 2017-04-20 02:37:31 -04:00
Marco A L Barbosa
3ca6ad9a3f Fix x86_64-linux-android failing tests 2017-04-19 12:24:45 -03:00
superriva
2122616185 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-04-04 10:13:43 +03:00
Marco A L Barbosa
bfeb3606f2 Merge branch 'master' into ci-android 2017-02-27 17:25:43 -03:00
bors
dc1aa0e2c0 Auto merge of #530 - berkowski:baud_constants, r=alexcrichton
Added baudrate constants.

Addresses #528, adding baudrate constants for `bsd` and `notbsd` flavors of `unix`.

Passes `libc-test` locally on ubuntu 14.04 LTS with the additional (uncommitted) entries into in `build.rs`:

```
cfg.skip_const( move |name| {
        match name {
            # ... snip ...
            "PTRACE_O_SUSPEND_SECCOMP" |
            "CLONE_NEWCGROUP" |
            "NETLINK_LIST_MEMBERSHIPS" |
            "NETLINK_LISTEN_ALL_NSID" |
            "NETLINK_CAP_ACK" |
            "PR_CAP_AMBIENT_CLEAR_ALL" |
            "PR_CAP_AMBIENT_LOWER" |
            "PR_CAP_AMBIENT_RAISE" |
            "PR_CAP_AMBIENT_IS_SET" |
            "PR_CAP_AMBIENT" |
            "PR_FP_MODE_FRE" |
            "PR_FP_MODE_FR" |
            "PR_GET_FP_MODE" |
            "PR_SET_FP_MODE" |
            "PR_MPX_DISABLE_MANAGEMENT" |
            "PR_MPX_ENABLE_MANAGEMENT" |
            "PR_GET_THP_DISABLE" |
            "PR_SET_THP_DISABLE" |
            "PR_SET_MM_MAP_SIZE" |
            "PR_GET_MM_MAP_SIZE" |
            "PR_SET_MM_MAP" |
            "NLM_F_DUMP_FILTERED" |
            "EPOLLEXCLUSIVE" => true,

            _ => false,
        }
    });
```
I'm assuming this is because I'm stuck using `linux-libc-dev:3.13.0-24.46` for the moment and those constants are defined in newer versions.
2017-02-24 20:25:55 +00:00
Marco A L Barbosa
92ce51823c Make libc-tests compile for aarch64-linux-android
- 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
2017-02-24 16:24:49 -03:00