File Conn.c changed (mode: 100644) (index db74d46..02dd3f5) |
7 |
7 |
*/ |
*/ |
8 |
8 |
|
|
9 |
9 |
#include "Conn.h" |
#include "Conn.h" |
10 |
|
#include "Conn_engine_poll.h" |
|
11 |
10 |
#include "Conn_engine_epoll.h" |
#include "Conn_engine_epoll.h" |
12 |
11 |
|
|
13 |
12 |
|
|
14 |
13 |
/* Internal variables */ |
/* Internal variables */ |
15 |
|
/* Engine */ |
|
16 |
|
static unsigned int Conn_engine; |
|
17 |
|
static unsigned int Conn_engine_poll_found; |
|
18 |
|
static unsigned int Conn_engine_epoll_found; |
|
19 |
14 |
|
|
20 |
15 |
/* Engine functions */ |
/* Engine functions */ |
21 |
16 |
static int (*Conn_engine_init)(void); |
static int (*Conn_engine_init)(void); |
|
... |
... |
static int (*Conn_engine_move_slot)(const unsigned int dst, |
31 |
26 |
|
|
32 |
27 |
/* Functions */ |
/* Functions */ |
33 |
28 |
|
|
34 |
|
/* |
|
35 |
|
* Set prefered engine |
|
36 |
|
*/ |
|
37 |
|
int Conn_engine_set(const unsigned int engine) |
|
38 |
|
{ |
|
39 |
|
if (engine == Conn_engine) |
|
40 |
|
return 0; |
|
41 |
|
|
|
42 |
|
if (engine == CONN_ENGINE_POLL) { |
|
43 |
|
if (Conn_engine_poll_found == 0) { |
|
44 |
|
snprintf(Conn_error, sizeof(Conn_error), |
|
45 |
|
"Cannot use engine POLL. Probably not supported."); |
|
46 |
|
return -1; |
|
47 |
|
} |
|
48 |
|
|
|
49 |
|
#ifdef POLL_FOUND |
|
50 |
|
/* Set variables */ |
|
51 |
|
CONN_POLLIN = POLLIN; |
|
52 |
|
CONN_POLLOUT = POLLOUT; |
|
53 |
|
CONN_POLLPRI = POLLPRI; |
|
54 |
|
CONN_POLLERR = POLLERR; |
|
55 |
|
CONN_POLLHUP = POLLHUP; |
|
56 |
|
CONN_POLLNVAL = POLLNVAL; |
|
57 |
|
CONN_POLLRDNORM = POLLRDNORM; |
|
58 |
|
CONN_POLLRDBAND = POLLRDBAND; |
|
59 |
|
/* Set functions */ |
|
60 |
|
Conn_engine_init = Conn_poll_init; |
|
61 |
|
Conn_engine_shutdown = Conn_poll_shutdown; |
|
62 |
|
Conn_engine_grow = Conn_poll_grow; |
|
63 |
|
Conn_engine_add_obj = Conn_poll_add_obj; |
|
64 |
|
Conn_engine_del_obj = Conn_poll_del_obj; |
|
65 |
|
Conn_engine_chg_obj = Conn_poll_chg_obj; |
|
66 |
|
Conn_engine_poll = Conn_poll_poll; |
|
67 |
|
Conn_engine_move_slot = Conn_poll_move_slot; |
|
68 |
|
#endif |
|
69 |
|
} else if (engine == CONN_ENGINE_EPOLL) { |
|
70 |
|
if (Conn_engine_epoll_found == 0) { |
|
71 |
|
snprintf(Conn_error, sizeof(Conn_error), |
|
72 |
|
"Cannot use engine EPOLL. Probably not supported."); |
|
73 |
|
return -1; |
|
74 |
|
} |
|
75 |
|
|
|
76 |
|
#ifdef EPOLL_FOUND |
|
77 |
|
/* Set variables */ |
|
78 |
|
CONN_POLLIN = EPOLLIN; |
|
79 |
|
CONN_POLLOUT = EPOLLOUT; |
|
80 |
|
CONN_POLLPRI = EPOLLPRI; |
|
81 |
|
CONN_POLLERR = EPOLLERR; |
|
82 |
|
CONN_POLLHUP = EPOLLHUP; |
|
83 |
|
CONN_POLLNVAL = 0; /* not defined for epoll */ |
|
84 |
|
CONN_POLLRDNORM = 0; /* not defined for epoll */ |
|
85 |
|
CONN_POLLRDBAND = 0; /* not defined for epoll */ |
|
86 |
|
/* Set functions */ |
|
87 |
|
Conn_engine_init = Conn_epoll_init; |
|
88 |
|
Conn_engine_shutdown = Conn_epoll_shutdown; |
|
89 |
|
Conn_engine_grow = Conn_epoll_grow; |
|
90 |
|
Conn_engine_add_obj = Conn_epoll_add_obj; |
|
91 |
|
Conn_engine_del_obj = Conn_epoll_del_obj; |
|
92 |
|
Conn_engine_chg_obj = Conn_epoll_chg_obj; |
|
93 |
|
Conn_engine_poll = Conn_epoll_poll; |
|
94 |
|
Conn_engine_move_slot = Conn_epoll_move_slot; |
|
95 |
|
#endif |
|
96 |
|
} else { |
|
97 |
|
snprintf(Conn_error, sizeof(Conn_error), |
|
98 |
|
"Cannot use engine %u because is not supported.", engine); |
|
99 |
|
return -1; |
|
100 |
|
} |
|
101 |
|
|
|
102 |
|
return 0; |
|
103 |
|
} |
|
104 |
|
|
|
105 |
29 |
/* |
/* |
106 |
30 |
* Reads a value from proc |
* Reads a value from proc |
107 |
31 |
*/ |
*/ |
|
... |
... |
int Conn_init(const unsigned int max) |
185 |
109 |
Conn_queue_init(&Conn_queue_free); |
Conn_queue_init(&Conn_queue_free); |
186 |
110 |
*/ |
*/ |
187 |
111 |
|
|
188 |
|
#ifdef POLL_FOUND |
|
189 |
|
engine = CONN_ENGINE_POLL; |
|
190 |
|
Conn_engine_poll_found = 1; |
|
191 |
|
#endif |
|
192 |
|
|
|
193 |
|
#ifdef EPOLL_FOUND |
|
194 |
|
engine = CONN_ENGINE_EPOLL; |
|
195 |
|
Conn_engine_epoll_found = 1; |
|
196 |
|
#endif |
|
197 |
|
|
|
198 |
112 |
ret = Conn_engine_set(engine); |
ret = Conn_engine_set(engine); |
199 |
113 |
if (ret != 0) |
if (ret != 0) |
200 |
114 |
return -1; |
return -1; |
201 |
115 |
|
|
202 |
|
ret = Conn_engine_init(); |
|
|
116 |
|
ret = Conn_engine_epoll_init(); |
203 |
117 |
if (ret != 0) |
if (ret != 0) |
204 |
118 |
return -1; |
return -1; |
205 |
119 |
|
|
|
... |
... |
int Conn_poll(const int timeout) |
1387 |
1301 |
if (Conn_pending > 0) |
if (Conn_pending > 0) |
1388 |
1302 |
Conn_trytoconnect(); |
Conn_trytoconnect(); |
1389 |
1303 |
|
|
1390 |
|
ret = Conn_engine_poll(timeout2, Conn_poll_cb); |
|
|
1304 |
|
ret = Conn_engine_epoll_poll(timeout2, Conn_poll_cb); |
1391 |
1305 |
if (ret < 0) |
if (ret < 0) |
1392 |
1306 |
return -1; |
return -1; |
1393 |
1307 |
|
|
File Conn_engine_core.c changed (mode: 100644) (index 1ef5a31..f8c3b9f) |
1 |
1 |
/* |
/* |
2 |
2 |
* Author: Catalin(ux) M BOIE <catab at embedromix.ro> |
* Author: Catalin(ux) M BOIE <catab at embedromix.ro> |
3 |
|
* Date: 2004-2008 |
|
|
3 |
|
* Date: 2004 |
4 |
4 |
* Description: Some functions to help writing network servers and clients, |
* Description: Some functions to help writing network servers and clients, |
5 |
5 |
* both ipv4 and ipv6. |
* both ipv4 and ipv6. |
6 |
6 |
* Licence: LGPL |
* Licence: LGPL |
|
8 |
8 |
|
|
9 |
9 |
#include "Conn_engine_core.h" |
#include "Conn_engine_core.h" |
10 |
10 |
|
|
|
11 |
|
#include <sys/epoll.h> |
11 |
12 |
|
|
12 |
13 |
/* Visible variables */ |
/* Visible variables */ |
13 |
14 |
void (*Conn_accept_cb)(struct Conn *C) = NULL; |
void (*Conn_accept_cb)(struct Conn *C) = NULL; |
|
... |
... |
unsigned int Conn_default_obuf = 128; |
30 |
31 |
unsigned int Conn_max_ibuf = 4096000; |
unsigned int Conn_max_ibuf = 4096000; |
31 |
32 |
unsigned int Conn_max_obuf = 4096000; |
unsigned int Conn_max_obuf = 4096000; |
32 |
33 |
|
|
33 |
|
/* Max bytes enqueued on one send/recv call */ |
|
|
34 |
|
/* Max bytes to enqueue on one send/recv call */ |
34 |
35 |
unsigned int Conn_max_send = 32 * 1024; |
unsigned int Conn_max_send = 32 * 1024; |
35 |
36 |
unsigned int Conn_max_recv = 32 * 1024; |
unsigned int Conn_max_recv = 32 * 1024; |
36 |
37 |
|
|
|
... |
... |
char Conn_error[512]; |
60 |
61 |
FILE *Conn_Log = NULL; |
FILE *Conn_Log = NULL; |
61 |
62 |
int debug_band = 11; |
int debug_band = 11; |
62 |
63 |
|
|
63 |
|
/* Flags */ |
|
64 |
|
unsigned int CONN_POLLIN; |
|
65 |
|
unsigned int CONN_POLLOUT; |
|
66 |
|
unsigned int CONN_POLLPRI; |
|
67 |
|
unsigned int CONN_POLLERR; |
|
68 |
|
unsigned int CONN_POLLHUP; |
|
69 |
|
unsigned int CONN_POLLNVAL; |
|
70 |
|
unsigned int CONN_POLLRDNORM; |
|
71 |
|
unsigned int CONN_POLLRDBAND; |
|
72 |
|
|
|
73 |
64 |
/* queues */ |
/* queues */ |
74 |
65 |
struct Conn_queue Conn_queue_free; |
struct Conn_queue Conn_queue_free; |
75 |
66 |
|
|
|
... |
... |
int Conn_try_expand_buf(const unsigned int slot, const int what, |
272 |
263 |
char *p; |
char *p; |
273 |
264 |
unsigned int hm; |
unsigned int hm; |
274 |
265 |
unsigned int old_size, amount, head, tail; |
unsigned int old_size, amount, head, tail; |
275 |
|
unsigned int default_buf, buf_size, max_buf; |
|
|
266 |
|
unsigned int buf_size, max_buf; |
276 |
267 |
char *pbuf; |
char *pbuf; |
277 |
268 |
|
|
278 |
269 |
if (what == 0) { |
if (what == 0) { |
279 |
270 |
head = Conns[slot].obuf_head; |
head = Conns[slot].obuf_head; |
280 |
271 |
tail = Conns[slot].obuf_tail; |
tail = Conns[slot].obuf_tail; |
281 |
|
default_buf = Conn_default_obuf; |
|
282 |
272 |
old_size = Conns[slot].obuf_size; |
old_size = Conns[slot].obuf_size; |
283 |
273 |
buf_size = Conns[slot].obuf_size; |
buf_size = Conns[slot].obuf_size; |
284 |
274 |
max_buf = Conn_max_obuf; |
max_buf = Conn_max_obuf; |
|
... |
... |
int Conn_try_expand_buf(const unsigned int slot, const int what, |
286 |
276 |
} else { |
} else { |
287 |
277 |
head = Conns[slot].ibuf_head; |
head = Conns[slot].ibuf_head; |
288 |
278 |
tail = Conns[slot].ibuf_tail; |
tail = Conns[slot].ibuf_tail; |
289 |
|
default_buf = Conn_default_ibuf; |
|
290 |
279 |
old_size = Conns[slot].ibuf_size; |
old_size = Conns[slot].ibuf_size; |
291 |
280 |
buf_size = Conns[slot].ibuf_size; |
buf_size = Conns[slot].ibuf_size; |
292 |
281 |
max_buf = Conn_max_ibuf; |
max_buf = Conn_max_ibuf; |
|
... |
... |
void Conn_poll_status(const short ev, char *ret) |
350 |
339 |
|
|
351 |
340 |
strcpy(ret, ""); |
strcpy(ret, ""); |
352 |
341 |
|
|
353 |
|
if (ev & CONN_POLLIN) ret[i++] = 'I'; |
|
354 |
|
if (ev & CONN_POLLPRI) ret[i++] = 'P'; |
|
355 |
|
if (ev & CONN_POLLOUT) ret[i++] = 'O'; |
|
356 |
|
if (ev & CONN_POLLERR) ret[i++] = 'E'; |
|
357 |
|
if (ev & CONN_POLLHUP) ret[i++] = 'H'; |
|
358 |
|
if (ev & CONN_POLLNVAL) ret[i++] = 'V'; |
|
359 |
|
if (ev & CONN_POLLRDNORM) ret[i++] = 'r'; |
|
360 |
|
if (ev & CONN_POLLRDBAND) ret[i++] = 'R'; |
|
|
342 |
|
if (ev & EPOLLIN) ret[i++] = 'I'; |
|
343 |
|
if (ev & EPOLLPRI) ret[i++] = 'P'; |
|
344 |
|
if (ev & EPOLLOUT) ret[i++] = 'O'; |
|
345 |
|
if (ev & EPOLLERR) ret[i++] = 'E'; |
|
346 |
|
if (ev & EPOLLHUP) ret[i++] = 'H'; |
|
347 |
|
if (ev & EPOLLNVAL) ret[i++] = 'V'; |
|
348 |
|
if (ev & EPOLLRDNORM) ret[i++] = 'N'; |
|
349 |
|
if (ev & EPOLLRDBAND) ret[i++] = 'B'; |
|
350 |
|
if (ev & EPOLLWRNORM) ret[i++] = 'n'; |
|
351 |
|
if (ev & EPOLLWRBAND) ret[i++] = 'b'; |
|
352 |
|
if (ev & EPOLLRDHUP) ret[i++] = 'h'; |
361 |
353 |
ret[i++] = '\0'; |
ret[i++] = '\0'; |
362 |
354 |
} |
} |
363 |
355 |
|
|
|
... |
... |
int Conn_set_cb(struct Conn *C, const unsigned int cb_type, void (*f)(struct Con |
881 |
873 |
|
|
882 |
874 |
/* |
/* |
883 |
875 |
* Search for str in active buffer from a given offset |
* Search for str in active buffer from a given offset |
884 |
|
* Returns pointer to string if match or NUll if doesn't. |
|
|
876 |
|
* Returns pointer to string if match or NULL if doesn't. |
885 |
877 |
* @flags: bit 0 == 1 => case insensitive |
* @flags: bit 0 == 1 => case insensitive |
886 |
878 |
*/ |
*/ |
887 |
879 |
char *Conn_ostrstr(struct Conn *C, const unsigned int off, const char *str, |
char *Conn_ostrstr(struct Conn *C, const unsigned int off, const char *str, |
|
... |
... |
void Conn_eat(struct Conn *C, const unsigned int bytes) |
1010 |
1002 |
*/ |
*/ |
1011 |
1003 |
void Conn_eatall(struct Conn *C) |
void Conn_eatall(struct Conn *C) |
1012 |
1004 |
{ |
{ |
1013 |
|
Conn_eat(C, Conn_qlen(C)); |
|
|
1005 |
|
unsigned int slot; |
|
1006 |
|
|
|
1007 |
|
slot = C->slot; |
|
1008 |
|
|
|
1009 |
|
Conns[slot].ibuf_head = 0; |
|
1010 |
|
Conns[slot].ibuf_tail = 0; |
1014 |
1011 |
} |
} |
1015 |
1012 |
|
|
1016 |
1013 |
/* |
/* |
|
... |
... |
struct Conn_split *Conn_split(const char *line0) |
1346 |
1343 |
char *p; |
char *p; |
1347 |
1344 |
struct Conn_split *ret = NULL; |
struct Conn_split *ret = NULL; |
1348 |
1345 |
struct Conn_split_cell *q; |
struct Conn_split_cell *q; |
1349 |
|
unsigned int i; |
|
1350 |
1346 |
char search_for; |
char search_for; |
1351 |
1347 |
char *left, *right; |
char *left, *right; |
1352 |
1348 |
unsigned int right_len; |
unsigned int right_len; |
|
... |
... |
struct Conn_split *Conn_split(const char *line0) |
1383 |
1379 |
|
|
1384 |
1380 |
/* Building left */ |
/* Building left */ |
1385 |
1381 |
left = p; |
left = p; |
1386 |
|
i = 0; |
|
1387 |
1382 |
while ((*p != '\0') && (*p != '=')) |
while ((*p != '\0') && (*p != '=')) |
1388 |
1383 |
p++; |
p++; |
1389 |
1384 |
if (*p != '\0') { |
if (*p != '\0') { |
|
... |
... |
struct Conn_split *Conn_split(const char *line0) |
1401 |
1396 |
p++; |
p++; |
1402 |
1397 |
} |
} |
1403 |
1398 |
|
|
1404 |
|
i = 0; |
|
1405 |
1399 |
while ((*p != '\0') && (*p != search_for)) { |
while ((*p != '\0') && (*p != search_for)) { |
1406 |
1400 |
right_len++; |
right_len++; |
1407 |
1401 |
p++; |
p++; |
File Conn_engine_poll.c deleted (index 8a866db..0000000) |
1 |
|
#include <Conn_config.h> |
|
2 |
|
|
|
3 |
|
#ifdef POLL_FOUND |
|
4 |
|
|
|
5 |
|
#include <Conn_engine_poll.h> |
|
6 |
|
|
|
7 |
|
/* |
|
8 |
|
* Variables |
|
9 |
|
*/ |
|
10 |
|
static unsigned long Conn_poll_allocated_slots = 0; |
|
11 |
|
static struct pollfd *Conn_poll_pfds = NULL; |
|
12 |
|
|
|
13 |
|
/* |
|
14 |
|
* Functions |
|
15 |
|
*/ |
|
16 |
|
|
|
17 |
|
/* |
|
18 |
|
* Init the engine |
|
19 |
|
*/ |
|
20 |
|
int Conn_poll_init(void) |
|
21 |
|
{ |
|
22 |
|
return 0; |
|
23 |
|
} |
|
24 |
|
|
|
25 |
|
int Conn_poll_shutdown(void) |
|
26 |
|
{ |
|
27 |
|
free(Conn_poll_pfds); |
|
28 |
|
|
|
29 |
|
return 0; |
|
30 |
|
} |
|
31 |
|
|
|
32 |
|
/* |
|
33 |
|
* Grow the number of slots needed for poll |
|
34 |
|
*/ |
|
35 |
|
int Conn_poll_grow(unsigned int alloc) |
|
36 |
|
{ |
|
37 |
|
struct pollfd *p, *set; |
|
38 |
|
unsigned int diff, mem; |
|
39 |
|
|
|
40 |
|
Log(10, "%s: Trying to grow pollfds from %d to %d.\n", |
|
41 |
|
__FUNCTION__, |
|
42 |
|
Conn_poll_allocated_slots, alloc); |
|
43 |
|
|
|
44 |
|
if (alloc <= Conn_poll_allocated_slots) |
|
45 |
|
return 0; |
|
46 |
|
|
|
47 |
|
diff = alloc - Conn_poll_allocated_slots; |
|
48 |
|
|
|
49 |
|
mem = alloc * sizeof(struct pollfd); |
|
50 |
|
p = (struct pollfd *) realloc(Conn_poll_pfds, mem); |
|
51 |
|
if (p == NULL) { |
|
52 |
|
snprintf(Conn_error, sizeof(Conn_error), |
|
53 |
|
"Cannot alloc %u bytes for pollfds.", mem); |
|
54 |
|
return -1; |
|
55 |
|
} |
|
56 |
|
|
|
57 |
|
set = p + Conn_poll_allocated_slots; |
|
58 |
|
memset(set, 0, diff * sizeof(struct pollfd)); |
|
59 |
|
Conn_poll_pfds = p; |
|
60 |
|
|
|
61 |
|
return 0; |
|
62 |
|
} |
|
63 |
|
|
|
64 |
|
/* |
|
65 |
|
* Add a target to the list |
|
66 |
|
*/ |
|
67 |
|
int Conn_poll_add_obj(struct Conn *C) |
|
68 |
|
{ |
|
69 |
|
Conn_poll_pfds[C->slot].fd = C->fd; |
|
70 |
|
Conn_poll_pfds[C->slot].events = C->events; |
|
71 |
|
|
|
72 |
|
return 0; |
|
73 |
|
} |
|
74 |
|
|
|
75 |
|
/* |
|
76 |
|
* Remove a target from the list |
|
77 |
|
*/ |
|
78 |
|
int Conn_poll_del_obj(struct Conn *C) |
|
79 |
|
{ |
|
80 |
|
Conn_poll_pfds[C->slot].fd = -1; |
|
81 |
|
Conn_poll_pfds[C->slot].events = 0; |
|
82 |
|
|
|
83 |
|
return 0; |
|
84 |
|
} |
|
85 |
|
|
|
86 |
|
/* |
|
87 |
|
* Change event mask |
|
88 |
|
*/ |
|
89 |
|
int Conn_poll_chg_obj(struct Conn *C) |
|
90 |
|
{ |
|
91 |
|
Conn_poll_pfds[C->slot].events = C->events; |
|
92 |
|
|
|
93 |
|
return 0; |
|
94 |
|
} |
|
95 |
|
|
|
96 |
|
|
|
97 |
|
/* |
|
98 |
|
* Calls a callback for fds with activity |
|
99 |
|
* Returns: -1 on error, 0 nothing to do, n (>0) if some work was done |
|
100 |
|
* timeout is in 1/1000 seconds increments. |
|
101 |
|
*/ |
|
102 |
|
int Conn_poll_poll(const int timeout2, void (*cb)(const unsigned int slot, |
|
103 |
|
const int revents)) |
|
104 |
|
{ |
|
105 |
|
int slot, events; |
|
106 |
|
|
|
107 |
|
Log(10, "%s: timeout2=%ums...\n", __FUNCTION__, timeout2); |
|
108 |
|
again: |
|
109 |
|
events = poll(&Conn_poll_pfds[0], Conn_no, timeout2); |
|
110 |
|
if ((events == -1) && (errno == EINTR)) |
|
111 |
|
goto again; |
|
112 |
|
|
|
113 |
|
if (events < 0) { |
|
114 |
|
snprintf(Conn_error, sizeof(Conn_error), |
|
115 |
|
"%s: Conn_no=%d [%s]", |
|
116 |
|
__FUNCTION__, Conn_no, |
|
117 |
|
strerror(errno)); |
|
118 |
|
return -1; |
|
119 |
|
} |
|
120 |
|
|
|
121 |
|
gettimeofday(&Conn_now, NULL); |
|
122 |
|
|
|
123 |
|
if (events == 0) |
|
124 |
|
return 0; |
|
125 |
|
|
|
126 |
|
/* We do revers scan because of moving Conn objects */ |
|
127 |
|
Log(11, "\tProcessing %d event(s)...\n", |
|
128 |
|
events); |
|
129 |
|
slot = Conn_no - 1; |
|
130 |
|
do { |
|
131 |
|
if (Conn_poll_pfds[slot].revents & POLLNVAL) { |
|
132 |
|
Log(0, "BUG NVAL!\n"); |
|
133 |
|
exit(1); |
|
134 |
|
} |
|
135 |
|
|
|
136 |
|
cb(slot, Conn_poll_pfds[slot].revents); |
|
137 |
|
|
|
138 |
|
slot--; |
|
139 |
|
} while (slot >= 0); |
|
140 |
|
|
|
141 |
|
return events; |
|
142 |
|
|
|
143 |
|
} |
|
144 |
|
|
|
145 |
|
/* |
|
146 |
|
* Move a slot over an other. |
|
147 |
|
*/ |
|
148 |
|
int Conn_poll_move_slot(const unsigned int dst, const unsigned int src) |
|
149 |
|
{ |
|
150 |
|
struct pollfd tmp; |
|
151 |
|
|
|
152 |
|
tmp = Conn_poll_pfds[dst]; |
|
153 |
|
Conn_poll_pfds[dst] = Conn_poll_pfds[src]; |
|
154 |
|
Conn_poll_pfds[src] = tmp; |
|
155 |
|
|
|
156 |
|
return 0; |
|
157 |
|
} |
|
158 |
|
|
|
159 |
|
#endif |
|
File Makefile.in changed (mode: 100644) (index 7c701fd..c62a877) |
... |
... |
export CC := gcc |
2 |
2 |
export INCS += -I. |
export INCS += -I. |
3 |
3 |
export LIBS += -lpthread |
export LIBS += -lpthread |
4 |
4 |
export CFLAGS += -ggdb3 -Wall -Wextra -pedantic -Wno-long-long -pipe -fpic |
export CFLAGS += -ggdb3 -Wall -Wextra -pedantic -Wno-long-long -pipe -fpic |
5 |
|
export OBJS += Conn_engine_core.o Conn_engine_poll.o Conn_engine_epoll.o Conn.o \ |
|
|
5 |
|
export OBJS += Conn_engine_core.o Conn_engine_epoll.o Conn.o \ |
6 |
6 |
Conn_wpool.o |
Conn_wpool.o |
7 |
7 |
|
|
8 |
8 |
.PHONY: all |
.PHONY: all |
|
... |
... |
all: libConn.so.@VER@ |
12 |
12 |
Conn_engine_core.o: Conn_engine_core.c Conn_engine_core.h Conn_config.h |
Conn_engine_core.o: Conn_engine_core.c Conn_engine_core.h Conn_config.h |
13 |
13 |
$(CC) $(CFLAGS) $(INCS) -c Conn_engine_core.c |
$(CC) $(CFLAGS) $(INCS) -c Conn_engine_core.c |
14 |
14 |
|
|
15 |
|
Conn_engine_poll.o: Conn_engine_poll.c Conn_config.h Conn_engine_core.h |
|
16 |
|
$(CC) $(CFLAGS) $(INCS) -c Conn_engine_poll.c |
|
17 |
|
|
|
18 |
15 |
Conn_engine_epoll.o: Conn_engine_epoll.c Conn_config.h Conn_engine_core.h |
Conn_engine_epoll.o: Conn_engine_epoll.c Conn_config.h Conn_engine_core.h |
19 |
16 |
$(CC) $(CFLAGS) $(INCS) -c Conn_engine_epoll.c |
$(CC) $(CFLAGS) $(INCS) -c Conn_engine_epoll.c |
20 |
17 |
|
|
21 |
18 |
Conn_wpool.o: Conn_wpool.c Conn_wpool.h Conn_engine_core.o Conn_config.h |
Conn_wpool.o: Conn_wpool.c Conn_wpool.h Conn_engine_core.o Conn_config.h |
22 |
19 |
$(CC) $(CFLAGS) $(INCS) -c Conn_wpool.c |
$(CC) $(CFLAGS) $(INCS) -c Conn_wpool.c |
23 |
20 |
|
|
24 |
|
Conn.o: Conn.c Conn.h Conn_engine_core.o Conn_engine_poll.o Conn_engine_epoll.o Conn_wpool.o |
|
|
21 |
|
Conn.o: Conn.c Conn.h Conn_engine_core.o Conn_engine_epoll.o Conn_wpool.o |
25 |
22 |
$(CC) $(CFLAGS) $(INCS) -c Conn.c |
$(CC) $(CFLAGS) $(INCS) -c Conn.c |
26 |
23 |
|
|
27 |
24 |
%.o: %.c |
%.o: %.c |