summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_fork.c
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2013-03-14 21:38:22 +0000
committertedu <tedu@openbsd.org>2013-03-14 21:38:22 +0000
commit0af1a64da7783e3588769a2ef08b4d6d1515c629 (patch)
treeb6562f472cd08594c600d85e3a77661a303184fd /sys/kern/kern_fork.c
parent- some indent fixes (diff)
downloadwireguard-openbsd-0af1a64da7783e3588769a2ef08b4d6d1515c629.tar.xz
wireguard-openbsd-0af1a64da7783e3588769a2ef08b4d6d1515c629.zip
the 5.1 era tfork syscall claws its way out of the grave. we failed to
fully deprecate it (notably the go port was still using it as of 5.3) so to give users a little more time to update, __tfork51 lives again. okish deraadt guenther
Diffstat (limited to 'sys/kern/kern_fork.c')
-rw-r--r--sys/kern/kern_fork.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index b3e658c3692..02bc078a951 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_fork.c,v 1.144 2013/03/02 07:05:17 guenther Exp $ */
+/* $OpenBSD: kern_fork.c,v 1.145 2013/03/14 21:38:22 tedu Exp $ */
/* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */
/*
@@ -141,6 +141,31 @@ sys___tfork(struct proc *p, void *v, register_t *retval)
tfork_child_return, param.tf_tcb, retval, NULL));
}
+#ifdef COMPAT_O51
+int
+compat_o51_sys___tfork(struct proc *p, void *v, register_t *retval)
+{
+ struct compat_o51_sys___tfork_args /* {
+ syscallarg(struct __tfork51) *param;
+ } */ *uap = v;
+ struct __tfork51 param;
+ int flags;
+ int error;
+
+ if ((error = copyin(SCARG(uap, param), &param, sizeof(param))))
+ return (error);
+
+ if (param.tf_flags != 0)
+ return (EINVAL);
+
+ flags = FORK_TFORK | FORK_THREAD | FORK_SIGHAND | FORK_SHAREVM
+ | FORK_NOZOMBIE | FORK_SHAREFILES;
+
+ return (fork1(p, 0, flags, NULL, param.tf_tid, tfork_child_return,
+ param.tf_tcb, retval, NULL));
+}
+#endif
+
void
tfork_child_return(void *arg)
{