summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ypserv/yp_main.c
diff options
context:
space:
mode:
authorwpaul <wpaul@FreeBSD.org>1996-12-03 02:37:39 +0000
committerwpaul <wpaul@FreeBSD.org>1996-12-03 02:37:39 +0000
commit47ee9196beeaa7a40be71cf2e8642202eef9a54c (patch)
tree6de7b34289a2dd1a6de71f645eda8ba5441a4ade /usr.sbin/ypserv/yp_main.c
parent65c6417408e3df83cd787c930d520484f3ac5fa7 (diff)
downloadFreeBSD-src-47ee9196beeaa7a40be71cf2e8642202eef9a54c.zip
FreeBSD-src-47ee9196beeaa7a40be71cf2e8642202eef9a54c.tar.gz
Back out the non-forking YPPROC_ALL stuff. Whatever drugs I was doing
when I came up with this idea weren't strong enough to help me see it through. If this was a self-contained application and I had complete control over what data got sent through what socket and when, I might be able to get everything to work right without blocking, but instead I have RPC/XDR in between me and the socket layer, and they have their own ideas about what to do. Maybe one day I'll go totally mad and figure out the right way to do this; in the meantime this mess goes on the back burner.
Diffstat (limited to 'usr.sbin/ypserv/yp_main.c')
-rw-r--r--usr.sbin/ypserv/yp_main.c41
1 files changed, 40 insertions, 1 deletions
diff --git a/usr.sbin/ypserv/yp_main.c b/usr.sbin/ypserv/yp_main.c
index 54a36d2..5c22d89 100644
--- a/usr.sbin/ypserv/yp_main.c
+++ b/usr.sbin/ypserv/yp_main.c
@@ -79,6 +79,7 @@ static int _rpcfdtype;
extern void ypprog_1 __P((struct svc_req, register SVCXPRT));
extern void ypprog_2 __P((struct svc_req, register SVCXPRT));
+extern int _rpc_dtablesize __P((void));
extern int _rpcsvcstate; /* Set when a request is serviced */
char *progname = "ypserv";
char *yp_dir = _PATH_YP;
@@ -97,6 +98,45 @@ void _msgout(char* msg)
syslog(LOG_ERR, msg);
}
+static void
+yp_svc_run()
+{
+#ifdef FD_SETSIZE
+ fd_set readfds;
+#else
+ int readfds;
+#endif /* def FD_SETSIZE */
+ extern int forked;
+ int pid;
+ int fd_setsize = _rpc_dtablesize();
+
+ /* Establish the identity of the parent ypserv process. */
+ pid = getpid();
+
+ for (;;) {
+#ifdef FD_SETSIZE
+ readfds = svc_fdset;
+#else
+ readfds = svc_fds;
+#endif /* def FD_SETSIZE */
+ switch (select(fd_setsize, &readfds, NULL, NULL,
+ (struct timeval *)0)) {
+ case -1:
+ if (errno == EINTR) {
+ continue;
+ }
+ perror("svc_run: - select failed");
+ return;
+ case 0:
+ continue;
+ default:
+ svc_getreqset(&readfds);
+ if (forked && pid != getpid())
+ exit(0);
+ }
+ }
+}
+
static void unregister()
{
(void) pmap_unset(YPPROG, YPVERS);
@@ -190,7 +230,6 @@ main(argc, argv)
}
load_securenets();
- yp_init_async();
#ifdef DB_CACHE
yp_init_dbs();
#endif
OpenPOWER on IntegriCloud