Date: Wed, 16 Sep 2009 03:49:54 +0000 (UTC) From: Stacey Son <sson@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r197243 - in head: lib/libc/sys sys/kern sys/sys Message-ID: <200909160349.n8G3nsZo011324@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: sson Date: Wed Sep 16 03:49:54 2009 New Revision: 197243 URL: http://svn.freebsd.org/changeset/base/197243 Log: Add EV_RECEIPT to kevents. EV_RECEIPT is useful to disambiguating error conditions when multiple events structures are passed to kevent(2). The error code is returned in the data field and EV_ERROR is set. Approved by: rwatson (co-mentor) Modified: head/lib/libc/sys/kqueue.2 head/sys/kern/kern_event.c head/sys/sys/event.h Modified: head/lib/libc/sys/kqueue.2 ============================================================================== --- head/lib/libc/sys/kqueue.2 Wed Sep 16 03:37:39 2009 (r197242) +++ head/lib/libc/sys/kqueue.2 Wed Sep 16 03:49:54 2009 (r197243) @@ -211,6 +211,15 @@ Removes the event from the kqueue. Events which are attached to file descriptors are automatically deleted on the last close of the descriptor. +.It EV_RECEIPT +This flag is useful for making bulk changes to a kqueue without draining +any pending events. +When passed as input, it forces +.Dv EV_ERROR +to always be returned. +When a filter is successfully added the +.Va data +field will be zero. .It EV_ONESHOT Causes the event to return only the first occurrence of the filter being triggered. Modified: head/sys/kern/kern_event.c ============================================================================== --- head/sys/kern/kern_event.c Wed Sep 16 03:37:39 2009 (r197242) +++ head/sys/kern/kern_event.c Wed Sep 16 03:49:54 2009 (r197243) @@ -832,7 +832,7 @@ kern_kevent(struct thread *td, int fd, i continue; kevp->flags &= ~EV_SYSFLAGS; error = kqueue_register(kq, kevp, td, 1); - if (error) { + if (error || (kevp->flags & EV_RECEIPT)) { if (nevents != 0) { kevp->flags = EV_ERROR; kevp->data = error; Modified: head/sys/sys/event.h ============================================================================== --- head/sys/sys/event.h Wed Sep 16 03:37:39 2009 (r197242) +++ head/sys/sys/event.h Wed Sep 16 03:49:54 2009 (r197243) @@ -72,7 +72,7 @@ struct kevent { /* flags */ #define EV_ONESHOT 0x0010 /* only report one occurrence */ #define EV_CLEAR 0x0020 /* clear event state after reporting */ - /* 0x0040 reserved for EV_RECEIPT */ +#define EV_RECEIPT 0x0040 /* force EV_ERROR on success, data=0 */ #define EV_DISPATCH 0x0080 /* disable event after reporting */ #define EV_SYSFLAGS 0xF000 /* reserved by system */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200909160349.n8G3nsZo011324>