summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1999-06-07 07:17:57 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1999-06-07 07:17:57 +0000
commit4e96377228ca04c54bdc4aec8116d85f74e15834 (patch)
tree2bc8d849fde3727add9392d8f2a95f71c02fed16 /sys
parenta7879e1dacba108b617cc911081400e53cca0155 (diff)
replacement pipe() system call; copies data into place inside kernel, so
that EFAULT return value is possible
Diffstat (limited to 'sys')
-rw-r--r--sys/compat/bsdos/syscalls.master4
-rw-r--r--sys/compat/freebsd/syscalls.master4
-rw-r--r--sys/compat/hpux/syscalls.master4
-rw-r--r--sys/compat/ibcs2/syscalls.master4
-rw-r--r--sys/compat/osf1/syscalls.master4
-rw-r--r--sys/compat/sunos/syscalls.master4
-rw-r--r--sys/compat/svr4/syscalls.master4
-rw-r--r--sys/compat/ultrix/syscalls.master4
-rw-r--r--sys/kern/sys_pipe.c4
-rw-r--r--sys/kern/syscalls.master5
-rw-r--r--sys/kern/uipc_syscalls.c30
11 files changed, 49 insertions, 22 deletions
diff --git a/sys/compat/bsdos/syscalls.master b/sys/compat/bsdos/syscalls.master
index fe90384f933..af947a3ddce 100644
--- a/sys/compat/bsdos/syscalls.master
+++ b/sys/compat/bsdos/syscalls.master
@@ -1,4 +1,4 @@
- $OpenBSD: syscalls.master,v 1.4 1999/05/31 17:34:44 millert Exp $
+ $OpenBSD: syscalls.master,v 1.5 1999/06/07 07:17:46 deraadt Exp $
; OpenBSD COMPAT_BSDOS system call name/number "master" file.
; (See syscalls.conf to see what it is processed into.)
@@ -97,7 +97,7 @@
40 NOARGS { int compat_43_sys_lstat(char *path, \
struct ostat *ub); } olstat
41 NOARGS { int sys_dup(u_int fd); }
-42 NOARGS { int sys_pipe(void); }
+42 NOARGS { int sys_opipe(void); }
43 NOARGS { gid_t sys_getegid(void); }
44 NOARGS { int sys_profil(caddr_t samples, u_int size, \
u_int offset, u_int scale); }
diff --git a/sys/compat/freebsd/syscalls.master b/sys/compat/freebsd/syscalls.master
index d6f0df89b23..5c25a57e31c 100644
--- a/sys/compat/freebsd/syscalls.master
+++ b/sys/compat/freebsd/syscalls.master
@@ -1,4 +1,4 @@
- $OpenBSD: syscalls.master,v 1.10 1999/05/31 17:34:45 millert Exp $
+ $OpenBSD: syscalls.master,v 1.11 1999/06/07 07:17:46 deraadt Exp $
; $NetBSD: syscalls.master,v 1.3 1995/10/10 18:28:40 mycroft Exp $
; from: @(#)syscalls.master 8.2 (Berkeley) 1/13/94
@@ -104,7 +104,7 @@
40 STD { int compat_43_freebsd_sys_lstat(char *path, \
struct ostat *ub); } olstat
41 NOARGS { int sys_dup(u_int fd); }
-42 NOARGS { int sys_pipe(void); }
+42 NOARGS { int sys_opipe(void); }
43 NOARGS { gid_t sys_getegid(void); }
44 NOARGS { int sys_profil(caddr_t samples, u_int size, \
u_int offset, u_int scale); }
diff --git a/sys/compat/hpux/syscalls.master b/sys/compat/hpux/syscalls.master
index 34d934169f9..ab31f1556fc 100644
--- a/sys/compat/hpux/syscalls.master
+++ b/sys/compat/hpux/syscalls.master
@@ -1,4 +1,4 @@
- $OpenBSD: syscalls.master,v 1.5 1997/03/26 08:11:09 downsj Exp $
+ $OpenBSD: syscalls.master,v 1.6 1999/06/07 07:17:46 deraadt Exp $
; $NetBSD: syscalls.master,v 1.13 1997/03/16 03:48:04 thorpej Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@@ -90,7 +90,7 @@
39 STD { int hpux_sys_setpgrp_6x(void); }
40 STD { int hpux_sys_lstat(char *path, struct hpux_stat *sb); }
41 STD { int hpux_sys_dup(int fd); }
-42 NOARGS { int sys_pipe(void); }
+42 NOARGS { int sys_opipe(void); }
43 STD { int hpux_sys_times_6x(struct tms *tms); }
44 NOARGS { int sys_profil(caddr_t samples, u_int size, \
u_int offset, u_int scale); }
diff --git a/sys/compat/ibcs2/syscalls.master b/sys/compat/ibcs2/syscalls.master
index a56e1b66b86..70ca3f47c9f 100644
--- a/sys/compat/ibcs2/syscalls.master
+++ b/sys/compat/ibcs2/syscalls.master
@@ -1,4 +1,4 @@
- $OpenBSD: syscalls.master,v 1.6 1997/01/23 16:12:20 niklas Exp $
+ $OpenBSD: syscalls.master,v 1.7 1999/06/07 07:17:47 deraadt Exp $
; $NetBSD: syscalls.master,v 1.10 1996/09/07 14:21:59 mycroft Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@@ -93,7 +93,7 @@
int pid, int pgid); }
40 UNIMPL ibcs2_xenix
41 NOARGS { int sys_dup(u_int fd); }
-42 NOARGS { int sys_pipe(void); }
+42 NOARGS { int sys_opipe(void); }
43 STD { int ibcs2_sys_times(struct tms *tp); }
44 UNIMPL profil
45 STD { int ibcs2_sys_plock(int cmd); }
diff --git a/sys/compat/osf1/syscalls.master b/sys/compat/osf1/syscalls.master
index 27726a49fdb..06a877c40ce 100644
--- a/sys/compat/osf1/syscalls.master
+++ b/sys/compat/osf1/syscalls.master
@@ -1,4 +1,4 @@
- $OpenBSD: syscalls.master,v 1.5 1998/02/17 01:48:07 millert Exp $
+ $OpenBSD: syscalls.master,v 1.6 1999/06/07 07:17:47 deraadt Exp $
; $NetBSD: syscalls.master,v 1.2 1995/10/07 06:27:28 mycroft Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@@ -87,7 +87,7 @@
39 NOARGS { int sys_setpgid(int pid, int pgid); }
40 UNIMPL old lstat
41 NOARGS { int sys_dup(u_int fd); }
-42 NOARGS { int sys_pipe(void); }
+42 NOARGS { int sys_opipe(void); }
43 UNIMPL set_program_attributes
44 UNIMPL profil
45 STD { int osf1_sys_open(char *path, int flags, int mode); }
diff --git a/sys/compat/sunos/syscalls.master b/sys/compat/sunos/syscalls.master
index f4e9b956a64..fe1fe06e37c 100644
--- a/sys/compat/sunos/syscalls.master
+++ b/sys/compat/sunos/syscalls.master
@@ -1,4 +1,4 @@
- $OpenBSD: syscalls.master,v 1.10 1998/03/23 07:12:40 millert Exp $
+ $OpenBSD: syscalls.master,v 1.11 1999/06/07 07:17:48 deraadt Exp $
; $NetBSD: syscalls.master,v 1.33 1996/02/28 16:05:43 pk Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@@ -86,7 +86,7 @@
39 UNIMPL sunos_setpgrp
40 STD { int sunos_sys_lstat(char *path, struct ostat *ub); }
41 NOARGS { int sys_dup(u_int fd); }
-42 NOARGS { int sys_pipe(void); }
+42 NOARGS { int sys_opipe(void); }
43 STD { int sunos_sys_otimes(struct tms *tp); }
44 NOARGS { int sys_profil(caddr_t samples, u_int size, \
u_int offset, u_int scale); }
diff --git a/sys/compat/svr4/syscalls.master b/sys/compat/svr4/syscalls.master
index 64840be13f7..1abb1a1ff86 100644
--- a/sys/compat/svr4/syscalls.master
+++ b/sys/compat/svr4/syscalls.master
@@ -1,4 +1,4 @@
- $OpenBSD: syscalls.master,v 1.23 1998/03/06 21:58:10 niklas Exp $
+ $OpenBSD: syscalls.master,v 1.24 1999/06/07 07:17:48 deraadt Exp $
; $NetBSD: syscalls.master,v 1.17 1996/02/10 17:12:51 christos Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@@ -90,7 +90,7 @@
39 STD { int svr4_sys_pgrpsys(int cmd, int pid, int pgid); }
40 UNIMPL xenix
41 NOARGS { int sys_dup(u_int fd); }
-42 NOARGS { int sys_pipe(void); }
+42 NOARGS { int sys_opipe(void); }
43 STD { int svr4_sys_times(struct tms *tp); }
44 UNIMPL profil
45 UNIMPL plock
diff --git a/sys/compat/ultrix/syscalls.master b/sys/compat/ultrix/syscalls.master
index d07afb73214..113e7b5c97c 100644
--- a/sys/compat/ultrix/syscalls.master
+++ b/sys/compat/ultrix/syscalls.master
@@ -1,4 +1,4 @@
- $OpenBSD: syscalls.master,v 1.6 1997/01/26 23:52:04 downsj Exp $
+ $OpenBSD: syscalls.master,v 1.7 1999/06/07 07:17:48 deraadt Exp $
; $NetBSD: syscalls.master,v 1.15 1996/01/07 13:38:57 jonathan Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@@ -86,7 +86,7 @@
40 STD { int ultrix_sys_lstat(char *path, \
struct ostat *ub); } olstat
41 NOARGS { int sys_dup(u_int fd); }
-42 NOARGS { int sys_pipe(void); }
+42 NOARGS { int sys_opipe(void); }
43 OBSOL v7 times
44 NOARGS { int sys_profil(caddr_t samples, u_int size, \
u_int offset, u_int scale); }
diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c
index ebc661bb095..f14e55a005f 100644
--- a/sys/kern/sys_pipe.c
+++ b/sys/kern/sys_pipe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sys_pipe.c,v 1.12 1999/06/07 01:41:01 deraadt Exp $ */
+/* $OpenBSD: sys_pipe.c,v 1.13 1999/06/07 07:17:42 deraadt Exp $ */
/*
* Copyright (c) 1996 John S. Dyson
@@ -156,7 +156,7 @@ int
#if defined(__FreeBSD__)
pipe(p, uap, retval)
#else /* (__NetBSD__) || (__OpenBSD__) */
-sys_pipe(p, v, retval)
+sys_opipe(p, v, retval)
#endif
struct proc *p;
void *v;
diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master
index 58e865bef0f..f3bbc850c38 100644
--- a/sys/kern/syscalls.master
+++ b/sys/kern/syscalls.master
@@ -1,4 +1,4 @@
-; $OpenBSD: syscalls.master,v 1.36 1999/05/31 17:34:47 millert Exp $
+; $OpenBSD: syscalls.master,v 1.37 1999/06/07 07:17:42 deraadt Exp $
; $NetBSD: syscalls.master,v 1.32 1996/04/23 10:24:21 mycroft Exp $
; @(#)syscalls.master 8.2 (Berkeley) 1/13/94
@@ -107,7 +107,7 @@
40 COMPAT_43 { int sys_lstat(char *path, \
struct ostat *ub); } olstat
41 STD { int sys_dup(int fd); }
-42 STD { int sys_pipe(void); }
+42 STD { int sys_opipe(void); }
43 STD { gid_t sys_getegid(void); }
44 STD { int sys_profil(caddr_t samples, size_t size, \
u_long offset, u_int scale); }
@@ -519,3 +519,4 @@
261 STD { int sys_statfs(const char *path, \
struct statfs *buf); }
262 STD { int sys_fstatfs(int fd, struct statfs *buf); }
+263 STD { int sys_pipe(int *fdp); }
diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c
index cff7ebce68b..99a511eaf34 100644
--- a/sys/kern/uipc_syscalls.c
+++ b/sys/kern/uipc_syscalls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_syscalls.c,v 1.21 1999/06/07 01:40:01 deraadt Exp $ */
+/* $OpenBSD: uipc_syscalls.c,v 1.22 1999/06/07 07:17:42 deraadt Exp $ */
/* $NetBSD: uipc_syscalls.c,v 1.19 1996/02/09 19:00:48 christos Exp $ */
/*
@@ -835,10 +835,36 @@ sys_getsockopt(p, v, retval)
return (error);
}
+int
+sys_pipe(p, v, retval)
+ struct proc *p;
+ void *v;
+ register_t *retval;
+{
+ register struct filedesc *fdp = p->p_fd;
+ register struct sys_pipe_args /* {
+ syscallarg(int *) fdp;
+ } */ *uap = v;
+ int error;
+
+ if ((error = sys_opipe(p, v, retval)) == -1)
+ return (error);
+
+ error = copyout((caddr_t)retval, (caddr_t)SCARG(uap, fdp),
+ 2 * sizeof (int));
+ if (error) {
+ ffree(fdp->fd_ofiles[retval[0]]);
+ fdp->fd_ofiles[retval[0]] = NULL;
+ ffree(fdp->fd_ofiles[retval[1]]);
+ fdp->fd_ofiles[retval[1]] = NULL;
+ }
+ return (error);
+}
+
#ifdef OLD_PIPE
/* ARGSUSED */
int
-sys_pipe(p, v, retval)
+sys_opipe(p, v, retval)
struct proc *p;
void *v;
register_t *retval;