comparison src/event/modules/ngx_kqueue_module.c @ 64:34d647deb1da

nginx-0.0.1-2003-03-04-09:33:48 import
author Igor Sysoev <igor@sysoev.ru>
date Tue, 04 Mar 2003 06:33:48 +0000
parents 36d2c25cc9bb
children 5a7d1aaa1618
comparison
equal deleted inserted replaced
63:36d2c25cc9bb 64:34d647deb1da
1 /* 1 /*
2 * Copyright (C) 2002 Igor Sysoev, http://sysoev.ru 2 * Copyright (C) 2002-2003 Igor Sysoev, http://sysoev.ru
3 */ 3 */
4 4
5 5
6 #include <ngx_config.h> 6 #include <ngx_config.h>
7 #include <ngx_core.h> 7 #include <ngx_core.h>
75 ngx_event_flags = NGX_HAVE_LEVEL_EVENT 75 ngx_event_flags = NGX_HAVE_LEVEL_EVENT
76 |NGX_HAVE_ONESHOT_EVENT 76 |NGX_HAVE_ONESHOT_EVENT
77 #if (HAVE_CLEAR_EVENT) 77 #if (HAVE_CLEAR_EVENT)
78 |NGX_HAVE_CLEAR_EVENT 78 |NGX_HAVE_CLEAR_EVENT
79 #endif 79 #endif
80 #if (HAVE_LOWAT_EVENT)
81 |NGX_HAVE_LOWAT_EVENT
82 #endif
80 |NGX_HAVE_KQUEUE_EVENT; 83 |NGX_HAVE_KQUEUE_EVENT;
81 84
82 ngx_write_chain_proc = ngx_freebsd_write_chain; 85 ngx_write_chain_proc = ngx_freebsd_write_chain;
83 86
84 #endif 87 #endif
85 88
86 #endif 89 #endif
87 90
88 return NGX_OK; 91 return NGX_OK;
92 }
93
94
95 void ngx_kqueue_done(ngx_log_t *log)
96 {
97 if (close(kq) == -1) {
98 ngx_log_error(NGX_LOG_ALERT, log, ngx_errno, "kqueue close() failed");
99 }
89 } 100 }
90 101
91 102
92 int ngx_kqueue_add_event(ngx_event_t *ev, int event, u_int flags) 103 int ngx_kqueue_add_event(ngx_event_t *ev, int event, u_int flags)
93 { 104 {
171 } 182 }
172 183
173 change_list[nchanges].ident = c->fd; 184 change_list[nchanges].ident = c->fd;
174 change_list[nchanges].filter = filter; 185 change_list[nchanges].filter = filter;
175 change_list[nchanges].flags = flags; 186 change_list[nchanges].flags = flags;
187 change_list[nchanges].udata = ev;
188
189 #if (HAVE_LOWAT_EVENT)
190
191 if ((flags & EV_ADD) && ev->lowat > 0) {
192 change_list[nchanges].fflags = NOTE_LOWAT;
193 change_list[nchanges].data = ev->lowat;
194
195 } else {
196 change_list[nchanges].fflags = 0;
197 change_list[nchanges].data = 0;
198 }
199
200 #else
201
176 change_list[nchanges].fflags = 0; 202 change_list[nchanges].fflags = 0;
177 change_list[nchanges].data = 0; 203 change_list[nchanges].data = 0;
178 change_list[nchanges].udata = ev; 204
205 #endif
179 206
180 ev->index = nchanges; 207 ev->index = nchanges;
181 208
182 nchanges++; 209 nchanges++;
183 210