Mercurial > hg > nginx
annotate src/event/modules/ngx_devpoll_module.c @ 814:760ed037a5a4
fix log message
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Wed, 25 Oct 2006 15:38:02 +0000 |
parents | 6d5c1535bb9d |
children | 06479b01caff |
rev | line source |
---|---|
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
1 |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
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 |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
4 */ |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
5 |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
6 |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
7 #include <ngx_config.h> |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
8 #include <ngx_core.h> |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
9 #include <ngx_event.h> |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
10 |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
11 |
469 | 12 #if (NGX_TEST_BUILD_DEVPOLL) |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
13 |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
14 /* Solaris declarations */ |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
15 |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
16 #define POLLREMOVE 0x0800 |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
17 #define DP_POLL 0xD001 |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
18 |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
19 struct dvpoll { |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
20 struct pollfd *dp_fds; |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
21 int dp_nfds; |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
22 int dp_timeout; |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
23 }; |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
24 |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
25 #endif |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
26 |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
27 |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
28 typedef struct { |
116
571bcbff82c5
nginx-0.0.1-2003-07-11-08:50:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
115
diff
changeset
|
29 u_int changes; |
571bcbff82c5
nginx-0.0.1-2003-07-11-08:50:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
115
diff
changeset
|
30 u_int events; |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
31 } ngx_devpoll_conf_t; |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
32 |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
33 |
563 | 34 static ngx_int_t ngx_devpoll_init(ngx_cycle_t *cycle, ngx_msec_t timer); |
115
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
35 static void ngx_devpoll_done(ngx_cycle_t *cycle); |
499 | 36 static ngx_int_t ngx_devpoll_add_event(ngx_event_t *ev, int event, u_int flags); |
37 static ngx_int_t ngx_devpoll_del_event(ngx_event_t *ev, int event, u_int flags); | |
38 static ngx_int_t ngx_devpoll_set_event(ngx_event_t *ev, int event, u_int flags); | |
563 | 39 static ngx_int_t ngx_devpoll_process_events(ngx_cycle_t *cycle, |
40 ngx_msec_t timer, ngx_uint_t flags); | |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
41 |
115
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
42 static void *ngx_devpoll_create_conf(ngx_cycle_t *cycle); |
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
43 static char *ngx_devpoll_init_conf(ngx_cycle_t *cycle, void *conf); |
39
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
44 |
167
8aef3c72e5da
nginx-0.0.1-2003-10-30-19:51:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
144
diff
changeset
|
45 static int dp = -1; |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
46 static struct pollfd *change_list, *event_list; |
116
571bcbff82c5
nginx-0.0.1-2003-07-11-08:50:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
115
diff
changeset
|
47 static u_int nchanges, max_changes, nevents; |
39
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
48 |
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
49 static ngx_event_t **change_index; |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
50 |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
51 |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
52 static ngx_str_t devpoll_name = ngx_string("/dev/poll"); |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
53 |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
54 static ngx_command_t ngx_devpoll_commands[] = { |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
55 |
499 | 56 { ngx_string("devpoll_changes"), |
57 NGX_EVENT_CONF|NGX_CONF_TAKE1, | |
58 ngx_conf_set_num_slot, | |
59 0, | |
60 offsetof(ngx_devpoll_conf_t, changes), | |
61 NULL }, | |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
62 |
499 | 63 { ngx_string("devpoll_events"), |
64 NGX_EVENT_CONF|NGX_CONF_TAKE1, | |
65 ngx_conf_set_num_slot, | |
66 0, | |
67 offsetof(ngx_devpoll_conf_t, events), | |
68 NULL }, | |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
69 |
499 | 70 ngx_null_command |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
71 }; |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
72 |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
73 |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
74 ngx_event_module_t ngx_devpoll_module_ctx = { |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
75 &devpoll_name, |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
76 ngx_devpoll_create_conf, /* create configuration */ |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
77 ngx_devpoll_init_conf, /* init configuration */ |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
78 |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
79 { |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
80 ngx_devpoll_add_event, /* add an event */ |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
81 ngx_devpoll_del_event, /* delete an event */ |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
82 ngx_devpoll_add_event, /* enable an event */ |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
83 ngx_devpoll_del_event, /* disable an event */ |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
84 NULL, /* add an connection */ |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
85 NULL, /* delete an connection */ |
380
5ce6561246a5
nginx-0.0.7-2004-07-07-10:15:04 import
Igor Sysoev <igor@sysoev.ru>
parents:
375
diff
changeset
|
86 NULL, /* process the changes */ |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
87 ngx_devpoll_process_events, /* process the events */ |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
88 ngx_devpoll_init, /* init the events */ |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
89 ngx_devpoll_done, /* done the events */ |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
90 } |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
91 |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
92 }; |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
93 |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
94 ngx_module_t ngx_devpoll_module = { |
509 | 95 NGX_MODULE_V1, |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
96 &ngx_devpoll_module_ctx, /* module context */ |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
97 ngx_devpoll_commands, /* module directives */ |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
93
diff
changeset
|
98 NGX_EVENT_MODULE, /* module type */ |
541 | 99 NULL, /* init master */ |
116
571bcbff82c5
nginx-0.0.1-2003-07-11-08:50:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
115
diff
changeset
|
100 NULL, /* init module */ |
541 | 101 NULL, /* init process */ |
102 NULL, /* init thread */ | |
103 NULL, /* exit thread */ | |
104 NULL, /* exit process */ | |
105 NULL, /* exit master */ | |
106 NGX_MODULE_V1_PADDING | |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
107 }; |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
108 |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
109 |
499 | 110 static ngx_int_t |
563 | 111 ngx_devpoll_init(ngx_cycle_t *cycle, ngx_msec_t timer) |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
112 { |
194
2357fa41738a
nginx-0.0.1-2003-11-21-09:30:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
179
diff
changeset
|
113 size_t n; |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
114 ngx_devpoll_conf_t *dpcf; |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
115 |
115
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
116 dpcf = ngx_event_get_conf(cycle->conf_ctx, ngx_devpoll_module); |
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
117 |
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
118 if (dp == -1) { |
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
119 dp = open("/dev/poll", O_RDWR); |
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
120 |
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
121 if (dp == -1) { |
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
122 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, |
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
123 "open(/dev/poll) failed"); |
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
124 return NGX_ERROR; |
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
125 } |
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
126 } |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
127 |
115
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
128 if (max_changes < dpcf->changes) { |
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
129 if (nchanges) { |
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
130 n = nchanges * sizeof(struct pollfd); |
245
e6c005b66b3a
nginx-0.0.1-2004-01-30-00:45:01 import
Igor Sysoev <igor@sysoev.ru>
parents:
243
diff
changeset
|
131 if (write(dp, change_list, n) != (ssize_t) n) { |
115
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
132 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, |
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
133 "write(/dev/poll) failed"); |
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
134 return NGX_ERROR; |
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
135 } |
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
136 |
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
137 nchanges = 0; |
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
138 } |
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
139 |
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
140 if (change_list) { |
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
141 ngx_free(change_list); |
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
142 } |
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
143 |
501 | 144 change_list = ngx_alloc(sizeof(struct pollfd) * dpcf->changes, |
145 cycle->log); | |
146 if (change_list == NULL) { | |
147 return NGX_ERROR; | |
148 } | |
115
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
149 |
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
150 if (change_index) { |
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
151 ngx_free(change_index); |
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
152 } |
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
153 |
501 | 154 change_index = ngx_alloc(sizeof(ngx_event_t *) * dpcf->changes, |
155 cycle->log); | |
156 if (change_index == NULL) { | |
157 return NGX_ERROR; | |
158 } | |
115
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
159 } |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
160 |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
161 max_changes = dpcf->changes; |
115
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
162 |
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
163 if (nevents < dpcf->events) { |
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
164 if (event_list) { |
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
165 ngx_free(event_list); |
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
166 } |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
167 |
501 | 168 event_list = ngx_alloc(sizeof(struct pollfd) * dpcf->events, |
169 cycle->log); | |
170 if (event_list == NULL) { | |
171 return NGX_ERROR; | |
172 } | |
115
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
173 } |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
174 |
115
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
175 nevents = dpcf->events; |
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
176 |
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
177 ngx_io = ngx_os_io; |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
178 |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
179 ngx_event_actions = ngx_devpoll_module_ctx.actions; |
115
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
180 |
543 | 181 ngx_event_flags = NGX_USE_LEVEL_EVENT|NGX_USE_FD_EVENT; |
36
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 |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
186 |
499 | 187 static void |
188 ngx_devpoll_done(ngx_cycle_t *cycle) | |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
189 { |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
190 if (close(dp) == -1) { |
115
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
191 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, |
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
192 "close(/dev/poll) failed"); |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
193 } |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
194 |
115
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
195 dp = -1; |
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
196 |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
197 ngx_free(change_list); |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
198 ngx_free(event_list); |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
199 ngx_free(change_index); |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
200 |
115
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
201 change_list = NULL; |
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
202 event_list = NULL; |
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
203 change_index = NULL; |
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
204 max_changes = 0; |
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
205 nchanges = 0; |
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
206 nevents = 0; |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
207 } |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
208 |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
209 |
499 | 210 static ngx_int_t |
211 ngx_devpoll_add_event(ngx_event_t *ev, int event, u_int flags) | |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
212 { |
245
e6c005b66b3a
nginx-0.0.1-2004-01-30-00:45:01 import
Igor Sysoev <igor@sysoev.ru>
parents:
243
diff
changeset
|
213 #if (NGX_DEBUG) |
e6c005b66b3a
nginx-0.0.1-2004-01-30-00:45:01 import
Igor Sysoev <igor@sysoev.ru>
parents:
243
diff
changeset
|
214 ngx_connection_t *c; |
39
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
215 #endif |
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
216 |
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
217 #if (NGX_READ_EVENT != POLLIN) |
452 | 218 event = (event == NGX_READ_EVENT) ? POLLIN : POLLOUT; |
39
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
219 #endif |
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
220 |
245
e6c005b66b3a
nginx-0.0.1-2004-01-30-00:45:01 import
Igor Sysoev <igor@sysoev.ru>
parents:
243
diff
changeset
|
221 #if (NGX_DEBUG) |
e6c005b66b3a
nginx-0.0.1-2004-01-30-00:45:01 import
Igor Sysoev <igor@sysoev.ru>
parents:
243
diff
changeset
|
222 c = ev->data; |
e6c005b66b3a
nginx-0.0.1-2004-01-30-00:45:01 import
Igor Sysoev <igor@sysoev.ru>
parents:
243
diff
changeset
|
223 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, ev->log, 0, |
461 | 224 "devpoll add event: fd:%d ev:%04Xd", c->fd, event); |
39
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
225 #endif |
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
226 |
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
227 ev->active = 1; |
452 | 228 |
39
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
229 return ngx_devpoll_set_event(ev, event, 0); |
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
230 } |
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
231 |
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
232 |
499 | 233 static ngx_int_t |
234 ngx_devpoll_del_event(ngx_event_t *ev, int event, u_int flags) | |
39
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
235 { |
109
a9bc21d63fe4
nginx-0.0.1-2003-07-02-18:41:17 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
236 ngx_event_t *e; |
a9bc21d63fe4
nginx-0.0.1-2003-07-02-18:41:17 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
237 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
|
238 |
110
152567c11325
nginx-0.0.1-2003-07-02-22:51:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
109
diff
changeset
|
239 c = ev->data; |
152567c11325
nginx-0.0.1-2003-07-02-22:51:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
109
diff
changeset
|
240 |
452 | 241 #if (NGX_READ_EVENT != POLLIN) |
242 event = (event == NGX_READ_EVENT) ? POLLIN : POLLOUT; | |
243 #endif | |
244 | |
245
e6c005b66b3a
nginx-0.0.1-2004-01-30-00:45:01 import
Igor Sysoev <igor@sysoev.ru>
parents:
243
diff
changeset
|
245 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, ev->log, 0, |
461 | 246 "devpoll del event: fd:%d ev:%04Xd", c->fd, event); |
39
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
247 |
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
248 if (ngx_devpoll_set_event(ev, POLLREMOVE, flags) == NGX_ERROR) { |
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
249 return NGX_ERROR; |
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
250 } |
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
251 |
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
252 ev->active = 0; |
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
253 |
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
254 if (flags & NGX_CLOSE_EVENT) { |
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
255 return NGX_OK; |
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
256 } |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
257 |
452 | 258 /* restore the paired event if it exists */ |
109
a9bc21d63fe4
nginx-0.0.1-2003-07-02-18:41:17 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
259 |
452 | 260 if (event == POLLIN) { |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
261 e = c->write; |
39
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
262 event = POLLOUT; |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
263 |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
264 } else { |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
265 e = c->read; |
39
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
266 event = POLLIN; |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
267 } |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
268 |
452 | 269 if (e && e->active) { |
39
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
270 return ngx_devpoll_set_event(e, event, 0); |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
271 } |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
272 |
39
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
273 return NGX_OK; |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
274 } |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
275 |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
276 |
499 | 277 static ngx_int_t |
278 ngx_devpoll_set_event(ngx_event_t *ev, int event, u_int flags) | |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
279 { |
194
2357fa41738a
nginx-0.0.1-2003-11-21-09:30:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
179
diff
changeset
|
280 size_t n; |
39
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
281 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
|
282 |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
283 c = ev->data; |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
284 |
245
e6c005b66b3a
nginx-0.0.1-2004-01-30-00:45:01 import
Igor Sysoev <igor@sysoev.ru>
parents:
243
diff
changeset
|
285 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, ev->log, 0, |
461 | 286 "devpoll fd:%d ev:%04Xd fl:%04Xd", c->fd, event, flags); |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
287 |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
288 if (nchanges >= max_changes) { |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
289 ngx_log_error(NGX_LOG_WARN, ev->log, 0, |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
290 "/dev/pool change list is filled up"); |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
291 |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
292 n = nchanges * sizeof(struct pollfd); |
245
e6c005b66b3a
nginx-0.0.1-2004-01-30-00:45:01 import
Igor Sysoev <igor@sysoev.ru>
parents:
243
diff
changeset
|
293 if (write(dp, change_list, n) != (ssize_t) n) { |
39
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
294 ngx_log_error(NGX_LOG_ALERT, ev->log, ngx_errno, |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
295 "write(/dev/poll) failed"); |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
296 return NGX_ERROR; |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
297 } |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
298 |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
299 nchanges = 0; |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
300 } |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
301 |
39
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
302 change_list[nchanges].fd = c->fd; |
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
303 change_list[nchanges].events = event; |
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
304 change_list[nchanges].revents = 0; |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
305 |
39
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
306 change_index[nchanges] = ev; |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
307 ev->index = nchanges; |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
308 |
39
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
309 nchanges++; |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
310 |
39
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
311 if (flags & NGX_CLOSE_EVENT) { |
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
312 n = nchanges * sizeof(struct pollfd); |
245
e6c005b66b3a
nginx-0.0.1-2004-01-30-00:45:01 import
Igor Sysoev <igor@sysoev.ru>
parents:
243
diff
changeset
|
313 if (write(dp, change_list, n) != (ssize_t) n) { |
39
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
314 ngx_log_error(NGX_LOG_ALERT, ev->log, ngx_errno, |
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
315 "write(/dev/poll) failed"); |
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
316 return NGX_ERROR; |
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
317 } |
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
318 |
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
319 nchanges = 0; |
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
320 } |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
321 |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
322 return NGX_OK; |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
323 } |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
324 |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
325 |
499 | 326 ngx_int_t |
563 | 327 ngx_devpoll_process_events(ngx_cycle_t *cycle, ngx_msec_t timer, |
328 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
|
329 { |
483 | 330 int events, revents; |
557 | 331 size_t n; |
332 ngx_err_t err; | |
305
4b1a3a4acc60
nginx-0.0.3-2004-04-02-19:13:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
247
diff
changeset
|
333 ngx_int_t i; |
563 | 334 ngx_uint_t level; |
335 ngx_event_t *rev, *wev, **queue; | |
115
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
336 ngx_connection_t *c; |
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
337 struct dvpoll dvp; |
316
a0beefedaf94
nginx-0.0.3-2004-04-15-00:34:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
338 |
a0beefedaf94
nginx-0.0.3-2004-04-15-00:34:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
339 /* NGX_TIMER_INFINITE == INFTIM */ |
a0beefedaf94
nginx-0.0.3-2004-04-15-00:34:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
340 |
305
4b1a3a4acc60
nginx-0.0.3-2004-04-02-19:13:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
247
diff
changeset
|
341 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0, |
557 | 342 "devpoll timer: %M", timer); |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
343 |
47
d81326c3b21b
nginx-0.0.1-2003-01-15-10:02:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
40
diff
changeset
|
344 if (nchanges) { |
d81326c3b21b
nginx-0.0.1-2003-01-15-10:02:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
40
diff
changeset
|
345 n = nchanges * sizeof(struct pollfd); |
245
e6c005b66b3a
nginx-0.0.1-2004-01-30-00:45:01 import
Igor Sysoev <igor@sysoev.ru>
parents:
243
diff
changeset
|
346 if (write(dp, change_list, n) != (ssize_t) n) { |
305
4b1a3a4acc60
nginx-0.0.3-2004-04-02-19:13:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
247
diff
changeset
|
347 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, |
47
d81326c3b21b
nginx-0.0.1-2003-01-15-10:02:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
40
diff
changeset
|
348 "write(/dev/poll) failed"); |
d81326c3b21b
nginx-0.0.1-2003-01-15-10:02:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
40
diff
changeset
|
349 return NGX_ERROR; |
d81326c3b21b
nginx-0.0.1-2003-01-15-10:02:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
40
diff
changeset
|
350 } |
567 | 351 |
352 nchanges = 0; | |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
353 } |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
354 |
40
d5d4f3bba6f0
nginx-0.0.1-2002-12-26-10:24:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
39
diff
changeset
|
355 dvp.dp_fds = event_list; |
d5d4f3bba6f0
nginx-0.0.1-2002-12-26-10:24:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
39
diff
changeset
|
356 dvp.dp_nfds = nevents; |
d5d4f3bba6f0
nginx-0.0.1-2002-12-26-10:24:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
39
diff
changeset
|
357 dvp.dp_timeout = timer; |
d5d4f3bba6f0
nginx-0.0.1-2002-12-26-10:24:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
39
diff
changeset
|
358 events = ioctl(dp, DP_POLL, &dvp); |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
359 |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
360 if (events == -1) { |
114
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
110
diff
changeset
|
361 err = ngx_errno; |
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
110
diff
changeset
|
362 } else { |
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
110
diff
changeset
|
363 err = 0; |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
364 } |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
365 |
563 | 366 if (flags & NGX_UPDATE_TIME) { |
367 ngx_time_update(0, 0); | |
368 } | |
178
a8ff48d26cca
nginx-0.0.1-2003-11-11-00:09:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
167
diff
changeset
|
369 |
246
6753e8cdaa2c
nginx-0.0.1-2004-01-30-20:39:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
245
diff
changeset
|
370 if (err) { |
563 | 371 if (err == NGX_EINTR) { |
372 | |
373 if (ngx_event_timer_alarm) { | |
374 ngx_event_timer_alarm = 0; | |
375 return NGX_OK; | |
376 } | |
577 | 377 |
563 | 378 level = NGX_LOG_INFO; |
577 | 379 |
380 } else { | |
563 | 381 level = NGX_LOG_ALERT; |
382 } | |
383 | |
384 ngx_log_error(level, cycle->log, err, "ioctl(DP_POLL) failed"); | |
246
6753e8cdaa2c
nginx-0.0.1-2004-01-30-20:39:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
245
diff
changeset
|
385 return NGX_ERROR; |
6753e8cdaa2c
nginx-0.0.1-2004-01-30-20:39:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
245
diff
changeset
|
386 } |
6753e8cdaa2c
nginx-0.0.1-2004-01-30-20:39:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
245
diff
changeset
|
387 |
567 | 388 if (events == 0) { |
389 if (timer != NGX_TIMER_INFINITE) { | |
390 return NGX_OK; | |
391 } | |
114
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
110
diff
changeset
|
392 |
567 | 393 ngx_log_error(NGX_LOG_ALERT, cycle->log, 0, |
394 "ioctl(DP_POLL) returned no events without timeout"); | |
395 return NGX_ERROR; | |
316
a0beefedaf94
nginx-0.0.3-2004-04-15-00:34:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
396 } |
a0beefedaf94
nginx-0.0.3-2004-04-15-00:34:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
397 |
563 | 398 ngx_mutex_lock(ngx_posted_events_mutex); |
316
a0beefedaf94
nginx-0.0.3-2004-04-15-00:34:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
399 |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
400 for (i = 0; i < events; i++) { |
543 | 401 c = ngx_cycle->files[event_list[i].fd]; |
115
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
402 |
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
403 if (c->fd == -1) { |
543 | 404 if (c->read->closed) { |
473 | 405 continue; |
406 } | |
407 | |
408 ngx_log_error(NGX_LOG_ALERT, cycle->log, 0, "unexpected event"); | |
409 continue; | |
410 } | |
411 | |
483 | 412 revents = event_list[i].revents; |
413 | |
305
4b1a3a4acc60
nginx-0.0.3-2004-04-02-19:13:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
247
diff
changeset
|
414 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, cycle->log, 0, |
461 | 415 "devpoll: fd:%d, ev:%04Xd, rev:%04Xd", |
483 | 416 event_list[i].fd, event_list[i].events, revents); |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
417 |
483 | 418 if (revents & (POLLERR|POLLHUP|POLLNVAL)) { |
305
4b1a3a4acc60
nginx-0.0.3-2004-04-02-19:13:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
247
diff
changeset
|
419 ngx_log_error(NGX_LOG_ALERT, cycle->log, 0, |
461 | 420 "ioctl(DP_POLL) error fd:%d ev:%04Xd rev:%04Xd", |
483 | 421 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
|
422 } |
39
83fa61cd3d2f
nginx-0.0.1-2002-12-24-20:30:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
423 |
483 | 424 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:
247
diff
changeset
|
425 ngx_log_error(NGX_LOG_ALERT, cycle->log, 0, |
247
008276b9e061
nginx-0.0.1-2004-02-01-11:10:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
246
diff
changeset
|
426 "strange ioctl(DP_POLL) events " |
461 | 427 "fd:%d ev:%04Xd rev:%04Xd", |
483 | 428 event_list[i].fd, event_list[i].events, revents); |
429 } | |
430 | |
431 if ((revents & (POLLERR|POLLHUP|POLLNVAL)) | |
432 && (revents & (POLLIN|POLLOUT)) == 0) | |
433 { | |
434 /* | |
435 * if the error events were returned without POLLIN or POLLOUT, | |
436 * then add these flags to handle the events at least in one | |
577 | 437 * active handler |
483 | 438 */ |
439 | |
440 revents |= POLLIN|POLLOUT; | |
247
008276b9e061
nginx-0.0.1-2004-02-01-11:10:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
246
diff
changeset
|
441 } |
008276b9e061
nginx-0.0.1-2004-02-01-11:10:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
246
diff
changeset
|
442 |
381
02a511569afb
nginx-0.0.7-2004-07-07-19:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
380
diff
changeset
|
443 rev = c->read; |
02a511569afb
nginx-0.0.7-2004-07-07-19:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
380
diff
changeset
|
444 |
483 | 445 if ((revents & POLLIN) && rev->active) { |
316
a0beefedaf94
nginx-0.0.3-2004-04-15-00:34:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
446 |
563 | 447 if ((flags & NGX_POST_THREAD_EVENTS) && !rev->accept) { |
448 rev->posted_ready = 1; | |
316
a0beefedaf94
nginx-0.0.3-2004-04-15-00:34:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
449 |
563 | 450 } else { |
451 rev->ready = 1; | |
452 } | |
316
a0beefedaf94
nginx-0.0.3-2004-04-15-00:34:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
453 |
563 | 454 if (flags & NGX_POST_EVENTS) { |
455 queue = (ngx_event_t **) (rev->accept ? | |
456 &ngx_posted_accept_events : &ngx_posted_events); | |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
457 |
563 | 458 ngx_locked_post_event(rev, queue); |
316
a0beefedaf94
nginx-0.0.3-2004-04-15-00:34:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
459 |
563 | 460 } else { |
461 rev->handler(rev); | |
462 } | |
463 } | |
464 | |
465 wev = c->write; | |
466 | |
467 if ((revents & POLLOUT) && wev->active) { | |
323
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
468 |
563 | 469 if (flags & NGX_POST_THREAD_EVENTS) { |
470 wev->posted_ready = 1; | |
316
a0beefedaf94
nginx-0.0.3-2004-04-15-00:34:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
471 |
563 | 472 } else { |
473 wev->ready = 1; | |
474 } | |
475 | |
476 if (flags & NGX_POST_EVENTS) { | |
477 ngx_locked_post_event(wev, &ngx_posted_events); | |
478 | |
479 } else { | |
480 wev->handler(wev); | |
316
a0beefedaf94
nginx-0.0.3-2004-04-15-00:34:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
481 } |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
482 } |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
483 } |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
484 |
563 | 485 ngx_mutex_unlock(ngx_posted_events_mutex); |
316
a0beefedaf94
nginx-0.0.3-2004-04-15-00:34:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
486 |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
487 return NGX_OK; |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
488 } |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
489 |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
490 |
499 | 491 static void * |
492 ngx_devpoll_create_conf(ngx_cycle_t *cycle) | |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
493 { |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
494 ngx_devpoll_conf_t *dpcf; |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
495 |
501 | 496 dpcf = ngx_palloc(cycle->pool, sizeof(ngx_devpoll_conf_t)); |
497 if (dpcf == NULL) { | |
498 return NGX_CONF_ERROR; | |
499 } | |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
500 |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
501 dpcf->changes = NGX_CONF_UNSET; |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
502 dpcf->events = NGX_CONF_UNSET; |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
503 |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
504 return dpcf; |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
505 } |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
506 |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
507 |
499 | 508 static char * |
509 ngx_devpoll_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:
69
diff
changeset
|
510 { |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
511 ngx_devpoll_conf_t *dpcf = conf; |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
512 |
663 | 513 ngx_conf_init_uint_value(dpcf->changes, 32); |
514 ngx_conf_init_uint_value(dpcf->events, 32); | |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
515 |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
516 return NGX_CONF_OK; |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
517 } |