|
Re: [GHC] #647: Socket bug on Mac OS X, with patch: msg#00122lang.haskell.glasgow.bugs
#647: Socket bug on Mac OS X, with patch ----------------------------------+----------------------------------------- Reporter: gwright@xxxxxxxxxxx | Owner: Type: bug | Status: new Priority: normal | Milestone: 6.4.2 Component: libraries/network | Version: 6.4.1 Severity: normal | Resolution: Keywords: "OS X" Sockets | Os: MacOS X Difficulty: Easy (1 hr) | Architecture: powerpc ----------------------------------+----------------------------------------- Comment (by gwright@xxxxxxxxxxx): As far as I know, this bug is really only for darwin and the older BSDs. Traditional BSDs required the sockaddr_in structure to be completely zeroed before use even if all of the fields were properly initialized. This is necessary because the structure is padded out to 16 bytes, and functions like bind check the pad space to make sure it is all zero. This is a sanity check from the earliest days of BSD, when there were other 16 byte sockaddr_* structures, like sockaddr_ns for XNS networks. The sockaddr_ns structure had a different field layout. Checking the pad space was a way to ensure that a socket address for the internet family (AF_INET) was not filled in with an XNS address. Yes, this is all the result of some Berkeley graduate student being over- cautious a quarter of a century ago. Linux and recent FreeBSDs do not require zeroing the sockaddr_* structure before use. (I've tested on FreeBSD 6.0, and zeroing first is not needed. I think Solaris does not require it either.) It is a bit annoying that OS X could not fix this. If you look at the first edition of Stevens' _UNIX Network Programming_, you see that every time before a sockaddr_* struct is used, it is bzero'ed first. Although as Wolfgang notes, it was never well documented. Probably more than you wanted to know about sockets, no? -Greg -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/647> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler_______________________________________________ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@xxxxxxxxxxx http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: [GHC] #647: Socket bug on Mac OS X, with patch, GHC |
|---|---|
| Next by Date: | Re: ghci module list, Simon Marlow |
| Previous by Thread: | Re: [GHC] #647: Socket bug on Mac OS X, with patch, GHC |
| Next by Thread: | Re: [GHC] #647: Socket bug on Mac OS X, with patch, GHC |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |