Date: 2 Jul 1996 12:17:18 GMT From: peter@spinner.DIALix.COM (Peter Wemm) To: freebsd-current@freebsd.org Subject: Re: socketpair bug? Message-ID: <4rb40e$a4u$2@haywire.DIALix.COM> References: <96Jun30.222423pdt.177476@crevenia.parc.xerox.com>
next in thread | previous in thread | raw e-mail | index | archive | help
In article <199607012153.OAA06625@phaeton.artisoft.com>, terry@lambert.org (Terry Lambert) writes: >> In message <199606271813.UAA02652@uriah.heep.sax.de> you write: >> >See also my Usenet reply: socketpair() basically needs a similar libc >> >syscall wrapper like pipe(). Right now, it uses the generic syscall >> >wrapper which is wrong. (The XXX??'s can be removed again then. :) >> >> I think the answer is the other way around -- socketpair() works as it >> is and just needs the two XXX'd lines removed, no need for it to have a >> wrapper like pipe(). >> >> We went through this a while ago and I don't remember the outcome >> (except, of course, that I didn't commit anything, but that's probably >> just because I'm lazy) > > How do you put a wrapper in a foreign libc? > > Like a statically compiled SCO or BSDI or Linux binary? > > Or even a shared library using binary, without building the shared > library (how do you do that for SCO?)? Simple. We *already* provide wrappers for almost all the syscalls for foreign executable environments. The BSDI case isn't so simple, but since their libc is based on the same original code as ours, I'd be extremely suprised if they have changed it to take the primary and secondary return values and write over the top of the pointer that is passed. Remember, we have in userland: pipe(int pfd[2]); socketpair(int d, int type, int protocol, int fd[2]); while in the kernel it is: 42 STD POSIX { int pipe(void); } 135 STD BSD { int socketpair(int domain, int type, int protocol, int *rsv); } Spot the difference. One interface (pipe) uses primary and secondary return values, the other (socketpair) one uses copyout. Socketpair should not *also* set the primary and secondary return values as that just confuses things as their is no code in the libc to understand it, and the wrong values are returned to the user. I agree with Bill, removing the XXX'ed lines is probably the best way out. There are no native binaries that run on the i386 *BSD's that still use socketpair() as if it were pipe(). The non-BSD ABI's already go through syscall translation, so they are irrelevant. > > Terry Lambert > terry@lambert.org -Peter
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4rb40e$a4u$2>