Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 31 Jan 2012 16:43:19 +0800
From:      David Xu <listlog2011@gmail.com>
To:        David Xu <listlog2011@gmail.com>
Cc:        freebsd-bugs@FreeBSD.org
Subject:   Re: kern/156567: [kqueue] [patch] Add EV_CLEAR to AIO events in kqueue
Message-ID:  <4F27A9A7.7040907@gmail.com>
In-Reply-To: <201201310810.q0V8ACMA004882@freefall.freebsd.org>
References:  <201201310810.q0V8ACMA004882@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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<listlog2011@gmail.com>
> To: igor<igor@soumenkov.com>
> 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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4F27A9A7.7040907>