Skip to content

Commit

Permalink
Auto merge of #787 - vojtechkral:master, r=alexcrichton
Browse files Browse the repository at this point in the history
Fix kqueue filter consts type on NetBSD [WAS: Provide EV_SET]

Using BSD kqueue's `kevent` structure is tedious, because some BSD variants define the structure slightly differently. This forces user's code to differentiate between BSD variants and initialize `kevent` accordingly, which is annoying and error-prone.

For an example, refer to [MIO](https://github.com/carllerche/mio/blob/master/src/sys/unix/kqueue.rs#L38).

This is an attempt to fix it - provide a ctor function with the same signature across BSD variants.

Is an `impl` piece for a C structure allowed in libc?

**edit:** I noticed the `kevent` function has a similar problem, maybe I should include a fix for that too...
**edit:** ^ Done
  • Loading branch information
bors committed Oct 24, 2017
2 parents 0a52819 + a0e683e commit 42b24bf
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/unix/bsd/netbsdlike/netbsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -649,13 +649,13 @@ pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 1;
pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 2;
pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL;

pub const EVFILT_AIO: ::int32_t = 2;
pub const EVFILT_PROC: ::int32_t = 4;
pub const EVFILT_READ: ::int32_t = 0;
pub const EVFILT_SIGNAL: ::int32_t = 5;
pub const EVFILT_TIMER: ::int32_t = 6;
pub const EVFILT_VNODE: ::int32_t = 3;
pub const EVFILT_WRITE: ::int32_t = 1;
pub const EVFILT_AIO: ::uint32_t = 2;
pub const EVFILT_PROC: ::uint32_t = 4;
pub const EVFILT_READ: ::uint32_t = 0;
pub const EVFILT_SIGNAL: ::uint32_t = 5;
pub const EVFILT_TIMER: ::uint32_t = 6;
pub const EVFILT_VNODE: ::uint32_t = 3;
pub const EVFILT_WRITE: ::uint32_t = 1;

pub const EV_ADD: ::uint32_t = 0x1;
pub const EV_DELETE: ::uint32_t = 0x2;
Expand Down

0 comments on commit 42b24bf

Please sign in to comment.