Date: Sun, 21 Nov 1999 22:37:55 +0100 From: Jeroen Ruigrok/Asmodai <asmodai@wxs.nl> To: Bruce Evans <bde@zeta.org.au> Cc: Assar Westerlund <assar@sics.se>, net@FreeBSD.org, cvs-committers@FreeBSD.org, green@freebsd.org, phk@freebsd.org Subject: Re: Patches for socket.h Message-ID: <19991121223755.A2447@daemon.ninth-circle.org> In-Reply-To: <Pine.BSF.4.10.9911220217080.7782-100000@alphplex.bde.org> References: <19991121141950.F48139@daemon.ninth-circle.org> <Pine.BSF.4.10.9911220217080.7782-100000@alphplex.bde.org>
next in thread | previous in thread | raw e-mail | index | archive | help
-On [19991121 18:09], Bruce Evans (bde@zeta.org.au) wrote: >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? >> >> 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>. Bwerk. Here I showed my noviceness about the intergral meaning. Sorrt for doubting you Assar. Bruce, you mean those u_int whould be a type of unsigned int then? I am not quite understanding what you just said here. >> 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. http://home.wxs.nl/~asmodai/socket.patch or http://lucifer.bart.nl/~asmodai/socket.patch I tested this patch against a CURRENT cvsupped thursday. I made world, made my own kernel and LINT, no problems whatsoever. Comments welcome, -- Jeroen Ruigrok van der Werven/Asmodai asmodai(at)wxs.nl The BSD Programmer's Documentation Project <http://home.wxs.nl/~asmodai> Network/Security Specialist BSD: Technical excellence at its best Learn e-mail netiquette: http://www.lemis.com/email.html Embrace Love, be godlike... 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?19991121223755.A2447>