--- src/sys/sys/event.h Fri Jul 1 20:28:32 2005 +++ src/sys/sys/event.h Wed Sep 27 17:35:09 2006 @@ -38,8 +38,9 @@ #define EVFILT_TIMER (-7) /* timers */ #define EVFILT_NETDEV (-8) /* network devices */ #define EVFILT_FS (-9) /* filesystem events */ +#define EVFILT_USER (-10) /* user events */ -#define EVFILT_SYSCOUNT 9 +#define EVFILT_SYSCOUNT 10 #define EV_SET(kevp_, a, b, c, d, e, f) do { \ struct kevent *kevp = (kevp_); \ --- src/sys/kern/kern_event.c Mon Sep 4 21:17:25 2006 +++ src/sys/kern/kern_event.c Wed Sep 27 18:53:25 2006 @@ -132,6 +132,9 @@ static int filt_timerattach(struct knote *kn); static void filt_timerdetach(struct knote *kn); static int filt_timer(struct knote *kn, long hint); +static int filt_userattach(struct knote *kn); +static void filt_userdetach(struct knote *kn); +static int filt_user(struct knote *kn, long hint); static struct filterops file_filtops = { 1, filt_fileattach, NULL, NULL }; @@ -142,6 +145,8 @@ { 0, filt_procattach, filt_procdetach, filt_proc }; static struct filterops timer_filtops = { 0, filt_timerattach, filt_timerdetach, filt_timer }; +static struct filterops user_filtops = + { 0, filt_userattach, filt_userdetach, filt_user }; static uma_zone_t knote_zone; static int kq_ncallouts = 0; @@ -247,6 +252,7 @@ { &timer_filtops }, /* EVFILT_TIMER */ { &file_filtops }, /* EVFILT_NETDEV */ { &fs_filtops }, /* EVFILT_FS */ + { &user_filtops }, /* EVFILT_USER */ }; /* @@ -495,6 +501,27 @@ { return (kn->kn_data != 0); +} + +static int +filt_userattach(struct knote *kn) +{ + kn->kn_flags |= EV_ONESHOT; /* automatically set */ + kn->kn_status &= ~KN_DETACHED; /* knlist_add usually sets it */ + return (0); +} + +static void +filt_userdetach(struct knote *kn) +{ + kn->kn_status |= KN_DETACHED; /* knlist_remove usually clears it */ +} + +static int +filt_user(struct knote *kn, long hint) +{ + + return (1); } /*