Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move kqueue-related definitions from nix to libc #379

Merged
merged 4 commits into from
Sep 9, 2016

Conversation

asomers
Copy link
Contributor

@asomers asomers commented Sep 5, 2016

This PR moves, as much as possible, kqueue and kevent related definitions from the nix crate to libc. There will be a companion PR to the nix repo.

Add definitions for struct kqueue, function kqueue, and for all
related #defines for every BSD-derived operating system.
Reported by:	Sebastien Marie
@rust-highfive
Copy link

r? @alexcrichton

(rust_highfive has picked a reviewer for you, use r? to override)

@asomers
Copy link
Contributor Author

asomers commented Sep 5, 2016

I fixed the macos test failures. The FreeBSD tests failed because your CI VM is too old. It's complaining about symbols that are defined in FreeBSD 11 but not in FreeBSD 10. And I don't know why the OpenBSD test failed. Could somebody please take a look at it?

@asomers
Copy link
Contributor Author

asomers commented Sep 5, 2016

The macos tests are still failing because OSX is a moving target. The value of EVFILT_SYSCOUNT has changed twice recently. What do you want to do about that? Should we omit it from the bindings? It's not a very useful definition.

nchanges: ::size_t,
eventlist: *mut ::kevent,
nevents: ::size_t,
timeout: *const ::timespec) -> ::c_int;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nchanges and nevents should be c_int.
But I am unsure about the error message of OpenBSD test: it seems related to return type ?

@alexcrichton
Copy link
Member

Awesome, thanks! Could perhaps some of the more unstable or up-to-date constants be left out for now? Or do they all need to be added all at once?

@asomers
Copy link
Contributor Author

asomers commented Sep 6, 2016

I can leave out some of the newer constants. I think I should leave out EVFILT_SYSCOUNT too, because that changes from one release to another.

It strikes me that rather than use FFI, a C module might be more appropriate for these definitions. It would be able to automatically detect which constants are defined and set their values correctly. I know how to write such a module for Ruby, but not for Rust. Is there a way to define publicly visible Rust symbols from C code?

@alexcrichton
Copy link
Member

For the libc crate itself we wouldn't have any C code, but for something like nix that could work! You can call C from Rust easily with just a extern { ... } block and vice-versa if necessary with #[no_mangle].

* Rollback FreeBSD definitions to circa 10.3-RELEASE
* Remove EVFILT_SYSCOUNT across the board.  It's value is changeable, so
  it's not safe to define with FFI.
@alexcrichton
Copy link
Member

@bors: r+

Thanks! Also feel free to ping a PR whenever it's updated :)

@bors
Copy link
Contributor

bors commented Sep 8, 2016

📌 Commit 38c4b8b has been approved by alexcrichton

@bors
Copy link
Contributor

bors commented Sep 9, 2016

⌛ Testing commit 38c4b8b with merge b641737...

bors added a commit that referenced this pull request Sep 9, 2016
Move kqueue-related definitions from nix to libc

This PR moves, as much as possible, kqueue and kevent related definitions from the nix crate to libc.  There will be a companion PR to the nix repo.
@bors
Copy link
Contributor

bors commented Sep 9, 2016

☀️ Test successful - status-appveyor, travis
Approved by: alexcrichton
Pushing b641737 to master...

@bors bors merged commit 38c4b8b into rust-lang:master Sep 9, 2016
homu added a commit to nix-rust/nix that referenced this pull request Oct 20, 2016
Move kqueue-related definitions from nix to libc

See rust-lang/libc#379 for the companion commit to libc.  If and when that commit is merged, I'll update nix's Cargo.toml file and add it to this PR.
Susurrus pushed a commit to Susurrus/libc that referenced this pull request Mar 26, 2017
Add missing wait flag WUNTRACED for non-Linux systems

My understanding is that this flag is required by POSIX, so all systems should allow for it
Susurrus pushed a commit to Susurrus/libc that referenced this pull request Mar 26, 2017
The final version of libc's PR rust-lang#379 removed a few definitions, and fixed
OpenBSD's definition of fn kevent.
danielverkamp pushed a commit to danielverkamp/libc that referenced this pull request Apr 28, 2020
* split the portable vector tests into separate crates

* use rustc reductions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants