Deleted Added
full compact
kern_event.c (70834) kern_event.c (71500)
1/*-
2 * Copyright (c) 1999,2000 Jonathan Lemon <jlemon@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 1999,2000 Jonathan Lemon <jlemon@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: head/sys/kern/kern_event.c 70834 2001-01-09 04:33:49Z wollman $
26 * $FreeBSD: head/sys/kern/kern_event.c 71500 2001-01-24 00:35:12Z jhb $
27 */
28
29#include <sys/param.h>
30#include <sys/systm.h>
31#include <sys/kernel.h>
32#include <sys/proc.h>
33#include <sys/malloc.h>
34#include <sys/unistd.h>

--- 175 unchanged lines hidden (view full) ---

210 * internal flag indicating registration done by kernel
211 */
212 if (kn->kn_flags & EV_FLAG1) {
213 kn->kn_data = kn->kn_sdata; /* ppid */
214 kn->kn_fflags = NOTE_CHILD;
215 kn->kn_flags &= ~EV_FLAG1;
216 }
217
27 */
28
29#include <sys/param.h>
30#include <sys/systm.h>
31#include <sys/kernel.h>
32#include <sys/proc.h>
33#include <sys/malloc.h>
34#include <sys/unistd.h>

--- 175 unchanged lines hidden (view full) ---

210 * internal flag indicating registration done by kernel
211 */
212 if (kn->kn_flags & EV_FLAG1) {
213 kn->kn_data = kn->kn_sdata; /* ppid */
214 kn->kn_fflags = NOTE_CHILD;
215 kn->kn_flags &= ~EV_FLAG1;
216 }
217
218 /* XXX lock the proc here while adding to the list? */
218 PROC_LOCK(p);
219 SLIST_INSERT_HEAD(&p->p_klist, kn, kn_selnext);
219 SLIST_INSERT_HEAD(&p->p_klist, kn, kn_selnext);
220 PROC_UNLOCK(p);
220
221 return (0);
222}
223
224/*
225 * The knote may be attached to a different process, which may exit,
226 * leaving nothing for the knote to be attached to. So when the process
227 * exits, the knote is marked as DETACHED and also flagged as ONESHOT so

--- 4 unchanged lines hidden (view full) ---

232static void
233filt_procdetach(struct knote *kn)
234{
235 struct proc *p = kn->kn_ptr.p_proc;
236
237 if (kn->kn_status & KN_DETACHED)
238 return;
239
221
222 return (0);
223}
224
225/*
226 * The knote may be attached to a different process, which may exit,
227 * leaving nothing for the knote to be attached to. So when the process
228 * exits, the knote is marked as DETACHED and also flagged as ONESHOT so

--- 4 unchanged lines hidden (view full) ---

233static void
234filt_procdetach(struct knote *kn)
235{
236 struct proc *p = kn->kn_ptr.p_proc;
237
238 if (kn->kn_status & KN_DETACHED)
239 return;
240
240 /* XXX locking? this might modify another process. */
241 PROC_LOCK(p);
241 SLIST_REMOVE(&p->p_klist, kn, knote, kn_selnext);
242 SLIST_REMOVE(&p->p_klist, kn, knote, kn_selnext);
243 PROC_UNLOCK(p);
242}
243
244static int
245filt_proc(struct knote *kn, long hint)
246{
247 u_int event;
248
249 /*

--- 676 unchanged lines hidden ---
244}
245
246static int
247filt_proc(struct knote *kn, long hint)
248{
249 u_int event;
250
251 /*

--- 676 unchanged lines hidden ---