From owner-freebsd-questions Sat Aug 26 4:31: 4 2000 Delivered-To: freebsd-questions@freebsd.org Received: from fw.wintelcom.net (ns1.wintelcom.net [209.1.153.20]) by hub.freebsd.org (Postfix) with ESMTP id 911E537B43E for ; Sat, 26 Aug 2000 04:31:01 -0700 (PDT) Received: (from bright@localhost) by fw.wintelcom.net (8.10.0/8.10.0) id e7QBV1x28469; Sat, 26 Aug 2000 04:31:01 -0700 (PDT) Date: Sat, 26 Aug 2000 04:31:00 -0700 From: Alfred Perlstein To: Ed Alley Cc: freebsd-questions@FreeBSD.ORG Subject: Re: sockaddr differences Message-ID: <20000826043100.O1209@fw.wintelcom.net> References: <200008260101.SAA02730@jordan.llnl.gov> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.4i In-Reply-To: <200008260101.SAA02730@jordan.llnl.gov>; from alley1@llnl.gov on Fri, Aug 25, 2000 at 06:01:59PM -0700 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG * Ed Alley [000825 18:01] wrote: [FreeBSD has the sun_len feild in sockaddr_un...] > First Question: > Why is FreeBSD different? Because as usual, we do it right. :) > > Second Question: > Does anyone know of a simple way that I can > program around this without putting in a > lot of ifdefs in my programs? sure stick this in your application's header somewhere: #ifdef __BSD__ #define sun_len_hack(sockaddr, len) \ do { sockaddr->sun_len = len; } while(0) else /* !__BSD__ */ #define sun_len_hack(sockaddr, sun_len) #enfif /* __BSD__ */ Then use sun_len_hack(&sockaddr_un, len) in your code, on non-BSD it should be optimized out. -- -Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org] "I have the heart of a child; I keep it in a jar on my desk." To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message