comparison src/event/modules/ngx_aio_module.c @ 94:8220378432a8

nginx-0.0.1-2003-05-22-19:23:47 import
author Igor Sysoev <igor@sysoev.ru>
date Thu, 22 May 2003 15:23:47 +0000
parents 738fe44c70d5
children b48066122884
comparison
equal deleted inserted replaced
93:738fe44c70d5 94:8220378432a8
11 11
12 static int ngx_aio_init(ngx_log_t *log); 12 static int ngx_aio_init(ngx_log_t *log);
13 static void ngx_aio_done(ngx_log_t *log); 13 static void ngx_aio_done(ngx_log_t *log);
14 static int ngx_aio_add_event(ngx_event_t *ev, int event, u_int flags); 14 static int ngx_aio_add_event(ngx_event_t *ev, int event, u_int flags);
15 static int ngx_aio_del_event(ngx_event_t *ev, int event, u_int flags); 15 static int ngx_aio_del_event(ngx_event_t *ev, int event, u_int flags);
16 static int ngx_aio_del_connection(ngx_connection_t *c);
16 static int ngx_aio_process_events(ngx_log_t *log); 17 static int ngx_aio_process_events(ngx_log_t *log);
17 18
18 19
19 ngx_os_io_t ngx_os_aio = { 20 ngx_os_io_t ngx_os_aio = {
20 ngx_aio_read, 21 ngx_aio_read,
37 ngx_aio_add_event, /* add an event */ 38 ngx_aio_add_event, /* add an event */
38 ngx_aio_del_event, /* delete an event */ 39 ngx_aio_del_event, /* delete an event */
39 NULL, /* enable an event */ 40 NULL, /* enable an event */
40 NULL, /* disable an event */ 41 NULL, /* disable an event */
41 NULL, /* add an connection */ 42 NULL, /* add an connection */
42 NULL, /* delete an connection */ 43 ngx_aio_del_connection, /* delete an connection */
43 ngx_aio_process_events, /* process the events */ 44 ngx_aio_process_events, /* process the events */
44 ngx_aio_init, /* init the events */ 45 ngx_aio_init, /* init the events */
45 ngx_aio_done /* done the events */ 46 ngx_aio_done /* done the events */
46 } 47 }
47 48
92 { 93 {
93 return ngx_kqueue_module_ctx.actions.del(ev, event, flags); 94 return ngx_kqueue_module_ctx.actions.del(ev, event, flags);
94 } 95 }
95 96
96 97
98 static int ngx_aio_del_connection(ngx_connection_t *c)
99 {
100 int rc;
101
102 if (c->read->active || c->write->active) {
103 rc = aio_cancel(c->fd, NULL);
104 if (rc == -1) {
105 ngx_log_error(NGX_LOG_CRIT, c->log, ngx_errno,
106 "aio_cancel() failed");
107 return NGX_ERROR;
108 }
109
110 ngx_log_debug(c->log, "aio_cancel: %d" _ rc);
111
112 #if 0
113 rc = aio_error(&c->read->aiocb);
114 if (rc == -1) {
115 ngx_log_error(NGX_LOG_CRIT, c->log, ngx_errno,
116 "aio_error() failed");
117 return NGX_ERROR;
118 }
119
120 ngx_log_debug(c->log, "aio_error: %d" _ rc);
121 #endif
122 }
123
124 #if 0
125 if (c->write->active) {
126 rc = aio_cancel(c->fd, &c->write->aiocb);
127 if (rc == -1) {
128 ngx_log_error(NGX_LOG_CRIT, c->log, ngx_errno,
129 "aio_cancel() failed");
130 return NGX_ERROR;
131 }
132
133 ngx_log_debug(c->log, "aio_cancel: %d" _ rc);
134
135 rc = aio_error(&c->read->aiocb);
136 if (rc == -1) {
137 ngx_log_error(NGX_LOG_CRIT, c->log, ngx_errno,
138 "aio_error() failed");
139 return NGX_ERROR;
140 }
141
142 ngx_log_debug(c->log, "aio_error: %d" _ rc);
143 }
144 #endif
145
146 return NGX_OK;
147 }
148
149
97 static int ngx_aio_process_events(ngx_log_t *log) 150 static int ngx_aio_process_events(ngx_log_t *log)
98 { 151 {
99 return ngx_kqueue_module_ctx.actions.process(log); 152 return ngx_kqueue_module_ctx.actions.process(log);
100 } 153 }
101 154