vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hello, I hope this is an appropriate place for the question, if not please forgive me. getsockname(int s, struct sockaddr *name, socklen_t *namelen); namelen is a input and output parameter. The input case is pretty obvious and I'm going to skip it. For the output case I have seen two different behaviours. Linux and OpenSolaris copy the size of the actual in-kernel structure into namelen regardles of the input value of namelen. The BSDs copy MIN(namelen,sa->sa_len) back into namelen. The two questions I have are: -Who is correct? OpenSolaris/Linux or XNU/OpenBSD/... POSIX.1, BSDi [1] and others [2], [3] indicate (to me as non native speaker) that the length of the address as in the kernel should be set. My conclusion is OpenSolaris and Linux are correct. -Is it worth fixing the BSDs to set sa_len as namelen if you have some input on this question, can point me to a FAQ I have missed I would really appreciate it. kind regards holger [1] BSDI getsockname man page http://www.brno.cas.cz/cgi-bin/bsdi-man? proto=1.1&query=getsockname&msection=2&apropos=0 [2] linux man page http://www.die.net/doc/linux/man/man2/getsockname. 2.html [3] OSX man page http://developer.apple.com/documentation/Darwin/ Reference/ManPages/man2/getsockname.2.html |
| Thread Tools | |
| Display Modes | |
|
|