From owner-freebsd-current Tue Jul 2 05:17:31 1996 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id FAA03043 for current-outgoing; Tue, 2 Jul 1996 05:17:31 -0700 (PDT) Received: from haywire.DIALix.COM (root@haywire.DIALix.COM [192.203.228.65]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id FAA03036 for ; Tue, 2 Jul 1996 05:17:24 -0700 (PDT) Received: (from news@localhost) by haywire.DIALix.COM (8.7.5/8.7.3) id UAA11974 for freebsd-current@freebsd.org; Tue, 2 Jul 1996 20:17:19 +0800 (WST) Received: from GATEWAY by haywire.DIALix.COM with netnews for freebsd-current@freebsd.org (problems to: usenet@haywire.dialix.com) To: freebsd-current@freebsd.org Date: 2 Jul 1996 12:17:18 GMT From: peter@spinner.DIALix.COM (Peter Wemm) Message-ID: <4rb40e$a4u$2@haywire.DIALix.COM> Organization: DIALix Services, Perth, Australia. References: <96Jun30.222423pdt.177476@crevenia.parc.xerox.com> Subject: Re: socketpair bug? Sender: owner-current@freebsd.org X-Loop: FreeBSD.org Precedence: bulk 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