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<[email protected]>
To: igor<[email protected]>
Cc: [email protected], [email protected]
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.


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);
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "[email protected]"

Reply via email to