path: root/sys/sys/signal.h
diff options
authorDavid Xu <davidxu@FreeBSD.org>2012-02-01 02:53:06 +0000
committerDavid Xu <davidxu@FreeBSD.org>2012-02-01 02:53:06 +0000
commitfde809356a4bd2146bc8d0b9d96de1a92a7b967e (patch)
tree701c607f5cf534d8d2984fccfa40fe965a97b69b /sys/sys/signal.h
parent1db689c58339ac490d46d21bb19e02ee79b4e79d (diff)
If multiple threads call kevent() to get AIO events on same kqueue fd,
it is possible that a single AIO event will be reported to multiple threads, it is not threading friendly, and the existing API can not control this behavior. Allocate a kevent flags field sigev_notify_kevent_flags for AIO event notification in sigevent, and allow user to pass EV_CLEAR, EV_DISPATCH or EV_ONESHOT to AIO kernel code, user can control whether the event should be cleared once it is retrieved by a thread. This change should be comptaible with existing application, because the field should have already been zero-filled, and no additional action will be taken by kernel. PR: kern/156567
Notes: svn path=/head/; revision=230857
Diffstat (limited to 'sys/sys/signal.h')
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/sys/signal.h b/sys/sys/signal.h
index 971683516e3c..73aeea117f7d 100644
--- a/sys/sys/signal.h
+++ b/sys/sys/signal.h
@@ -169,12 +169,14 @@ struct sigevent {
void (*_function)(union sigval);
void *_attribute; /* pthread_attr_t * */
} _sigev_thread;
+ unsigned short _kevent_flags;
long __spare__[8];
} _sigev_un;
#define sigev_notify_kqueue sigev_signo
+#define sigev_notify_kevent_flags _sigev_un._kevent_flags
#define sigev_notify_thread_id _sigev_un._threadid
#define sigev_notify_function _sigev_un._sigev_thread._function