I've come across a piece of software that defines __POSIX_C_SOURCE which
causes __BSD_VISIBLE to bet set to 0.

In sys/socket.h if __BSD_VISIBLE is 0 sys/_types.h is included instead
of sys/types.h. This is fine however in three cases we reference
u_int8_t (2) and u_int64_t (1) which requires sys/types.h.

If we change these to __uint8_t and __uint64_t they work with either
types.h or _types.h. Does this make sense? Will there be any side
effects?

-- 
James Turner
Index: sys/sys/socket.h
===================================================================
RCS file: /cvs/src/sys/sys/socket.h,v
retrieving revision 1.82
diff -u -p -r1.82 socket.h
--- sys/sys/socket.h    15 Sep 2012 00:47:08 -0000      1.82
+++ sys/sys/socket.h    2 Apr 2013 02:40:46 -0000
@@ -186,7 +186,7 @@ struct      splice {
  * addresses.
  */
 struct sockaddr {
-       u_int8_t    sa_len;             /* total length */
+       __uint8_t    sa_len;            /* total length */
        sa_family_t sa_family;          /* address family */
        char        sa_data[14];        /* actually longer; address value */
 };
@@ -204,10 +204,10 @@ struct sockaddr {
  * occurrences (including header file) to __ss_len.
  */
 struct sockaddr_storage {
-       u_int8_t        ss_len;         /* total length */
+       __uint8_t       ss_len;         /* total length */
        sa_family_t     ss_family;      /* address family */
        unsigned char   __ss_pad1[6];   /* align to quad */
-       u_int64_t       __ss_pad2;      /* force alignment for stupid compilers 
*/
+       __uint64_t      __ss_pad2;      /* force alignment for stupid compilers 
*/
        unsigned char   __ss_pad3[240]; /* pad to a total of 256 bytes */
 };
 

Reply via email to