1f08c3bdfSopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later
2f08c3bdfSopenharmony_ci/*
3f08c3bdfSopenharmony_ci * Copyright (c) 2018 Google, Inc.
4f08c3bdfSopenharmony_ci */
5f08c3bdfSopenharmony_ci
6f08c3bdfSopenharmony_ci#ifndef SENDMMSG_VAR__
7f08c3bdfSopenharmony_ci#define SENDMMSG_VAR__
8f08c3bdfSopenharmony_ci
9f08c3bdfSopenharmony_ci#include "tst_timer.h"
10f08c3bdfSopenharmony_ci#include "lapi/syscalls.h"
11f08c3bdfSopenharmony_ci
12f08c3bdfSopenharmony_cistatic inline int libc_sendmmsg(int sockfd, struct mmsghdr *msgvec,
13f08c3bdfSopenharmony_ci				unsigned int vlen, unsigned int flags)
14f08c3bdfSopenharmony_ci{
15f08c3bdfSopenharmony_ci#ifdef HAVE_SENDMMSG
16f08c3bdfSopenharmony_ci	return sendmmsg(sockfd, msgvec, vlen, flags);
17f08c3bdfSopenharmony_ci#else
18f08c3bdfSopenharmony_ci	tst_brk(TCONF, "libc sendmmsg not present");
19f08c3bdfSopenharmony_ci	return -1;
20f08c3bdfSopenharmony_ci#endif
21f08c3bdfSopenharmony_ci}
22f08c3bdfSopenharmony_ci
23f08c3bdfSopenharmony_cistatic inline int sys_sendmmsg(int sockfd, struct mmsghdr *msgvec,
24f08c3bdfSopenharmony_ci			       unsigned int vlen, unsigned int flags)
25f08c3bdfSopenharmony_ci{
26f08c3bdfSopenharmony_ci	return tst_syscall(__NR_sendmmsg, sockfd, msgvec, vlen, flags);
27f08c3bdfSopenharmony_ci}
28f08c3bdfSopenharmony_ci
29f08c3bdfSopenharmony_cistatic inline int libc_recvmmsg(int sockfd, struct mmsghdr *msgvec,
30f08c3bdfSopenharmony_ci			unsigned int vlen, unsigned int flags, void *timeout)
31f08c3bdfSopenharmony_ci{
32f08c3bdfSopenharmony_ci#ifdef HAVE_RECVMMSG
33f08c3bdfSopenharmony_ci	return recvmmsg(sockfd, msgvec, vlen, flags, timeout);
34f08c3bdfSopenharmony_ci#else
35f08c3bdfSopenharmony_ci	tst_brk(TCONF, "libc recvmmsg not present");
36f08c3bdfSopenharmony_ci	return -1;
37f08c3bdfSopenharmony_ci#endif
38f08c3bdfSopenharmony_ci}
39f08c3bdfSopenharmony_ci
40f08c3bdfSopenharmony_cistatic inline int sys_recvmmsg(int sockfd, struct mmsghdr *msgvec,
41f08c3bdfSopenharmony_ci			unsigned int vlen, unsigned int flags, void *timeout)
42f08c3bdfSopenharmony_ci{
43f08c3bdfSopenharmony_ci	return tst_syscall(__NR_recvmmsg, sockfd, msgvec, vlen, flags, timeout);
44f08c3bdfSopenharmony_ci}
45f08c3bdfSopenharmony_ci
46f08c3bdfSopenharmony_cistatic inline int sys_recvmmsg64(int sockfd, struct mmsghdr *msgvec,
47f08c3bdfSopenharmony_ci			unsigned int vlen, unsigned int flags, void *timeout)
48f08c3bdfSopenharmony_ci{
49f08c3bdfSopenharmony_ci	return tst_syscall(__NR_recvmmsg_time64, sockfd, msgvec, vlen, flags,
50f08c3bdfSopenharmony_ci			   timeout);
51f08c3bdfSopenharmony_ci}
52f08c3bdfSopenharmony_ci
53f08c3bdfSopenharmony_ci#endif /* SENDMMSG_VAR__ */
54