endpwent();
rde_main(struct bgpd_config *config, int pipe_m2r[2], int pipe_s2r[2]){	pid_t		 pid;	struct passwd	*pw;	struct pollfd	 pfd[2];	size_t		 nfds;	int		 n;	conf = config;	if ((pw = calloc(1, sizeof(struct passwd))) == NULL)		fatal(NULL, errno);	if ((pw = getpwnam(BGPD_USER)) == NULL)		fatal("getpwnam", errno);	switch (pid = fork()) {	case -1:		fatal("cannot fork", errno);	case 0:		break;	default:		return (pid);	}	if (chroot(pw->pw_dir) < 0)		fatal("chroot failed", errno);	chdir("/");	setproctitle("route decision engine");	if (setgroups(1, &pw->pw_gid) ||	    setegid(pw->pw_gid) || setgid(pw->pw_gid) ||	    seteuid(pw->pw_uid) || setuid(pw->pw_uid)) {		fatal("can't drop privileges", errno);	}	signal(SIGTERM, rde_sighdlr);	close(pipe_s2r[0]);	close(pipe_m2r[0]);	/* initialize the RIB structures */	peer_init(config, peerhashsize);	path_init(pathhashsize);	nexthop_init(nexthophashsize);	pt_init();	init_imsg_buf();	se_sock = pipe_s2r[1];	logit(LOG_INFO, "route decision engine ready");	while (rde_quit == 0) {		bzero(&pfd, sizeof(pfd));		pfd[PFD_PIPE_MAIN].fd = pipe_m2r[1];		pfd[PFD_PIPE_MAIN].events = POLLIN;		if (main_queued_writes > 0)			pfd[PFD_PIPE_MAIN].events |= POLLOUT;		pfd[PFD_PIPE_SESSION].fd = pipe_s2r[1];		pfd[PFD_PIPE_SESSION].events = POLLIN;		if (se_queued_writes > 0)			pfd[PFD_PIPE_SESSION].events |= POLLOUT;		if ((nfds = poll(pfd, 2, INFTIM)) == -1)			if (errno != EINTR)				fatal("poll error", errno);		if (nfds > 0 && pfd[PFD_PIPE_MAIN].revents & POLLIN) {			rde_dispatch_imsg(pfd[PFD_PIPE_MAIN].fd,			    PFD_PIPE_MAIN);		}		if (nfds > 0 && pfd[PFD_PIPE_SESSION].revents & POLLIN) {			rde_dispatch_imsg(pfd[PFD_PIPE_SESSION].fd,			    PFD_PIPE_SESSION);		}		if (nfds > 0 && (pfd[PFD_PIPE_MAIN].revents & POLLOUT) &&		    main_queued_writes) {			nfds--;			if ((n = buf_sock_write(pfd[PFD_PIPE_MAIN].fd)) == -1)				fatal("pipe write error", errno);			main_queued_writes -= n;		}		if (nfds > 0 && (pfd[PFD_PIPE_SESSION].revents & POLLOUT) &&		    se_queued_writes) {			nfds--;			if ((n = buf_sock_write(pfd[PFD_PIPE_SESSION].fd)) ==			    -1)				fatal("pipe write error", errno);			se_queued_writes -= n;		}	}	logit(LOG_INFO, "route decision engine exiting");	_exit(0);}