xref: /third_party/ltp/include/lapi/pwritev2.h (revision f08c3bdf)
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 LAPI_PWRITEV2_H__
8#define LAPI_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
18static inline ssize_t pwritev2(int fd, const struct iovec *iov, int iovcnt,
19                               off_t offset, int flags)
20{
21	return tst_syscall(__NR_pwritev2, fd, iov, iovcnt,
22			   LO_HI_LONG(offset), flags);
23}
24#endif
25
26#endif /* LAPI_PWRITEV2_H__ */
27