Re: sockaddr binary compatibility between kernel and user?
Re: sockaddr binary compatibility between kernel and user?
- Subject: Re: sockaddr binary compatibility between kernel and user?
- From: "Justin C. Walker" <email@hidden>
- Date: Sun, 14 Jan 2007 09:44:33 -0800
On Jan 14, 2007, at 24:16 , email@hidden wrote:
Are there any binary compatibility guarantees with the data structures
used with the socket KPIs and user space? The data structures I'm
specifically concerned about are sockaddr_in and sockaddr_in6. For
example, is it safe to send a sockaddr_in6 from user space to the
kernel? The case I'm worried about is if I have a 64-bit app running
on a 32-bit kernel or vice versa since 32-bit and 64-bit builds
sometimes layout structures differently.
These structures are used primarily to communicate between a user
process and the kernel, so I'd think that any failure is a bug.
Generally, it works.
As far as 32- vs. 64-bit issues, these are generally handled at the
system call interface. The kernel knows what mode each process is
using, and has set up its handling of the process's system calls with
that in mind.
One thing to be wary of is that the kernel expects some "unused"
fields to be zero, so it pays to zero the structure before filling it
in and handing it to the kernel.
Justin
--
Justin C. Walker, Curmudgeon-at-Large
() The ASCII Ribbon Campaign
/\ Help Cure HTML Email
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden