Skip to content

Commit

Permalink
Move inotify to the linux and android sub-modules
Browse files Browse the repository at this point in the history
  • Loading branch information
gnzlbg committed Mar 25, 2019
1 parent 1baa3c3 commit e7dc882
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 44 deletions.
42 changes: 42 additions & 0 deletions src/unix/notbsd/android/mod.rs
Expand Up @@ -1802,6 +1802,43 @@ pub const ALG_SET_AEAD_AUTHSIZE: ::c_int = 5;
pub const ALG_OP_DECRYPT: ::c_int = 0;
pub const ALG_OP_ENCRYPT: ::c_int = 1;

// uapi/linux/inotify.h
pub const IN_ACCESS: ::uint32_t = 0x0000_0001;
pub const IN_MODIFY: ::uint32_t = 0x0000_0002;
pub const IN_ATTRIB: ::uint32_t = 0x0000_0004;
pub const IN_CLOSE_WRITE: ::uint32_t = 0x0000_0008;
pub const IN_CLOSE_NOWRITE: ::uint32_t = 0x0000_0010;
pub const IN_CLOSE: ::uint32_t = (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE);
pub const IN_OPEN: ::uint32_t = 0x0000_0020;
pub const IN_MOVED_FROM: ::uint32_t = 0x0000_0040;
pub const IN_MOVED_TO: ::uint32_t = 0x0000_0080;
pub const IN_MOVE: ::uint32_t = (IN_MOVED_FROM | IN_MOVED_TO);
pub const IN_CREATE: ::uint32_t = 0x0000_0100;
pub const IN_DELETE: ::uint32_t = 0x0000_0200;
pub const IN_DELETE_SELF: ::uint32_t = 0x0000_0400;
pub const IN_MOVE_SELF: ::uint32_t = 0x0000_0800;
pub const IN_UNMOUNT: ::uint32_t = 0x0000_2000;
pub const IN_Q_OVERFLOW: ::uint32_t = 0x0000_4000;
pub const IN_IGNORED: ::uint32_t = 0x0000_8000;
pub const IN_ONLYDIR: ::uint32_t = 0x0100_0000;
pub const IN_DONT_FOLLOW: ::uint32_t = 0x0200_0000;
// pub const IN_EXCL_UNLINK: ::uint32_t = 0x0400_0000;

// pub const IN_MASK_CREATE: ::uint32_t = 0x1000_0000;
// pub const IN_MASK_ADD: ::uint32_t = 0x2000_0000;
pub const IN_ISDIR: ::uint32_t = 0x4000_0000;
pub const IN_ONESHOT: ::uint32_t = 0x8000_0000;

pub const IN_ALL_EVENTS: ::uint32_t = (
IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE |
IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM |
IN_MOVED_TO | IN_DELETE | IN_CREATE | IN_DELETE_SELF |
IN_MOVE_SELF
);

pub const IN_CLOEXEC: ::c_int = O_CLOEXEC;
pub const IN_NONBLOCK: ::c_int = O_NONBLOCK;

f! {
pub fn CMSG_NXTHDR(mhdr: *const msghdr,
cmsg: *const cmsghdr) -> *mut cmsghdr {
Expand Down Expand Up @@ -2067,6 +2104,11 @@ extern {
flags: ::c_int) -> ::c_int;
pub fn recvmmsg(sockfd: ::c_int, msgvec: *mut ::mmsghdr, vlen: ::c_uint,
flags: ::c_int, timeout: *const ::timespec) -> ::c_int;
pub fn inotify_init() -> ::c_int;
pub fn inotify_init1(flags: ::c_int) -> ::c_int;
pub fn inotify_add_watch(fd: ::c_int,
path: *const ::c_char,
mask: ::uint32_t) -> ::c_int;
}

cfg_if! {
Expand Down
42 changes: 42 additions & 0 deletions src/unix/notbsd/linux/mod.rs
Expand Up @@ -1812,6 +1812,43 @@ pub const ALG_SET_AEAD_AUTHSIZE: ::c_int = 5;
pub const ALG_OP_DECRYPT: ::c_int = 0;
pub const ALG_OP_ENCRYPT: ::c_int = 1;

// uapi/linux/inotify.h
pub const IN_ACCESS: ::uint32_t = 0x0000_0001;
pub const IN_MODIFY: ::uint32_t = 0x0000_0002;
pub const IN_ATTRIB: ::uint32_t = 0x0000_0004;
pub const IN_CLOSE_WRITE: ::uint32_t = 0x0000_0008;
pub const IN_CLOSE_NOWRITE: ::uint32_t = 0x0000_0010;
pub const IN_CLOSE: ::uint32_t = (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE);
pub const IN_OPEN: ::uint32_t = 0x0000_0020;
pub const IN_MOVED_FROM: ::uint32_t = 0x0000_0040;
pub const IN_MOVED_TO: ::uint32_t = 0x0000_0080;
pub const IN_MOVE: ::uint32_t = (IN_MOVED_FROM | IN_MOVED_TO);
pub const IN_CREATE: ::uint32_t = 0x0000_0100;
pub const IN_DELETE: ::uint32_t = 0x0000_0200;
pub const IN_DELETE_SELF: ::uint32_t = 0x0000_0400;
pub const IN_MOVE_SELF: ::uint32_t = 0x0000_0800;
pub const IN_UNMOUNT: ::uint32_t = 0x0000_2000;
pub const IN_Q_OVERFLOW: ::uint32_t = 0x0000_4000;
pub const IN_IGNORED: ::uint32_t = 0x0000_8000;
pub const IN_ONLYDIR: ::uint32_t = 0x0100_0000;
pub const IN_DONT_FOLLOW: ::uint32_t = 0x0200_0000;
// pub const IN_EXCL_UNLINK: ::uint32_t = 0x0400_0000;

// pub const IN_MASK_CREATE: ::uint32_t = 0x1000_0000;
// pub const IN_MASK_ADD: ::uint32_t = 0x2000_0000;
pub const IN_ISDIR: ::uint32_t = 0x4000_0000;
pub const IN_ONESHOT: ::uint32_t = 0x8000_0000;

pub const IN_ALL_EVENTS: ::uint32_t = (
IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE |
IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM |
IN_MOVED_TO | IN_DELETE | IN_CREATE | IN_DELETE_SELF |
IN_MOVE_SELF
);

pub const IN_CLOEXEC: ::c_int = O_CLOEXEC;
pub const IN_NONBLOCK: ::c_int = O_NONBLOCK;

f! {
pub fn CMSG_NXTHDR(mhdr: *const msghdr,
cmsg: *const cmsghdr) -> *mut cmsghdr {
Expand Down Expand Up @@ -2397,6 +2434,11 @@ extern {
stream: *mut ::FILE
) -> ::size_t;
pub fn inotify_rm_watch(fd: ::c_int, wd: ::c_int) -> ::c_int;
pub fn inotify_init() -> ::c_int;
pub fn inotify_init1(flags: ::c_int) -> ::c_int;
pub fn inotify_add_watch(fd: ::c_int,
path: *const ::c_char,
mask: ::uint32_t) -> ::c_int;
}

cfg_if! {
Expand Down
44 changes: 0 additions & 44 deletions src/unix/notbsd/mod.rs
Expand Up @@ -1154,45 +1154,6 @@ pub const ARPHRD_IEEE802154: u16 = 804;
pub const ARPHRD_VOID: u16 = 0xFFFF;
pub const ARPHRD_NONE: u16 = 0xFFFE;

// uapi/linux/inotify.h
pub const IN_ACCESS: ::uint32_t = 0x0000_0001;
pub const IN_MODIFY: ::uint32_t = 0x0000_0002;
pub const IN_ATTRIB: ::uint32_t = 0x0000_0004;
pub const IN_CLOSE_WRITE: ::uint32_t = 0x0000_0008;
pub const IN_CLOSE_NOWRITE: ::uint32_t = 0x0000_0010;
pub const IN_CLOSE: ::uint32_t = (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE);
pub const IN_OPEN: ::uint32_t = 0x0000_0020;
pub const IN_MOVED_FROM: ::uint32_t = 0x0000_0040;
pub const IN_MOVED_TO: ::uint32_t = 0x0000_0080;
pub const IN_MOVE: ::uint32_t = (IN_MOVED_FROM | IN_MOVED_TO);
pub const IN_CREATE: ::uint32_t = 0x0000_0100;
pub const IN_DELETE: ::uint32_t = 0x0000_0200;
pub const IN_DELETE_SELF: ::uint32_t = 0x0000_0400;
pub const IN_MOVE_SELF: ::uint32_t = 0x0000_0800;

pub const IN_UNMOUNT: ::uint32_t = 0x0000_2000;
pub const IN_Q_OVERFLOW: ::uint32_t = 0x0000_4000;
pub const IN_IGNORED: ::uint32_t = 0x0000_8000;

pub const IN_ONLYDIR: ::uint32_t = 0x0100_0000;
pub const IN_DONT_FOLLOW: ::uint32_t = 0x0200_0000;
// pub const IN_EXCL_UNLINK: ::uint32_t = 0x0400_0000;

// pub const IN_MASK_CREATE: ::uint32_t = 0x1000_0000;
// pub const IN_MASK_ADD: ::uint32_t = 0x2000_0000;
pub const IN_ISDIR: ::uint32_t = 0x4000_0000;
pub const IN_ONESHOT: ::uint32_t = 0x8000_0000;

pub const IN_ALL_EVENTS: ::uint32_t = (
IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE |
IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM |
IN_MOVED_TO | IN_DELETE | IN_CREATE | IN_DELETE_SELF |
IN_MOVE_SELF
);

pub const IN_CLOEXEC: ::c_int = O_CLOEXEC;
pub const IN_NONBLOCK: ::c_int = O_NONBLOCK;

fn CMSG_ALIGN(len: usize) -> usize {
len + ::mem::size_of::<usize>() - 1 & !(::mem::size_of::<usize>() - 1)
}
Expand Down Expand Up @@ -1445,11 +1406,6 @@ extern {
pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int)
-> ::ssize_t;
pub fn uname(buf: *mut ::utsname) -> ::c_int;
pub fn inotify_init() -> ::c_int;
pub fn inotify_init1(flags: ::c_int) -> ::c_int;
pub fn inotify_add_watch(fd: ::c_int,
path: *const ::c_char,
mask: ::uint32_t) -> ::c_int;
}

cfg_if! {
Expand Down

0 comments on commit e7dc882

Please sign in to comment.