Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Sep 2001 23:28:13 -0700
From:      Arun Sharma <arun@sharmas.dhs.org>
To:        Alexander Langer <alex@big.endian.de>
Cc:        Dan Moschuk <dan@FreeBSD.ORG>, arch@FreeBSD.ORG
Subject:   Re: [arun@sharmas.dhs.org: POSIX compatibility issue]
Message-ID:  <20010906232813.A12058@sharmas.dhs.org>
In-Reply-To: <20010906202151.A4070@zerogravity.kawo2.rwth-aachen.d>; from alex@big.endian.de on Thu, Sep 06, 2001 at 08:21:51PM %2B0200
References:  <20010906120625.C9605@spirit.jaded.net> <20010906202151.A4070@zerogravity.kawo2.rwth-aachen.d>

next in thread | previous in thread | raw e-mail | index | archive | help

--fUYQa+Pmc3FrFX/N
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Thu, Sep 06, 2001 at 08:21:51PM +0200, Alexander Langer wrote:
> Thus spake Dan Moschuk (dan@FreeBSD.ORG):
> 
> > Can anyone see a reason why this shouldn't be commited?
> 
> If POSIX doesn't allow u_* types, sys/socket.h has to be fixed,
> and not sys/types.h.  Anyone with POSIX specs should look up,
> how the datatypes in socket.h should be defined.

As many others suggested, I changed socket.h, instead of types.h.
The diff below makes my program happy.

	-Arun


--fUYQa+Pmc3FrFX/N
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="socket.diff.txt"

--- /usr/include/sys/socket.h-	Thu Sep  6 23:19:43 2001
+++ /usr/include/sys/socket.h	Thu Sep  6 23:20:29 2001
@@ -49,7 +49,7 @@
 /*
  * Data types.
  */
-typedef u_char		sa_family_t;
+typedef unsigned char		sa_family_t;
 #ifdef	_BSD_SOCKLEN_T_
 typedef	_BSD_SOCKLEN_T_	socklen_t;
 #undef	_BSD_SOCKLEN_T_
@@ -161,7 +161,7 @@
  * addresses.
  */
 struct sockaddr {
-	u_char		sa_len;		/* total length */
+	unsigned char		sa_len;		/* total length */
 	sa_family_t	sa_family;	/* address family */
 	char		sa_data[14];	/* actually longer; address value */
 };
@@ -172,8 +172,8 @@
  * information in raw sockets.
  */
 struct sockproto {
-	u_short	sp_family;		/* address family */
-	u_short	sp_protocol;		/* protocol */
+	unsigned short	sp_family;		/* address family */
+	unsigned short	sp_protocol;		/* protocol */
 };
 
 /*
@@ -181,12 +181,12 @@
  */
 #define	_SS_MAXSIZE	128
 #define	_SS_ALIGNSIZE	(sizeof(int64_t))
-#define	_SS_PAD1SIZE	(_SS_ALIGNSIZE - sizeof(u_char) - sizeof(sa_family_t))
-#define	_SS_PAD2SIZE	(_SS_MAXSIZE - sizeof(u_char) - sizeof(sa_family_t) - \
+#define	_SS_PAD1SIZE	(_SS_ALIGNSIZE - sizeof(unsigned char) - sizeof(sa_family_t))
+#define	_SS_PAD2SIZE	(_SS_MAXSIZE - sizeof(unsigned char) - sizeof(sa_family_t) - \
 				_SS_PAD1SIZE - _SS_ALIGNSIZE)
 
 struct sockaddr_storage {
-	u_char		ss_len;		/* address length */
+	unsigned char		ss_len;		/* address length */
 	sa_family_t	ss_family;	/* address family */
 	char		__ss_pad1[_SS_PAD1SIZE];
 	int64_t		__ss_align;	/* force desired structure storage alignment */
@@ -345,7 +345,7 @@
 	socklen_t	cmsg_len;		/* data byte count, including hdr */
 	int		cmsg_level;		/* originating protocol */
 	int		cmsg_type;		/* protocol-specific type */
-/* followed by	u_char  cmsg_data[]; */
+/* followed by	unsigned char  cmsg_data[]; */
 };
 
 /*
@@ -372,7 +372,7 @@
 };
 
 /* given pointer to struct cmsghdr, return pointer to data */
-#define	CMSG_DATA(cmsg)		((u_char *)(cmsg) + \
+#define	CMSG_DATA(cmsg)		((unsigned char *)(cmsg) + \
 				 _ALIGN(sizeof(struct cmsghdr)))
 
 /* given pointer to struct cmsghdr, return pointer to next cmsghdr */
@@ -403,7 +403,7 @@
  * 4.3 compat sockaddr, move to compat file later
  */
 struct osockaddr {
-	u_short	sa_family;		/* address family */
+	unsigned short	sa_family;		/* address family */
 	char	sa_data[14];		/* up to 14 bytes of direct address */
 };
 

--fUYQa+Pmc3FrFX/N--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010906232813.A12058>