Skip to content

Commit 5602ef7

Browse files
committed
Hard code parameter offset
Signed-off-by: Jiahao XU <[email protected]>
1 parent 6ad33aa commit 5602ef7

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

src/unix.rs

+6-13
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ impl Client {
396396
mod linux {
397397
use super::*;
398398

399-
use libc::{iovec, off_t, ssize_t, syscall, SYS_preadv2};
399+
use libc::{iovec, ssize_t, syscall, SYS_preadv2};
400400

401401
const RWF_NOWAIT: c_int = 0x00000008;
402402

@@ -408,27 +408,21 @@ mod linux {
408408
}
409409
}
410410

411-
unsafe fn preadv2(
412-
fd: c_int,
413-
iov: *const iovec,
414-
iovcnt: c_int,
415-
offset: off_t,
416-
flags: c_int,
417-
) -> ssize_t {
411+
unsafe fn preadv2(fd: c_int, iov: *const iovec, iovcnt: c_int, flags: c_int) -> ssize_t {
418412
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
419-
let res = syscall(SYS_preadv2, fd, iov, iovcnt, offset, 0, flags);
413+
let res = syscall(SYS_preadv2, fd, iov, iovcnt, -1, 0, flags);
420414

421415
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
422-
let res = syscall(SYS_preadv2, fd, iov, iovcnt, offset, flags);
416+
let res = syscall(SYS_preadv2, fd, iov, iovcnt, -1, flags);
423417

424418
#[cfg(not(target_arch = "x86_64"))]
425419
let res = syscall(
426420
SYS_preadv2,
427421
fd,
428422
iov,
429423
iovcnt,
430-
offset as libc::c_long,
431-
((offset as u64) >> 32) as libc::c_long,
424+
-1 as libc::c_long,
425+
((-1 as u64) >> 32) as libc::c_long,
432426
flags,
433427
);
434428

@@ -450,7 +444,6 @@ mod linux {
450444
iov_len: buf.len(),
451445
},
452446
1,
453-
-1,
454447
RWF_NOWAIT,
455448
)
456449
}) {

0 commit comments

Comments
 (0)