Skip to content

Commit 2eab0f8

Browse files
committed
review: cfg attrs to switch musl fanotify_mark mask type.
Specifying the `mask` argument to `fanotify_mark` as `u64` works for all platform targets except those that use musl. This platform seems to require specifying the mask type as `::c_ulonglong` or a type mismatch occurs in the libc-test runs.
1 parent d4de085 commit 2eab0f8

File tree

1 file changed

+13
-0
lines changed
  • src/unix/linux_like/linux

1 file changed

+13
-0
lines changed

src/unix/linux_like/linux/mod.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3392,13 +3392,26 @@ extern "C" {
33923392
mask: u32,
33933393
) -> ::c_int;
33943394
pub fn fanotify_init(flags: ::c_uint, event_f_flags: ::c_uint) -> ::c_int;
3395+
3396+
#[cfg(not(target_env = "musl"))]
33953397
pub fn fanotify_mark(
33963398
fd: ::c_int,
33973399
flags: ::c_uint,
33983400
mask: u64,
33993401
dirfd: ::c_int,
34003402
path: *const ::c_char,
34013403
) -> ::c_int;
3404+
// Musl targets need the `mask` argument of `fanotify_mark` be specified `::c_ulonglong`
3405+
// instead of `u64` or there will be a type mismatch between `long long unsigned int` and the
3406+
// expected `uint64_t`.
3407+
#[cfg(target_env = "musl")]
3408+
pub fn fanotify_mark(
3409+
fd: ::c_int,
3410+
flags: ::c_uint,
3411+
mask: ::c_ulonglong,
3412+
dirfd: ::c_int,
3413+
path: *const ::c_char,
3414+
) -> ::c_int;
34023415
}
34033416

34043417
cfg_if! {

0 commit comments

Comments
 (0)