Mercurial > hg > nginx-quic
annotate src/os/unix/ngx_posix_config.h @ 6081:12ab5cd445c0 stable-1.6
Core: fixed potential buffer overrun when initializing hash.
Initial size as calculated from the number of elements may be bigger
than max_size. If this happens, make sure to set size to max_size.
Reported by Chris West.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Tue, 24 Feb 2015 18:37:14 +0300 |
parents | 72e31d88defa |
children | a88e309f839b |
rev | line source |
---|---|
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
374
diff
changeset
|
1 |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
374
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 |
4412 | 4 * Copyright (C) Nginx, Inc. |
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
374
diff
changeset
|
5 */ |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
374
diff
changeset
|
6 |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
374
diff
changeset
|
7 |
355
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
8 #ifndef _NGX_POSIX_CONFIG_H_INCLUDED_ |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
9 #define _NGX_POSIX_CONFIG_H_INCLUDED_ |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
10 |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
11 |
515 | 12 #if (NGX_HPUX) |
455 | 13 #define _XOPEN_SOURCE |
14 #define _XOPEN_SOURCE_EXTENDED 1 | |
4692
489839d07b38
Fixed "sendmsg() failed" alerts on HP-UX.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4557
diff
changeset
|
15 #define _HPUX_ALT_XOPEN_SOCKET_API |
455 | 16 #endif |
17 | |
18 | |
515 | 19 #if (NGX_TRU64) |
467 | 20 #define _REENTRANT |
21 #endif | |
22 | |
23 | |
1576 | 24 #ifdef __CYGWIN__ |
25 #define timezonevar /* timezone is variable */ | |
1581
81774dc3db28
Cygwin can not pass SCM_RIGHTS via unix socket, use signals
Igor Sysoev <igor@sysoev.ru>
parents:
1576
diff
changeset
|
26 #define NGX_BROKEN_SCM_RIGHTS 1 |
1576 | 27 #endif |
28 | |
29 | |
355
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
30 #include <sys/types.h> |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
31 #include <sys/time.h> |
455 | 32 #if (NGX_HAVE_UNISTD_H) |
355
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
33 #include <unistd.h> |
455 | 34 #endif |
35 #if (NGX_HAVE_INTTYPES_H) | |
36 #include <inttypes.h> | |
37 #endif | |
355
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
38 #include <stdarg.h> |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
39 #include <stddef.h> /* offsetof() */ |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
40 #include <stdio.h> |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
41 #include <stdlib.h> |
5389
72e31d88defa
Added ngx_filename_cmp() with "/" sorted to the left.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4692
diff
changeset
|
42 #include <ctype.h> |
355
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
43 #include <errno.h> |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
44 #include <string.h> |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
45 #include <signal.h> |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
46 #include <pwd.h> |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
47 #include <grp.h> |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
48 #include <dirent.h> |
727 | 49 #include <glob.h> |
4557
b13419459a50
Added explicit include of time.h.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4412
diff
changeset
|
50 #include <time.h> |
2659
a3bcaabf2ec8
fix OpenBSD building, broken in r2616
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
51 #if (NGX_HAVE_SYS_PARAM_H) |
a3bcaabf2ec8
fix OpenBSD building, broken in r2616
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
52 #include <sys/param.h> /* statfs() */ |
a3bcaabf2ec8
fix OpenBSD building, broken in r2616
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
53 #endif |
2615 | 54 #if (NGX_HAVE_SYS_MOUNT_H) |
55 #include <sys/mount.h> /* statfs() */ | |
56 #endif | |
57 #if (NGX_HAVE_SYS_STATVFS_H) | |
58 #include <sys/statvfs.h> /* statvfs() */ | |
59 #endif | |
355
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
60 |
455 | 61 #if (NGX_HAVE_SYS_FILIO_H) |
62 #include <sys/filio.h> /* FIONBIO */ | |
63 #endif | |
64 #include <sys/ioctl.h> /* FIONBIO */ | |
65 | |
355
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
66 #include <sys/uio.h> |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
67 #include <sys/stat.h> |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
68 #include <fcntl.h> |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
69 |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
70 #include <sys/wait.h> |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
71 #include <sys/mman.h> |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
72 #include <sys/resource.h> |
374
213f17e9f776
nginx-0.0.7-2004-07-02-09:47:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
355
diff
changeset
|
73 #include <sched.h> |
355
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
74 |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
75 #include <sys/socket.h> |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
76 #include <netinet/in.h> |
455 | 77 #include <netinet/tcp.h> /* TCP_NODELAY */ |
355
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
78 #include <arpa/inet.h> |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
79 #include <netdb.h> |
479 | 80 #include <sys/un.h> |
355
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
81 |
455 | 82 #if (NGX_HAVE_LIMITS_H) |
83 #include <limits.h> /* IOV_MAX */ | |
84 #endif | |
85 | |
1954
d85e291b99f9
it seems that malloc.h is required for Cygwin only
Igor Sysoev <igor@sysoev.ru>
parents:
1901
diff
changeset
|
86 #ifdef __CYGWIN__ |
1576 | 87 #include <malloc.h> /* memalign() */ |
88 #endif | |
89 | |
90 #if (NGX_HAVE_CRYPT_H) | |
91 #include <crypt.h> | |
92 #endif | |
93 | |
94 | |
455 | 95 #ifndef IOV_MAX |
96 #define IOV_MAX 16 | |
97 #endif | |
98 | |
99 | |
355
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
100 #include <ngx_auto_config.h> |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
101 |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
102 |
3909
0daede16d68b
use POSIX semaphores in shmtx instead of sched_yield()
Igor Sysoev <igor@sysoev.ru>
parents:
3052
diff
changeset
|
103 #if (NGX_HAVE_POSIX_SEM) |
0daede16d68b
use POSIX semaphores in shmtx instead of sched_yield()
Igor Sysoev <igor@sysoev.ru>
parents:
3052
diff
changeset
|
104 #include <semaphore.h> |
0daede16d68b
use POSIX semaphores in shmtx instead of sched_yield()
Igor Sysoev <igor@sysoev.ru>
parents:
3052
diff
changeset
|
105 #endif |
0daede16d68b
use POSIX semaphores in shmtx instead of sched_yield()
Igor Sysoev <igor@sysoev.ru>
parents:
3052
diff
changeset
|
106 |
0daede16d68b
use POSIX semaphores in shmtx instead of sched_yield()
Igor Sysoev <igor@sysoev.ru>
parents:
3052
diff
changeset
|
107 |
469 | 108 #if (NGX_HAVE_POLL) |
355
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
109 #include <poll.h> |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
110 #endif |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
111 |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
112 |
469 | 113 #if (NGX_HAVE_KQUEUE) |
455 | 114 #include <sys/event.h> |
115 #endif | |
116 | |
117 | |
469 | 118 #if (NGX_HAVE_DEVPOLL) |
455 | 119 #include <sys/ioctl.h> |
120 #include <sys/devpoll.h> | |
121 #endif | |
122 | |
123 | |
3052
6060225e9261
FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents:
2659
diff
changeset
|
124 #if (NGX_HAVE_FILE_AIO) |
6060225e9261
FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents:
2659
diff
changeset
|
125 #include <aio.h> |
6060225e9261
FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents:
2659
diff
changeset
|
126 typedef struct aiocb ngx_aiocb_t; |
6060225e9261
FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents:
2659
diff
changeset
|
127 #endif |
6060225e9261
FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents:
2659
diff
changeset
|
128 |
6060225e9261
FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents:
2659
diff
changeset
|
129 |
1377
0d57c150115b
set default listen() backlog to 511 on all platforms except FreeBSD
Igor Sysoev <igor@sysoev.ru>
parents:
727
diff
changeset
|
130 #define NGX_LISTEN_BACKLOG 511 |
0d57c150115b
set default listen() backlog to 511 on all platforms except FreeBSD
Igor Sysoev <igor@sysoev.ru>
parents:
727
diff
changeset
|
131 |
4223
1b779cb69dc8
malloc() debugging on MacOSX.
Igor Sysoev <igor@sysoev.ru>
parents:
3909
diff
changeset
|
132 #define ngx_debug_init() |
1b779cb69dc8
malloc() debugging on MacOSX.
Igor Sysoev <igor@sysoev.ru>
parents:
3909
diff
changeset
|
133 |
1377
0d57c150115b
set default listen() backlog to 511 on all platforms except FreeBSD
Igor Sysoev <igor@sysoev.ru>
parents:
727
diff
changeset
|
134 |
455 | 135 #if (__FreeBSD__) && (__FreeBSD_version < 400017) |
136 | |
137 #include <sys/param.h> /* ALIGN() */ | |
138 | |
2006
b52cb9bf2064
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
1954
diff
changeset
|
139 /* |
1901
d880fa02fb65
use CMSG_LEN(), this fixes an alert "sendmsg() failed (9: Bad file descriptor)"
Igor Sysoev <igor@sysoev.ru>
parents:
1581
diff
changeset
|
140 * FreeBSD 3.x has no CMSG_SPACE() and CMSG_LEN() and has the broken CMSG_DATA() |
d880fa02fb65
use CMSG_LEN(), this fixes an alert "sendmsg() failed (9: Bad file descriptor)"
Igor Sysoev <igor@sysoev.ru>
parents:
1581
diff
changeset
|
141 */ |
455 | 142 |
143 #undef CMSG_SPACE | |
144 #define CMSG_SPACE(l) (ALIGN(sizeof(struct cmsghdr)) + ALIGN(l)) | |
145 | |
1901
d880fa02fb65
use CMSG_LEN(), this fixes an alert "sendmsg() failed (9: Bad file descriptor)"
Igor Sysoev <igor@sysoev.ru>
parents:
1581
diff
changeset
|
146 #undef CMSG_LEN |
d880fa02fb65
use CMSG_LEN(), this fixes an alert "sendmsg() failed (9: Bad file descriptor)"
Igor Sysoev <igor@sysoev.ru>
parents:
1581
diff
changeset
|
147 #define CMSG_LEN(l) (ALIGN(sizeof(struct cmsghdr)) + (l)) |
d880fa02fb65
use CMSG_LEN(), this fixes an alert "sendmsg() failed (9: Bad file descriptor)"
Igor Sysoev <igor@sysoev.ru>
parents:
1581
diff
changeset
|
148 |
455 | 149 #undef CMSG_DATA |
150 #define CMSG_DATA(cmsg) ((u_char *)(cmsg) + ALIGN(sizeof(struct cmsghdr))) | |
151 | |
152 #endif | |
153 | |
154 | |
601 | 155 extern char **environ; |
156 | |
157 | |
355
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
158 #endif /* _NGX_POSIX_CONFIG_H_INCLUDED_ */ |