kern/156567: [kqueue] [patch] Add EV_CLEAR to AIO events in
kqueue
David Xu
listlog2011 at gmail.com
Tue Jan 31 08:43:23 UTC 2012
On 2012/1/31 16:10, David Xu wrote:
> The following reply was made to PR kern/156567; it has been noted by GNATS.
>
> From: David Xu<listlog2011 at gmail.com>
> To: igor<igor at soumenkov.com>
> Cc: bug-followup at FreeBSD.org, freebsd-bugs at FreeBSD.org
> Subject: Re: kern/156567: [kqueue] [patch] Add EV_CLEAR to AIO events in kqueue
> Date: Tue, 31 Jan 2012 16:04:06 +0800
>
> On 2012/1/31 4:47, igor wrote:
> >
> >
> > Dear all,
> >
> > What can I do to get my patch finally applied or
> > rejected (hope not :) ? My PR is not even assigned to anyone. Should I
> > do my best to become a committer (how? :-) ?
> >
> > The solution I propose
> > finally allows to use kqueue with aio in multi-threaded applications.
> > The only reason I created it is because I wanted to use it for myself
> > and it worked flawlessly.
> >
> > Please, anyone?
> >
> It is better to allocate a member field from struct sigevent for kevent
> flags, we have spare fields available there, please check the union
> _sigev_un.
>
> Regards,
> David Xu
>
I propose attached patch. It adds a kevent flags field into sigevent, it
should provide
binary compatible with existing applications.
-------------- next part --------------
Index: /sys/sys/signal.h
===================================================================
--- /sys/sys/signal.h (revision 230761)
+++ /sys/sys/signal.h (working copy)
@@ -169,12 +169,14 @@
void (*_function)(union sigval);
void *_attribute; /* pthread_attr_t * */
} _sigev_thread;
+ unsigned short _kevent_flags;
long __spare__[8];
} _sigev_un;
};
#if __BSD_VISIBLE
#define sigev_notify_kqueue sigev_signo
+#define sigev_notify_kevent_flags _sigev_un._kevent_flags
#define sigev_notify_thread_id _sigev_un._threadid
#endif
#define sigev_notify_function _sigev_un._sigev_thread._function
Index: /sys/kern/vfs_aio.c
===================================================================
--- /sys/kern/vfs_aio.c (revision 230761)
+++ /sys/kern/vfs_aio.c (working copy)
@@ -1649,7 +1649,8 @@
kqfd = aiocbe->uaiocb.aio_sigevent.sigev_notify_kqueue;
kev.ident = (uintptr_t)aiocbe->uuaiocb;
kev.filter = EVFILT_AIO;
- kev.flags = EV_ADD | EV_ENABLE | EV_FLAG1;
+ kev.flags = EV_ADD | EV_ENABLE | EV_FLAG1 |
+ (aiocbe->uaiocb.aio_sigevent.sigev_notify_kevent_flags & EV_CLEAR);
kev.data = (intptr_t)aiocbe;
kev.udata = aiocbe->uaiocb.aio_sigevent.sigev_value.sival_ptr;
error = kqfd_register(kqfd, &kev, td, 1);
More information about the freebsd-bugs
mailing list