*BSD News Article 28436


Return to BSD News archive

Xref: sserve comp.os.386bsd.questions:9298 comp.unix.bsd:13597
Newsgroups: comp.os.386bsd.questions,comp.unix.bsd
Path: sserve!newshost.anu.edu.au!munnari.oz.au!foxhound.dsto.gov.au!fang.dsto.gov.au!yoyo.aarnet.edu.au!news.adelaide.edu.au!news.cs.su.oz.au!harbinger.cc.monash.edu.au!yeshua.marcam.com!MathWorks.Com!europa.eng.gtefsd.com!howland.reston.ans.net!pipex!uknet!festival!edcogsci!richard
From: richard@cogsci.ed.ac.uk (Richard Tobin)
Subject: sockaddr change
Message-ID: <CMrE5K.JxL@cogsci.ed.ac.uk>
Organization: HCRC, University of Edinburgh
Date: Wed, 16 Mar 1994 13:15:18 GMT
Lines: 19

At some point, probably between NetBSD 0.8 and 0.9 (and 4.3 and 4.4?),
the sockaddr_* structures changed to have to fields u_char s*_len and
s*_family instead of u_short s*_family.

Can someone tell me what the purpose of this change is and how user
code should be changed?  Code that passes

    sizeof(a.sun_family)+strlen(a.sun_path)

as the namelen argument to bind will no longer work (and this is what
the NetBSD IPC tutorial tells you to do!).  What should be used instead?
sizeof(a)?  sizeof(a) - sizeof(a.sun_path) + strlen(a.sun_path)?
offsetof(a, sun_path) + strlen(a.sun_path)?

-- Richard
-- 
Richard Tobin, HCRC, Edinburgh University                 R.Tobin@ed.ac.uk

"Your monkey has got it right, sir."  - HHGTTG