Commit Graph

1306 Commits

Author SHA1 Message Date
bors
68d4848fe6 Auto merge of #937 - bdrewery:freebsd-ino64-compat, r=alexcrichton
Use pre-ino64 FreeBSD symbols to resolve binary compatibility.

This follows the same method as other platforms like OSX and NetBSD.

This will fix rustup and building from git (once libc is updated for bootstrap)
on FreeBSD12 post-ino64 in f713b08c02.
It also avoids having to hotpatch the stage0 compiler, and HOME/.cargo
libc files on FreeBSD12 to build rust.

The only real pitfall is that this will prevent interaction with inodes that
have an ino_t above the 32-bit limit due to truncation.  On the other hand
Rust won't work at all on 12 without doing this currently.  In general
it should not be a problem for users and if they need 64-bit ino_t they
can use a patched libc, rather than the current state of affairs in
requiring a patched libc to use Rust on 12.

A better, or complementary, approach would be something like proposed in
https://github.com/rust-lang/rfcs/pull/2048 to allow targetting a specific
version of FreeBSD. This would allow Rust to default to this compatibility
mode by targetting FreeBSD10 and still allow targetting FreeBSD12 for 64-bit
ino_t.

The symbol versions used were taken from the old version in
f713b08c02 (diff-61a32fcfb7ecd4517665fed591813c57)
and
f713b08c02 (diff-7f67ccf8b5f44ff2f54eaab0207abb8d).

The scope of functions versioned here differs from other platforms as
not all structs were modified that were on others, such as DIR for
`opendir`, `telldir`, etc.  Only functions using dirent, stat, glob_t,
and dev_t need the changes.

Fixes https://github.com/rust-lang/rust/issues/42681
2018-03-02 01:19:11 +00:00
Bryan Drewery
78f93220d7 Use pre-ino64 FreeBSD symbols to resolve binary compatibility.
This follows the same method as other platforms like OSX and NetBSD.

This will fix rustup and building from git (once libc is updated for bootstrap)
on FreeBSD12 post-ino64 in f713b08c02.
It also avoids having to hotpatch the stage0 compiler, and HOME/.cargo
libc files on FreeBSD12 to build rust.

The only real pitfall is that this will prevent interaction with inodes that
have an ino_t above the 32-bit limit due to truncation.  On the other hand
Rust won't work at all on 12 without doing this currently.  In general
it should not be a problem for users and if they need 64-bit ino_t they
can use a patched libc, rather than the current state of affairs in
requiring a patched libc to use Rust on 12.

A better, or complementary, approach would be something like proposed in
https://github.com/rust-lang/rfcs/pull/2048 to allow targetting a specific
version of FreeBSD. This would allow Rust to default to this compatibility
mode by targetting FreeBSD10 and still allow targetting FreeBSD12 for 64-bit
ino_t.

The symbol versions used were taken from the old version in
f713b08c02 (diff-61a32fcfb7ecd4517665fed591813c57)
and
f713b08c02 (diff-7f67ccf8b5f44ff2f54eaab0207abb8d).

The scope of functions versioned here differs from other platforms as
not all structs were modified that were on others, such as DIR for
`opendir`, `telldir`, etc.  Only functions using dirent, stat, glob_t,
and dev_t need the changes.

Fixes https://github.com/rust-lang/rust/issues/42681
2018-03-01 15:26:26 -08:00
bors
f0938610e5 Auto merge of #936 - bdrewery:freebsd-kevent-compat, r=alexcrichton
Link against kevent@FBSD_1.0 to fix ABI compat with FreeBSD12.

struct kevent was modified in FreeBSD12.  The @FBSD_1.0 symbol supports the old
structure ABI still.

This allows the `mio` crate tests to now pass on FreeBSD12.
2018-03-01 20:50:57 +00:00
Bryan Drewery
969ad2b73c Link against kevent@FBSD_1.0 to fix ABI compat with FreeBSD12.
struct kevent was modified in FreeBSD12.  The @FBSD_1.0 symbol supports the old
structure ABI still.

This allows the `mio` crate tests to now pass on FreeBSD12.
2018-03-01 12:36:00 -08:00
bgermann
c299cc49d3 Add Solaris constants needed by net2
The added constants are
IPV6_UNICAST_HOPS,
IPV6_MULTICAST_IF,
IPV6_MULTICAST_HOPS,
IP_MULTICAST_IF.
2018-03-01 12:48:24 +01:00
Raph Levien
709709db15 Add IPV6_UNICAST_HOPS to fuchsia module
Recent change #925 added constants for IPV6 multicast, but seems
to have inadvertently left off IPV6_UNICAST_HOPS from fuchsia.

Fixes #932
2018-02-28 15:41:50 -08:00
bors
8bed48a751 Auto merge of #931 - bdrewery:posix_spawn_freebsd, r=alexcrichton
Add posix_spawn bindings for FreeBSD
2018-02-28 17:30:10 +00:00
gnzlbg
78320c7c75 retry 2018-02-28 15:27:38 +01:00
gnzlbg
2938d1c4c2 fix style 2018-02-28 10:58:01 +01:00
gnzlbg
5c95d8d03b wrap target_vendor with stdbuild 2018-02-28 08:34:12 +01:00
gnzlbg
4c0b6ea61e fix style 2018-02-27 16:13:49 +01:00
gnzlbg
988843834f test --no-default-features and fix musl builds 2018-02-27 15:47:18 +01:00
Bryan Drewery
92d50c9c79 Add posix_spawn bindings for FreeBSD 2018-02-26 16:45:41 -08:00
bors
8650afb555 Auto merge of #926 - faern:add-netfilter-fields, r=alexcrichton
Add netfilter/nftables fields

Adding a few missing `NF_` constants to more complete the story around that header. Then most importantly add a lot of `NFT_` constants needed in my nftables library. Some were added back in #911, but as the library grew I realized I needed more constants.
2018-02-26 03:28:23 +00:00
bors
42377bb76d Auto merge of #925 - bluejekyll:master, r=alexcrichton
add IPV6_MULTICAST_IF and IPV6_MULTICAST_HOPS

These were missing from the net2 crate. Adding them here so that the higher functions can be added to net2 later. They are necessary for declaring the interface for ipv6 multicast packets (route), and limits on the number of hops an ipv6 packet can travel

Linux reference: https://github.com/torvalds/linux/blob/master/include/uapi/linux/in6.h#L168-L170
macOS reference: https://github.com/apple/darwin-xnu/blob/master/bsd/netinet6/in6.h#L538-L540
2018-02-26 03:07:07 +00:00
Benjamin Fry
0e421c9611 add IPV6_UNICAST_HOPS 2018-02-25 15:23:46 -08:00
Linus Färnstrand
b89d662117 Add missing NFT_ constants from nf_tables.h 2018-02-25 22:45:43 +01:00
Linus Färnstrand
750fcf5c5a Add missing netfilter constants
Was able to move some of them up one level so they are valid on more
platforms with less duplication
2018-02-25 22:45:43 +01:00
Linus Färnstrand
c8fb675939 Add INT_MIN and INT_MAX 2018-02-25 22:22:09 +01:00
Benjamin Fry
7ed5599a64 add IPV6_MULTICAST_IF and IPV6_MULTICAST_HOPS 2018-02-25 10:58:44 -08:00
kristopher tate
28224dfe81 android: removing some newer constants included since kernel v4.12.3; 2018-02-25 23:39:37 +09:00
kristopher tate
8ed59661a0 android: fixes style errors; 2018-02-25 23:39:37 +09:00
kristopher tate
d160a59ac8 android: ETH_* constants from linux/if_ether.h ; ref nix-rust/nix#865 2018-02-25 23:39:37 +09:00
Linus Färnstrand
95befb4b20 Bump NFT_*_MAXNAMELEN to 256 2018-02-25 02:05:28 +01:00
Linus Färnstrand
fe499944e7 Move non-musl GENL_ constants to correct submodules 2018-02-25 00:23:50 +01:00
Linus Färnstrand
69ae346034 Add genetlink.h constants 2018-02-22 14:58:22 +01:00
Linus Färnstrand
393271185a Add NLA_ALIGN(TO) constant/function 2018-02-22 14:58:22 +01:00
Linus Färnstrand
6e211cdf61 Add netlink/genetlink structs to notbsd 2018-02-22 14:58:10 +01:00
John Paul Adrian Glaubitz
a9cddbcfcf Prefer hexadecimal representation of O_TMPFILE on linux-sparc64 2018-02-17 17:58:16 +01:00
Bryant Mairs
3dd2162fe0 Add termios ioctl constants to NetBSD 2018-02-13 21:05:46 -08:00
luozijun
0f4ae0b8f1 Add constants IFF_TUN, IFF_TAP and IFF_NO_PI on linux, android and fuchsia system 2018-02-07 11:12:29 +08:00
gnzlbg
53e4733180 add macosx sysv ipc shared memory 2018-02-03 14:43:38 +01:00
bors
782794985c Auto merge of #902 - gnzlbg:missing_linux_intrinsics, r=malbarbo
Missing linux intrinsics
2018-02-01 15:41:35 +00:00
gnzlbg
ea58a8cb59 remove memfd_create 2018-02-01 14:42:49 +01:00
Linus Färnstrand
4d5ed47efd Add netfilter constants to Linux and Android 2018-01-30 23:08:00 +01:00
bors
11cabded2b Auto merge of #909 - alexcrichton:posix-spawn, r=alexcrichton
Add posix_spawn bindings
2018-01-26 01:34:54 +00:00
Alex Crichton
4621a34864 Add posix_spawn bindings 2018-01-25 17:12:24 -08:00
bors
56444a4545 Auto merge of #908 - malbarbo:musl-mips-static, r=alexcrichton
Do not assume dynamic linking in musl/mips targets
2018-01-24 02:38:22 +00:00
bors
9613051cd9 Auto merge of #887 - myfreeweb:freebsd-procdesc, r=alexcrichton
Add missing FreeBSD APIs

Process descriptors, realtime process priority, a couple missing kqueue event filters.
2018-01-23 15:56:00 +00:00
Greg V
c13302d87e Add rtprio (realtime priority) API for FreeBSD and DragonFly 2018-01-23 13:13:48 +03:00
Marco A L Barbosa
6a7dd87aab Add syscall table for musl/powerpc64 2018-01-22 15:55:52 -02:00
Marco A L Barbosa
042b7070bc Do not assume dynamic linking in musl mips 2018-01-22 15:38:05 -02:00
Greg V
6725fd6aef Add FreeBSD process descriptors API
Available since FreeBSD 9.0, this API allows using local descriptors
instead of global PIDs. It works in Capsicum sandboxes.
2018-01-22 18:15:36 +03:00
Greg V
ecea23aa53 Add missing kqueue event filters on FreeBSD 2018-01-22 18:15:36 +03:00
Bill Fraser
1ada396bde add DT_UNKNOWN
The `d_type` field of `struct dirent` can be `DT_UNKNOWN` if a
filesystem doesn't support returning the file type in directory entries.
Linux's readdir(3) man page, for example, says: "Currently, only some
filesystems [...] have full support for returning the file type in
d_type. All applications must properly handle a return of DT_UNKNOWN."
2018-01-19 15:58:03 -08:00
gnzlbg
049b43e720 make malloc_usable size take a *mut instead of *const 2018-01-19 12:09:12 +01:00
gnzlbg
9908dcea17 move to linux::other 2018-01-18 17:16:33 +01:00
gnzlbg
6c63b9d8b2 fix style 2018-01-18 17:11:20 +01:00
gnzlbg
c91864394e Adds Linux's memfd_create 2018-01-18 17:07:32 +01:00
gnzlbg
b2cfdf22f9 remove getauxval and malloc_usable_size from musl 2018-01-18 17:05:59 +01:00
gnzlbg
7c074b85d4 remove gethosname, use proper types depending on bsd flavour 2018-01-18 17:02:07 +01:00
gnzlbg
f6b64f09c7 Disable mallinfo on musl 2018-01-18 16:54:49 +01:00
gnzlbg
dca8a31d00 Add gethostname.
Closes #868 .
2018-01-18 10:34:31 +01:00
gnzlbg
e4bc821548 Add {get,set}domainname 2018-01-18 10:33:37 +01:00
gnzlbg
a2c0da68c3 Adds Linux's mallinfo
Closes #901 .
2018-01-17 18:20:03 +01:00
gnzlbg
82188828e9 Adds Linux's malloc_usable_size.
Closes #900 .
2018-01-17 18:20:03 +01:00
gnzlbg
bfd3bf34bb Adds Linux's remap_file_pages .
Closes #899.
2018-01-17 18:20:02 +01:00
gnzlbg
f8db1a0f47 Adds Linux's getauxval
Closes #874 .
2018-01-17 18:19:48 +01:00
Bryant Mairs
46933f0311 Add sockaddr_ctl on Mac 2018-01-14 22:26:46 -08:00
bors
3ccb0750ff Auto merge of #879 - SanchayanMaity:kill, r=alexcrichton
Add killpg
2018-01-13 18:01:39 +00:00
bors
1e80d93800 Auto merge of #896 - cneira:master, r=alexcrichton
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.
2018-01-12 22:12:26 +00:00
neirac
c6bb76abf2 revert changes 2018-01-12 19:41:27 +00:00
neirac
6406f18b9f fix style 2018-01-12 19:38:07 +00:00
neirac
c1df963888 epoll create syscall table numer 2018-01-12 15:25:46 +00:00
Guillaume Gomez
d5d0bdf414 Add difftime function 2018-01-11 23:32:27 +01:00
neirac
3a7294ad0e pub mod unix 2018-01-11 22:06:34 +00:00
neirac
94608b85e0 illumos defines 2018-01-11 21:12:23 +00:00
neirac
02b5a926d6 solaris mod 2018-01-11 20:38:30 +00:00
neirac
3e3c292063 solaris defs missing 2018-01-11 20:28:37 +00:00
neirac
5b6bab01f7 solaris defs missing 2018-01-11 20:27:39 +00:00
neirac
66e0bf148d pub unix 2018-01-11 20:08:46 +00:00
neirac
efc8c95296 add const 2018-01-11 18:48:13 +00:00
neirac
8492b7a2d3 epoll defines 2018-01-11 15:45:59 +00:00
neirac
3092748c95 adding epoll for illumos 2018-01-11 15:25:00 +00:00
Kelsey Z
586867d39a feat(linux): add mntent struct and related functions
Useful when playing around with mounting points, sadly not a common
interface
2018-01-11 21:57:30 +13:00
Ed Schouten
dad866d670 Add support for CloudABI running on 32-bit ARM systems. 2018-01-09 11:40:07 +01:00
Ed Schouten
ee3d0578e6 Correct the type of c_char.
On ARM64, it is supposed to be unsigned char:

  $ aarch64-unknown-cloudabi-cc -dM -E - < /dev/null | grep __CHAR_UNSIGNED__
  #define __CHAR_UNSIGNED__ 1
2018-01-09 11:39:21 +01:00
bors
2b4cd1016b Auto merge of #889 - EdSchouten:cloudabi-time_t, r=alexcrichton
Add time_t for CloudABI.

Even though this data type is not used by libstd in any platform
independent code, one of the unit tests in src/libstd/time/mod.rs refers
to it. Instead of making that unit test more complicated, simply add
time_t, matching the type used by the C library.
2018-01-08 15:05:51 +00:00
Igor Gnatenko
2462733797 android: add statvfs flags (ST_*)
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2018-01-08 00:38:46 +01:00
Ed Schouten
63bb3f482d Add time_t for CloudABI.
Even though this data type is not used by libstd in any platform
independent code, one of the unit tests in src/libstd/time/mod.rs refers
to it. Instead of making that unit test more complicated, simply add
time_t, matching the type used by the C library.
2018-01-07 23:36:04 +01:00
Ed Schouten
bbaf0426bd Add _SC_NPROCESSORS_ONLN for CloudABI.
This constant is not used by the C library, which is why I didn't add it
initially. It is, however, used by libtest to determine the parallelism
for the execution of tests.
2018-01-02 12:37:34 +01:00
bors
f060d95ffc Auto merge of #884 - EdSchouten:cloudabi, r=alexcrichton
Add support for CloudABI.

CloudABI is a sandboxed UNIX-like runtime environment, based on the
principle of capability-based security. As CloudABI is intended to be
cross-platform, the system call layer is specified here:

    https://github.com/NuxiNL/cloudabi/blob/master/cloudabi.txt

From these definitions, we automatically generate C and Rust bindings.
The latter is published on crates.io:

    https://crates.io/crates/cloudabi

My goal is to implement libstd for CloudABI in such a way that it uses
the C library as little as possible; only in places where it would ease
interfacing with C code (e.g., thread creation). In places where
constants in the C library are directly based on the CloudABI
specification (e.g., errnos), use the constants provided by the cloudabi
crate.
2017-12-28 16:21:11 +00:00
Ed Schouten
ac0bdf9a48 Add EXIT_FAILURE and EXIT_SUCCESS for CloudABI.
These are now used by libstd's termination.rs.
2017-12-28 13:20:13 +01:00
Ed Schouten
7c36e1c305 Add arc4random_buf() for PRNG access. 2017-12-28 10:38:21 +01:00
Ed Schouten
27a5a3b967 Fix style to appease CI. 2017-12-27 18:58:34 +01:00
Ed Schouten
2fa33ef8eb Inline values coming from the cloudabi package. 2017-12-27 17:20:46 +01:00
Ed Schouten
510cb2f720 Add support for CloudABI.
CloudABI is a sandboxed UNIX-like runtime environment, based on the
principle of capability-based security. As CloudABI is intended to be
cross-platform, the system call layer is specified here:

    https://github.com/NuxiNL/cloudabi/blob/master/cloudabi.txt

From these definitions, we automatically generate C and Rust bindings.
The latter is published on crates.io:

    https://crates.io/crates/cloudabi

My goal is to implement libstd for CloudABI in such a way that it uses
the C library as little as possible; only in places where it would ease
interfacing with C code (e.g., thread creation). In places where
constants in the C library are directly based on the CloudABI
specification (e.g., errnos), use the constants provided by the cloudabi
crate.
2017-12-27 14:42:19 +01:00
luozijun
536b5cfa86 Add bpf constant on macOS 2017-12-27 04:04:46 +08:00
luozijun
629908abe3 Add struct bpf_hdr on macOS 2017-12-27 04:03:39 +08:00
luozijun
5ea536a0a0 Add some constants for linux and macos 2017-12-26 10:36:01 +08:00
Sanchayan Maity
a2f948dd61 Add killpg 2017-12-19 20:57:46 +05:30
Jörg Thalheim
9f720f3c64 Add SECCOMP_MODE_* flags on Linux 2017-12-19 14:31:12 +00:00
bors
ef9eefb6df Auto merge of #876 - asomers:remove_deprecated, r=alexcrichton
Change deprecated constants into hidden constants

rustc, an important libc consumer, has a policy that they can't use any
crates with deprecated symbols.  Replace libc's two deprecated symbols
with hidden symbols instead.
2017-12-17 18:27:08 +00:00
Alan Somers
6e8e7cf3b6 Change deprecated constants into hidden constants
rustc, an important libc consumer, has a policy that they can't use any
crates with deprecated symbols.  Replace libc's two deprecated symbols
with hidden symbols instead.
2017-12-17 11:22:03 -07:00
bors
236e0fa551 Auto merge of #875 - kpcyrd:aarch64-syscalls, r=alexcrichton
Add additional aarch64 linux syscalls

I've noticed some syscalls are missing for aarch64 linux, I've added those I needed. The numbers have been taken from a raspberry pi 3.

Adds:
- `SYS_fcntl`
- `SYS_lseek`
- `SYS_newfstatat`
- `SYS_fstat`
- `SYS_mmap`
- `SYS_open`
- `SYS_stat`
- `SYS_lstat`
- `SYS_pipe`
- `SYS_getdents`
- `SYS_poll`
2017-12-17 17:54:02 +00:00
kpcyrd
6610e424ec Remove special aarch64 syscalls again 2017-12-17 02:35:36 +01:00
bors
a8c0a3bf3e Auto merge of #871 - asomers:mq, r=alexcrichton
POSIX mqueue bindings for the BSDs

Note that OpenBSD and OSX do not support POSIX message queues.
2017-12-17 00:54:16 +00:00
Alan Somers
831ca990d2 POSIX mqueue bindings for the BSDs
Note that OpenBSD and OSX do not support POSIX message queues.
2017-12-16 10:22:11 -07:00
kpcyrd
ac365733d9 Add additional aarch64 linux syscalls 2017-12-16 01:21:10 +01:00
luozijun
348bda9410 Remove constants UTUN_CONTROL_NAME 2017-12-15 01:07:05 +08:00