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