Skip to content

Commit c4922c3

Browse files
committed
Moved inotify declarations up so that it works on android too.
1 parent a8a817a commit c4922c3

File tree

2 files changed

+52
-52
lines changed

2 files changed

+52
-52
lines changed

src/unix/notbsd/linux/mod.rs

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -500,13 +500,6 @@ s! {
500500
pub updated: ::c_ulong,
501501
pub ha: [::c_uchar; ::MAX_ADDR_LEN],
502502
}
503-
504-
pub struct inotify_event {
505-
pub wd: ::c_int,
506-
pub mask: ::uint32_t,
507-
pub cookie: ::uint32_t,
508-
pub len: ::uint32_t
509-
}
510503
}
511504

512505
s_no_extra_traits!{
@@ -1697,45 +1690,6 @@ pub const ARPD_LOOKUP: ::c_ushort = 0x02;
16971690
pub const ARPD_FLUSH: ::c_ushort = 0x03;
16981691
pub const ATF_MAGIC: ::c_int = 0x80;
16991692

1700-
// uapi/linux/inotify.h
1701-
pub const IN_ACCESS: ::uint32_t = 0x0000_0001;
1702-
pub const IN_MODIFY: ::uint32_t = 0x0000_0002;
1703-
pub const IN_ATTRIB: ::uint32_t = 0x0000_0004;
1704-
pub const IN_CLOSE_WRITE: ::uint32_t = 0x0000_0008;
1705-
pub const IN_CLOSE_NOWRITE: ::uint32_t = 0x0000_0010;
1706-
pub const IN_CLOSE: ::uint32_t = (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE);
1707-
pub const IN_OPEN: ::uint32_t = 0x0000_0020;
1708-
pub const IN_MOVED_FROM: ::uint32_t = 0x0000_0040;
1709-
pub const IN_MOVED_TO: ::uint32_t = 0x0000_0080;
1710-
pub const IN_MOVE: ::uint32_t = (IN_MOVED_FROM | IN_MOVED_TO);
1711-
pub const IN_CREATE: ::uint32_t = 0x0000_0100;
1712-
pub const IN_DELETE: ::uint32_t = 0x0000_0200;
1713-
pub const IN_DELETE_SELF: ::uint32_t = 0x0000_0400;
1714-
pub const IN_MOVE_SELF: ::uint32_t = 0x0000_0800;
1715-
1716-
pub const IN_UNMOUNT: ::uint32_t = 0x0000_2000;
1717-
pub const IN_Q_OVERFLOW: ::uint32_t = 0x0000_4000;
1718-
pub const IN_IGNORED: ::uint32_t = 0x0000_8000;
1719-
1720-
pub const IN_ONLYDIR: ::uint32_t = 0x0100_0000;
1721-
pub const IN_DONT_FOLLOW: ::uint32_t = 0x0200_0000;
1722-
// pub const IN_EXCL_UNLINK: ::uint32_t = 0x0400_0000;
1723-
1724-
// pub const IN_MASK_CREATE: ::uint32_t = 0x1000_0000;
1725-
// pub const IN_MASK_ADD: ::uint32_t = 0x2000_0000;
1726-
pub const IN_ISDIR: ::uint32_t = 0x4000_0000;
1727-
pub const IN_ONESHOT: ::uint32_t = 0x8000_0000;
1728-
1729-
pub const IN_ALL_EVENTS: ::uint32_t = (
1730-
IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE |
1731-
IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM |
1732-
IN_MOVED_TO | IN_DELETE | IN_CREATE | IN_DELETE_SELF |
1733-
IN_MOVE_SELF
1734-
);
1735-
1736-
pub const IN_CLOEXEC: ::c_int = O_CLOEXEC;
1737-
pub const IN_NONBLOCK: ::c_int = O_NONBLOCK;
1738-
17391693
#[cfg(not(target_arch = "sparc64"))]
17401694
pub const SO_TIMESTAMPING: ::c_int = 37;
17411695
#[cfg(target_arch = "sparc64")]
@@ -2337,12 +2291,6 @@ extern {
23372291
nobj: ::size_t,
23382292
stream: *mut ::FILE
23392293
) -> ::size_t;
2340-
pub fn inotify_init() -> ::c_int;
2341-
pub fn inotify_init1(flags: ::c_int) -> ::c_int;
2342-
pub fn inotify_add_watch(fd: ::c_int,
2343-
path: *const ::c_char,
2344-
mask: ::uint32_t) -> ::c_int;
2345-
pub fn inotify_rm_watch(fd: ::c_int, wd: ::c_int) -> ::c_int;
23462294
}
23472295

23482296
cfg_if! {

src/unix/notbsd/mod.rs

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,13 @@ s! {
209209
pub ar_pln: u8,
210210
pub ar_op: u16,
211211
}
212+
213+
pub struct inotify_event {
214+
pub wd: ::c_int,
215+
pub mask: ::uint32_t,
216+
pub cookie: ::uint32_t,
217+
pub len: ::uint32_t
218+
}
212219
}
213220

214221
s_no_extra_traits!{
@@ -1128,6 +1135,45 @@ pub const ARPHRD_IEEE802154: u16 = 804;
11281135
pub const ARPHRD_VOID: u16 = 0xFFFF;
11291136
pub const ARPHRD_NONE: u16 = 0xFFFE;
11301137

1138+
// uapi/linux/inotify.h
1139+
pub const IN_ACCESS: ::uint32_t = 0x0000_0001;
1140+
pub const IN_MODIFY: ::uint32_t = 0x0000_0002;
1141+
pub const IN_ATTRIB: ::uint32_t = 0x0000_0004;
1142+
pub const IN_CLOSE_WRITE: ::uint32_t = 0x0000_0008;
1143+
pub const IN_CLOSE_NOWRITE: ::uint32_t = 0x0000_0010;
1144+
pub const IN_CLOSE: ::uint32_t = (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE);
1145+
pub const IN_OPEN: ::uint32_t = 0x0000_0020;
1146+
pub const IN_MOVED_FROM: ::uint32_t = 0x0000_0040;
1147+
pub const IN_MOVED_TO: ::uint32_t = 0x0000_0080;
1148+
pub const IN_MOVE: ::uint32_t = (IN_MOVED_FROM | IN_MOVED_TO);
1149+
pub const IN_CREATE: ::uint32_t = 0x0000_0100;
1150+
pub const IN_DELETE: ::uint32_t = 0x0000_0200;
1151+
pub const IN_DELETE_SELF: ::uint32_t = 0x0000_0400;
1152+
pub const IN_MOVE_SELF: ::uint32_t = 0x0000_0800;
1153+
1154+
pub const IN_UNMOUNT: ::uint32_t = 0x0000_2000;
1155+
pub const IN_Q_OVERFLOW: ::uint32_t = 0x0000_4000;
1156+
pub const IN_IGNORED: ::uint32_t = 0x0000_8000;
1157+
1158+
pub const IN_ONLYDIR: ::uint32_t = 0x0100_0000;
1159+
pub const IN_DONT_FOLLOW: ::uint32_t = 0x0200_0000;
1160+
// pub const IN_EXCL_UNLINK: ::uint32_t = 0x0400_0000;
1161+
1162+
// pub const IN_MASK_CREATE: ::uint32_t = 0x1000_0000;
1163+
// pub const IN_MASK_ADD: ::uint32_t = 0x2000_0000;
1164+
pub const IN_ISDIR: ::uint32_t = 0x4000_0000;
1165+
pub const IN_ONESHOT: ::uint32_t = 0x8000_0000;
1166+
1167+
pub const IN_ALL_EVENTS: ::uint32_t = (
1168+
IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE |
1169+
IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM |
1170+
IN_MOVED_TO | IN_DELETE | IN_CREATE | IN_DELETE_SELF |
1171+
IN_MOVE_SELF
1172+
);
1173+
1174+
pub const IN_CLOEXEC: ::c_int = O_CLOEXEC;
1175+
pub const IN_NONBLOCK: ::c_int = O_NONBLOCK;
1176+
11311177
fn CMSG_ALIGN(len: usize) -> usize {
11321178
len + mem::size_of::<usize>() - 1 & !(mem::size_of::<usize>() - 1)
11331179
}
@@ -1374,6 +1420,12 @@ extern {
13741420
pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int)
13751421
-> ::ssize_t;
13761422
pub fn uname(buf: *mut ::utsname) -> ::c_int;
1423+
pub fn inotify_init() -> ::c_int;
1424+
pub fn inotify_init1(flags: ::c_int) -> ::c_int;
1425+
pub fn inotify_add_watch(fd: ::c_int,
1426+
path: *const ::c_char,
1427+
mask: ::uint32_t) -> ::c_int;
1428+
pub fn inotify_rm_watch(fd: ::c_int, wd: ::c_int) -> ::c_int;
13771429
}
13781430

13791431
cfg_if! {

0 commit comments

Comments
 (0)