Mercurial > hg > nginx
annotate src/event/modules/ngx_win32_poll_module.c @ 9266:93bbb9fbf30d
Fixed compilation on NetBSD 10.
NetBSD 10 changed struct kevent's udata type from "intptr_t" to "void *",
similarly to how it is defined on other systems. This breaks compilation,
since intptr_t is assumed on NetBSD.
Fix is to limit special intptr_t handling to NetBSD versions before 10.0.
To simplify testing, relevant definitions are moved from configure to code
(which seems to be the right thing anyway).
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 06 May 2024 00:07:33 +0300 |
parents | efd71d49bde0 |
children |
rev | line source |
---|---|
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
1 |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
2 /* |
444
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
441
diff
changeset
|
3 * Copyright (C) Igor Sysoev |
7444
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7442
diff
changeset
|
4 * Copyright (C) Maxim Dounin |
4412 | 5 * Copyright (C) Nginx, Inc. |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
6 */ |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
7 |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
8 |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
9 #include <ngx_config.h> |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
10 #include <ngx_core.h> |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
11 #include <ngx_event.h> |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
12 |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
13 |
563 | 14 static ngx_int_t ngx_poll_init(ngx_cycle_t *cycle, ngx_msec_t timer); |
114
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
107
diff
changeset
|
15 static void ngx_poll_done(ngx_cycle_t *cycle); |
1354
f69d1aab6a0f
make 64-bit ngx_int_t on 64-bit platforms
Igor Sysoev <igor@sysoev.ru>
parents:
708
diff
changeset
|
16 static ngx_int_t ngx_poll_add_event(ngx_event_t *ev, ngx_int_t event, |
f69d1aab6a0f
make 64-bit ngx_int_t on 64-bit platforms
Igor Sysoev <igor@sysoev.ru>
parents:
708
diff
changeset
|
17 ngx_uint_t flags); |
f69d1aab6a0f
make 64-bit ngx_int_t on 64-bit platforms
Igor Sysoev <igor@sysoev.ru>
parents:
708
diff
changeset
|
18 static ngx_int_t ngx_poll_del_event(ngx_event_t *ev, ngx_int_t event, |
f69d1aab6a0f
make 64-bit ngx_int_t on 64-bit platforms
Igor Sysoev <igor@sysoev.ru>
parents:
708
diff
changeset
|
19 ngx_uint_t flags); |
563 | 20 static ngx_int_t ngx_poll_process_events(ngx_cycle_t *cycle, ngx_msec_t timer, |
21 ngx_uint_t flags); | |
381
02a511569afb
nginx-0.0.7-2004-07-07-19:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
380
diff
changeset
|
22 static char *ngx_poll_init_conf(ngx_cycle_t *cycle, void *conf); |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
23 |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
24 |
7444
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7442
diff
changeset
|
25 static struct pollfd *event_list; |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7442
diff
changeset
|
26 static ngx_connection_t **event_index; |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7442
diff
changeset
|
27 static ngx_uint_t nevents; |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
28 |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
29 |
6922
a72886067bbb
Added missing static specifiers.
Eran Kornblau <erankor@gmail.com>
parents:
6806
diff
changeset
|
30 static ngx_str_t poll_name = ngx_string("poll"); |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
31 |
6922
a72886067bbb
Added missing static specifiers.
Eran Kornblau <erankor@gmail.com>
parents:
6806
diff
changeset
|
32 static ngx_event_module_t ngx_poll_module_ctx = { |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
33 &poll_name, |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
34 NULL, /* create configuration */ |
381
02a511569afb
nginx-0.0.7-2004-07-07-19:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
380
diff
changeset
|
35 ngx_poll_init_conf, /* init configuration */ |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
36 |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
37 { |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
38 ngx_poll_add_event, /* add an event */ |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
39 ngx_poll_del_event, /* delete an event */ |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
40 ngx_poll_add_event, /* enable an event */ |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
41 ngx_poll_del_event, /* disable an event */ |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
42 NULL, /* add an connection */ |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
43 NULL, /* delete an connection */ |
6018
466bd63b63d1
Thread pools implementation.
Valentin Bartenev <vbart@nginx.com>
parents:
6016
diff
changeset
|
44 NULL, /* trigger a notify */ |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
45 ngx_poll_process_events, /* process the events */ |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
46 ngx_poll_init, /* init the events */ |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
47 ngx_poll_done /* done the events */ |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
48 } |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
49 |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
50 }; |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
51 |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
52 ngx_module_t ngx_poll_module = { |
509 | 53 NGX_MODULE_V1, |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
54 &ngx_poll_module_ctx, /* module context */ |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
55 NULL, /* module directives */ |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
92
diff
changeset
|
56 NGX_EVENT_MODULE, /* module type */ |
541 | 57 NULL, /* init master */ |
114
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
107
diff
changeset
|
58 NULL, /* init module */ |
541 | 59 NULL, /* init process */ |
60 NULL, /* init thread */ | |
61 NULL, /* exit thread */ | |
62 NULL, /* exit process */ | |
63 NULL, /* exit master */ | |
64 NGX_MODULE_V1_PADDING | |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
65 }; |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
66 |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
67 |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
68 |
499 | 69 static ngx_int_t |
563 | 70 ngx_poll_init(ngx_cycle_t *cycle, ngx_msec_t timer) |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
71 { |
7444
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7442
diff
changeset
|
72 struct pollfd *list; |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7442
diff
changeset
|
73 ngx_connection_t **index; |
114
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
107
diff
changeset
|
74 |
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
107
diff
changeset
|
75 if (event_list == NULL) { |
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
107
diff
changeset
|
76 nevents = 0; |
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
107
diff
changeset
|
77 } |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
78 |
3358
f94e8ff65aa2
add NGX_PROCESS_HELPER process status
Igor Sysoev <igor@sysoev.ru>
parents:
3043
diff
changeset
|
79 if (ngx_process >= NGX_PROCESS_WORKER |
314
d71c87d11b16
nginx-0.0.3-2004-04-14-09:57:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
313
diff
changeset
|
80 || cycle->old_cycle == NULL |
114
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
107
diff
changeset
|
81 || cycle->old_cycle->connection_n < cycle->connection_n) |
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
107
diff
changeset
|
82 { |
501 | 83 list = ngx_alloc(sizeof(struct pollfd) * cycle->connection_n, |
84 cycle->log); | |
85 if (list == NULL) { | |
86 return NGX_ERROR; | |
87 } | |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
88 |
114
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
107
diff
changeset
|
89 if (event_list) { |
7442
e0e636ab10be
Events: fixed copying of old events in poll init.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6922
diff
changeset
|
90 ngx_memcpy(list, event_list, sizeof(struct pollfd) * nevents); |
114
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
107
diff
changeset
|
91 ngx_free(event_list); |
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
107
diff
changeset
|
92 } |
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
107
diff
changeset
|
93 |
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
107
diff
changeset
|
94 event_list = list; |
7444
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7442
diff
changeset
|
95 |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7442
diff
changeset
|
96 index = ngx_alloc(sizeof(ngx_connection_t *) * cycle->connection_n, |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7442
diff
changeset
|
97 cycle->log); |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7442
diff
changeset
|
98 if (index == NULL) { |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7442
diff
changeset
|
99 return NGX_ERROR; |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7442
diff
changeset
|
100 } |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7442
diff
changeset
|
101 |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7442
diff
changeset
|
102 if (event_index) { |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7442
diff
changeset
|
103 ngx_memcpy(index, event_index, |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7442
diff
changeset
|
104 sizeof(ngx_connection_t *) * nevents); |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7442
diff
changeset
|
105 ngx_free(event_index); |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7442
diff
changeset
|
106 } |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7442
diff
changeset
|
107 |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7442
diff
changeset
|
108 event_index = index; |
114
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
107
diff
changeset
|
109 } |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
110 |
114
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
107
diff
changeset
|
111 ngx_io = ngx_os_io; |
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
107
diff
changeset
|
112 |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
113 ngx_event_actions = ngx_poll_module_ctx.actions; |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
114 |
7444
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7442
diff
changeset
|
115 ngx_event_flags = NGX_USE_LEVEL_EVENT; |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
116 |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
117 return NGX_OK; |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
118 } |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
119 |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
120 |
499 | 121 static void |
122 ngx_poll_done(ngx_cycle_t *cycle) | |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
123 { |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
124 ngx_free(event_list); |
7444
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7442
diff
changeset
|
125 ngx_free(event_index); |
114
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
107
diff
changeset
|
126 |
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
107
diff
changeset
|
127 event_list = NULL; |
7444
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7442
diff
changeset
|
128 event_index = NULL; |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
129 } |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
130 |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
131 |
499 | 132 static ngx_int_t |
1354
f69d1aab6a0f
make 64-bit ngx_int_t on 64-bit platforms
Igor Sysoev <igor@sysoev.ru>
parents:
708
diff
changeset
|
133 ngx_poll_add_event(ngx_event_t *ev, ngx_int_t event, ngx_uint_t flags) |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
134 { |
39
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
38
diff
changeset
|
135 ngx_event_t *e; |
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
38
diff
changeset
|
136 ngx_connection_t *c; |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
137 |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
138 c = ev->data; |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
139 |
315
39b6f2df45c0
nginx-0.0.3-2004-04-14-21:44:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
314
diff
changeset
|
140 ev->active = 1; |
39b6f2df45c0
nginx-0.0.3-2004-04-14-21:44:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
314
diff
changeset
|
141 |
250
1903c6821958
nginx-0.0.2-2004-02-03-23:27:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
248
diff
changeset
|
142 if (ev->index != NGX_INVALID_INDEX) { |
1903c6821958
nginx-0.0.2-2004-02-03-23:27:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
248
diff
changeset
|
143 ngx_log_error(NGX_LOG_ALERT, ev->log, 0, |
1354
f69d1aab6a0f
make 64-bit ngx_int_t on 64-bit platforms
Igor Sysoev <igor@sysoev.ru>
parents:
708
diff
changeset
|
144 "poll event fd:%d ev:%i is already set", c->fd, event); |
250
1903c6821958
nginx-0.0.2-2004-02-03-23:27:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
248
diff
changeset
|
145 return NGX_OK; |
1903c6821958
nginx-0.0.2-2004-02-03-23:27:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
248
diff
changeset
|
146 } |
1903c6821958
nginx-0.0.2-2004-02-03-23:27:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
248
diff
changeset
|
147 |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
148 if (event == NGX_READ_EVENT) { |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
149 e = c->write; |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
150 #if (NGX_READ_EVENT != POLLIN) |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
151 event = POLLIN; |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
152 #endif |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
153 |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
154 } else { |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
155 e = c->read; |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
156 #if (NGX_WRITE_EVENT != POLLOUT) |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
157 event = POLLOUT; |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
158 #endif |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
159 } |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
160 |
245
e6c005b66b3a
nginx-0.0.1-2004-01-30-00:45:01 import
Igor Sysoev <igor@sysoev.ru>
parents:
230
diff
changeset
|
161 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, ev->log, 0, |
1354
f69d1aab6a0f
make 64-bit ngx_int_t on 64-bit platforms
Igor Sysoev <igor@sysoev.ru>
parents:
708
diff
changeset
|
162 "poll add event: fd:%d ev:%i", c->fd, event); |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
163 |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
164 if (e == NULL || e->index == NGX_INVALID_INDEX) { |
7444
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7442
diff
changeset
|
165 |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
166 event_list[nevents].fd = c->fd; |
1354
f69d1aab6a0f
make 64-bit ngx_int_t on 64-bit platforms
Igor Sysoev <igor@sysoev.ru>
parents:
708
diff
changeset
|
167 event_list[nevents].events = (short) event; |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
168 event_list[nevents].revents = 0; |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
169 |
7444
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7442
diff
changeset
|
170 event_index[nevents] = c; |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7442
diff
changeset
|
171 |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
172 ev->index = nevents; |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
173 nevents++; |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
174 |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
175 } else { |
250
1903c6821958
nginx-0.0.2-2004-02-03-23:27:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
248
diff
changeset
|
176 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, ev->log, 0, |
1354
f69d1aab6a0f
make 64-bit ngx_int_t on 64-bit platforms
Igor Sysoev <igor@sysoev.ru>
parents:
708
diff
changeset
|
177 "poll add index: %i", e->index); |
250
1903c6821958
nginx-0.0.2-2004-02-03-23:27:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
248
diff
changeset
|
178 |
1354
f69d1aab6a0f
make 64-bit ngx_int_t on 64-bit platforms
Igor Sysoev <igor@sysoev.ru>
parents:
708
diff
changeset
|
179 event_list[e->index].events |= (short) event; |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
180 ev->index = e->index; |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
181 } |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
182 |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
183 return NGX_OK; |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
184 } |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
185 |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
186 |
499 | 187 static ngx_int_t |
1354
f69d1aab6a0f
make 64-bit ngx_int_t on 64-bit platforms
Igor Sysoev <igor@sysoev.ru>
parents:
708
diff
changeset
|
188 ngx_poll_del_event(ngx_event_t *ev, ngx_int_t event, ngx_uint_t flags) |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
189 { |
563 | 190 ngx_event_t *e; |
191 ngx_connection_t *c; | |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
192 |
252
84b1c672ec5a
nginx-0.0.2-2004-02-05-19:58:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
251
diff
changeset
|
193 c = ev->data; |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
194 |
313
98f1a8028067
nginx-0.0.3-2004-04-13-19:08:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
195 ev->active = 0; |
98f1a8028067
nginx-0.0.3-2004-04-13-19:08:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
196 |
39
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
38
diff
changeset
|
197 if (ev->index == NGX_INVALID_INDEX) { |
252
84b1c672ec5a
nginx-0.0.2-2004-02-05-19:58:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
251
diff
changeset
|
198 ngx_log_error(NGX_LOG_ALERT, ev->log, 0, |
1354
f69d1aab6a0f
make 64-bit ngx_int_t on 64-bit platforms
Igor Sysoev <igor@sysoev.ru>
parents:
708
diff
changeset
|
199 "poll event fd:%d ev:%i is already deleted", |
252
84b1c672ec5a
nginx-0.0.2-2004-02-05-19:58:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
251
diff
changeset
|
200 c->fd, event); |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
201 return NGX_OK; |
39
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
38
diff
changeset
|
202 } |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
203 |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
204 if (event == NGX_READ_EVENT) { |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
205 e = c->write; |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
206 #if (NGX_READ_EVENT != POLLIN) |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
207 event = POLLIN; |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
208 #endif |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
209 |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
210 } else { |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
211 e = c->read; |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
212 #if (NGX_WRITE_EVENT != POLLOUT) |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
213 event = POLLOUT; |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
214 #endif |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
215 } |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
216 |
245
e6c005b66b3a
nginx-0.0.1-2004-01-30-00:45:01 import
Igor Sysoev <igor@sysoev.ru>
parents:
230
diff
changeset
|
217 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, ev->log, 0, |
1354
f69d1aab6a0f
make 64-bit ngx_int_t on 64-bit platforms
Igor Sysoev <igor@sysoev.ru>
parents:
708
diff
changeset
|
218 "poll del event: fd:%d ev:%i", c->fd, event); |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
219 |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
220 if (e == NULL || e->index == NGX_INVALID_INDEX) { |
250
1903c6821958
nginx-0.0.2-2004-02-03-23:27:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
248
diff
changeset
|
221 nevents--; |
1903c6821958
nginx-0.0.2-2004-02-03-23:27:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
248
diff
changeset
|
222 |
5802
a4e9c7e6e062
Events: changed nevents type to unsigned in poll module.
Yves Crespin <yves.crespin@e-quartz.fr>
parents:
5016
diff
changeset
|
223 if (ev->index < nevents) { |
259
d30f2c39caae
nginx-0.0.2-2004-02-12-23:57:10 import
Igor Sysoev <igor@sysoev.ru>
parents:
253
diff
changeset
|
224 |
d30f2c39caae
nginx-0.0.2-2004-02-12-23:57:10 import
Igor Sysoev <igor@sysoev.ru>
parents:
253
diff
changeset
|
225 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, ev->log, 0, |
1354
f69d1aab6a0f
make 64-bit ngx_int_t on 64-bit platforms
Igor Sysoev <igor@sysoev.ru>
parents:
708
diff
changeset
|
226 "index: copy event %ui to %i", nevents, ev->index); |
259
d30f2c39caae
nginx-0.0.2-2004-02-12-23:57:10 import
Igor Sysoev <igor@sysoev.ru>
parents:
253
diff
changeset
|
227 |
37
9fe40e51d4a3
nginx-0.0.1-2002-12-23-21:22:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
228 event_list[ev->index] = event_list[nevents]; |
7444
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7442
diff
changeset
|
229 event_index[ev->index] = event_index[nevents]; |
252
84b1c672ec5a
nginx-0.0.2-2004-02-05-19:58:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
251
diff
changeset
|
230 |
7444
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7442
diff
changeset
|
231 c = event_index[ev->index]; |
252
84b1c672ec5a
nginx-0.0.2-2004-02-05-19:58:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
251
diff
changeset
|
232 |
7444
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7442
diff
changeset
|
233 if (c->fd == (ngx_socket_t) -1) { |
252
84b1c672ec5a
nginx-0.0.2-2004-02-05-19:58:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
251
diff
changeset
|
234 ngx_log_error(NGX_LOG_ALERT, ev->log, 0, |
84b1c672ec5a
nginx-0.0.2-2004-02-05-19:58:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
251
diff
changeset
|
235 "unexpected last event"); |
84b1c672ec5a
nginx-0.0.2-2004-02-05-19:58:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
251
diff
changeset
|
236 |
84b1c672ec5a
nginx-0.0.2-2004-02-05-19:58:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
251
diff
changeset
|
237 } else { |
5802
a4e9c7e6e062
Events: changed nevents type to unsigned in poll module.
Yves Crespin <yves.crespin@e-quartz.fr>
parents:
5016
diff
changeset
|
238 if (c->read->index == nevents) { |
252
84b1c672ec5a
nginx-0.0.2-2004-02-05-19:58:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
251
diff
changeset
|
239 c->read->index = ev->index; |
259
d30f2c39caae
nginx-0.0.2-2004-02-12-23:57:10 import
Igor Sysoev <igor@sysoev.ru>
parents:
253
diff
changeset
|
240 } |
252
84b1c672ec5a
nginx-0.0.2-2004-02-05-19:58:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
251
diff
changeset
|
241 |
5802
a4e9c7e6e062
Events: changed nevents type to unsigned in poll module.
Yves Crespin <yves.crespin@e-quartz.fr>
parents:
5016
diff
changeset
|
242 if (c->write->index == nevents) { |
259
d30f2c39caae
nginx-0.0.2-2004-02-12-23:57:10 import
Igor Sysoev <igor@sysoev.ru>
parents:
253
diff
changeset
|
243 c->write->index = ev->index; |
252
84b1c672ec5a
nginx-0.0.2-2004-02-05-19:58:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
251
diff
changeset
|
244 } |
84b1c672ec5a
nginx-0.0.2-2004-02-05-19:58:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
251
diff
changeset
|
245 } |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
246 } |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
247 |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
248 } else { |
250
1903c6821958
nginx-0.0.2-2004-02-03-23:27:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
248
diff
changeset
|
249 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, ev->log, 0, |
1354
f69d1aab6a0f
make 64-bit ngx_int_t on 64-bit platforms
Igor Sysoev <igor@sysoev.ru>
parents:
708
diff
changeset
|
250 "poll del index: %i", e->index); |
250
1903c6821958
nginx-0.0.2-2004-02-03-23:27:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
248
diff
changeset
|
251 |
1354
f69d1aab6a0f
make 64-bit ngx_int_t on 64-bit platforms
Igor Sysoev <igor@sysoev.ru>
parents:
708
diff
changeset
|
252 event_list[e->index].events &= (short) ~event; |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
253 } |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
254 |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
255 ev->index = NGX_INVALID_INDEX; |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
256 |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
257 return NGX_OK; |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
258 } |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
259 |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
260 |
499 | 261 static ngx_int_t |
563 | 262 ngx_poll_process_events(ngx_cycle_t *cycle, ngx_msec_t timer, ngx_uint_t flags) |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
263 { |
483 | 264 int ready, revents; |
557 | 265 ngx_err_t err; |
7444
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7442
diff
changeset
|
266 ngx_uint_t i, found; |
5821
3f5f0ab59b35
Events: processing of posted events changed from LIFO to FIFO.
Valentin Bartenev <vbart@nginx.com>
parents:
5820
diff
changeset
|
267 ngx_event_t *ev; |
3f5f0ab59b35
Events: processing of posted events changed from LIFO to FIFO.
Valentin Bartenev <vbart@nginx.com>
parents:
5820
diff
changeset
|
268 ngx_queue_t *queue; |
114
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
107
diff
changeset
|
269 ngx_connection_t *c; |
356
2e3cbc1bbe3c
nginx-0.0.7-2004-06-16-19:32:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
327
diff
changeset
|
270 |
2e3cbc1bbe3c
nginx-0.0.7-2004-06-16-19:32:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
327
diff
changeset
|
271 /* NGX_TIMER_INFINITE == INFTIM */ |
2e3cbc1bbe3c
nginx-0.0.7-2004-06-16-19:32:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
327
diff
changeset
|
272 |
252
84b1c672ec5a
nginx-0.0.2-2004-02-05-19:58:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
251
diff
changeset
|
273 #if (NGX_DEBUG0) |
323
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
274 if (cycle->log->log_level & NGX_LOG_DEBUG_ALL) { |
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
275 for (i = 0; i < nevents; i++) { |
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
276 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, cycle->log, 0, |
5803
ecfc601f1225
Events: format specifier fixes.
Yves Crespin <yves.crespin@e-quartz.fr>
parents:
5802
diff
changeset
|
277 "poll: %ui: fd:%d ev:%04Xd", |
323
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
278 i, event_list[i].fd, event_list[i].events); |
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
279 } |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
280 } |
313
98f1a8028067
nginx-0.0.3-2004-04-13-19:08:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
281 #endif |
98f1a8028067
nginx-0.0.3-2004-04-13-19:08:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
282 |
557 | 283 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0, "poll timer: %M", timer); |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
284 |
7444
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7442
diff
changeset
|
285 ready = WSAPoll(event_list, (u_int) nevents, (int) timer); |
114
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
107
diff
changeset
|
286 |
3043 | 287 err = (ready == -1) ? ngx_errno : 0; |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
288 |
3473
0299cf5856fc
do not update time in the timer signal handler,
Igor Sysoev <igor@sysoev.ru>
parents:
3358
diff
changeset
|
289 if (flags & NGX_UPDATE_TIME || ngx_event_timer_alarm) { |
3475
ab353d7dc182
*) introduce ngx_time_sigsafe_update() to update the error log time only
Igor Sysoev <igor@sysoev.ru>
parents:
3474
diff
changeset
|
290 ngx_time_update(); |
563 | 291 } |
114
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
107
diff
changeset
|
292 |
305
4b1a3a4acc60
nginx-0.0.3-2004-04-02-19:13:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
261
diff
changeset
|
293 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, cycle->log, 0, |
5803
ecfc601f1225
Events: format specifier fixes.
Yves Crespin <yves.crespin@e-quartz.fr>
parents:
5802
diff
changeset
|
294 "poll ready %d of %ui", ready, nevents); |
246
6753e8cdaa2c
nginx-0.0.1-2004-01-30-20:39:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
245
diff
changeset
|
295 |
6753e8cdaa2c
nginx-0.0.1-2004-01-30-20:39:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
245
diff
changeset
|
296 if (err) { |
7444
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7442
diff
changeset
|
297 ngx_log_error(NGX_LOG_ALERT, cycle->log, err, "WSAPoll() failed"); |
246
6753e8cdaa2c
nginx-0.0.1-2004-01-30-20:39:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
245
diff
changeset
|
298 return NGX_ERROR; |
6753e8cdaa2c
nginx-0.0.1-2004-01-30-20:39:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
245
diff
changeset
|
299 } |
6753e8cdaa2c
nginx-0.0.1-2004-01-30-20:39:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
245
diff
changeset
|
300 |
567 | 301 if (ready == 0) { |
302 if (timer != NGX_TIMER_INFINITE) { | |
303 return NGX_OK; | |
304 } | |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
305 |
567 | 306 ngx_log_error(NGX_LOG_ALERT, cycle->log, 0, |
7444
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7442
diff
changeset
|
307 "WSAPoll() returned no events without timeout"); |
567 | 308 return NGX_ERROR; |
313
98f1a8028067
nginx-0.0.3-2004-04-13-19:08:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
309 } |
98f1a8028067
nginx-0.0.3-2004-04-13-19:08:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
310 |
38
2ffaa35fba42
nginx-0.0.1-2002-12-24-10:09:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
37
diff
changeset
|
311 for (i = 0; i < nevents && ready; i++) { |
247
008276b9e061
nginx-0.0.1-2004-02-01-11:10:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
246
diff
changeset
|
312 |
483 | 313 revents = event_list[i].revents; |
314 | |
563 | 315 #if 1 |
305
4b1a3a4acc60
nginx-0.0.3-2004-04-02-19:13:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
261
diff
changeset
|
316 ngx_log_debug4(NGX_LOG_DEBUG_EVENT, cycle->log, 0, |
5803
ecfc601f1225
Events: format specifier fixes.
Yves Crespin <yves.crespin@e-quartz.fr>
parents:
5802
diff
changeset
|
317 "poll: %ui: fd:%d ev:%04Xd rev:%04Xd", |
483 | 318 i, event_list[i].fd, event_list[i].events, revents); |
252
84b1c672ec5a
nginx-0.0.2-2004-02-05-19:58:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
251
diff
changeset
|
319 #else |
483 | 320 if (revents) { |
305
4b1a3a4acc60
nginx-0.0.3-2004-04-02-19:13:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
261
diff
changeset
|
321 ngx_log_debug4(NGX_LOG_DEBUG_EVENT, cycle->log, 0, |
5803
ecfc601f1225
Events: format specifier fixes.
Yves Crespin <yves.crespin@e-quartz.fr>
parents:
5802
diff
changeset
|
322 "poll: %ui: fd:%d ev:%04Xd rev:%04Xd", |
483 | 323 i, event_list[i].fd, event_list[i].events, revents); |
252
84b1c672ec5a
nginx-0.0.2-2004-02-05-19:58:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
251
diff
changeset
|
324 } |
84b1c672ec5a
nginx-0.0.2-2004-02-05-19:58:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
251
diff
changeset
|
325 #endif |
247
008276b9e061
nginx-0.0.1-2004-02-01-11:10:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
246
diff
changeset
|
326 |
483 | 327 if (revents & POLLNVAL) { |
305
4b1a3a4acc60
nginx-0.0.3-2004-04-02-19:13:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
261
diff
changeset
|
328 ngx_log_error(NGX_LOG_ALERT, cycle->log, 0, |
461 | 329 "poll() error fd:%d ev:%04Xd rev:%04Xd", |
483 | 330 event_list[i].fd, event_list[i].events, revents); |
247
008276b9e061
nginx-0.0.1-2004-02-01-11:10:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
246
diff
changeset
|
331 } |
008276b9e061
nginx-0.0.1-2004-02-01-11:10:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
246
diff
changeset
|
332 |
483 | 333 if (revents & ~(POLLIN|POLLOUT|POLLERR|POLLHUP|POLLNVAL)) { |
305
4b1a3a4acc60
nginx-0.0.3-2004-04-02-19:13:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
261
diff
changeset
|
334 ngx_log_error(NGX_LOG_ALERT, cycle->log, 0, |
461 | 335 "strange poll() events fd:%d ev:%04Xd rev:%04Xd", |
483 | 336 event_list[i].fd, event_list[i].events, revents); |
247
008276b9e061
nginx-0.0.1-2004-02-01-11:10:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
246
diff
changeset
|
337 } |
008276b9e061
nginx-0.0.1-2004-02-01-11:10:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
246
diff
changeset
|
338 |
7444
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7442
diff
changeset
|
339 if (event_list[i].fd == (ngx_socket_t) -1) { |
313
98f1a8028067
nginx-0.0.3-2004-04-13-19:08:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
340 /* |
314
d71c87d11b16
nginx-0.0.3-2004-04-14-09:57:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
313
diff
changeset
|
341 * the disabled event, a workaround for our possible bug, |
d71c87d11b16
nginx-0.0.3-2004-04-14-09:57:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
313
diff
changeset
|
342 * see the comment below |
313
98f1a8028067
nginx-0.0.3-2004-04-13-19:08:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
343 */ |
251
c31c40540318
nginx-0.0.2-2004-02-04-23:30:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
250
diff
changeset
|
344 continue; |
c31c40540318
nginx-0.0.2-2004-02-04-23:30:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
250
diff
changeset
|
345 } |
c31c40540318
nginx-0.0.2-2004-02-04-23:30:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
250
diff
changeset
|
346 |
7444
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7442
diff
changeset
|
347 c = event_index[i]; |
114
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
107
diff
changeset
|
348 |
7444
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7442
diff
changeset
|
349 if (c->fd == (ngx_socket_t) -1) { |
305
4b1a3a4acc60
nginx-0.0.3-2004-04-02-19:13:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
261
diff
changeset
|
350 ngx_log_error(NGX_LOG_ALERT, cycle->log, 0, "unexpected event"); |
250
1903c6821958
nginx-0.0.2-2004-02-03-23:27:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
248
diff
changeset
|
351 |
1903c6821958
nginx-0.0.2-2004-02-03-23:27:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
248
diff
changeset
|
352 /* |
1903c6821958
nginx-0.0.2-2004-02-03-23:27:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
248
diff
changeset
|
353 * it is certainly our fault and it should be investigated, |
1903c6821958
nginx-0.0.2-2004-02-03-23:27:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
248
diff
changeset
|
354 * in the meantime we disable this event to avoid a CPU spinning |
1903c6821958
nginx-0.0.2-2004-02-03-23:27:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
248
diff
changeset
|
355 */ |
1903c6821958
nginx-0.0.2-2004-02-03-23:27:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
248
diff
changeset
|
356 |
1903c6821958
nginx-0.0.2-2004-02-03-23:27:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
248
diff
changeset
|
357 if (i == nevents - 1) { |
1903c6821958
nginx-0.0.2-2004-02-03-23:27:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
248
diff
changeset
|
358 nevents--; |
1903c6821958
nginx-0.0.2-2004-02-03-23:27:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
248
diff
changeset
|
359 } else { |
7444
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7442
diff
changeset
|
360 event_list[i].fd = (ngx_socket_t) -1; |
250
1903c6821958
nginx-0.0.2-2004-02-03-23:27:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
248
diff
changeset
|
361 } |
1903c6821958
nginx-0.0.2-2004-02-03-23:27:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
248
diff
changeset
|
362 |
247
008276b9e061
nginx-0.0.1-2004-02-01-11:10:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
246
diff
changeset
|
363 continue; |
114
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
107
diff
changeset
|
364 } |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
365 |
6806
75dbab4ea930
Events: improved error event handling for UDP sockets.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
6112
diff
changeset
|
366 if (revents & (POLLERR|POLLHUP|POLLNVAL)) { |
75dbab4ea930
Events: improved error event handling for UDP sockets.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
6112
diff
changeset
|
367 |
483 | 368 /* |
6806
75dbab4ea930
Events: improved error event handling for UDP sockets.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
6112
diff
changeset
|
369 * if the error events were returned, add POLLIN and POLLOUT |
75dbab4ea930
Events: improved error event handling for UDP sockets.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
6112
diff
changeset
|
370 * to handle the events at least in one active handler |
483 | 371 */ |
372 | |
373 revents |= POLLIN|POLLOUT; | |
374 } | |
375 | |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
376 found = 0; |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
377 |
5016
4406168861e8
Events: fixed null pointer dereference with resolver and poll.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
378 if ((revents & POLLIN) && c->read->active) { |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
379 found = 1; |
313
98f1a8028067
nginx-0.0.3-2004-04-13-19:08:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
380 |
98f1a8028067
nginx-0.0.3-2004-04-13-19:08:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
381 ev = c->read; |
5820
3377f9459e99
Events: removed broken thread support from posted events.
Valentin Bartenev <vbart@nginx.com>
parents:
5804
diff
changeset
|
382 ev->ready = 1; |
7583
efd71d49bde0
Events: available bytes calculation via ioctl(FIONREAD).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7444
diff
changeset
|
383 ev->available = -1; |
563 | 384 |
5820
3377f9459e99
Events: removed broken thread support from posted events.
Valentin Bartenev <vbart@nginx.com>
parents:
5804
diff
changeset
|
385 queue = ev->accept ? &ngx_posted_accept_events |
3377f9459e99
Events: removed broken thread support from posted events.
Valentin Bartenev <vbart@nginx.com>
parents:
5804
diff
changeset
|
386 : &ngx_posted_events; |
313
98f1a8028067
nginx-0.0.3-2004-04-13-19:08:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
387 |
5820
3377f9459e99
Events: removed broken thread support from posted events.
Valentin Bartenev <vbart@nginx.com>
parents:
5804
diff
changeset
|
388 ngx_post_event(ev, queue); |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
389 } |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
390 |
5016
4406168861e8
Events: fixed null pointer dereference with resolver and poll.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
391 if ((revents & POLLOUT) && c->write->active) { |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
392 found = 1; |
563 | 393 |
5820
3377f9459e99
Events: removed broken thread support from posted events.
Valentin Bartenev <vbart@nginx.com>
parents:
5804
diff
changeset
|
394 ev = c->write; |
3377f9459e99
Events: removed broken thread support from posted events.
Valentin Bartenev <vbart@nginx.com>
parents:
5804
diff
changeset
|
395 ev->ready = 1; |
313
98f1a8028067
nginx-0.0.3-2004-04-13-19:08:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
396 |
5820
3377f9459e99
Events: removed broken thread support from posted events.
Valentin Bartenev <vbart@nginx.com>
parents:
5804
diff
changeset
|
397 ngx_post_event(ev, &ngx_posted_events); |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
398 } |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
399 |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
400 if (found) { |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
401 ready--; |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
402 continue; |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
403 } |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
404 } |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
405 |
39
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
38
diff
changeset
|
406 if (ready != 0) { |
305
4b1a3a4acc60
nginx-0.0.3-2004-04-02-19:13:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
261
diff
changeset
|
407 ngx_log_error(NGX_LOG_ALERT, cycle->log, 0, "poll ready != events"); |
39
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
38
diff
changeset
|
408 } |
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
38
diff
changeset
|
409 |
5804
92490a725fef
Events: removed unused variable in ngx_poll_process_events().
Maxim Dounin <mdounin@mdounin.ru>
parents:
5803
diff
changeset
|
410 return NGX_OK; |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
411 } |
381
02a511569afb
nginx-0.0.7-2004-07-07-19:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
380
diff
changeset
|
412 |
02a511569afb
nginx-0.0.7-2004-07-07-19:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
380
diff
changeset
|
413 |
499 | 414 static char * |
415 ngx_poll_init_conf(ngx_cycle_t *cycle, void *conf) | |
381
02a511569afb
nginx-0.0.7-2004-07-07-19:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
380
diff
changeset
|
416 { |
02a511569afb
nginx-0.0.7-2004-07-07-19:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
380
diff
changeset
|
417 ngx_event_conf_t *ecf; |
02a511569afb
nginx-0.0.7-2004-07-07-19:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
380
diff
changeset
|
418 |
02a511569afb
nginx-0.0.7-2004-07-07-19:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
380
diff
changeset
|
419 ecf = ngx_event_get_conf(cycle->conf_ctx, ngx_event_core_module); |
02a511569afb
nginx-0.0.7-2004-07-07-19:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
380
diff
changeset
|
420 |
02a511569afb
nginx-0.0.7-2004-07-07-19:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
380
diff
changeset
|
421 if (ecf->use != ngx_poll_module.ctx_index) { |
02a511569afb
nginx-0.0.7-2004-07-07-19:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
380
diff
changeset
|
422 return NGX_CONF_OK; |
02a511569afb
nginx-0.0.7-2004-07-07-19:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
380
diff
changeset
|
423 } |
02a511569afb
nginx-0.0.7-2004-07-07-19:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
380
diff
changeset
|
424 |
7444
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7442
diff
changeset
|
425 #if (NGX_LOAD_WSAPOLL) |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7442
diff
changeset
|
426 |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7442
diff
changeset
|
427 if (!ngx_have_wsapoll) { |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7442
diff
changeset
|
428 ngx_log_error(NGX_LOG_EMERG, cycle->log, 0, |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7442
diff
changeset
|
429 "poll is not available on this platform"); |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7442
diff
changeset
|
430 return NGX_CONF_ERROR; |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7442
diff
changeset
|
431 } |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7442
diff
changeset
|
432 |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7442
diff
changeset
|
433 #endif |
4089b3d2cb59
Win32: added WSAPoll() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7442
diff
changeset
|
434 |
381
02a511569afb
nginx-0.0.7-2004-07-07-19:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
380
diff
changeset
|
435 return NGX_CONF_OK; |
02a511569afb
nginx-0.0.7-2004-07-07-19:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
380
diff
changeset
|
436 } |