1*49cdfc7eSAndroid Build Coastguard Worker // SPDX-License-Identifier: GPL-2.0-or-later
2*49cdfc7eSAndroid Build Coastguard Worker /*
3*49cdfc7eSAndroid Build Coastguard Worker * Copyright (c) 2019 FUJITSU LIMITED. All rights reserved.
4*49cdfc7eSAndroid Build Coastguard Worker * Author: Jinhui Huang <[email protected]>
5*49cdfc7eSAndroid Build Coastguard Worker */
6*49cdfc7eSAndroid Build Coastguard Worker
7*49cdfc7eSAndroid Build Coastguard Worker #ifndef LAPI_PWRITEV2_H__
8*49cdfc7eSAndroid Build Coastguard Worker #define LAPI_PWRITEV2_H__
9*49cdfc7eSAndroid Build Coastguard Worker
10*49cdfc7eSAndroid Build Coastguard Worker #include "config.h"
11*49cdfc7eSAndroid Build Coastguard Worker #include "lapi/syscalls.h"
12*49cdfc7eSAndroid Build Coastguard Worker
13*49cdfc7eSAndroid Build Coastguard Worker #if !defined(HAVE_PWRITEV2)
14*49cdfc7eSAndroid Build Coastguard Worker
15*49cdfc7eSAndroid Build Coastguard Worker /* LO_HI_LONG taken from glibc */
16*49cdfc7eSAndroid Build Coastguard Worker # define LO_HI_LONG(val) (long) (val), (long) (((uint64_t) (val)) >> 32)
17*49cdfc7eSAndroid Build Coastguard Worker
pwritev2(int fd,const struct iovec * iov,int iovcnt,off_t offset,int flags)18*49cdfc7eSAndroid Build Coastguard Worker static inline ssize_t pwritev2(int fd, const struct iovec *iov, int iovcnt,
19*49cdfc7eSAndroid Build Coastguard Worker off_t offset, int flags)
20*49cdfc7eSAndroid Build Coastguard Worker {
21*49cdfc7eSAndroid Build Coastguard Worker return tst_syscall(__NR_pwritev2, fd, iov, iovcnt,
22*49cdfc7eSAndroid Build Coastguard Worker LO_HI_LONG(offset), flags);
23*49cdfc7eSAndroid Build Coastguard Worker }
24*49cdfc7eSAndroid Build Coastguard Worker #endif
25*49cdfc7eSAndroid Build Coastguard Worker
26*49cdfc7eSAndroid Build Coastguard Worker #endif /* LAPI_PWRITEV2_H__ */
27