kern_event.c (126033) | kern_event.c (127982) |
---|---|
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 --- 11 unchanged lines hidden (view full) --- 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 27#include <sys/cdefs.h> | 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 --- 11 unchanged lines hidden (view full) --- 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 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/kern/kern_event.c 126033 2004-02-20 04:00:48Z green $"); | 28__FBSDID("$FreeBSD: head/sys/kern/kern_event.c 127982 2004-04-07 05:59:57Z cperciva $"); |
29 30#include <sys/param.h> 31#include <sys/systm.h> 32#include <sys/kernel.h> 33#include <sys/lock.h> 34#include <sys/mutex.h> 35#include <sys/proc.h> 36#include <sys/malloc.h> --- 306 unchanged lines hidden (view full) --- 343 tv.tv_sec = kn->kn_sdata / 1000; 344 tv.tv_usec = (kn->kn_sdata % 1000) * 1000; 345 tticks = tvtohz(&tv); 346 347 kn->kn_flags |= EV_CLEAR; /* automatically set */ 348 MALLOC(calloutp, struct callout *, sizeof(*calloutp), 349 M_KQUEUE, M_WAITOK); 350 callout_init(calloutp, 0); | 29 30#include <sys/param.h> 31#include <sys/systm.h> 32#include <sys/kernel.h> 33#include <sys/lock.h> 34#include <sys/mutex.h> 35#include <sys/proc.h> 36#include <sys/malloc.h> --- 306 unchanged lines hidden (view full) --- 343 tv.tv_sec = kn->kn_sdata / 1000; 344 tv.tv_usec = (kn->kn_sdata % 1000) * 1000; 345 tticks = tvtohz(&tv); 346 347 kn->kn_flags |= EV_CLEAR; /* automatically set */ 348 MALLOC(calloutp, struct callout *, sizeof(*calloutp), 349 M_KQUEUE, M_WAITOK); 350 callout_init(calloutp, 0); |
351 callout_reset(calloutp, tticks, filt_timerexpire, kn); | |
352 kn->kn_hook = calloutp; | 351 kn->kn_hook = calloutp; |
352 callout_reset(calloutp, tticks, filt_timerexpire, kn); |
|
353 354 return (0); 355} 356 357static void 358filt_timerdetach(struct knote *kn) 359{ 360 struct callout *calloutp; 361 362 calloutp = (struct callout *)kn->kn_hook; | 353 354 return (0); 355} 356 357static void 358filt_timerdetach(struct knote *kn) 359{ 360 struct callout *calloutp; 361 362 calloutp = (struct callout *)kn->kn_hook; |
363 callout_stop(calloutp); | 363 callout_drain(calloutp); |
364 FREE(calloutp, M_KQUEUE); 365 kq_ncallouts--; 366} 367 368static int 369filt_timer(struct knote *kn, long hint) 370{ 371 --- 734 unchanged lines hidden --- | 364 FREE(calloutp, M_KQUEUE); 365 kq_ncallouts--; 366} 367 368static int 369filt_timer(struct knote *kn, long hint) 370{ 371 --- 734 unchanged lines hidden --- |