From owner-freebsd-bugs@FreeBSD.ORG Tue Jan 31 08:43:22 2012 Return-Path: Delivered-To: freebsd-bugs@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EB31D106564A for ; Tue, 31 Jan 2012 08:43:22 +0000 (UTC) (envelope-from listlog2011@gmail.com) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id B7C228FC16; Tue, 31 Jan 2012 08:43:22 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q0V8hI2Z044286; Tue, 31 Jan 2012 08:43:21 GMT (envelope-from listlog2011@gmail.com) Message-ID: <4F27A9A7.7040907@gmail.com> Date: Tue, 31 Jan 2012 16:43:19 +0800 From: David Xu User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:9.0) Gecko/20111222 Thunderbird/9.0.1 MIME-Version: 1.0 To: David Xu References: <201201310810.q0V8ACMA004882@freefall.freebsd.org> In-Reply-To: <201201310810.q0V8ACMA004882@freefall.freebsd.org> Content-Type: multipart/mixed; boundary="------------090000010409030405020805" Cc: freebsd-bugs@FreeBSD.org Subject: Re: kern/156567: [kqueue] [patch] Add EV_CLEAR to AIO events in kqueue X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: davidxu@FreeBSD.org List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Jan 2012 08:43:23 -0000 This is a multi-part message in MIME format. --------------090000010409030405020805 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 > To: igor > Cc: bug-followup@FreeBSD.org, freebsd-bugs@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. --------------090000010409030405020805 Content-Type: text/plain; name="aio_event.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="aio_event.diff" 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); --------------090000010409030405020805--