File: frrsendmmsg.h

package info (click to toggle)
frr 10.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 76,324 kB
  • sloc: ansic: 686,900; python: 225,905; perl: 6,379; sh: 2,627; cpp: 1,883; makefile: 670; yacc: 397; lex: 363; lisp: 66; xml: 35; javascript: 8
file content (30 lines) | stat: -rw-r--r-- 711 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * FRR sendmmsg wrapper
 * Copyright (C) 2024 by Nvidia, Inc.
 *                       Donald Sharp
 */
#ifndef __FRRSENDMMSG_H__
#define __FRRSENDMMSG_H__

#if !defined(HAVE_STRUCT_MMSGHDR_MSG_HDR) || !defined(HAVE_SENDMMSG)
/* avoid conflicts in case we have partial support */
#define mmsghdr	 frr_mmsghdr
#define sendmmsg frr_sendmmsg

struct mmsghdr {
	struct msghdr msg_hdr;
	unsigned int msg_len;
};

/* just go 1 at a time here, the loop this is used in will handle the rest */
static inline int sendmmsg(int fd, struct mmsghdr *mmh, unsigned int len,
			   int flags)
{
	int rv = sendmsg(fd, &mmh->msg_hdr, 0);

	return rv > 0 ? 1 : rv;
}
#endif

#endif