1/* 2 * Copyright (c) 1989, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Rick Macklem at The University of Guelph. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 67 unchanged lines hidden (view full) --- 76#include <fcntl.h> 77#include <grp.h> 78#include <pwd.h> 79#include <signal.h> 80#include <stdio.h> 81#include <stdlib.h> 82#include <strings.h> 83#include <unistd.h> |
84#include <libutil.h> |
85 86/* Global defs */ 87#ifdef DEBUG 88#define syslog(e, s) fprintf(stderr,(s)) 89int debug = 1; 90#else 91int debug = 0; 92#endif 93 94struct nfsd_srvargs nsd; |
95#ifdef OLD_SETPROCTITLE |
96char **Argv = NULL; /* pointer to argument vector */ 97char *LastArg = NULL; /* end of argv */ |
98#endif |
99 100#ifdef NFSKERB 101char lnam[ANAME_SZ]; 102KTEXT_ST kt; 103AUTH_DAT kauth; 104char inst[INST_SZ]; 105struct nfsrpc_fullblock kin, kout; 106struct nfsrpc_fullverf kverf; 107NFSKERBKEY_T kivec; 108struct timeval ktv; 109NFSKERBKEYSCHED_T kerb_keysched; 110#endif 111 112void nonfs __P((int)); 113void reapchild __P((int)); |
114#ifdef OLD_SETPROCTITLE |
115#ifdef __FreeBSD__ 116void setproctitle __P((char *)); 117#endif |
118#endif |
119void usage __P((void)); 120 121/* 122 * Nfs server daemon mostly just a user context for nfssvc() 123 * 124 * 1 - do file descriptor and signal cleanup 125 * 2 - fork the nfsd(s) 126 * 3 - create server socket(s) --- 40 unchanged lines hidden (view full) --- 167 endvfsent(); /* flush cache */ 168 vfc = getvfsbyname("nfs"); /* probably unnecessary */ 169 } 170 if(!vfc) { 171 errx(1, "NFS is not available in the running kernel"); 172 } 173#endif 174 |
175#ifdef OLD_SETPROCTITLE |
176 /* Save start and extent of argv for setproctitle. */ 177 Argv = argv; 178 if (envp == 0 || *envp == 0) 179 envp = argv; 180 while (*envp) 181 envp++; 182 LastArg = envp[-1] + strlen(envp[-1]); |
183#endif |
184 185#define MAXNFSDCNT 20 186#define DEFNFSDCNT 4 187 nfsdcnt = DEFNFSDCNT; 188 cltpflag = reregister = tcpflag = tp4cnt = tp4flag = tpipcnt = 0; 189 tpipflag = udpflag = 0; 190#ifdef ISO 191#define GETOPT "cn:rtu" --- 453 unchanged lines hidden (view full) --- 645void 646reapchild(signo) 647 int signo; 648{ 649 650 while (wait3(NULL, WNOHANG, NULL) > 0); 651} 652 |
653#ifdef OLD_SETPROCTITLE |
654#ifdef __FreeBSD__ 655void 656setproctitle(a) 657 char *a; 658{ 659 register char *cp; 660 char buf[80]; 661 662 cp = Argv[0]; 663 (void)snprintf(buf, sizeof(buf), "nfsd-%s", a); 664 (void)strncpy(cp, buf, LastArg - cp); 665 cp += strlen(cp); 666 while (cp < LastArg) 667 *cp++ = '\0'; 668 Argv[1] = NULL; 669} 670#endif /* __FreeBSD__ */ |
671#endif |