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