| 294 | static void check(void *ptr); |
| 295 | |
| 296 | int |
| 297 | main(int argc, char **argv) |
| 298 | { |
| 299 | int argn; |
| 300 | int start; |
| 301 | #define START_NONE 0 |
| 302 | #define START_PARALLEL 1 |
| 303 | #define START_RATE 2 |
| 304 | int start_parallel = -1, start_rate = -1; |
| 305 | int end; |
| 306 | #define END_NONE 0 |
| 307 | #define END_FETCHES 1 |
| 308 | #define END_SECONDS 2 |
| 309 | int end_fetches = -1, end_seconds = -1; |
| 310 | int cnum; |
| 311 | char *url_file; |
| 312 | char *sip_file; |
| 313 | #ifdef RLIMIT_NOFILE |
| 314 | struct rlimit limits; |
| 315 | #endif /* RLIMIT_NOFILE */ |
| 316 | struct epoll_event *events; |
| 317 | struct timeval now; |
| 318 | int i, r, periodic_tmr; |
| 319 | |
| 320 | max_connections = 64 - RESERVED_FDS; /* a guess */ |
| 321 | #ifdef RLIMIT_NOFILE |
| 322 | /* Try and increase the limit on # of files to the maximum. */ |
| 323 | if (getrlimit(RLIMIT_NOFILE, &limits) == 0) { |
| 324 | if (limits.rlim_cur != limits.rlim_max) { |
| 325 | if (limits.rlim_max == RLIM_INFINITY) |
| 326 | limits.rlim_cur = 8192; /* arbitrary */ |
| 327 | else if (limits.rlim_max > limits.rlim_cur) |
| 328 | limits.rlim_cur = limits.rlim_max; |
| 329 | (void)setrlimit(RLIMIT_NOFILE, &limits); |
| 330 | } |
| 331 | max_connections = limits.rlim_cur - RESERVED_FDS; |
| 332 | } |
| 333 | #endif /* RLIMIT_NOFILE */ |
| 334 | |
| 335 | /* Parse args. */ |
| 336 | argv0 = argv[0]; |
| 337 | argn = 1; |
| 338 | do_checksum = do_throttle = do_verbose = do_jitter = do_proxy = 0; |
| 339 | do_accept_gzip = do_sequential = 0; |
| 340 | throttle = THROTTLE; |
| 341 | sip_file = (char *)0; |
| 342 | user_agent = VERSION; |
| 343 | cookie = NULL; |
| 344 | http_version = "1.1"; |
| 345 | is_http_1_1 = 1; |
| 346 | idle_secs = IDLE_SECS; |
| 347 | start = START_NONE; |
| 348 | end = END_NONE; |
| 349 | keep_alive = 0; |
| 350 | socket_pool = 0; |
| 351 | extra_headers = NULL; |
| 352 | while (argn < argc && argv[argn][0] == '-' && argv[argn][1] != '\0') { |
| 353 | if (strncmp(argv[argn], "-checksum", strlen(argv[argn])) == 0) |
nothing calls this directly
no test coverage detected