summaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
authorThomas Schwinge <thomas@codesourcery.com>2012-11-03 18:29:46 +0100
committerThomas Schwinge <thomas@codesourcery.com>2012-11-20 19:26:04 +0100
commit123be9deda8eb24ef15fb889248984e6d23bb8b4 (patch)
tree8d875402831e2eb1923b9d3ef8d88bcee14ad2c6 /sysdeps
parentcf9a5d186154b1ad4a8459fafa135dcd822e5f3b (diff)
Add recvmmsg and sendmmsg to the generic glibc API.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/unix/sysv/linux/Makefile3
-rw-r--r--sysdeps/unix/sysv/linux/bits/socket.h33
-rw-r--r--sysdeps/unix/sysv/linux/internal_sendmmsg.S9
-rw-r--r--sysdeps/unix/sysv/linux/recvmmsg.c11
-rw-r--r--sysdeps/unix/sysv/linux/sendmmsg.c18
5 files changed, 16 insertions, 58 deletions
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index 8e5361c49b..ecd9c2c973 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -12,8 +12,7 @@ CFLAGS-malloc.c += -DMORECORE_CLEARS=2
endif
ifeq ($(subdir),socket)
-sysdep_routines += internal_accept4 recvmmsg internal_recvmmsg sendmmsg \
- internal_sendmmsg
+sysdep_routines += internal_accept4 internal_recvmmsg internal_sendmmsg
endif
ifeq ($(subdir),misc)
diff --git a/sysdeps/unix/sysv/linux/bits/socket.h b/sysdeps/unix/sysv/linux/bits/socket.h
index 309cba7282..df8f1670b0 100644
--- a/sysdeps/unix/sysv/linux/bits/socket.h
+++ b/sysdeps/unix/sysv/linux/bits/socket.h
@@ -235,16 +235,6 @@ struct msghdr
int msg_flags; /* Flags on received message. */
};
-#ifdef __USE_GNU
-/* For `recvmmsg' and 'sendmmsg'. */
-struct mmsghdr
- {
- struct msghdr msg_hdr; /* Actual message header. */
- unsigned int msg_len; /* Number of received or sent bytes
- for the entry. */
- };
-#endif
-
/* Structure used for storage of ancillary data object information. */
struct cmsghdr
{
@@ -389,27 +379,4 @@ struct linger
int l_linger; /* Time to linger. */
};
-
-__BEGIN_DECLS
-
-#ifdef __USE_GNU
-/* Receive up to VLEN messages as described by VMESSAGES from socket FD.
- Returns the number of bytes read or -1 for errors.
-
- This function is a cancellation point and therefore not marked with
- __THROW. */
-extern int recvmmsg (int __fd, struct mmsghdr *__vmessages,
- unsigned int __vlen, int __flags,
- const struct timespec *__tmo);
-
-/* Send a VLEN messages as described by VMESSAGES to socket FD.
- Return the number of datagrams successfully written or -1 for errors.
-This function is a cancellation point and therefore not marked with
- __THROW. */
-extern int sendmmsg (int __fd, struct mmsghdr *__vmessages,
- unsigned int __vlen, int __flags);
-#endif
-
-__END_DECLS
-
#endif /* bits/socket.h */
diff --git a/sysdeps/unix/sysv/linux/internal_sendmmsg.S b/sysdeps/unix/sysv/linux/internal_sendmmsg.S
index f5152c9f1f..e6681f099d 100644
--- a/sysdeps/unix/sysv/linux/internal_sendmmsg.S
+++ b/sysdeps/unix/sysv/linux/internal_sendmmsg.S
@@ -2,13 +2,14 @@
#include <sys/syscall.h>
#if !defined __NR_sendmmsg && defined __NR_socketcall
# define socket sendmmsg
-# ifdef __ASSUME_SENDMMSG
-# define __socket sendmmsg
-# else
+# ifndef __ASSUME_SENDMMSG
# define __socket __internal_sendmmsg
+# define NO_WEAK_ALIAS
# endif
# define NARGS 4
# define NEED_CANCELLATION
-# define NO_WEAK_ALIAS
# include <socket.S>
+# ifdef __ASSUME_SENDMMSG
+libc_hidden_def (__sendmmsg)
+# endif
#endif
diff --git a/sysdeps/unix/sysv/linux/recvmmsg.c b/sysdeps/unix/sysv/linux/recvmmsg.c
index 32fc8dfc6c..009d868a62 100644
--- a/sysdeps/unix/sysv/linux/recvmmsg.c
+++ b/sysdeps/unix/sysv/linux/recvmmsg.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010 Free Software Foundation, Inc.
+/* Copyright (C) 2010-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Schwab <schwab@redhat.com>, 2010.
@@ -88,12 +88,5 @@ recvmmsg (int fd, struct mmsghdr *vmessages, unsigned int vlen, int flags,
/* When __ASSUME_RECVMMSG recvmmsg is defined in internal_recvmmsg.S. */
# endif
#else
-int
-recvmmsg (int fd, struct mmsghdr *vmessages, unsigned int vlen, int flags,
- const struct timespec *tmo)
-{
- __set_errno (ENOSYS);
- return -1;
-}
-stub_warning (recvmmsg)
+# include <socket/recvmmsg.c>
#endif
diff --git a/sysdeps/unix/sysv/linux/sendmmsg.c b/sysdeps/unix/sysv/linux/sendmmsg.c
index 0674419206..a6daff1728 100644
--- a/sysdeps/unix/sysv/linux/sendmmsg.c
+++ b/sysdeps/unix/sysv/linux/sendmmsg.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011 Free Software Foundation, Inc.
+/* Copyright (C) 2011-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
@@ -26,7 +26,7 @@
#ifdef __NR_sendmmsg
int
-sendmmsg (int fd, struct mmsghdr *vmessages, unsigned int vlen, int flags)
+__sendmmsg (int fd, struct mmsghdr *vmessages, unsigned int vlen, int flags)
{
if (SINGLE_THREAD_P)
return INLINE_SYSCALL (sendmmsg, 4, fd, vmessages, vlen, flags);
@@ -39,6 +39,8 @@ sendmmsg (int fd, struct mmsghdr *vmessages, unsigned int vlen, int flags)
return result;
}
+libc_hidden_def (__sendmmsg)
+weak_alias (__sendmmsg, sendmmsg)
#elif defined __NR_socketcall
# ifndef __ASSUME_SENDMMSG
extern int __internal_sendmmsg (int fd, struct mmsghdr *vmessages,
@@ -48,7 +50,7 @@ extern int __internal_sendmmsg (int fd, struct mmsghdr *vmessages,
static int have_sendmmsg;
int
-sendmmsg (int fd, struct mmsghdr *vmessages, unsigned int vlen, int flags)
+__sendmmsg (int fd, struct mmsghdr *vmessages, unsigned int vlen, int flags)
{
if (__builtin_expect (have_sendmmsg >= 0, 1))
{
@@ -81,15 +83,11 @@ sendmmsg (int fd, struct mmsghdr *vmessages, unsigned int vlen, int flags)
__set_errno (ENOSYS);
return -1;
}
+libc_hidden_def (__sendmmsg)
+weak_alias (__sendmmsg, sendmmsg)
# else
/* When __ASSUME_SENDMMSG sendmmsg is defined in internal_sendmmsg.S. */
# endif
#else
-int
-sendmmsg (int fd, struct mmsghdr *vmessages, unsigned int vlen, int flags)
-{
- __set_errno (ENOSYS);
- return -1;
-}
-stub_warning (sendmmsg)
+# include <socket/sendmmsg.c>
#endif