summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2010-05-18 22:26:11 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2010-05-18 22:26:11 +0000
commit63ced9f75be635c48a84b1560d61e5454858d26d (patch)
treef6eab136e79f9de453f12ad7a440328a9578b2fc
parent0eebcf7d241b97d6a763d98b8cd5ee2dd7fe9ab6 (diff)
move knote list to struct process. ok guenther
-rw-r--r--sys/kern/kern_event.c6
-rw-r--r--sys/kern/kern_exec.c4
-rw-r--r--sys/kern/kern_exit.c5
-rw-r--r--sys/kern/kern_fork.c7
-rw-r--r--sys/kern/kern_sig.c8
-rw-r--r--sys/sys/proc.h5
6 files changed, 18 insertions, 17 deletions
diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c
index bb196052f9a..9c94d337b31 100644
--- a/sys/kern/kern_event.c
+++ b/sys/kern/kern_event.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_event.c,v 1.35 2009/11/09 17:53:39 nicm Exp $ */
+/* $OpenBSD: kern_event.c,v 1.36 2010/05/18 22:26:09 tedu Exp $ */
/*-
* Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org>
@@ -219,7 +219,7 @@ filt_procattach(struct knote *kn)
}
/* XXX lock the proc here while adding to the list? */
- SLIST_INSERT_HEAD(&p->p_klist, kn, kn_selnext);
+ SLIST_INSERT_HEAD(&p->p_p->ps_klist, kn, kn_selnext);
return (0);
}
@@ -241,7 +241,7 @@ filt_procdetach(struct knote *kn)
return;
/* XXX locking? this might modify another process. */
- SLIST_REMOVE(&p->p_klist, kn, knote, kn_selnext);
+ SLIST_REMOVE(&p->p_p->ps_klist, kn, knote, kn_selnext);
}
int
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index 71989c132ed..3bd0efe326e 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_exec.c,v 1.111 2010/01/14 23:12:11 schwarze Exp $ */
+/* $OpenBSD: kern_exec.c,v 1.112 2010/05/18 22:26:10 tedu Exp $ */
/* $NetBSD: kern_exec.c,v 1.75 1996/02/09 18:59:28 christos Exp $ */
/*-
@@ -599,7 +599,7 @@ sys_execve(struct proc *p, void *v, register_t *retval)
/*
* notify others that we exec'd
*/
- KNOTE(&p->p_klist, NOTE_EXEC);
+ KNOTE(&p->p_p->ps_klist, NOTE_EXEC);
/* setup new registers and do misc. setup. */
if (pack.ep_emul->e_fixup != NULL) {
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index 3ff122b1621..347bf0a0f8e 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_exit.c,v 1.90 2010/03/24 23:18:17 tedu Exp $ */
+/* $OpenBSD: kern_exit.c,v 1.91 2010/05/18 22:26:10 tedu Exp $ */
/* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */
/*
@@ -292,7 +292,8 @@ exit1(struct proc *p, int rv, int flags)
/*
* notify interested parties of our demise.
*/
- KNOTE(&p->p_klist, NOTE_EXIT);
+ if (p == p->p_p->ps_mainproc)
+ KNOTE(&p->p_p->ps_klist, NOTE_EXIT);
/*
* Notify parent that we're gone. If we have P_NOZOMBIE or parent has
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index df6ffd8c7a0..770174abe05 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_fork.c,v 1.109 2010/03/24 23:18:17 tedu Exp $ */
+/* $OpenBSD: kern_fork.c,v 1.110 2010/05/18 22:26:10 tedu Exp $ */
/* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */
/*
@@ -156,7 +156,7 @@ process_new(struct proc *newproc, struct proc *parentproc)
{
struct process *pr, *parent;
- pr = pool_get(&process_pool, PR_WAITOK);
+ pr = pool_get(&process_pool, PR_WAITOK | PR_ZERO);
pr->ps_mainproc = newproc;
TAILQ_INIT(&pr->ps_threads);
TAILQ_INSERT_TAIL(&pr->ps_threads, newproc, p_thr_link);
@@ -460,7 +460,8 @@ fork1(struct proc *p1, int exitsig, int flags, void *stack, size_t stacksize,
/*
* Notify any interested parties about the new process.
*/
- KNOTE(&p1->p_klist, NOTE_FORK | p2->p_pid);
+ if ((flags & FORK_THREAD) == 0)
+ KNOTE(&p1->p_p->ps_klist, NOTE_FORK | p2->p_pid);
/*
* Update stats now that we know the fork was successful.
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index 440e922c18c..27f7c93e49b 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sig.c,v 1.107 2009/11/27 19:43:55 guenther Exp $ */
+/* $OpenBSD: kern_sig.c,v 1.108 2010/05/18 22:26:10 tedu Exp $ */
/* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */
/*
@@ -834,7 +834,7 @@ ptsignal(struct proc *p, int signum, enum signal_type type)
#endif
if (type != SPROPAGATED)
- KNOTE(&p->p_klist, NOTE_SIGNAL | signum);
+ KNOTE(&p->p_p->ps_klist, NOTE_SIGNAL | signum);
prop = sigprop[signum];
@@ -1654,7 +1654,7 @@ filt_sigattach(struct knote *kn)
kn->kn_flags |= EV_CLEAR; /* automatically set */
/* XXX lock the proc here while adding to the list? */
- SLIST_INSERT_HEAD(&p->p_klist, kn, kn_selnext);
+ SLIST_INSERT_HEAD(&p->p_p->ps_klist, kn, kn_selnext);
return (0);
}
@@ -1664,7 +1664,7 @@ filt_sigdetach(struct knote *kn)
{
struct proc *p = kn->kn_ptr.p_proc;
- SLIST_REMOVE(&p->p_klist, kn, knote, kn_selnext);
+ SLIST_REMOVE(&p->p_p->ps_klist, kn, knote, kn_selnext);
}
/*
diff --git a/sys/sys/proc.h b/sys/sys/proc.h
index 6ee8bded551..924e96e047d 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: proc.h,v 1.126 2010/04/20 22:05:44 tedu Exp $ */
+/* $OpenBSD: proc.h,v 1.127 2010/05/18 22:26:10 tedu Exp $ */
/* $NetBSD: proc.h,v 1.44 1996/04/22 01:23:21 christos Exp $ */
/*-
@@ -146,6 +146,7 @@ struct process {
int ps_refcnt; /* Number of references. */
u_int ps_rdomain; /* Process routing domain. */
+ struct klist ps_klist; /* knotes attached to this process */
};
#else
struct process;
@@ -223,8 +224,6 @@ struct proc {
void *p_emuldata; /* Per-process emulation data, or */
/* NULL. Malloc type M_EMULDATA */
- struct klist p_klist; /* knotes attached to this process */
- /* pad to 256, avoid shifting eproc. */
sigset_t p_sigdivert; /* Signals to be diverted to thread. */