diff options
author | Matthew Dempsky <matthew@cvs.openbsd.org> | 2011-07-08 05:01:28 +0000 |
---|---|---|
committer | Matthew Dempsky <matthew@cvs.openbsd.org> | 2011-07-08 05:01:28 +0000 |
commit | a10e17099a766cc70ac71a7dfd517b7546471363 (patch) | |
tree | c91c204499643a21e28ce174fdd18e3ba3e56a79 /sys | |
parent | f75680fb2ff2d017cb54d8e6668d62cfc864bb4f (diff) |
Remove the sys_opipe() kernel entry point. sys_pipe() is the future.
While here, switch compat_linux to just use sys_pipe() rather than
incorrectly wrapping sys_opipe().
ok tedu@, miod@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/compat/linux/linux_misc.c | 48 | ||||
-rw-r--r-- | sys/compat/linux/syscalls.master | 4 | ||||
-rw-r--r-- | sys/kern/sys_pipe.c | 27 | ||||
-rw-r--r-- | sys/kern/syscalls.master | 4 | ||||
-rw-r--r-- | sys/kern/uipc_syscalls.c | 26 |
5 files changed, 24 insertions, 85 deletions
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index 4733511b35c..ec237c17bed 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: linux_misc.c,v 1.69 2011/07/07 01:19:39 tedu Exp $ */ +/* $OpenBSD: linux_misc.c,v 1.70 2011/07/08 05:01:27 matthew Exp $ */ /* $NetBSD: linux_misc.c,v 1.27 1996/05/20 01:59:21 fvdl Exp $ */ /*- @@ -765,52 +765,6 @@ linux_sys_times(p, v, retval) } /* - * OpenBSD passes fd[0] in retval[0], and fd[1] in retval[1]. - * Linux directly passes the pointer. - */ -int -linux_sys_pipe(p, v, retval) - struct proc *p; - void *v; - register_t *retval; -{ - struct linux_sys_pipe_args /* { - syscallarg(int *) pfds; - } */ *uap = v; - int error; - int pfds[2]; -#ifdef __i386__ - int reg_edx = retval[1]; -#endif /* __i386__ */ - - if ((error = sys_opipe(p, 0, retval))) { -#ifdef __i386__ - retval[1] = reg_edx; -#endif /* __i386__ */ - return error; - } - - /* Assumes register_t is an int */ - - pfds[0] = retval[0]; - pfds[1] = retval[1]; - if ((error = copyout(pfds, SCARG(uap, pfds), 2 * sizeof (int)))) { -#ifdef __i386__ - retval[1] = reg_edx; -#endif /* __i386__ */ - fdrelease(p, retval[0]); - fdrelease(p, retval[1]); - return error; - } - - retval[0] = 0; -#ifdef __i386__ - retval[1] = reg_edx; -#endif /* __i386__ */ - return 0; -} - -/* * Alarm. This is a libc call which uses setitimer(2) in OpenBSD. * Fiddle with the timers to make it work. */ diff --git a/sys/compat/linux/syscalls.master b/sys/compat/linux/syscalls.master index 9a83e46d908..2b6cc4d3ddf 100644 --- a/sys/compat/linux/syscalls.master +++ b/sys/compat/linux/syscalls.master @@ -1,4 +1,4 @@ - $OpenBSD: syscalls.master,v 1.57 2011/07/07 06:15:47 pirofti Exp $ + $OpenBSD: syscalls.master,v 1.58 2011/07/08 05:01:27 matthew Exp $ ; $NetBSD: syscalls.master,v 1.15 1995/12/18 14:35:10 fvdl Exp $ ; @(#)syscalls.master 8.1 (Berkeley) 7/19/93 @@ -97,7 +97,7 @@ 39 STD { int linux_sys_mkdir(char *path, int mode); } 40 STD { int linux_sys_rmdir(char *path); } 41 NOARGS { int sys_dup(u_int fd); } -42 STD { int linux_sys_pipe(int *pfds); } +42 NOARGS { int sys_pipe(int *fdp); } 43 STD { int linux_sys_times(struct times *tms); } 44 STD { int linux_sys_prof(void); } 45 STD { int linux_sys_brk(char *nsize); } diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c index c21bcfe3f91..ae9961f457d 100644 --- a/sys/kern/sys_pipe.c +++ b/sys/kern/sys_pipe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sys_pipe.c,v 1.59 2011/05/27 08:53:15 nicm Exp $ */ +/* $OpenBSD: sys_pipe.c,v 1.60 2011/07/08 05:01:27 matthew Exp $ */ /* * Copyright (c) 1996 John S. Dyson @@ -101,12 +101,15 @@ int pipespace(struct pipe *, u_int); /* ARGSUSED */ int -sys_opipe(struct proc *p, void *v, register_t *retval) +sys_pipe(struct proc *p, void *v, register_t *retval) { + struct sys_pipe_args /* { + syscallarg(int *) fdp; + } */ *uap = v; struct filedesc *fdp = p->p_fd; struct file *rf, *wf; struct pipe *rpipe, *wpipe; - int fd, error; + int fds[2], error; fdplock(fdp); @@ -119,23 +122,21 @@ sys_opipe(struct proc *p, void *v, register_t *retval) if (error != 0) goto free2; - error = falloc(p, &rf, &fd); + error = falloc(p, &rf, &fds[0]); if (error != 0) goto free2; rf->f_flag = FREAD | FWRITE; rf->f_type = DTYPE_PIPE; rf->f_data = rpipe; rf->f_ops = &pipeops; - retval[0] = fd; - error = falloc(p, &wf, &fd); + error = falloc(p, &wf, &fds[1]); if (error != 0) goto free3; wf->f_flag = FREAD | FWRITE; wf->f_type = DTYPE_PIPE; wf->f_data = wpipe; wf->f_ops = &pipeops; - retval[1] = fd; rpipe->pipe_peer = wpipe; wpipe->pipe_peer = rpipe; @@ -144,10 +145,18 @@ sys_opipe(struct proc *p, void *v, register_t *retval) FILE_SET_MATURE(wf); fdpunlock(fdp); - return (0); + + error = copyout(fds, SCARG(uap, fdp), sizeof(fds)); + if (error != 0) { + fdplock(fdp); + fdrelease(p, fds[0]); + fdrelease(p, fds[1]); + fdpunlock(fdp); + } + return (error); free3: - fdremove(fdp, retval[0]); + fdremove(fdp, fds[0]); closef(rf, p); rpipe = NULL; free2: diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master index 9c8ace8dab3..36d9e3a1dc4 100644 --- a/sys/kern/syscalls.master +++ b/sys/kern/syscalls.master @@ -1,4 +1,4 @@ -; $OpenBSD: syscalls.master,v 1.111 2011/07/07 23:45:00 matthew Exp $ +; $OpenBSD: syscalls.master,v 1.112 2011/07/08 05:01:27 matthew Exp $ ; $NetBSD: syscalls.master,v 1.32 1996/04/23 10:24:21 mycroft Exp $ ; @(#)syscalls.master 8.2 (Berkeley) 1/13/94 @@ -110,7 +110,7 @@ 39 STD { pid_t sys_getppid(void); } 40 OBSOL lstat43 41 STD { int sys_dup(int fd); } -42 STD { int sys_opipe(void); } +42 OBSOL opipe 43 STD { gid_t sys_getegid(void); } 44 STD { int sys_profil(caddr_t samples, size_t size, \ u_long offset, u_int scale); } diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index 57970027dc8..2189694e6b6 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_syscalls.c,v 1.79 2011/04/04 12:44:10 deraadt Exp $ */ +/* $OpenBSD: uipc_syscalls.c,v 1.80 2011/07/08 05:01:27 matthew Exp $ */ /* $NetBSD: uipc_syscalls.c,v 1.19 1996/02/09 19:00:48 christos Exp $ */ /* @@ -886,30 +886,6 @@ out: return (error); } -int -sys_pipe(struct proc *p, void *v, register_t *retval) -{ - struct sys_pipe_args /* { - syscallarg(int *) fdp; - } */ *uap = v; - int error, fds[2]; - register_t rval[2]; - - if ((error = sys_opipe(p, v, rval)) != 0) - return (error); - - fds[0] = rval[0]; - fds[1] = rval[1]; - error = copyout(fds, SCARG(uap, fdp), 2 * sizeof (int)); - if (error) { - fdplock(p->p_fd); - fdrelease(p, fds[0]); - fdrelease(p, fds[1]); - fdpunlock(p->p_fd); - } - return (error); -} - /* * Get socket name. */ |