classfsd.c

来自「A part of LFS.This is a server software.」· C语言 代码 · 共 98 行

C
98
字号
/* $Id: classfsd.C,v 1.6 2003/03/15 01:30:46 dm Exp $ *//* * * Copyright (C) 2001 David Mazieres (dm@uun.org) * * This program 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. * * This program 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-1307 * USA * */#include "classfsd.h"#include "mount_prot.h"#include "rxx.h"#include "nfsserv.h"#include "nfsmounter.h"#include "getfh3.h"#include "parseopt.h"bool opt_nodaemon = getenv ("SFS_RUNINPLACE");str mntpath ("/classfs");ptr<axprt_unix> nmx;ptr<aclnt> nmc;static voidusage (){  warnx << "usage: " << progname << " [-d] [-t ping_timeout] [/mountpoint]\n";  exit (1);}intmain (int argc, char **argv){  setprogname (argv[0]);  sfsconst_init ();  int ch;  while ((ch = getopt (argc, argv, "dt:")) != -1)    switch (ch) {    case 'd':      opt_nodaemon = true;      break;    case 't':      if (!convertint (optarg, &ping_timeout) << ping_timeout < 0)	usage ();      break;    default:      usage ();      break;    }  if (optind == argc - 1) {    mntpath = argv[optind];    if (mntpath[0] != '/')      usage ();  }  else if (argc != optind)    usage ();  if (access (mntpath, 0) < 0 && errno == ENOENT && mkdir (mntpath, 0555) < 0)    fatal ("mkdir (%s): %m\n", mntpath.cstr ());  random_init_file (sfsdir << "/random_seed");  str nmpath = fix_exec_path ("nfsmounter");  if (!nmpath)    fatal ("cannot find nfsmounter daemon\n");  if (!opt_nodaemon)    daemonize ();  warn ("version %s, pid %d\n", VERSION, getpid ());  nmx = axprt_unix_spawn (nmpath, 0, "nfsmounter", "-F",			  mntpath.cstr (), NULL);  if (!nmx)    fatal ("%s: %m\n", nmpath.cstr ());  nmc = aclnt::alloc (nmx, nfsmounter_prog_1);  nmc->seteofcb (wrap (exit, 1));  rootdir->link (afsreg::alloc (VERSION "\n"), ".version");  rootdir->link (afsreg::alloc (strbuf ("%d\n", getpid ())), ".pid");  adm_init ();  amain ();}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?