| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: event.h,v 1.28 2017/06/02 19:44:06 kamil Exp $ */ | | 1 | /* $NetBSD: event.h,v 1.29 2017/06/14 16:37:05 christos Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org> | | 4 | * Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org> |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -44,32 +44,33 @@ | | | @@ -44,32 +44,33 @@ |
44 | #define EVFILT_SIGNAL 5U /* attached to struct proc */ | | 44 | #define EVFILT_SIGNAL 5U /* attached to struct proc */ |
45 | #define EVFILT_TIMER 6U /* arbitrary timer (in ms) */ | | 45 | #define EVFILT_TIMER 6U /* arbitrary timer (in ms) */ |
46 | #define EVFILT_SYSCOUNT 7U /* number of filters */ | | 46 | #define EVFILT_SYSCOUNT 7U /* number of filters */ |
47 | | | 47 | |
48 | struct kevent { | | 48 | struct kevent { |
49 | uintptr_t ident; /* identifier for this event */ | | 49 | uintptr_t ident; /* identifier for this event */ |
50 | uint32_t filter; /* filter for event */ | | 50 | uint32_t filter; /* filter for event */ |
51 | uint32_t flags; /* action flags for kqueue */ | | 51 | uint32_t flags; /* action flags for kqueue */ |
52 | uint32_t fflags; /* filter flag value */ | | 52 | uint32_t fflags; /* filter flag value */ |
53 | int64_t data; /* filter data value */ | | 53 | int64_t data; /* filter data value */ |
54 | intptr_t udata; /* opaque user data identifier */ | | 54 | intptr_t udata; /* opaque user data identifier */ |
55 | }; | | 55 | }; |
56 | | | 56 | |
57 | #define EV_SET(kevp, a, b, c, d, e, f) \ | | 57 | #define EV_SET(kevp, ident, filter, flags, fflags, data, udata) \ |
58 | EV_SET_((kevp), (a), (b), (c), (d), (e), __CAST(intptr_t, (f))) | | 58 | _EV_SET((kevp), __CAST(uintptr_t, (ident)), (filter), (flags), \ |
| | | 59 | (fflags), (data), __CAST(intptr_t, (udata))) |
59 | | | 60 | |
60 | static __inline void | | 61 | static __inline void |
61 | EV_SET_(struct kevent *_kevp, uintptr_t _ident, uint32_t _filter, | | 62 | _EV_SET(struct kevent *_kevp, uintptr_t _ident, uint32_t _filter, |
62 | uint32_t _flags, uint32_t _fflags, int64_t _data, intptr_t _udata) | | 63 | uint32_t _flags, uint32_t _fflags, int64_t _data, intptr_t _udata) |
63 | { | | 64 | { |
64 | _kevp->ident = _ident; | | 65 | _kevp->ident = _ident; |
65 | _kevp->filter = _filter; | | 66 | _kevp->filter = _filter; |
66 | _kevp->flags = _flags; | | 67 | _kevp->flags = _flags; |
67 | _kevp->fflags = _fflags; | | 68 | _kevp->fflags = _fflags; |
68 | _kevp->data = _data; | | 69 | _kevp->data = _data; |
69 | _kevp->udata = _udata; | | 70 | _kevp->udata = _udata; |
70 | } | | 71 | } |
71 | | | 72 | |
72 | /* actions */ | | 73 | /* actions */ |
73 | #define EV_ADD 0x0001U /* add event to kq (implies ENABLE) */ | | 74 | #define EV_ADD 0x0001U /* add event to kq (implies ENABLE) */ |
74 | #define EV_DELETE 0x0002U /* delete event from kq */ | | 75 | #define EV_DELETE 0x0002U /* delete event from kq */ |
75 | #define EV_ENABLE 0x0004U /* enable event */ | | 76 | #define EV_ENABLE 0x0004U /* enable event */ |