From owner-freebsd-net Sun Nov 21 13:38:18 1999 Delivered-To: freebsd-net@freebsd.org Received: from smtp05.wxs.nl (smtp05.wxs.nl [195.121.6.57]) by hub.freebsd.org (Postfix) with ESMTP id 5800F14E97; Sun, 21 Nov 1999 13:38:10 -0800 (PST) (envelope-from asmodai@wxs.nl) Received: from daemon.ninth-circle.org ([195.121.197.25]) by smtp05.wxs.nl (Netscape Messaging Server 3.61) with ESMTP id AAA6263; Sun, 21 Nov 1999 22:38:08 +0100 Received: (from asmodai@localhost) by daemon.ninth-circle.org (8.9.3/8.9.3) id WAA02649; Sun, 21 Nov 1999 22:37:56 +0100 (CET) (envelope-from asmodai) Date: Sun, 21 Nov 1999 22:37:55 +0100 From: Jeroen Ruigrok/Asmodai To: Bruce Evans Cc: Assar Westerlund , 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> References: <19991121141950.F48139@daemon.ninth-circle.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0pre3i In-Reply-To: Organisation: Ninth-Circle Enterprises Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org -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 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 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 . 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 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