Sat Oct 31 14:55:53 2020 UTC ()
Add an array of filter names.


(christos)
diff -r1.39 -r1.40 src/sys/sys/event.h

cvs diff -r1.39 -r1.40 src/sys/sys/event.h (expand / switch to unified diff)

--- src/sys/sys/event.h 2020/10/31 01:08:32 1.39
+++ src/sys/sys/event.h 2020/10/31 14:55:52 1.40
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: event.h,v 1.39 2020/10/31 01:08:32 christos Exp $ */ 1/* $NetBSD: event.h,v 1.40 2020/10/31 14:55:52 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.
@@ -37,26 +37,40 @@ @@ -37,26 +37,40 @@
37#include <sys/null.h> /* for NULL */ 37#include <sys/null.h> /* for NULL */
38 38
39#define EVFILT_READ 0U 39#define EVFILT_READ 0U
40#define EVFILT_WRITE 1U 40#define EVFILT_WRITE 1U
41#define EVFILT_AIO 2U /* attached to aio requests */ 41#define EVFILT_AIO 2U /* attached to aio requests */
42#define EVFILT_VNODE 3U /* attached to vnodes */ 42#define EVFILT_VNODE 3U /* attached to vnodes */
43#define EVFILT_PROC 4U /* attached to struct proc */ 43#define EVFILT_PROC 4U /* attached to struct proc */
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_FS 7U /* filesystem events */ 46#define EVFILT_FS 7U /* filesystem events */
47#define EVFILT_USER 8U /* user events */ 47#define EVFILT_USER 8U /* user events */
48#define EVFILT_SYSCOUNT 9U /* number of filters */ 48#define EVFILT_SYSCOUNT 9U /* number of filters */
49 49
 50#ifdef EVFILT_NAMES
 51static const char *evfiltnames[] = {
 52 "EVFILT_READ",
 53 "EVFILT_WRITE",
 54 "EVFILT_AIO",
 55 "EVFILT_VNODE",
 56 "EVFILT_PROC",
 57 "EVFILT_SIGNAL",
 58 "EVFILT_TIMER",
 59 "EVFILT_FS",
 60 "EVFILT_USER",
 61};
 62#endif
 63
50struct kevent { 64struct kevent {
51 uintptr_t ident; /* identifier for this event */ 65 uintptr_t ident; /* identifier for this event */
52 uint32_t filter; /* filter for event */ 66 uint32_t filter; /* filter for event */
53 uint32_t flags; /* action flags for kqueue */ 67 uint32_t flags; /* action flags for kqueue */
54 uint32_t fflags; /* filter flag value */ 68 uint32_t fflags; /* filter flag value */
55 int64_t data; /* filter data value */ 69 int64_t data; /* filter data value */
56 void *udata; /* opaque user data identifier */ 70 void *udata; /* opaque user data identifier */
57}; 71};
58 72
59static __inline void 73static __inline void
60_EV_SET(struct kevent *_kevp, uintptr_t _ident, uint32_t _filter, 74_EV_SET(struct kevent *_kevp, uintptr_t _ident, uint32_t _filter,
61 uint32_t _flags, uint32_t _fflags, int64_t _data, void *_udata) 75 uint32_t _flags, uint32_t _fflags, int64_t _data, void *_udata)
62{ 76{