| 119 | |
| 120 | |
| 121 | static ngx_int_t |
| 122 | ngx_kqueue_init(ngx_cycle_t *cycle, ngx_msec_t timer) |
| 123 | { |
| 124 | ngx_kqueue_conf_t *kcf; |
| 125 | struct timespec ts; |
| 126 | #if (NGX_HAVE_TIMER_EVENT) |
| 127 | struct kevent kev; |
| 128 | #endif |
| 129 | |
| 130 | #if (NGX_HAVE_FSTACK) |
| 131 | if(ngx_ff_process == NGX_FF_PROCESS_NONE) { |
| 132 | return NGX_OK; |
| 133 | } |
| 134 | #endif |
| 135 | |
| 136 | kcf = ngx_event_get_conf(cycle->conf_ctx, ngx_kqueue_module); |
| 137 | |
| 138 | if (ngx_kqueue == -1) { |
| 139 | ngx_kqueue = kqueue(); |
| 140 | |
| 141 | if (ngx_kqueue == -1) { |
| 142 | ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, |
| 143 | "kqueue() failed"); |
| 144 | return NGX_ERROR; |
| 145 | } |
| 146 | |
| 147 | #ifdef EVFILT_USER |
| 148 | if (ngx_kqueue_notify_init(cycle->log) != NGX_OK) { |
| 149 | return NGX_ERROR; |
| 150 | } |
| 151 | #endif |
| 152 | } |
| 153 | |
| 154 | if (max_changes < kcf->changes) { |
| 155 | if (nchanges) { |
| 156 | ts.tv_sec = 0; |
| 157 | ts.tv_nsec = 0; |
| 158 | |
| 159 | if (kevent(ngx_kqueue, change_list, (int) nchanges, NULL, 0, &ts) |
| 160 | == -1) |
| 161 | { |
| 162 | ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, |
| 163 | "kevent() failed"); |
| 164 | return NGX_ERROR; |
| 165 | } |
| 166 | nchanges = 0; |
| 167 | } |
| 168 | |
| 169 | if (change_list) { |
| 170 | ngx_free(change_list); |
| 171 | } |
| 172 | |
| 173 | change_list = ngx_alloc(kcf->changes * sizeof(struct kevent), |
| 174 | cycle->log); |
| 175 | if (change_list == NULL) { |
| 176 | return NGX_ERROR; |
| 177 | } |
| 178 | } |
nothing calls this directly
no test coverage detected