mirror of
https://github.com/FRRouting/frr.git
synced 2025-04-30 13:37:17 +02:00
lib: Breakout sendmmsg into it's own header
The only 2 places sendmmsg is used is in zlog_5424.c and zlog_live.c. Why is the rest of the entire system paying for this compilation? Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
parent
4e249eb2e4
commit
10387101fe
30
lib/frrsendmmsg.h
Normal file
30
lib/frrsendmmsg.h
Normal file
|
@ -0,0 +1,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
|
|
@ -227,6 +227,7 @@ pkginclude_HEADERS += \
|
|||
lib/frr_pthread.h \
|
||||
lib/frratomic.h \
|
||||
lib/frrcu.h \
|
||||
lib/frrsendmmsg.h \
|
||||
lib/frrstr.h \
|
||||
lib/graph.h \
|
||||
lib/hash.h \
|
||||
|
|
20
lib/zebra.h
20
lib/zebra.h
|
@ -203,26 +203,6 @@ size_t strlcpy(char *__restrict dest,
|
|||
void explicit_bzero(void *buf, size_t len);
|
||||
#endif
|
||||
|
||||
#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
|
||||
|
||||
/*
|
||||
* RFC 3542 defines several macros for using struct cmsghdr.
|
||||
* Here, we define those that are not present
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
|
||||
#include "zebra.h"
|
||||
|
||||
#include "frrsendmmsg.h"
|
||||
|
||||
#include "zlog_5424.h"
|
||||
|
||||
#include <sys/un.h>
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
#include "zebra.h"
|
||||
|
||||
#include "frrsendmmsg.h"
|
||||
|
||||
#include "zlog_live.h"
|
||||
|
||||
#include "memory.h"
|
||||
|
|
Loading…
Reference in a new issue