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