kern_event.c (86341) | kern_event.c (88633) |
---|---|
1/*- 2 * Copyright (c) 1999,2000,2001 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,2001 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 86341 2001-11-14 06:30:36Z dillon $ | 26 * $FreeBSD: head/sys/kern/kern_event.c 88633 2001-12-29 07:13:47Z alfred $ |
27 */ 28 29#include <sys/param.h> 30#include <sys/systm.h> 31#include <sys/kernel.h> 32#include <sys/lock.h> 33#include <sys/mutex.h> 34#include <sys/proc.h> --- 82 unchanged lines hidden (view full) --- 117 kn->kn_status |= KN_ACTIVE; \ 118 if ((kn->kn_status & (KN_QUEUED | KN_DISABLED)) == 0) \ 119 knote_enqueue(kn); \ 120} while(0) 121 122#define KN_HASHSIZE 64 /* XXX should be tunable */ 123#define KN_HASH(val, mask) (((val) ^ (val >> 8)) & (mask)) 124 | 27 */ 28 29#include <sys/param.h> 30#include <sys/systm.h> 31#include <sys/kernel.h> 32#include <sys/lock.h> 33#include <sys/mutex.h> 34#include <sys/proc.h> --- 82 unchanged lines hidden (view full) --- 117 kn->kn_status |= KN_ACTIVE; \ 118 if ((kn->kn_status & (KN_QUEUED | KN_DISABLED)) == 0) \ 119 knote_enqueue(kn); \ 120} while(0) 121 122#define KN_HASHSIZE 64 /* XXX should be tunable */ 123#define KN_HASH(val, mask) (((val) ^ (val >> 8)) & (mask)) 124 |
125extern struct filterops aio_filtops; | 125static int 126filt_nullattach(struct knote *kn) 127{ 128 129 return (ENXIO); 130}; 131 132struct filterops null_filtops = 133 { 0, filt_nullattach, NULL, NULL }; 134 |
126extern struct filterops sig_filtops; 127 128/* 129 * Table for for all system-defined filters. 130 */ 131static struct filterops *sysfilt_ops[] = { 132 &file_filtops, /* EVFILT_READ */ 133 &file_filtops, /* EVFILT_WRITE */ | 135extern struct filterops sig_filtops; 136 137/* 138 * Table for for all system-defined filters. 139 */ 140static struct filterops *sysfilt_ops[] = { 141 &file_filtops, /* EVFILT_READ */ 142 &file_filtops, /* EVFILT_WRITE */ |
134 &aio_filtops, /* EVFILT_AIO */ | 143 &null_filtops, /* EVFILT_AIO */ |
135 &file_filtops, /* EVFILT_VNODE */ 136 &proc_filtops, /* EVFILT_PROC */ 137 &sig_filtops, /* EVFILT_SIGNAL */ 138 &timer_filtops, /* EVFILT_TIMER */ 139}; 140 141static int 142filt_fileattach(struct knote *kn) --- 312 unchanged lines hidden (view full) --- 455done: 456 if (fp != NULL) 457 fdrop(fp, td); 458 mtx_unlock(&Giant); 459 return (error); 460} 461 462int | 144 &file_filtops, /* EVFILT_VNODE */ 145 &proc_filtops, /* EVFILT_PROC */ 146 &sig_filtops, /* EVFILT_SIGNAL */ 147 &timer_filtops, /* EVFILT_TIMER */ 148}; 149 150static int 151filt_fileattach(struct knote *kn) --- 312 unchanged lines hidden (view full) --- 464done: 465 if (fp != NULL) 466 fdrop(fp, td); 467 mtx_unlock(&Giant); 468 return (error); 469} 470 471int |
472kqueue_add_filteropts(int filt, struct filterops *filtops) 473{ 474 475 if (filt > 0) 476 panic("filt(%d) > 0", filt); 477 if (filt + EVFILT_SYSCOUNT < 0) 478 panic("filt(%d) + EVFILT_SYSCOUNT(%d) == %d < 0", 479 filt, EVFILT_SYSCOUNT, filt + EVFILT_SYSCOUNT); 480 if (sysfilt_ops[~filt] != &null_filtops) 481 panic("sysfilt_ops[~filt(%d)] != &null_filtops", filt); 482 sysfilt_ops[~filt] = filtops; 483 return (0); 484} 485 486int 487kqueue_del_filteropts(int filt) 488{ 489 490 if (filt > 0) 491 panic("filt(%d) > 0", filt); 492 if (filt + EVFILT_SYSCOUNT < 0) 493 panic("filt(%d) + EVFILT_SYSCOUNT(%d) == %d < 0", 494 filt, EVFILT_SYSCOUNT, filt + EVFILT_SYSCOUNT); 495 if (sysfilt_ops[~filt] == &null_filtops) 496 panic("sysfilt_ops[~filt(%d)] != &null_filtops", filt); 497 sysfilt_ops[~filt] = &null_filtops; 498 return (0); 499} 500 501int |
|
463kqueue_register(struct kqueue *kq, struct kevent *kev, struct thread *td) 464{ 465 struct filedesc *fdp = kq->kq_fdp; 466 struct filterops *fops; 467 struct file *fp = NULL; 468 struct knote *kn = NULL; 469 int s, error = 0; 470 --- 520 unchanged lines hidden --- | 502kqueue_register(struct kqueue *kq, struct kevent *kev, struct thread *td) 503{ 504 struct filedesc *fdp = kq->kq_fdp; 505 struct filterops *fops; 506 struct file *fp = NULL; 507 struct knote *kn = NULL; 508 int s, error = 0; 509 --- 520 unchanged lines hidden --- |