@@ -77,105 +77,6 @@ int sysctlbyname(const char *name, void *oldp, size_t *oldlenp,
77
77
LINUX_PORT_ERROR ();
78
78
}
79
79
80
- #if 0
81
-
82
- // this code remains here purely for debugging purposes
83
- // ultimately it can be deleted
84
-
85
- DISPATCH_NOINLINE
86
- static const char *
87
- _evfiltstr (short filt )
88
- {
89
- switch (filt ) {
90
- #define _evfilt2 (f ) case (f): return #f
91
- _evfilt2 (EVFILT_READ );
92
- _evfilt2 (EVFILT_WRITE );
93
- _evfilt2 (EVFILT_AIO );
94
- _evfilt2 (EVFILT_VNODE );
95
- _evfilt2 (EVFILT_PROC );
96
- _evfilt2 (EVFILT_SIGNAL );
97
- _evfilt2 (EVFILT_TIMER );
98
- #if HAVE_MACH
99
- _evfilt2 (EVFILT_MACHPORT );
100
- _evfilt2 (DISPATCH_EVFILT_MACH_NOTIFICATION );
101
- #endif
102
- _evfilt2 (EVFILT_FS );
103
- _evfilt2 (EVFILT_USER );
104
- #ifdef EVFILT_VM
105
- _evfilt2 (EVFILT_VM );
106
- #endif
107
- #ifdef EVFILT_SOCK
108
- _evfilt2 (EVFILT_SOCK );
109
- #endif
110
- #ifdef EVFILT_MEMORYSTATUS
111
- _evfilt2 (EVFILT_MEMORYSTATUS );
112
- #endif
113
-
114
- _evfilt2 (DISPATCH_EVFILT_TIMER );
115
- _evfilt2 (DISPATCH_EVFILT_CUSTOM_ADD );
116
- _evfilt2 (DISPATCH_EVFILT_CUSTOM_OR );
117
- default :
118
- return "EVFILT_missing" ;
119
- }
120
- }
121
-
122
- #if 0
123
- #define dbg_kevent64 (fmt ...) do { printf(fmt); } while(0)
124
- #define dbg_cond_kevent64 (cond ,fmt ...) do { if (cond) printf(fmt); } while(0)
125
- #else
126
- #define dbg_kevent64 (fmt ...) do { } while(0)
127
- #define dbg_cond_kevent64 (cond ,fmt ...) do { } while(0)
128
- #endif
129
-
130
-
131
- int kevent64 (int kq , const struct kevent64_s * changelist_c , int nchanges , struct kevent64_s * eventlist ,
132
- int nevents , unsigned int flags , const struct timespec * timeout )
133
- {
134
- // Documentation is not really clear. Instrument the code to make sure
135
- // we can do type conversions right now between kevent64 <-> kevent, where as
136
- // kevent64 uses the ext[2] extension. So far we only see these used in the EVFILT_TIMER.
137
- // right now we do this in the way into kevent, we also have to assert that
138
- // no more than 1 change or one event is passed until we get a better handle of the
139
- // usage pattern of this. (Hubertus Franke)
140
-
141
- struct kevent64_s * changelist = (struct kevent64_s * ) changelist_c ; // so we can modify it
142
-
143
- #if 1
144
- // lets put some checks in here to make sure we do it all correct
145
- // we can only convert kevent64_s -> kevent for a single entry since kevent64_s has ext[0:1] extension
146
- if ((nchanges > 1 ) || (nevents > 1 ))
147
- LINUX_PORT_ERROR ();
148
- if (nchanges ) {
149
- dbg_kevent64 ("kevent64(%s,%x,%x): cl.ext[0,1]=%lx:%ld %lx:%ld cl.data=%lx:%ld\n" ,
150
- _evfiltstr (changelist -> filter ), changelist -> flags , changelist -> fflags ,
151
- changelist -> ext [0 ], changelist -> ext [0 ],
152
- changelist -> ext [1 ], changelist -> ext [1 ],
153
- changelist -> data , changelist -> data );
154
- if ((changelist -> filter == EVFILT_TIMER ) && (changelist -> fflags & NOTE_ABSOLUTE )) {
155
- // NOTE_ABSOLUTE is not recognized by the current kevent we need to convert this
156
- // into a relative. Consider fiddling with creating relative events instead (didn't work
157
- // on first attempt). We also ignore the LEEWAY. Finally we must convert from
158
- // NSECS to MSECS (might have to expand to deal with OTHER NOTE_xSECS flags
159
-
160
- //changelist->data -= _dispatch_get_nanoseconds();
161
- //changelist->data -= time(NULL) * NSEC_PER_SEC;
162
- dbg_kevent64 ("kevent64(%s,%x) data=%lx:%ld\n" ,
163
- _evfiltstr (changelist -> filter ),changelist -> fflags ,
164
- changelist -> data ,changelist -> data );
165
- //changelist->data /= 1000000UL;
166
- //if ((int64_t)(changelist->data) <= 0) changelist->data = 1; // for some reason time turns negative
167
- }
168
- }
169
- #endif
170
- // eventlist can not return more than 1 event type coersion doesn't work
171
- int rc = kevent (kq ,(struct kevent * ) changelist ,nchanges ,(struct kevent * ) eventlist ,nevents ,timeout );
172
- if (rc > 1 )
173
- LINUX_PORT_ERROR ();
174
- return rc ;
175
- }
176
-
177
- #endif
178
-
179
80
/*
180
81
* Stubbed out static data
181
82
*/
0 commit comments