ypupdated_main.c (90297) | ypupdated_main.c (90298) |
---|---|
1/* 2 * Copyright (c) 1995, 1996 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, 1996 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 "$FreeBSD: head/usr.sbin/rpc.ypupdated/ypupdated_main.c 90297 2002-02-06 13:30:31Z des $"; | 35 "$FreeBSD: head/usr.sbin/rpc.ypupdated/ypupdated_main.c 90298 2002-02-06 15:26:07Z des $"; |
36#endif /* not lint */ 37 38#include "ypupdate_prot.h" 39#include <stdio.h> 40#include <stdlib.h> /* getenv, exit */ 41#include <rpc/pmap_clnt.h> /* for pmap_unset */ 42#include <string.h> /* strcmp */ 43#include <signal.h> --- 30 unchanged lines hidden (view full) --- 74#define _SERVED 1 75#define _SERVING 2 76 77extern int _rpcsvcstate; /* Set when a request is serviced */ 78 79char *progname = "rpc.ypupdated"; 80char *yp_dir = "/var/yp/"; 81 | 36#endif /* not lint */ 37 38#include "ypupdate_prot.h" 39#include <stdio.h> 40#include <stdlib.h> /* getenv, exit */ 41#include <rpc/pmap_clnt.h> /* for pmap_unset */ 42#include <string.h> /* strcmp */ 43#include <signal.h> --- 30 unchanged lines hidden (view full) --- 74#define _SERVED 1 75#define _SERVING 2 76 77extern int _rpcsvcstate; /* Set when a request is serviced */ 78 79char *progname = "rpc.ypupdated"; 80char *yp_dir = "/var/yp/"; 81 |
82static 83void _msgout(char* msg) | 82static void 83_msgout(char* msg) |
84{ 85#ifdef RPC_SVC_FG 86 if (_rpcpmstart) 87 syslog(LOG_ERR, "%s", msg); 88 else 89 warnx("%s", msg); 90#else 91 syslog(LOG_ERR, "%s", msg); --- 22 unchanged lines hidden (view full) --- 114 if (_rpcsvcstate == _SERVED) 115 _rpcsvcstate = _IDLE; 116 117 (void) signal(SIGALRM, (SIG_PF) closedown); 118 (void) alarm(_RPCSVC_CLOSEDOWN/2); 119} 120 121static void | 84{ 85#ifdef RPC_SVC_FG 86 if (_rpcpmstart) 87 syslog(LOG_ERR, "%s", msg); 88 else 89 warnx("%s", msg); 90#else 91 syslog(LOG_ERR, "%s", msg); --- 22 unchanged lines hidden (view full) --- 114 if (_rpcsvcstate == _SERVED) 115 _rpcsvcstate = _IDLE; 116 117 (void) signal(SIGALRM, (SIG_PF) closedown); 118 (void) alarm(_RPCSVC_CLOSEDOWN/2); 119} 120 121static void |
122ypupdated_svc_run() | 122ypupdated_svc_run(void) |
123{ 124#ifdef FD_SETSIZE 125 fd_set readfds; 126#else 127 int readfds; 128#endif /* def FD_SETSIZE */ 129 extern int forked; 130 int pid; --- 21 unchanged lines hidden (view full) --- 152 default: 153 svc_getreqset(&readfds); 154 if (forked && pid != getpid()) 155 exit(0); 156 } 157 } 158} 159 | 123{ 124#ifdef FD_SETSIZE 125 fd_set readfds; 126#else 127 int readfds; 128#endif /* def FD_SETSIZE */ 129 extern int forked; 130 int pid; --- 21 unchanged lines hidden (view full) --- 152 default: 153 svc_getreqset(&readfds); 154 if (forked && pid != getpid()) 155 exit(0); 156 } 157 } 158} 159 |
160static void reaper(sig) 161 int sig; | 160static void 161reaper(int sig) |
162{ 163 int status; 164 165 if (sig == SIGHUP) { 166#ifdef foo 167 load_securenets(); 168#endif 169 return; 170 } 171 172 if (sig == SIGCHLD) { 173 while (wait3(&status, WNOHANG, NULL) > 0) 174 children--; 175 } else { 176 (void) pmap_unset(YPU_PROG, YPU_VERS); 177 exit(0); 178 } 179} 180 | 162{ 163 int status; 164 165 if (sig == SIGHUP) { 166#ifdef foo 167 load_securenets(); 168#endif 169 return; 170 } 171 172 if (sig == SIGCHLD) { 173 while (wait3(&status, WNOHANG, NULL) > 0) 174 children--; 175 } else { 176 (void) pmap_unset(YPU_PROG, YPU_VERS); 177 exit(0); 178 } 179} 180 |
181void usage() | 181void 182usage(void) |
182{ 183 fprintf(stderr, "rpc.ypupdatedd [-p path]\n"); 184 exit(0); 185} 186 187int | 183{ 184 fprintf(stderr, "rpc.ypupdatedd [-p path]\n"); 185 exit(0); 186} 187 188int |
188main(argc, argv) 189 int argc; 190 char *argv[]; | 189main(int argc, char *argv[]) |
191{ 192 register SVCXPRT *transp = NULL; 193 int sock; 194 int proto = 0; 195 struct sockaddr_in saddr; 196 int asize = sizeof (saddr); 197 int ch; 198 --- 90 unchanged lines hidden --- | 190{ 191 register SVCXPRT *transp = NULL; 192 int sock; 193 int proto = 0; 194 struct sockaddr_in saddr; 195 int asize = sizeof (saddr); 196 int ch; 197 --- 90 unchanged lines hidden --- |