Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Nov 1999 02:24:32 +1100 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Jeroen Ruigrok/Asmodai <asmodai@wxs.nl>
Cc:        Assar Westerlund <assar@sics.se>, net@FreeBSD.org, cvs-committers@FreeBSD.org
Subject:   Re: Patches for socket.h
Message-ID:  <Pine.BSF.4.10.9911220217080.7782-100000@alphplex.bde.org>
In-Reply-To: <19991121141950.F48139@daemon.ninth-circle.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 21 Nov 1999, Jeroen Ruigrok/Asmodai wrote:

> -On [19991121 04:00], Assar Westerlund (assar@sics.se) wrote:
> >Jeroen Ruigrok/Asmodai <asmodai@wxs.nl> writes:
> >
> >> One caveat for now is the sa_family_t type, which would be the type for
> >> sa_family in the sockaddr struct.
> >
> >typedef u_char sa_family_t or is it more complicated than that?
> 
> Sorry for not correctly answering it last night.
> 
> No, that's not it.
> 
> According to SUSv2:
> 
> The <sys/socket.h> header defines the unsigned integral type
> sa_family_t.
>
> So there will be a typedef unsigned int sa_family_t; and not of u_char.

integral != int.  u_char is unsigned integral.

`unsigned int' is consintently (mis)spelled `u_int' in <sys/socket.h>.

> Wrt socklen_t, the spec wants it to be at least 32 bits in size, so I
> could choose it to be u_int32_t or unsigned int, I am still somewhat in
> doubt what to prefer.  For now I settled on POSIX compliant types.

It has to be u_int32_t or u_long to meet the spec.  u_int is only guaranteed
to be 16 bits by POSIX and/or ISO C.

The spec requires changing int to an unsigned integral type in many places.
This may cause sign extension bugs.

Bruce



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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.10.9911220217080.7782-100000>