Repository navigation
Expand file tree
/
Copy pathmeinheld.h
More file actions
65 lines (56 loc) · 1.33 KB
/
Copy pathmeinheld.h
File metadata and controls
65 lines (56 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifndef MEINHELD_H
#define MEINHELD_H
#include <Python.h>
#include <assert.h>
#include <fcntl.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <inttypes.h>
#ifdef linux
#include <sys/sendfile.h>
#elif defined(__APPLE__) || defined(__FreeBSD__)
#include <sys/uio.h>
#endif
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <netdb.h>
#include <time.h>
#include <sys/time.h>
#include "greenlet.h"
#include "picoev.h"
#include "http_parser.h"
#define SERVER "meinheld/0.5dev"
#ifdef DEVELOP
#define DEBUG(...) \
do { \
/*printf("DEBUG: ");*/ \
printf("%-40s %-22s%4u: ", __FILE__, __func__, __LINE__); \
printf(__VA_ARGS__); \
printf("\n"); \
} while(0)
#define RDEBUG(...) \
do { \
/*printf("%-22s%4u: ", __FILE__, __LINE__);*/ \
printf("\x1B[31m%-40s %-22s%4u: ", __FILE__, __func__, __LINE__); \
printf(__VA_ARGS__); \
printf("\x1B[0m\n"); \
} while(0)
#else
#define DEBUG(...) do{}while(0)
#define RDEBUG(...) do{}while(0)
#endif
#if __GNUC__ >= 3
# define likely(x) __builtin_expect(!!(x), 1)
# define unlikely(x) __builtin_expect(!!(x), 0)
#else
# define likely(x) (x)
# define unlikely(x) (x)
#endif
#endif