From owner-freebsd-hackers Sat Oct 13 10:58:19 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from wall.polstra.com (wall-gw.polstra.com [206.213.73.130]) by hub.freebsd.org (Postfix) with ESMTP id 044E637B40B for ; Sat, 13 Oct 2001 10:58:14 -0700 (PDT) Received: from vashon.polstra.com (vashon.polstra.com [206.213.73.13]) by wall.polstra.com (8.11.3/8.11.3) with ESMTP id f9DHwB826092; Sat, 13 Oct 2001 10:58:12 -0700 (PDT) (envelope-from jdp@wall.polstra.com) Received: (from jdp@localhost) by vashon.polstra.com (8.11.6/8.11.0) id f9DHwB009026; Sat, 13 Oct 2001 10:58:11 -0700 (PDT) (envelope-from jdp) Date: Sat, 13 Oct 2001 10:58:11 -0700 (PDT) Message-Id: <200110131758.f9DHwB009026@vashon.polstra.com> To: hackers@freebsd.org From: John Polstra Cc: dillon@earth.backplane.com Subject: Re: sin_zero & bind problems In-Reply-To: <200110131717.f9DHHLR43887@earth.backplane.com> References: <20011013135842.A415@iv.nn.kiev.ua> <200110131717.f9DHHLR43887@earth.backplane.com> Organization: Polstra & Co., Seattle, WA Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG In article <200110131717.f9DHHLR43887@earth.backplane.com>, Matt Dillon wrote: > Nobody in their right mind uses a struct sockaddr_in or any other > struct sock* type of structure without zeroing it first. That's definitely true in reality, but I'm not sure it's a desirable situation. It runs counter to what POSIX generally requires. For example, if you use sigaction() you only have to set the struct sigaction members that are documented in the spec, even though the structure may have additional members on some platforms. In POSIX the rule is generally that you don't have to set any extra members unless an additional non-standard flag is set (e.g., in sa_flags) indicating that the member is valid. On the other hand (now arguing against myself), I guess by setting sin_len = sizeof(struct sockaddr_in) one is saying that the entire structure is valid, including sin_zero. *Grumble* I wish they had never put the sin_zero member in there in the first place. John -- John Polstra John D. Polstra & Co., Inc. Seattle, Washington USA "Disappointment is a good sign of basic intelligence." -- Chögyam Trungpa To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message