Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Aug 2000 04:31:00 -0700
From:      Alfred Perlstein <bright@wintelcom.net>
To:        Ed Alley <alley1@llnl.gov>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: sockaddr differences
Message-ID:  <20000826043100.O1209@fw.wintelcom.net>
In-Reply-To: <200008260101.SAA02730@jordan.llnl.gov>; from alley1@llnl.gov on Fri, Aug 25, 2000 at 06:01:59PM -0700
References:  <200008260101.SAA02730@jordan.llnl.gov>

next in thread | previous in thread | raw e-mail | index | archive | help
* Ed Alley <alley1@llnl.gov> [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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000826043100.O1209>