Commit Graph

2455 Commits

Author SHA1 Message Date
Linus Färnstrand
add1a320b4 Bump version to 0.2.43 2018-08-06 01:35:46 +02:00
roblabla
8ff70b6a4c Add some switch-related libc typedefs 2018-08-02 13:46:37 +02:00
bors
8318a3ec1c Auto merge of #1053 - papertigers:illumos-epoll-event, r=alexcrichton
illumos epoll_event struct should be packed

While attempting to run `cargo test` within the mio crate on illumos I noticed a number of the tests fail. Digging into the various epoll calls I discovered that the epoll_event struct was misaligned due to extra padding. The fix is to pack the epoll_event struct with the same compiler setting that the linux variant is using.

A simple rust example that demonstrates the issue:
```rust
extern crate libc;
use libc::epoll_event;
use std::mem;
fn main() {
    println!("{}", mem::size_of::<u64>());
    println!("{}", mem::size_of::<epoll_event>());
}
```
Running the above code on Linux results in:
```
8
12
```
while on illumos it currently results in:
```
8
16
```
Looking at the `test_close_on_drop` test from mio I traced the `epoll_ctl`
calls and saw the following:
```
[root@rustdev ~/src/mio]# dtrace -wn 'pid$target::epoll_ctl:entry {this->ev = arg3; printf("%d\n", arg2); print((struct epoll_event *)this->ev); stop()}' -c "/root/src/mio/target/debug/deps/test-109e1422fb40f621 test_close_on_drop"
dtrace: description 'pid$target::epoll_ctl:entry ' matched 1 probe
dtrace: allowing destructive actions
running 1 test
CPU     ID                    FUNCTION:NAME
  6  92874                  epoll_ctl:entry 4
struct epoll_event * 0xfffffc7fee7feda8
test test_close_on_drop::test_close_on_drop ... test test_close_on_drop::test_close_on_drop has been running for over 60 seconds
  6  92874                  epoll_ctl:entry 6
struct epoll_event * 0xfffffc7fee7fee18
^[[A  6  92874                  epoll_ctl:entry 7
struct epoll_event * 0xfffffc7fee7fee18
```
I dumped each of the epoll_event's with mdb:
```
[root@rustdev ~/src/mio]# mdb -Fp 219856
Loading modules: [ libumem.so.1 libc.so.1 ]
> 0xfffffc7fee7feda8::print
mdb: no symbol information for 0xfffffc7fee7feda8: no symbol corresponds to address
> 0xfffffc7fee7feda8::print struct epoll_event
{
    events = 0x80000001
    data = {
        ptr = 0xfffffffffffffc7f
        fd = 0xfffffc7f
        u32 = 0xfffffc7f
        u64 = 0xfffffffffffffc7f
    }
}
>
[root@rustdev ~/src/mio]# prun 219856
[root@rustdev ~/src/mio]# mdb -Fp 219856
Loading modules: [ libumem.so.1 libc.so.1 ]
> 0xfffffc7fee7fee18::print struct epoll_event
{
    events = 0x80000001
    data = {
        ptr = 0
        fd = 0
        u32 = 0
        u64 = 0
    }
}
>
[root@rustdev ~/src/mio]# prun 219856
[root@rustdev ~/src/mio]# mdb -Fp 2198
Loading modules: [ libumem.so.1 libc.so.1 ]
> 0xfffffc7fee7fee18::print struct epoll_event
{
    events = 0x80000004
    data = {
        ptr = 0x100000000
        fd = 0
        u32 = 0
        u64 = 0x100000000
    }
}
```
The output from the last two `epoll_event`'s represent `Token(0)` the Client and `Token(1)` from the mio test. The first one however is from `AWAKEN` which is defined as `usize::MAX`.  This value should be 18446744073709551615. However if we convert the hex value we see something else:
```
> 0xfffffffffffffc7f=E
                18446744073709550719
```
Because of the extra 4 bytes of padding currently present in the illumos `epoll_event` definition the low order bits are picking up some junk from other memory.

All of the poll-related mio tests pass with this change. Two other tests are still failing, which appears to be caused by an OS bug, not a problem with mio or libc.
2018-08-01 19:39:05 +00:00
bors
7b45a7cb55 Auto merge of #1048 - ColinFinck:master, r=alexcrichton
Add libc definitions for HermitCore (https://hermitcore.org)

HermitCore is based on lwIP, newlib, and pthread-embedded.
Some definitions are similar to other targets using newlib, however some are different enough to justify an own "hermit" port and not base on the existing "newlib" port.
2018-08-01 18:03:13 +00:00
Alex Crichton
5090477133
Merge pull request #1051 from alexcrichton/fix-apple
Fix OSX builders on CI
2018-08-01 12:22:33 -05:00
Alex Crichton
e6bc44b540 Allow iOS to fail 2018-08-01 07:51:33 -07:00
Alex Crichton
83f78df8c6 Fix OSX builders on CI
Looks like Travis has moved on from our old images, so we're forced to
update.
2018-08-01 07:49:22 -07:00
debris
e131bd1b1d change exchangedata param c_long -> c_ulong 2018-08-01 13:29:15 +02:00
debris
3d5c968b20 exchangedata is osx only, fix the function signature 2018-08-01 10:36:41 +02:00
debris
019f429ee9 Merge branch 'master' into exchangedata 2018-08-01 10:29:38 +02:00
Mike Zeller
d213c3acbd illumos epoll_event struct should be packed 2018-08-01 00:30:45 -04:00
Colin Finck
086bdf9643 Fix coding style. 2018-07-31 09:43:23 +02:00
bors
e1ebfafc2f Auto merge of #1049 - alecmocatta:master, r=alexcrichton
Add the FIO* consts for *-apple-*

Previously only FIONREAD was implemented for x86_64 apple. The constant is shared between i{3..6}86 and x86_64, so I've moved it into the shared module rather than the 64 bit specific one.

They're defined like this in sys/filio.h:
```
#define FIOCLEX	     _IO('f', 1)        /* set close on exec on fd */
#define FIONCLEX     _IO('f', 2)        /* remove close on exec */
#define FIONREAD    _IOR('f', 127, int) /* get # bytes to read */
#define FIONBIO     _IOW('f', 126, int) /* set/clear non-blocking i/o */
#define FIOASYNC    _IOW('f', 125, int) /* set/clear async i/o */
#define FIOSETOWN   _IOW('f', 124, int) /* set owner */
#define FIOGETOWN   _IOR('f', 123, int) /* get owner */
#define FIODTYPE    _IOR('f', 122, int) /* get d_type */
```

Rather than decipher the C macros I got the values like so:
```
#include <stdio.h>
#include <sys/ioctl.h>

int main() {
	printf("pub const FIOCLEX: ::c_uint = 0x%x;\n", FIOCLEX);
	printf("pub const FIONCLEX: ::c_uint = 0x%x;\n", FIONCLEX);
	printf("pub const FIONREAD: ::c_ulong = 0x%lx;\n", FIONREAD);
	printf("pub const FIONBIO: ::c_ulong = 0x%lx;\n", FIONBIO);
	printf("pub const FIOASYNC: ::c_ulong = 0x%lx;\n", FIOASYNC);
	printf("pub const FIOSETOWN: ::c_ulong = 0x%lx;\n", FIOSETOWN);
	printf("pub const FIOGETOWN: ::c_ulong = 0x%lx;\n", FIOGETOWN);
	printf("pub const FIODTYPE: ::c_ulong = 0x%lx;\n", FIODTYPE);
}

$ gcc --target=i686-apple-darwin -o x x.c && file ./x && ./x
./x: Mach-O executable i386
pub const FIOCLEX: ::c_uint = 0x20006601;
pub const FIONCLEX: ::c_uint = 0x20006602;
pub const FIONREAD: ::c_ulong = 0x4004667f;
pub const FIONBIO: ::c_ulong = 0x8004667e;
pub const FIOASYNC: ::c_ulong = 0x8004667d;
pub const FIOSETOWN: ::c_ulong = 0x8004667c;
pub const FIOGETOWN: ::c_ulong = 0x4004667b;
pub const FIODTYPE: ::c_ulong = 0x4004667a;

$ gcc --target=x86_64-apple-darwin -o x x.c && file ./x && ./x
./x: Mach-O 64-bit executable x86_64
pub const FIOCLEX: ::c_uint = 0x20006601;
pub const FIONCLEX: ::c_uint = 0x20006602;
pub const FIONREAD: ::c_ulong = 0x4004667f;
pub const FIONBIO: ::c_ulong = 0x8004667e;
pub const FIOASYNC: ::c_ulong = 0x8004667d;
pub const FIOSETOWN: ::c_ulong = 0x8004667c;
pub const FIOGETOWN: ::c_ulong = 0x4004667b;
pub const FIODTYPE: ::c_ulong = 0x4004667a;
```

I'm just awaiting an XCode install to check they're the same on arm.
2018-07-31 01:25:13 +00:00
alecmocatta
86e83947ae
remove FIOCLEX and FIONBIO which were shadowing a bsd-wide declaration 2018-07-30 20:40:38 +01:00
alecmocatta
25498ef54e
FIO* for *-apple-* 2018-07-30 19:46:52 +01:00
bors
8565755356 Auto merge of #1044 - faern:modern-alignment, r=alexcrichton
Add alignment feature and use #[repr(align(x))]

Trying to solve #1042.

Here I introduce the discussed feature that will allow going from struct alignment with a private `__align` field to using `#[repr(align(x))]`. However, I have not implemented it for all structs that require alignment yet, only `in6_addr`. This because I did not want to spend too much time before we have discussed and solved the remaining questions regarding this.

One thing to discuss is testing. I have so far not done anything to the CI scripts. So currently they will still test the crate only with the `align` feature disabled. Thus they will make sure the `__align` fields are still correct. But no automatic tests make sure everything is correct when the `align` feature is turned on. What do we want to do about that? Can we insert another `cargo test` with `--features align` to make all the Travis jobs run the test suite twice, or will that slow things down too much?

I have tried using this version of libc in rustc and the standard library. And successfully changed `Ipv6Addr::new` to not use any `unsafe` and to become a `const fn`. Whether or not we want that is out of scope for this PR, but my point was that the changes introduced with this PR allow much more flexible usage of the libc structs that have alignment.
2018-07-30 17:52:17 +00:00
Linus Färnstrand
e167a73564 Describe the align feature in the readme 2018-07-30 16:57:55 +02:00
Colin Finck
5801a08e3f Add libc definitions for HermitCore (https://hermitcore.org)
HermitCore is based on lwIP, newlib, and pthread-embedded.
2018-07-30 11:48:52 +02:00
Linus Färnstrand
2819634696 Add align feature to pthread structs 2018-07-29 18:54:45 +02:00
Linus Färnstrand
41ca29f709 Add align feature to sem_t struct 2018-07-29 18:54:45 +02:00
Linus Färnstrand
5f38367da3 Add testing with align feature 2018-07-29 18:54:45 +02:00
Linus Färnstrand
6abe0b5218 Add align feature and use on in6_addr 2018-07-29 18:54:45 +02:00
bors
7d262c091e Auto merge of #1047 - kubo39:posix-spawn-apple-extension, r=alexcrichton
Add some posix_spawn apple extension flags
2018-07-29 15:58:02 +00:00
Hiroki Noda
0cf5560c06 Add some posix_spawn apple extension flags 2018-07-29 15:43:24 +09:00
bors
7d2a122fb7 Auto merge of #1045 - Amanieu:revert_musl_libgcc, r=alexcrichton
Revert "Link to libgcc when statically linking musl"

This causes linker errors due to duplicated symbols. See https://github.com/rust-lang/rust/pull/52157
2018-07-22 15:59:11 +00:00
Amanieu d'Antras
6777e63439 Revert "Link to libgcc when statically linking musl"
This reverts commit 920cfeace9.
2018-07-21 05:23:14 +01:00
bors
72b16d27cc Auto merge of #1041 - bachp:module-init, r=alexcrichton
Add MODULE_INIT_ constants

These are flags required to implement the linux kernel loading mechanism.
Specifically finit_module.
2018-07-18 20:23:53 +00:00
Pascal Bach
23657074d9 provide linux/module.h in debian sparc64 build 2018-07-18 21:56:14 +02:00
Pascal Bach
1abcbda8c4 use new headers for musl build 2018-07-18 21:56:14 +02:00
Pascal Bach
aa41265f3f Update musl ci jobs to 1.1.19 2018-07-17 22:15:19 +02:00
Pascal Bach
ebe0feb55d Add linux/module.h to test build 2018-07-17 18:41:48 +02:00
Pascal Bach
8bfe10cb45 Add MODULE_INIT_ constants
These are flags required to implement the linux kernel loading mechanism.
Specifically finit_module.
2018-07-17 18:41:48 +02:00
bors
5ac35c85fe Auto merge of #1039 - alesharik:master, r=alexcrichton
Implement statfs for dragonfly, freebsd and openbsd
2018-07-17 13:47:45 +00:00
alesharik
ce4c1404a7 Bump ctest version 2018-07-17 11:40:52 +03:00
alesharik
5ec8699bcb Implement statfs for dragonfly, freebsd and openbsd 2018-07-17 00:17:55 +03:00
bors
73c02637c4 Auto merge of #1040 - semarie:openbsd-fix, r=alexcrichton
Openbsd fix

put in several fixes for OpenBSD (one fix per commit).
testsuite ran on OpenBSD 6.3-current (upcoming 6.4)

```
RUNNING ALL TESTS
PASSED 6474 tests
```
2018-07-16 00:25:22 +00:00
Sébastien Marie
fec9baf0a3 remove ignore for published OpenBSD versions 2018-07-14 06:58:37 +02:00
Sébastien Marie
280976e0d3 fix struct arphdr alignment on OpenBSD 2018-07-14 06:57:09 +02:00
Sébastien Marie
9d203f5ce9 adjust SIGSTKSZ value for OpenBSD 6.3-current 2018-07-14 06:48:47 +02:00
Sébastien Marie
ec026d605c add HW_NCPUONLINE sysctl (number of cpus being used) on OpenBSD 2018-07-14 06:45:39 +02:00
Sébastien Marie
14f6cf8c6a add KERN_AUDIO and inc KERN_MAXID on OpenBSD 2018-07-14 06:44:16 +02:00
Sébastien Marie
c70efd87cd TCP_KEEP* constants are netbsd specific
they doesn't exists on OpenBSD. put them under NetBSD specific tree.
2018-07-14 06:39:58 +02:00
bors
bfe0e32d12 Auto merge of #1038 - Amanieu:fix_netbsd, r=alexcrichton
Fix netbsd build with "stdbuild"

A bug was introduced in #930 which caused netbsd to not link to libm.

r? @alexcrichton
2018-07-12 16:49:51 +00:00
Amanieu d'Antras
3d763ae4aa Disable test for --no-default-features on rumprun 2018-07-12 17:47:31 +01:00
Amanieu d'Antras
6fc015f03e Fix netbsd build with "stdbuild" 2018-07-12 09:24:55 +01:00
bors
ab6355021e Auto merge of #1037 - alexcrichton:fix, r=alexcrichton
Fix a #[cfg] attribute

It looks like this was a mistake of #930 but should be easy to fix!
2018-07-10 14:16:22 +00:00
Alex Crichton
30bb481ba9 Fix a #[cfg] attribute
It looks like this was a mistake of #930 but should be easy to fix!
2018-07-10 07:14:43 -07:00
bors
37e3a22feb Auto merge of #1034 - Amanieu:musl_libgcc, r=alexcrichton
Link to libgcc when statically linking musl

On some architectures (e.g. aarch64) musl depends on some libgcc functions (`__addtf3`, `__multf3`, `__subtf3`) for `long double` arithmetic that it uses internally. Unfortunately we don't provide these functions in compiler-builtins, so we instead need to get them from libgcc.

Fixes:
https://github.com/rust-lang/rust/issues/46651
https://github.com/rust-lang-nursery/compiler-builtins/issues/201
https://github.com/rust-lang-nursery/compiler-builtins/issues/217
2018-07-09 14:12:23 +00:00
Amanieu d'Antras
920cfeace9 Link to libgcc when statically linking musl 2018-07-08 18:31:40 +01:00
bors
9f54322c06 Auto merge of #1035 - rust-lang:dependabot/cargo/ctest-5c53723, r=alexcrichton
Bump ctest from `482c7f0` to `5c53723`

Bumps [ctest](https://github.com/alexcrichton/ctest) from `482c7f0` to `5c53723`.
<details>
<summary>Commits</summary>

- [`5c53723`](5c537236d1) Update libc dep
- See full diff in [compare view](482c7f0643...5c537236d1)
</details>
<br />

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

---

**Note:** This repo was added to Dependabot recently, so you'll receive a maximum of 5 PRs for your first few update runs. Once an update run creates fewer than 5 PRs we'll remove that limit.

You can always request more updates by clicking `Bump now` in your [Dependabot dashboard](https://app.dependabot.com).

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot ignore this [patch|minor|major] version` will close this PR and stop Dependabot creating any more for this minor/major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language
- `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language
- `@dependabot badge me` will comment on this PR with code to add a "Dependabot enabled" badge to your readme

Additionally, you can set the following in your Dependabot [dashboard](https://app.dependabot.com):
- Update frequency (including time of day and day of week)
- Automerge options (never/patch/minor, and dev/runtime dependencies)
- Pull request limits (per update run and/or open at any time)
- Out-of-range updates (receive only lockfile updates, if desired)
- Security updates (receive only security updates, if desired)

Finally, you can contact us by mentioning @dependabot.

</details>
2018-07-06 23:45:31 +00:00