net.c: move fallback definition of struct mmsghdr to a separate file.
* msghdr.h: New file. * Makefile.am (strace_SOURCES): Add it. * net.c: Include it. Move fallback definition of struct mmsghdr there. * tests/mmsg.c: Include "msghdr.h". Remove fallback definition of struct mmsghdr.
This commit is contained in:
parent
26f90afc68
commit
4b38ce956c
@ -153,6 +153,7 @@ strace_SOURCES = \
|
||||
mount.c \
|
||||
mpers_type.h \
|
||||
mq.c \
|
||||
msghdr.h \
|
||||
mtd.c \
|
||||
native_defs.h \
|
||||
net.c \
|
||||
|
14
msghdr.h
Normal file
14
msghdr.h
Normal file
@ -0,0 +1,14 @@
|
||||
#ifndef MSGHDR_H_
|
||||
# define MSGHDR_H_
|
||||
|
||||
/* For definitions of struct msghdr and struct mmsghdr. */
|
||||
# include <sys/socket.h>
|
||||
|
||||
# ifndef HAVE_STRUCT_MMSGHDR
|
||||
struct mmsghdr {
|
||||
struct msghdr msg_hdr;
|
||||
unsigned msg_len;
|
||||
};
|
||||
# endif
|
||||
|
||||
#endif /* MSGHDR_H_ */
|
8
net.c
8
net.c
@ -29,6 +29,7 @@
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
#include "msghdr.h"
|
||||
#include <sys/stat.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/uio.h>
|
||||
@ -440,13 +441,6 @@ struct mmsghdr32 {
|
||||
uint32_t /* unsigned */ msg_len;
|
||||
};
|
||||
|
||||
#ifndef HAVE_STRUCT_MMSGHDR
|
||||
struct mmsghdr {
|
||||
struct msghdr msg_hdr;
|
||||
unsigned msg_len;
|
||||
};
|
||||
#endif
|
||||
|
||||
#if SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4
|
||||
static void
|
||||
copy_from_msghdr32(struct msghdr *to_msg, struct msghdr32 *from_msg32)
|
||||
|
@ -36,14 +36,8 @@
|
||||
# include <errno.h>
|
||||
# include <stdio.h>
|
||||
# include <unistd.h>
|
||||
# include <sys/socket.h>
|
||||
|
||||
# ifndef HAVE_STRUCT_MMSGHDR
|
||||
struct mmsghdr {
|
||||
struct msghdr msg_hdr;
|
||||
unsigned msg_len;
|
||||
};
|
||||
# endif
|
||||
# include "msghdr.h"
|
||||
|
||||
static int
|
||||
send_mmsg(int fd, struct mmsghdr *vec, unsigned int vlen, unsigned int flags)
|
||||
|
Loading…
Reference in New Issue
Block a user