[RFC] Fix __sendmmsg prototype guards

Message ID 5489BA91.3010706@linux.vnet.ibm.com
State Committed
Headers

Commit Message

Adhemerval Zanella Netto Dec. 11, 2014, 3:38 p.m. UTC
  Hi,

On make check for powerpc, I now seeing scanf15 and scanf17 test builds failing
with following warning:

In file included from ../inet/netinet/in.h:23:0,
                 from ../include/netinet/in.h:3,
                 from ../resolv/resolv.h:57,
                 from ../include/resolv.h:12,
                 from ../nptl/descr.h:39,
                 from ../sysdeps/powerpc/nptl/tls.h:58,
                 from ../sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h:24,
                 from ../sysdeps/unix/sysv/linux/lowlevellock-futex.h:22,
                 from ../sysdeps/nptl/lowlevellock.h:23,
                 from ../sysdeps/nptl/bits/stdio-lock.h:23,
                 from ../libio/libio.h:149,
                 from ../libio/stdio.h:74,
                 from scanf17.c:11:
../include/sys/socket.h:95:24: error: ‘struct mmsghdr’ declared inside parameter list [-Werror]
                        unsigned int __vlen, int __flags);

And I think it will shown in any architecture that is using the default
nptl/lowlevellock.h instead of the arch-specific ones.

In 'socket/sys/socket.h' file the function declaration is guarded with __USE_GNU,
while for 'include/sys/socket.h' it is not.  Usually this issue will not shown,
mainly because usually arch-specific lowlevellock.h does not include
sysdep.h.  However for powerpc case, which does use it, along with testcase
undefining '_GNU_SOURCE' it results in an error.

This patch fixes by adding the __USE_GNU guards on include/sys/socket.h.

Tested on powerpc64 and powerpc32.

--

	* include/sys/socket.h (__sendmmsg): Add __USE_GNU guards on function
	prototype.

--
  

Comments

Roland McGrath Dec. 11, 2014, 6:15 p.m. UTC | #1
OK
  

Patch

diff --git a/include/sys/socket.h b/include/sys/socket.h
index 9caf1bb..99f6036 100644
--- a/include/sys/socket.h
+++ b/include/sys/socket.h
@@ -91,9 +91,11 @@  extern ssize_t __libc_sendmsg (int __fd, const struct msghdr *__message,
 extern ssize_t __sendmsg (int __fd, const struct msghdr *__message,
 			  int __flags) attribute_hidden;
 
+#ifdef __USE_GNU
 extern int __sendmmsg (int __fd, struct mmsghdr *__vmessages,
                        unsigned int __vlen, int __flags);
 libc_hidden_proto (__sendmmsg)
+#endif
 
 /* Receive a message as described by MESSAGE from socket FD.
    Returns the number of bytes read or -1 for errors.  */