summaryrefslogtreecommitdiff
path: root/sys/compat/linux
diff options
context:
space:
mode:
authorPhilip Guenthe <guenther@cvs.openbsd.org>2010-07-26 01:56:28 +0000
committerPhilip Guenthe <guenther@cvs.openbsd.org>2010-07-26 01:56:28 +0000
commit12738501a521de949783a0ef772f333a85a28079 (patch)
treea8d79b5579bc5fb4f0fe053219d7da149a912112 /sys/compat/linux
parent58397ea88d58979fc9e046dc9c64692785b924ae (diff)
Correct the links between threads, processes, pgrps, and sessions,
so that the process-level stuff is to/from struct process and not struct proc. This fixes a bunch of problem cases in rthreads. Based on earlier work by blambert and myself, but mostly written at c2k10. Tested by many: deraadt, sthen, krw, ray, and in snapshots
Diffstat (limited to 'sys/compat/linux')
-rw-r--r--sys/compat/linux/linux_file.c13
-rw-r--r--sys/compat/linux/linux_misc.c10
2 files changed, 12 insertions, 11 deletions
diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c
index d717b8df49f..3cce3741841 100644
--- a/sys/compat/linux/linux_file.c
+++ b/sys/compat/linux/linux_file.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: linux_file.c,v 1.23 2006/09/25 07:12:57 otto Exp $ */
+/* $OpenBSD: linux_file.c,v 1.24 2010/07/26 01:56:27 guenther Exp $ */
/* $NetBSD: linux_file.c,v 1.15 1996/05/20 01:59:09 fvdl Exp $ */
/*
@@ -190,7 +190,8 @@ linux_sys_open(p, v, retval)
* terminal yet, and the O_NOCTTY flag is not set, try to make
* this the controlling terminal.
*/
- if (!(fl & O_NOCTTY) && SESS_LEADER(p) && !(p->p_flag & P_CONTROLT)) {
+ if (!(fl & O_NOCTTY) && SESS_LEADER(p->p_p) &&
+ !(p->p_p->ps_flags & PS_CONTROLT)) {
struct filedesc *fdp = p->p_fd;
struct file *fp;
@@ -417,13 +418,13 @@ linux_sys_fcntl(p, v, retval)
if ((long)arg <= 0) {
pgid = -(long)arg;
} else {
- struct proc *p1 = pfind((long)arg);
- if (p1 == 0)
+ struct process *pr = prfind((long)arg);
+ if (pr == 0)
return (ESRCH);
- pgid = (long)p1->p_pgrp->pg_id;
+ pgid = (long)pr->ps_pgrp->pg_id;
}
pgrp = pgfind(pgid);
- if (pgrp == NULL || pgrp->pg_session != p->p_session)
+ if (pgrp == NULL || pgrp->pg_session != p->p_p->ps_session)
return EPERM;
tp->t_pgrp = pgrp;
return 0;
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
index 5def1551993..cb7abec8993 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.64 2010/06/30 21:54:35 guenther Exp $ */
+/* $OpenBSD: linux_misc.c,v 1.65 2010/07/26 01:56:27 guenther Exp $ */
/* $NetBSD: linux_misc.c,v 1.27 1996/05/20 01:59:21 fvdl Exp $ */
/*-
@@ -1223,16 +1223,16 @@ linux_sys_getpgid(p, v, retval)
struct linux_sys_getpgid_args /* {
syscallarg(int) pid;
} */ *uap = v;
- struct proc *targp;
+ struct process *targpr;
if (SCARG(uap, pid) != 0 && SCARG(uap, pid) != p->p_pid) {
- if ((targp = pfind(SCARG(uap, pid))) == 0)
+ if ((targpr = prfind(SCARG(uap, pid))) == 0)
return ESRCH;
}
else
- targp = p;
+ targpr = p->p_p;
- retval[0] = targp->p_pgid;
+ retval[0] = targpr->ps_pgid;
return 0;
}