Deleted Added
full compact
nfsd.c (12869) nfsd.c (13141)
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>
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>
84
85/* Global defs */
86#ifdef DEBUG
87#define syslog(e, s) fprintf(stderr,(s))
88int debug = 1;
89#else
90int debug = 0;
91#endif
92
93struct nfsd_srvargs nsd;
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
94char **Argv = NULL; /* pointer to argument vector */
95char *LastArg = NULL; /* end of argv */
96char **Argv = NULL; /* pointer to argument vector */
97char *LastArg = NULL; /* end of argv */
98#endif
96
97#ifdef NFSKERB
98char lnam[ANAME_SZ];
99KTEXT_ST kt;
100AUTH_DAT kauth;
101char inst[INST_SZ];
102struct nfsrpc_fullblock kin, kout;
103struct nfsrpc_fullverf kverf;
104NFSKERBKEY_T kivec;
105struct timeval ktv;
106NFSKERBKEYSCHED_T kerb_keysched;
107#endif
108
109void nonfs __P((int));
110void reapchild __P((int));
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
111#ifdef __FreeBSD__
112void setproctitle __P((char *));
113#endif
115#ifdef __FreeBSD__
116void setproctitle __P((char *));
117#endif
118#endif
114void usage __P((void));
115
116/*
117 * Nfs server daemon mostly just a user context for nfssvc()
118 *
119 * 1 - do file descriptor and signal cleanup
120 * 2 - fork the nfsd(s)
121 * 3 - create server socket(s)

--- 40 unchanged lines hidden (view full) ---

162 endvfsent(); /* flush cache */
163 vfc = getvfsbyname("nfs"); /* probably unnecessary */
164 }
165 if(!vfc) {
166 errx(1, "NFS is not available in the running kernel");
167 }
168#endif
169
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
170 /* Save start and extent of argv for setproctitle. */
171 Argv = argv;
172 if (envp == 0 || *envp == 0)
173 envp = argv;
174 while (*envp)
175 envp++;
176 LastArg = envp[-1] + strlen(envp[-1]);
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
177
178#define MAXNFSDCNT 20
179#define DEFNFSDCNT 4
180 nfsdcnt = DEFNFSDCNT;
181 cltpflag = reregister = tcpflag = tp4cnt = tp4flag = tpipcnt = 0;
182 tpipflag = udpflag = 0;
183#ifdef ISO
184#define GETOPT "cn:rtu"

--- 453 unchanged lines hidden (view full) ---

638void
639reapchild(signo)
640 int signo;
641{
642
643 while (wait3(NULL, WNOHANG, NULL) > 0);
644}
645
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
646#ifdef __FreeBSD__
647void
648setproctitle(a)
649 char *a;
650{
651 register char *cp;
652 char buf[80];
653
654 cp = Argv[0];
655 (void)snprintf(buf, sizeof(buf), "nfsd-%s", a);
656 (void)strncpy(cp, buf, LastArg - cp);
657 cp += strlen(cp);
658 while (cp < LastArg)
659 *cp++ = '\0';
660 Argv[1] = NULL;
661}
662#endif /* __FreeBSD__ */
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