On 24.12.2017 22:25, Kamil Rytarowski wrote: > I propose to deprecate SYS_pipe. > > It is a special syscall that returns two integers from one function > call. Fanciness is not compatible with regular C syntax and it demands > per-cpu assembly wrappers and rump-kernel workarounds. It's not easily > usable with syscall(2). > > OpenBSD and FreeBSD already deprecated this traditional pipe(2) syscall > replacing it with a more portable equivalent in C. > > Changes: > - I've marked pipe(2) as compat_80. > - I've removed generation of garbage in retval[2] from pipe2(2). > - I've reimplemented in C the pipe(2) syscall with pipe2(2). > - I've adjusted the surrounding code for the changes. > > http://netbsd.org/~kamil/patch-00039-obsolete-SYS_pipe.txt > I've extracted two patches from the above proposal. In these patches SYS_pipe is not marked COMPAT_80 and not removed from rump. I've left it as it is. 1. Implement pipe() with pipe2(2) in libc: New source code is now Machine Independent. http://netbsd.org/~kamil/patch-00040-implement-pipe-with-pipe2-in-libc.txt The generated code in libc for x86_64 is also simpler and shorter: 000000000008b2a2 <_pipe>: 8b2a2: 31 f6 xor %esi,%esi 8b2a4: e9 b7 f5 fa ff jmpq 3a860 <pipe2@plt> 2. Refactor pipe1() kernel-internal function to operate over int[2] rather than register_t[2]. Stop returning garbage through retval[2] from pipe2(2). This simplifies the existing code, that looks like developed when sizeof(register_t) was equal to sizeof(int). Before the changes: $ ktruss -i ./a.out [...] 15131 1 a.out pipe2(0x7f7fff2e62b8, 0) = 0, 4 [...] After the changes: $ ktruss -i ./a.out [...[ 782 1 a.out pipe2(0x7f7fff97e850, 0) = 0 [...]
Attachment:
signature.asc
Description: OpenPGP digital signature