[rtems commit] Add abstime kqueue(2) timers and expand struct kevent members.

Sebastian Huber sebh at rtems.org
Wed Aug 8 06:49:07 UTC 2018


Module:    rtems
Branch:    master
Commit:    e9b708ab2afc45745b0c8d4deff5f6e3e6014c4c
Changeset: http://git.rtems.org/rtems/commit/?id=e9b708ab2afc45745b0c8d4deff5f6e3e6014c4c

Author:    kib <kib at FreeBSD.org>
Date:      Sat Jun 17 00:57:26 2017 +0000

Add abstime kqueue(2) timers and expand struct kevent members.

This change implements NOTE_ABSTIME flag for EVFILT_TIMER, which
specifies that the data field contains absolute time to fire the
event.

To make this useful, data member of the struct kevent must be extended
to 64bit.  Using the opportunity, I also added ext members.  This
changes struct kevent almost to Apple struct kevent64, except I did
not changed type of ident and udata, the later would cause serious API
incompatibilities.

The type of ident was kept uintptr_t since EVFILT_AIO returns a
pointer in this field, and e.g. CHERI is sensitive to the type
(discussed with brooks, jhb).

Unlike Apple kevent64, symbol versioning allows us to claim ABI
compatibility and still name the new syscall kevent(2).  Compat shims
are provided for both host native and compat32.

Requested by:	bapt
Reviewed by:	bapt, brooks, ngie (previous version)
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D11025

---

 cpukit/include/sys/event.h | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/cpukit/include/sys/event.h b/cpukit/include/sys/event.h
index a4f91e0..d1cfb58 100644
--- a/cpukit/include/sys/event.h
+++ b/cpukit/include/sys/event.h
@@ -55,6 +55,10 @@
 	(kevp)->fflags = (d);			\
 	(kevp)->data = (e);			\
 	(kevp)->udata = (f);			\
+	(kevp)->ext[0] = 0;			\
+	(kevp)->ext[1] = 0;			\
+	(kevp)->ext[2] = 0;			\
+	(kevp)->ext[3] = 0;			\
 } while(0)
 
 struct kevent {
@@ -62,8 +66,9 @@ struct kevent {
 	short		filter;		/* filter for event */
 	unsigned short	flags;
 	unsigned int	fflags;
-	__intptr_t	data;
+	__int64_t	data;
 	void		*udata;		/* opaque user data identifier */
+	__uint64_t	ext[4];
 };
 
 /* actions */
@@ -149,6 +154,7 @@ struct kevent {
 #define NOTE_MSECONDS		0x00000002	/* data is milliseconds */
 #define NOTE_USECONDS		0x00000004	/* data is microseconds */
 #define NOTE_NSECONDS		0x00000008	/* data is nanoseconds */
+#define	NOTE_ABSTIME		0x00000010	/* timeout is absolute */
 
 struct knote;
 SLIST_HEAD(klist, knote);
@@ -232,7 +238,7 @@ struct knote {
 #define	KN_SCAN		0x100			/* flux set in kqueue_scan() */
 	int			kn_influx;
 	int			kn_sfflags;	/* saved filter flags */
-	intptr_t		kn_sdata;	/* saved data field */
+	int64_t			kn_sdata;	/* saved data field */
 	union {
 		struct		file *p_fp;	/* file data pointer */
 		struct		proc *p_proc;	/* proc pointer */
@@ -253,6 +259,7 @@ struct kevent_copyops {
 	void	*arg;
 	int	(*k_copyout)(void *arg, struct kevent *kevp, int count);
 	int	(*k_copyin)(void *arg, struct kevent *kevp, int count);
+	size_t	kevent_size;
 };
 
 struct thread;




More information about the vc mailing list