1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
4 * Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
5 */
6
7 #ifndef LAPI_PREADV2_H__
8 #define LAPI_PREADV2_H__
9
10 #include "config.h"
11 #include "lapi/syscalls.h"
12
13 #ifndef RWF_NOWAIT
14 # define RWF_NOWAIT 0x00000008
15 #endif
16
17 #if !defined(HAVE_PREADV2)
18
19 /* LO_HI_LONG taken from glibc */
20 # define LO_HI_LONG(val) (long) (val), (long) (((uint64_t) (val)) >> 32)
21
preadv2(int fd,const struct iovec * iov,int iovcnt,off_t offset,int flags)22 static inline ssize_t preadv2(int fd, const struct iovec *iov, int iovcnt,
23 off_t offset, int flags)
24 {
25 return tst_syscall(__NR_preadv2, fd, iov, iovcnt,
26 LO_HI_LONG(offset), flags);
27 }
28 #endif
29
30 #endif /* LAPI_PREADV2_H__ */
31