From 94cef36797600d11a50d09828fa80df8a73dfd1c Mon Sep 17 00:00:00 2001 From: "Michael I. Bushnell" Date: Thu, 18 Jul 1996 04:35:29 +0000 Subject: *** empty log message *** --- nfsd/main.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 nfsd/main.c (limited to 'nfsd/main.c') diff --git a/nfsd/main.c b/nfsd/main.c new file mode 100644 index 00000000..69099361 --- /dev/null +++ b/nfsd/main.c @@ -0,0 +1,78 @@ +/* Main NFS server program + Copyright (C) 1996 Free Software Foundation, Inc. + Written by Michael I. Bushnell, p/BSG. + + This file is part of the GNU Hurd. + + The GNU Hurd is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. + + The GNU Hurd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ + +#include "nfsd.h" +#include +#include +#include +#include + +int main_udp_socket, pmap_udp_socket; +struct sockaddr_in main_address, pmap_address; +char *index_file_name; + +int +main (int argc, char **argv) +{ + int nthreads; + + if (argc > 2) + { + fprintf (stderr, "%s [num-threads]\n", argv[0]); + exit (1); + } + if (argc == 1) + nthreads = 4; + else + nthreads = atoi (argv[1]); + if (!nthreads) + nthreads = 4; + + index_file_name = asprintf ("%s/state/misc/nfsd.index", LOCALSTATEDIR); + + maptime_map (0, 0, &mapped_time); + + main_address.sin_family = AF_INET; + main_address.sin_port = htons (NFS_PORT); + main_address.sin_addr.s_addr = INADDR_ANY; + pmap_address.sin_family = AF_INET; + pmap_address.sin_port = htons (PMAPPORT); + pmap_address.sin_addr.s_addr = INADDR_ANY; + + main_udp_socket = socket (PF_INET, SOCK_DGRAM, 0); + pmap_udp_socket = socket (PF_INET, SOCK_DGRAM, 0); + bind (main_udp_socket, (struct sockaddr *)&main_address, + sizeof (struct sockaddr_in)); + bind (pmap_udp_socket, (struct sockaddr *)&pmap_address, + sizeof (struct sockaddr_in)); + + init_filesystems (); + + while (nthreads--) + cthread_detach (cthread_fork ((cthread_fn_t) server_loop, 0)); + + for (;;) + { + sleep (1); + scan_fhs (); + scan_creds (); + scan_replies (); + } +} -- cgit v1.2.3