yp_main.c (43847) | yp_main.c (46186) |
---|---|
1/* 2 * Copyright (c) 1995 3 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 18 unchanged lines hidden (view full) --- 27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. 31 */ 32 33#ifndef lint 34static const char rcsid[] = | 1/* 2 * Copyright (c) 1995 3 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 18 unchanged lines hidden (view full) --- 27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. 31 */ 32 33#ifndef lint 34static const char rcsid[] = |
35 "$Id: yp_main.c,v 1.18 1998/06/04 15:11:14 wpaul Exp $"; | 35 "$Id: yp_main.c,v 1.19 1999/02/10 16:16:14 wpaul Exp $"; |
36#endif /* not lint */ 37 38/* 39 * ypserv startup function. 40 * We need out own main() since we have to do some additional work 41 * that rpcgen won't do for us. Most of this file was generated using 42 * rpcgen.new, and later modified. 43 */ --- 50 unchanged lines hidden (view full) --- 94 if (_rpcpmstart) 95 syslog(LOG_ERR, msg); 96 else 97 warnx("%s", msg); 98 } else 99 syslog(LOG_ERR, msg); 100} 101 | 36#endif /* not lint */ 37 38/* 39 * ypserv startup function. 40 * We need out own main() since we have to do some additional work 41 * that rpcgen won't do for us. Most of this file was generated using 42 * rpcgen.new, and later modified. 43 */ --- 50 unchanged lines hidden (view full) --- 94 if (_rpcpmstart) 95 syslog(LOG_ERR, msg); 96 else 97 warnx("%s", msg); 98 } else 99 syslog(LOG_ERR, msg); 100} 101 |
102pid_t yp_pid; 103 |
|
102static void 103yp_svc_run() 104{ 105#ifdef FD_SETSIZE 106 fd_set readfds; 107#else 108 int readfds; 109#endif /* def FD_SETSIZE */ 110 extern int forked; | 104static void 105yp_svc_run() 106{ 107#ifdef FD_SETSIZE 108 fd_set readfds; 109#else 110 int readfds; 111#endif /* def FD_SETSIZE */ 112 extern int forked; |
111 int pid; | |
112 int fd_setsize = _rpc_dtablesize(); 113 struct timeval timeout; 114 115 /* Establish the identity of the parent ypserv process. */ | 113 int fd_setsize = _rpc_dtablesize(); 114 struct timeval timeout; 115 116 /* Establish the identity of the parent ypserv process. */ |
116 pid = getpid(); | 117 yp_pid = getpid(); |
117 118 for (;;) { 119#ifdef FD_SETSIZE 120 readfds = svc_fdset; 121#else 122 readfds = svc_fds; 123#endif /* def FD_SETSIZE */ 124 --- 5 unchanged lines hidden (view full) --- 130 &timeout)) { 131 case -1: 132 if (errno == EINTR) { 133 continue; 134 } 135 warn("svc_run: - select failed"); 136 return; 137 case 0: | 118 119 for (;;) { 120#ifdef FD_SETSIZE 121 readfds = svc_fdset; 122#else 123 readfds = svc_fds; 124#endif /* def FD_SETSIZE */ 125 --- 5 unchanged lines hidden (view full) --- 131 &timeout)) { 132 case -1: 133 if (errno == EINTR) { 134 continue; 135 } 136 warn("svc_run: - select failed"); 137 return; 138 case 0: |
138 yp_prune_dnsq(); | 139 if (getpid() == yp_pid) 140 yp_prune_dnsq(); |
139 break; 140 default: | 141 break; 142 default: |
141 if (FD_ISSET(resfd, &readfds)) { 142 yp_run_dnsq(); 143 FD_CLR(resfd, &readfds); | 143 if (getpid() == yp_pid) { 144 if (FD_ISSET(resfd, &readfds)) { 145 yp_run_dnsq(); 146 FD_CLR(resfd, &readfds); 147 } 148 svc_getreqset(&readfds); |
144 } | 149 } |
145 svc_getreqset(&readfds); | |
146 } | 150 } |
147 if (forked && pid != getpid()) | 151 if (yp_pid != getpid()) |
148 _exit(0); 149 } 150} 151 152static void unregister() 153{ 154 (void) pmap_unset(YPPROG, YPVERS); 155 (void) pmap_unset(YPPROG, YPOLDVERS); --- 182 unchanged lines hidden --- | 152 _exit(0); 153 } 154} 155 156static void unregister() 157{ 158 (void) pmap_unset(YPPROG, YPVERS); 159 (void) pmap_unset(YPPROG, YPOLDVERS); --- 182 unchanged lines hidden --- |