version 1.46, 2015/02/09 23:46:23 |
version 1.47, 2015/11/13 19:37:20 |
|
|
int |
int |
main(int argc, char **argv) |
main(int argc, char **argv) |
{ |
{ |
extern int optind; |
|
extern char *optarg; |
|
struct timeval tv; |
struct timeval tv; |
unsigned int secs, rtable; |
unsigned int secs, rtable; |
|
|
|
|
} |
} |
} |
} |
|
|
|
if (pledge("stdio rpath dns inet id proc", NULL) == -1) |
|
err(1, "pledge"); |
|
|
argv += optind; |
argv += optind; |
argc -= optind; |
argc -= optind; |
if ((argc != (ptb->sflag ? 0 : 1)) || |
if ((argc != (ptb->sflag ? 0 : 1)) || |
|
|
} else |
} else |
drop_gid(); |
drop_gid(); |
|
|
|
if (pledge("stdio id dns inet", NULL) == -1) |
|
err(1, "pledge"); |
|
|
if (!ptb->sflag) |
if (!ptb->sflag) |
host = argv[0]; |
host = argv[0]; |
/* |
/* |
|
|
errx(1, "getaddrinfo: %s", gai_strerror(herr)); |
errx(1, "getaddrinfo: %s", gai_strerror(herr)); |
} |
} |
|
|
|
if (pledge("stdio id inet", NULL) == -1) |
|
err(1, "pledge"); |
|
|
if (getrlimit(RLIMIT_NOFILE, &rl) == -1) |
if (getrlimit(RLIMIT_NOFILE, &rl) == -1) |
err(1, "getrlimit"); |
err(1, "getrlimit"); |
if (rl.rlim_cur < MAX_FD) |
if (rl.rlim_cur < MAX_FD) |
|
|
err(1, "setrlimit"); |
err(1, "setrlimit"); |
if (getrlimit(RLIMIT_NOFILE, &rl) == -1) |
if (getrlimit(RLIMIT_NOFILE, &rl) == -1) |
err(1, "getrlimit"); |
err(1, "getrlimit"); |
|
|
|
if (pledge("stdio inet", NULL) == -1) |
|
err(1, "pledge"); |
|
|
/* Init world */ |
/* Init world */ |
TAILQ_INIT(&sc_queue); |
TAILQ_INIT(&sc_queue); |
if ((ptb->dummybuf = malloc(ptb->dummybuf_len)) == NULL) |
if ((ptb->dummybuf = malloc(ptb->dummybuf_len)) == NULL) |
|
|
evtimer_add(&ev_progtimer, &tv); |
evtimer_add(&ev_progtimer, &tv); |
} |
} |
client_init(aitop, nconn, udp_sc, aib); |
client_init(aitop, nconn, udp_sc, aib); |
|
|
|
if (pledge("stdio", NULL) == -1) |
|
err(1, "pledge"); |
} |
} |
|
|
/* libevent main loop*/ |
/* libevent main loop*/ |
event_dispatch(); |
event_dispatch(); |
|
|