On Fri, 22 Oct 2010, Ted Unangst wrote:
> On Thu, 21 Oct 2010, hyjial wrote:
>
> > There is a u_int on line 50 of sys/tcp.h. u_int is defined only if
> > __BSD_VISIBLE is which it is not is _POSIX_SOURCE is defined.
> >
> > Is this intended ?
>
> No. Easy fix.
(This is PR 6192)
Instead, how about making <netinet/tcp.h> comply with SUS/POSIX, which
says that in a conforming environment this header file shall define
TCP_NODELAY and may declare additional TCP_* macros, but shall not
otherwise intrude on the applicatiojn visible namespace. Wrapping the top
of the file in #if __BSD_VISIBLE is the simplest way to meet that
requirement and solve both the PR and the request in this thread without
breaking software that doesn't insist on slamming its face into the POSIX
wall.
Philip Guenther
Index: tcp.h
===================================================================
RCS file: /cvs/src/sys/netinet/tcp.h,v
retrieving revision 1.17
diff -u -p -r1.17 tcp.h
--- tcp.h 27 Apr 2006 02:19:32 -0000 1.17
+++ tcp.h 23 Oct 2010 04:04:17 -0000
@@ -35,6 +35,8 @@
#ifndef _NETINET_TCP_H_
#define _NETINET_TCP_H_
+#if __BSD_VISIBLE
+
typedef u_int32_t tcp_seq;
/*
@@ -113,6 +115,8 @@ struct tcphdr {
#define TCP_MAXWIN 65535 /* largest value for (unscaled) window
*/
#define TCP_MAX_WINSHIFT 14 /* maximum window shift */
+
+#endif /* __BSD_VISIBLE */
/*
* User-settable options (used with setsockopt).