home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume3 / rfs / part1 next >
Encoding:
Internet Message Format  |  1986-11-30  |  60.4 KB

  1. Subject: RFS: remote file system (part 1 of 7)
  2. Newsgroups: mod.sources
  3. Approved: jpn@panda.UUCP
  4.  
  5. Mod.sources:  Volume 3, Issue 77
  6. Submitted by: genrad!masscomp!tektronix!tekcrl!toddb
  7. Subject: RFS: a Kernel-resident remote file system
  8.  
  9. RFS release 2.0+ (plus more fixes, easy installation w/ patch, etc.)
  10.  
  11. These seven shar files contain the software and documentation for
  12. installation, maintenance and adjustment of RFS, a public domain,
  13. kernel-resident distributed file system, written at Tektronix Computer
  14. Research Laboratories* by me for partial fulfillment of the master's
  15. degree program at the University of Denver.  It was designed to provide
  16. complete transparency with respect to file access and protections for
  17. all programs whether they use local or remote files and directories.
  18. It has been installed on VAX BSD 4.2 and 4.3 UNIX, Pyramid 4.2/5.0
  19. UNIX, version 2.5, and on a Tektronix internal proprietary workstation,
  20. called Magnolia.  The instructions are designed in a way that keeps all
  21. changes separate from your standard sources, in hope that it will
  22. encourage sites to try the installation.
  23.  
  24.             Todd Brunhoff
  25.             toddb%crl@tektronix.csnet
  26.             decvax!tektronix!crl!toddb
  27.  
  28. * RFS should not be confused with another completely different (but
  29.   excellent) implementation from Tektronix available on the 6000 series
  30.   workstation, called DFS, and done by a separate product group.  The
  31.   work on RFS was designed and written strictly by the author of this
  32.   paper at about the same time as DFS, and draws none of its
  33.   implementation details from DFS.  RFS is public domain, while DFS is
  34.   proprietary.
  35.  
  36. #!/bin/sh
  37. #
  38. # RFS, a kernel-resident remote file system.  Shar 1 of 7
  39. #
  40. #
  41. # This is a shell archive, meaning:
  42. # 1. Remove everything above the #!/bin/sh line.
  43. # 2. Save the resulting text in a file.
  44. # 3. Execute the file with /bin/sh (not csh) to create the files:
  45. #    remote/README
  46. #    remote/byteorder.c
  47. #    remote/change.c
  48. #    remote/debug.c
  49. #    remote/doc
  50. #    remote/doc/install.ms
  51. #    remote/doc/paper
  52. #    remote/doc/paper/Makefile
  53. #    remote/doc/paper/appendixB
  54. #    remote/doc/paper/fig1
  55. #    remote/doc/paper/fig1.mag
  56. #    remote/doc/paper/fig4
  57. #    remote/doc/paper/fig5
  58. #    remote/doc/paper/fig6
  59.  
  60. mkdir remote
  61.  
  62. #
  63. # remote/README
  64. #
  65. if [ -f remote/README ]; then 
  66.     echo -n 'Hit <return> to overwrite remote/README or ^C to quit' 
  67.     read ans 
  68.     rm -f remote/README 
  69. fi 
  70.  
  71. sed -e 's/^.//' << \SHAREOF > remote/README
  72. XStart with running off the following documents in the doc directory:
  73. X
  74. X    install.ms    (standard Berkeley ms macros)
  75. X    remotename.2    \
  76. X    remoteon.2     \ (standard Berkeley man macros)
  77. X    rfs_server.8     /
  78. X    rmtmnt.8    /
  79. X
  80. XThe directory doc/paper, contains a paper that contains most of the early
  81. Xdesign considerations for RFS, but is written using some TEK-internal
  82. Xms macros.
  83. X
  84. XRead the install.ms document first.
  85. SHAREOF
  86. chmod 664 remote/README
  87. #
  88. # remote/byteorder.c
  89. #
  90. if [ -f remote/byteorder.c ]; then 
  91.     echo -n 'Hit <return> to overwrite remote/byteorder.c or ^C to quit' 
  92.     read ans 
  93.     rm -f remote/byteorder.c 
  94. fi 
  95.  
  96. sed -e 's/^.//' << \SHAREOF > remote/byteorder.c
  97. X/*
  98. X * Copyright 1985, Todd Brunhoff.
  99. X *
  100. X * This software was written at Tektronix Computer Research Laboratories
  101. X * as partial fulfillment of a Master's degree at the University of Denver.
  102. X * This is not Tektronix proprietary software and should not be
  103. X * confused with any software product sold by Tektronix.  No warranty is
  104. X * expressed or implied on the reliability of this software; the author,
  105. X * the University of Denver, and Tektronix, inc. accept no liability for
  106. X * any damage done directly or indirectly by this software.  This software
  107. X * may be copied, modified or used in any way, without fee, provided this
  108. X * notice remains an unaltered part of the software.
  109. X *
  110. X * $Log:    byteorder.c,v $
  111. X * Revision 2.0  85/12/07  18:20:50  toddb
  112. X * First public release.
  113. X * 
  114. X */
  115. Xstatic char    *rcsid = "$Header: byteorder.c,v 2.0 85/12/07 18:20:50 toddb Rel $";
  116. Xlong    data = 0x03020100;
  117. X
  118. Xmain()
  119. X{
  120. X    char    *p = (char *)&data;
  121. X
  122. X    printf("bytes order=%d,%d,%d,%d\n", p[0],p[1],p[2],p[3]);
  123. X}
  124. SHAREOF
  125. chmod 444 remote/byteorder.c
  126. #
  127. # remote/change.c
  128. #
  129. if [ -f remote/change.c ]; then 
  130.     echo -n 'Hit <return> to overwrite remote/change.c or ^C to quit' 
  131.     read ans 
  132.     rm -f remote/change.c 
  133. fi 
  134.  
  135. sed -e 's/^.//' << \SHAREOF > remote/change.c
  136. X/*
  137. X * Copyright 1985, Todd Brunhoff.
  138. X *
  139. X * This software was written at Tektronix Computer Research Laboratories
  140. X * as partial fulfillment of a Master's degree at the University of Denver.
  141. X * This is not Tektronix proprietary software and should not be
  142. X * confused with any software product sold by Tektronix.  No warranty is
  143. X * expressed or implied on the reliability of this software; the author,
  144. X * the University of Denver, and Tektronix, inc. accept no liability for
  145. X * any damage done directly or indirectly by this software.  This software
  146. X * may be copied, modified or used in any way, without fee, provided this
  147. X * notice remains an unaltered part of the software.
  148. X *
  149. X * $Log:    change.c,v $
  150. X * Revision 2.0  85/12/07  18:20:57  toddb
  151. X * First public release.
  152. X * 
  153. X */
  154. Xstatic char    *rcsid = "$Header: change.c,v 2.0 85/12/07 18:20:57 toddb Rel $";
  155. X#include    "server.h"
  156. X#include    <stdio.h>
  157. X#include    <sys/time.h>
  158. X
  159. Xextern short    current_uid;
  160. Xextern short    current_pid;
  161. Xextern short    current_umask;
  162. Xextern short    current_server;
  163. Xextern short    gateway_server;
  164. Xextern long    fds_in_use;
  165. Xextern long    to_gateway;
  166. Xextern long    from_servers;
  167. Xextern boolean    i_am_gateway;
  168. Xextern boolean    i_have_control;
  169. Xextern process    *wildcard;
  170. Xextern syscallmap    smap[];
  171. Xextern hosts    *host;
  172. X
  173. X/*
  174. X * Given the user id # and the process id # in the message, we look up the
  175. X * process (or allocate a new one).  If there are things to be accomplished
  176. X * before the system call is performed, do them here.
  177. X */
  178. Xprocess *change_to_proc(msg)
  179. X    register struct message    *msg;
  180. X{
  181. X    register rusers    *ruser;
  182. X    register process    *proc = NULL;
  183. X    register char    *p;
  184. X    register long    syscall = msg->m_syscall,
  185. X            syscalltype = smap[ syscall ].s_type;
  186. X
  187. X    /*
  188. X     * First, we check to see that the file is not really a local file
  189. X     * for the client.  A simple example of this is a pathname of '..'
  190. X     * while sitting in our root directory.  If it is local, islocal()
  191. X     * will compose a message and send it.  We simply return.
  192. X     *
  193. X     * Even if this is handled by another server, we may be able to serve
  194. X     * the request;  but only if:
  195. X     *    1. it is a system call using a path (NEED_CWD).
  196. X     *    2. The path is starts with a '/'.
  197. X     *    3. The system call does not generate a new file descriptor
  198. X     *       (like open).
  199. X     *    4. This is not chdir().
  200. X     * The system calls that fall in this category, are stat, lstat,
  201. X     * rename, unlink, symlink, readlink, etc.
  202. X     * If the system call does not match these criterion, then we must
  203. X     * reroute it.
  204. X     */
  205. X
  206. X    proc = findprocess(msg->m_pid, msg->m_uid);
  207. X    if (syscalltype & NEED_CWD) {
  208. X        if (proc
  209. X        && proc->p_handler == current_pid
  210. X        && islocal(msg, syscalltype))
  211. X            return(NULL);
  212. X        if ((syscalltype & NEED_MYSERVER) == 0)
  213. X        {
  214. X            if (syscalltype & NEED_2PATH)
  215. X                p = twopath2addr(msg);
  216. X            else
  217. X                p = path1addr(msg);
  218. X            if (*p == '/')
  219. X            {
  220. X                setup_proc(proc = wildcard,
  221. X                    msg->m_uid, msg->m_pid);
  222. X                debug0("using wildcard proc... ");
  223. X            }
  224. X        }
  225. X    }
  226. X
  227. X    /*
  228. X     * A fork() (but not vfork()) generates two messages, one
  229. X     * from parent, one from the child.  If we know about it (no
  230. X     * matter if we are the server for the parent, the child or if
  231. X     * we are the gateway), then we already have received the
  232. X     * first notification.  Don't do a reroute for that, just
  233. X     * handle it locally (its redundant info).  If we don't know
  234. X     * about it, then this is the first anyone has heard of it,
  235. X     * so we use args[1] which is the parent pid of
  236. X     * the fork (in both messages).
  237. X     */
  238. X    if (proc == NULL && (syscall == RSYS_fork || syscall == RSYS_vfork))
  239. X        proc = findprocess(msg->m_args[ 1 ], msg->m_uid);
  240. X
  241. X    if (proc == NULL)
  242. X    {
  243. X        /*
  244. X         * If we are the gateway, and don't know about this process,
  245. X         * and it is an exit() call, then just ignore it; cause if we
  246. X         * don't know this guy, nobody does.  Otherwise,
  247. X         * allocate a new slot for it.
  248. X         */
  249. X        if (i_am_gateway)
  250. X        {
  251. X            if (syscall == RSYS_exit)
  252. X            {
  253. X                debug0("discard exit call for pid %d\n",
  254. X                    msg->m_pid);
  255. X                return(NULL);
  256. X            }
  257. X            else
  258. X                proc = add_new_process(msg->m_uid, msg->m_pid);
  259. X        }
  260. X        /*
  261. X         * If we are'nt the gateway, then hand this request back to
  262. X         * the gateway.  Maybe he will know where to send the request.
  263. X         */
  264. X        else
  265. X        {
  266. X            reroute(gateway_server, msg);
  267. X            return(NULL);
  268. X        }
  269. X    }
  270. X    /*
  271. X     * And if we just happen to know about this process (whether we
  272. X     * are the gateway or not), then just reroute it.
  273. X     */
  274. X    else if (proc->p_handler != current_pid)
  275. X    {
  276. X        reroute(proc->p_handler, msg);
  277. X        if (syscall == RSYS_exit && !i_am_gateway)
  278. X        {
  279. X            deletelist(&host->h_proclist, proc);
  280. X            freeproc(proc);
  281. X        }
  282. X        return(NULL);
  283. X    }
  284. X
  285. X    /*
  286. X     * At this point, the request is for us, and there is definitely
  287. X     * no mistake.
  288. X     */
  289. X    if ((syscalltype & NEED_FD) || syscall == RSYS_chdir)
  290. X    {
  291. X        debug3("%d current file descriptors\n", fds_in_use);
  292. X        /*
  293. X         * Here is where we reroute the opening of a file
  294. X         * or a chdir() to another server.
  295. X         */
  296. X        if (need_to_fork())
  297. X            if (! become_server(msg))
  298. X                return(NULL);
  299. X    }
  300. X
  301. X    if (syscalltype & NEED_PERM)
  302. X        change_to_user( proc->p_ruser->r_user );
  303. X
  304. X    debug1("pid %d: ", proc->p_pid);
  305. X    return(proc);
  306. X}
  307. X
  308. X/*
  309. X * change the current user id to 'uid'.
  310. X * This is done with simply a setreuid
  311. X */
  312. Xchange_to_user(user)
  313. X    register users    *user;
  314. X{
  315. X#ifdef RFSDEBUG
  316. X    long    gids[ NGROUPS ], ngids, i;
  317. X#endif RFSDEBUG
  318. X
  319. X    if (current_uid != user->u_local_uid)
  320. X    {
  321. X        debug2("set uid to %s(%d)\n",
  322. X            user->u_name, user->u_local_uid);
  323. X        change_to_uid(0);
  324. X        if (setgroups(user->u_numgroups, user->u_local_groups) < 0)
  325. X        {
  326. X            register long    i;
  327. X
  328. X            log("cannot set gids\n");
  329. X            for (i=1; i<user->u_numgroups; i++)
  330. X                log(",%d", user->u_local_groups[i]);
  331. X            return(FALSE);
  332. X        }
  333. X        change_to_uid(user->u_local_uid);
  334. X    }
  335. X    else
  336. X        debug2("already at uid %d (uid=%d/%d)\n",
  337. X            current_uid, getuid(), geteuid());
  338. X#ifdef RFSDEBUG
  339. X    if (remote_debug & 0x4)
  340. X    {
  341. X        log("%d gids should be", user->u_numgroups);
  342. X        for (i=0; i<user->u_numgroups; i++)
  343. X            log(" %d", user->u_local_groups[i]);
  344. X        ngids = getgroups(NGROUPS, gids);
  345. X        log("\n%d gids are=", ngids);
  346. X        for (i=0; i<ngids; i++)
  347. X            log(" %d", gids[i]);
  348. X        log("\n");
  349. X    }
  350. X#endif RFSDEBUG
  351. X    return (TRUE);
  352. X}
  353. X
  354. X/*
  355. X * Change to uid 'uid'.
  356. X */
  357. Xchange_to_uid(uid)
  358. X    register long    uid;
  359. X{
  360. X    if (current_uid != uid)
  361. X        if (setreuid(0, uid) < 0)
  362. X            log("cannot set uid to %d\n", uid);
  363. X        else
  364. X        {
  365. X            current_uid = uid;
  366. X            debug2("uid now %d/%d\n", getuid(), geteuid());
  367. X        }
  368. X}
  369. X
  370. X/*
  371. X * Change to umask 'mask'.
  372. X */
  373. Xchange_to_umask(mask)
  374. X    register long    mask;
  375. X{
  376. X    register long    oldmask;
  377. X
  378. X    if (mask != current_umask)
  379. X    {
  380. X        oldmask = umask(current_umask = mask);
  381. X        debug2("umask now 0%o, was 0%o\n", current_umask, oldmask);
  382. X    }
  383. X}
  384. X
  385. X/*
  386. X * check to see if we need to fork.  We do this for two reasons:
  387. X *    1. we are the gateway server.
  388. X *    2. we are currently handling other processes (a chdir might mess
  389. X *       them up).
  390. X * Note that we only have to ask ourselves "do we need to fork" when we are
  391. X * opening a new file, accepting a new process (the client is doing a fork()
  392. X * or vfork()), or changing directory.
  393. X */
  394. Xneed_to_fork()
  395. X{
  396. X    register char    *fds;
  397. X    register process    *proc;
  398. X    register long    myprocs = 0;
  399. X
  400. X    if (i_am_gateway)
  401. X        return(TRUE);
  402. X    for (proc = host->h_proclist; proc; proc = proc->p_next)
  403. X        if(proc->p_handler == current_pid)
  404. X            myprocs++;
  405. X    return(myprocs > 1);
  406. X}
  407. SHAREOF
  408. chmod 444 remote/change.c
  409. #
  410. # remote/debug.c
  411. #
  412. if [ -f remote/debug.c ]; then 
  413.     echo -n 'Hit <return> to overwrite remote/debug.c or ^C to quit' 
  414.     read ans 
  415.     rm -f remote/debug.c 
  416. fi 
  417.  
  418. sed -e 's/^.//' << \SHAREOF > remote/debug.c
  419. X/*
  420. X * Copyright 1985, Todd Brunhoff.
  421. X *
  422. X * This software was written at Tektronix Computer Research Laboratories
  423. X * as partial fulfillment of a Master's degree at the University of Denver.
  424. X * This is not Tektronix proprietary software and should not be
  425. X * confused with any software product sold by Tektronix.  No warranty is
  426. X * expressed or implied on the reliability of this software; the author,
  427. X * the University of Denver, and Tektronix, inc. accept no liability for
  428. X * any damage done directly or indirectly by this software.  This software
  429. X * may be copied, modified or used in any way, without fee, provided this
  430. X * notice remains an unaltered part of the software.
  431. X *
  432. X * $Log:    debug.c,v $
  433. X * Revision 2.0  85/12/07  18:21:07  toddb
  434. X * First public release.
  435. X * 
  436. X */
  437. Xstatic char    *rcsid = "$Header: debug.c,v 2.0 85/12/07 18:21:07 toddb Rel $";
  438. X#include    "server.h"
  439. X
  440. Xmain(argc, argv)
  441. X    char    **argv;
  442. X    int    argc;
  443. X{
  444. X    int    dbg;
  445. X
  446. X    dbg = atox(argv[1]);
  447. X    printf("set debug to %x\n", dbg);
  448. X    printf("remotename()=%d\n", remotename(NM_DEBUG, dbg));
  449. X    perror("debug");
  450. X}
  451. X
  452. X/*
  453. X * ascii to hex
  454. X */
  455. Xatox(buf)
  456. X    char    *buf;
  457. X{
  458. X    register char   *p;
  459. X    register unsigned       num, nibble;
  460. X
  461. X    /*
  462. X     * now, take it out checking to make sure that the number is
  463. X     * valid.
  464. X     */
  465. X    if (! buf)
  466. X        return(0);
  467. X    for(num=0, p = buf; *p; p++)
  468. X    {
  469. X        nibble = *p;
  470. X        if (nibble >= 'A' && nibble <= 'F')
  471. X            nibble -= 'A' - 10;
  472. X        else if (nibble >= 'a' && nibble <= 'f')
  473. X            nibble -= 'a' - 10;
  474. X        else if (nibble >= '0' && nibble <= '9')
  475. X            nibble -= '0';
  476. X        else
  477. X            return(0);
  478. X        num = (num << 4) | nibble;
  479. X    }
  480. X    return(num);
  481. X}
  482. SHAREOF
  483. chmod 444 remote/debug.c
  484. #
  485. # remote/doc
  486. #
  487. mkdir remote/doc
  488. chmod 775 remote/doc
  489. #
  490. # remote/doc/install.ms
  491. #
  492. if [ -f remote/doc/install.ms ]; then 
  493.     echo -n 'Hit <return> to overwrite remote/doc/install.ms or ^C to quit' 
  494.     read ans 
  495.     rm -f remote/doc/install.ms 
  496. fi 
  497.  
  498. sed -e 's/^.//' << \SHAREOF > remote/doc/install.ms
  499. X.ds Fi \\u\\s-4\\n+*\\s+4\\d
  500. X.TL
  501. XInstalling and Operating RFS
  502. X.AU
  503. XT. Brunhoff
  504. Xtoddb%crl@tektronix.csnet
  505. Xdecvax!tektronix!crl!toddb
  506. X.AI
  507. XUniversity of Denver
  508. X.AB
  509. XThis document describes
  510. Xthe installation, maintenance and adjustment
  511. Xof RFS, a public domain, kernel\-resident distributed file system,
  512. Xwritten at
  513. XTektronix Computer Research Laboratories* for partial
  514. Xfulfillment of the master's degree program at the University of Denver.
  515. XIt was designed to provide complete transparency with
  516. Xrespect to file access and protections for all programs
  517. Xwhether they use local or remote files and directories.
  518. XIt has been installed on VAX BSD 4.2 and 4.3 UNIX,
  519. XPyramid 4.2/5.0 UNIX, version 2.5,
  520. Xand on a Tektronix internal proprietary workstation,
  521. Xcalled Magnolia.
  522. XThe instructions are designed in a way that keeps all changes
  523. Xseparate from your standard sources, in hope that
  524. Xit will encourage sites to try the installation.
  525. X.AE
  526. X.nr * 0 1
  527. X.FS *
  528. XRFS should not be confused with another completely different (but excellent)
  529. Ximplementation
  530. Xfrom Tektronix available on the 6000 series workstation, called DFS,
  531. Xand done by a separate product group.
  532. XThe work on RFS was designed and written
  533. Xstrictly by the author of this paper at about the same
  534. Xtime as DFS, and draws none of its implementation details from DFS.
  535. XRFS is public domain, while DFS is proprietary.
  536. X.FE
  537. X.NH 1
  538. XInstalling and Compiling
  539. X.PP
  540. XThese instructions assume that you are familiar with
  541. Xthe C compiler, the commands \fImake(1)\fP, \fIvi\fP,
  542. Xthe structure of the kernel source files,
  543. Xhow to build a new kernel[1],
  544. Xthe structure of \fI/etc/passwd, /etc/hosts, /etc/services, /etc/rc.local\fP.
  545. XInstalling and compiling the software should take about two to four hours
  546. Xwithout interruption and on a lightly loaded 11/750.
  547. X.PP
  548. XThe best way to install this at first, is to make everything in someone's
  549. Xlogin directory, keeping all changes from being anywhere near permanent.
  550. XIn this way
  551. Xyou can gain confidence comfortably that the software really
  552. Xworks.
  553. XAll compiles can be done by an unprivilaged user that has read access
  554. Xto the kernel source.
  555. X.PP
  556. XTo do this,
  557. Xyou need the \fIremote\fP directory
  558. X(this document came from \fIremote/doc/install.ms\fP)
  559. Xwith all of its original contents.
  560. XLet us say that you have allocated this project to a user named \fIrfs\fP,
  561. Xand that he will be installing everything beneath his login directory,
  562. X\fI~rfs\fP.
  563. XIf you are reading this document,
  564. Xthen you probably now have the following directories
  565. Xunder \fI~rfs\fP:
  566. X.DS
  567. Xremote
  568. Xremote/RCS
  569. Xremote/doc
  570. Xremote/doc/paper
  571. Xremote/usr.include.{VAX4.2,VAX4.3,PYR2.5}
  572. Xremote/usr.src.lib.libc
  573. Xremote/usr.src.lib.libc/gen
  574. Xremote/usr.src.lib.libc/{vax,pyr}
  575. Xremote/usr.src.lib.libc/{vax,pyr}/sys
  576. Xremote/usr.sys.VAX4.2/{conf,h,machine,sys}
  577. Xremote/usr.sys.VAX4.3/{conf,h,machine,sys}
  578. Xremote/usr.sys.PYR2.5/{conf,h,sys}
  579. Xremote/usr.sys.remote
  580. X.DE
  581. X.PP
  582. XIf not,
  583. Xthey are easily obtained by mounting the tape (if that is the medium of this
  584. Xrelease) or by placing the \fIshar\fP file in, say,
  585. X\fI/tmp/rfs.shar\fP.
  586. XTo extract them, you would type, respectively,
  587. X.DS
  588. X% cd ~rfs; tar x
  589. X    or
  590. X% cd ~rfs; sh < /tmp/rfs.shar
  591. X.DE
  592. X.NH 2
  593. XBuilding the Kernel
  594. X.PP
  595. XA new kernel must be installed on the machine that is to have the
  596. Xdistributed file system capability.
  597. XThe machines that will be accessed through RFS
  598. Xdo not need to have a new kernel if they are running
  599. XBSD 4.3;
  600. Xhowever, BSD 4.2 sites have a serious bug in sys_socket.c that
  601. Xcauses infinite loops if there is any activity on a socket being
  602. Xread using the \fIrecv(2)\fP system call.
  603. XThe server uses this system call.
  604. X.PP
  605. XFirst,
  606. Xyou must set up a local copy of the kernel sources
  607. Xin \fI~rfs/sys\fP
  608. Xusing symbolic links for most,
  609. Xand copying and changing others (note that \fI~rfs/sys\fP does not
  610. Xexist yet, so be patient).
  611. XThe files new to the kernel are:
  612. X.DS
  613. X~rfs/sys/remote/remotefs.h
  614. X~rfs/sys/remote/rmt_data_template    (used to build rmt_data.c)
  615. X~rfs/sys/remote/remote_mkdata    (used to build rmt_data.c)
  616. X~rfs/sys/remote/rmt_exec.c
  617. X~rfs/sys/remote/rmt_final.c
  618. X~rfs/sys/remote/rmt_general.c
  619. X~rfs/sys/remote/rmt_generic.c
  620. X~rfs/sys/remote/rmt_io.c
  621. X~rfs/sys/remote/rmt_subr.c
  622. X~rfs/sys/remote/rmt_syscall1.c
  623. X~rfs/sys/remote/rmt_syscall2.c
  624. X~rfs/sys/remote/rmt_syscall3.c
  625. X.DE
  626. XThe files that must be changed in the kernel are:
  627. X.DS
  628. X~rfs/sys/h/errno.h
  629. X~rfs/sys/h/param.h
  630. X~rfs/sys/h/user.h
  631. X~rfs/sys/machine/trap.c
  632. X~rfs/sys/sys/init_sysent.c
  633. X~rfs/sys/sys/kern_exec.c
  634. X~rfs/sys/sys/kern_exit.c
  635. X~rfs/sys/sys/sys_inode.c        (a semantic bug; fixed in 4.3)
  636. X~rfs/sys/sys/ufs_nami.c        (ufs_namei.c in 4.3)
  637. X~rfs/sys/sys/ufs_syscalls.c
  638. X~rfs/sys/sys/uipc_socket.c    (the \fIrecv(2)\fP bug; fixed in 4.3)
  639. X.DE
  640. XFor configuration, there are a few files which must be changed
  641. Xslightly:
  642. X.DS
  643. X~rfs/sys/conf/files
  644. X~rfs/sys/conf/makefile.vax    (Makefile.vax in 4.3)
  645. X.DE
  646. XFinally,
  647. Xthe source files for building the new system calls (see 
  648. X\fBBuilding the User Programs\fP)
  649. Xmust know about the new system call numbers.
  650. XThis requires a
  651. X(local) change to a file normally found in \fI/usr/include\fP:
  652. X.DS
  653. X~rfs/usr.include/syscalls.h
  654. X.DE
  655. X.NH 3
  656. XEditing in the Changes (about 15 minutes)
  657. X.PP
  658. XAll of these files, or the changes that need to be made to them
  659. Xare found in files of the same name (plus a \fI.diff\fP for the
  660. Xpatch files) under \fI~rfs/remote/usr.*\fP.
  661. XA shell program named \fI~rfs/remote/shells/rfs_setup\fP
  662. Xhas been provided for setting up the symbolic links,
  663. Xcopying files,
  664. Xand patching in all the changes to the kernel using the \fBpatch\fP
  665. Xutility which has been posted publicly to newsgroups such as \fInet.sources\fP
  666. Xby Larry Wall\*(Fi.
  667. XSome of the added kernel
  668. Xsoftware contains \fIifdef\fPs for 4.3 BSD differences
  669. Xwhich only clutter the code and cause problems
  670. Xwhen you run \fImake depend\fP on BSD 4.2.
  671. X\fI~Rfs_setup\fP will remove these.
  672. X.FS
  673. XIf you have never heard of the \fBpatch\fP program, I don't know how you ever
  674. Xfound out about RFS.
  675. XSend me a note and I will mail the source to you.
  676. X.FE
  677. XRunning \fIremote/shells/rfs_setup\fP will work for 4.2 and 4.3 BSD Vax systems,
  678. Xand for Pyramid 90x systems running 2.5,
  679. Xbut for other systems, you must examine the shell
  680. Xscript to infer what it accomplishes.
  681. XLet me emphasize again that you are not (and should not be)
  682. Xediting the standard kernel sources.
  683. X.DS
  684. X% cd ~rfs
  685. X% ./remote/shells/rfs_setup    # several questions will be asked
  686. X.DE
  687. X.NH 3
  688. XEnsuring that RFS Software Does Not Interfere with the Kernel
  689. X.PP
  690. XThere are four variables defined in \fI~rfs/sys/remote/remotefs.h\fP
  691. Xwhich must be examined to be sure that they fit in correctly with
  692. Xthe rest of the kernel.
  693. XTheir values in the distributed software have been chosen
  694. Xso as not to conflict
  695. Xwith VAX BSD 4.2 or 4.3, and Pyramid 2.5 software.
  696. XIt will have to be changed for other Unix versions.
  697. X.IP FREMOTE
  698. Xis a flag that must not conflict with any other flags associated
  699. Xwith the kernel \fIfile\fP structure.
  700. XCheck in \fI/usr/sys/h/file.h\fP.
  701. X.IP DTYPE_REMOTE
  702. Xshould not conflict with DTYPE_INODE or DTYPE_SOCKET in
  703. X\fI/usr/sys/h/file.h\fP.
  704. XThis new file descriptor type means the
  705. Xfix to \fIino_close()\fP in \fI~rfs/sys/sys/sys_inode.c\fP must be installed.
  706. X.IP SREMOTE
  707. Xmarks a process as having used a remote file system at some time.
  708. XIt must be a unique bit for the \fIproc\fP structure element \fIp_flag\fP
  709. Xas defined in \fI/usr/sys/h/proc.h\fP.
  710. X.IP SNOREMOTE
  711. Xmust also be a unique bit for the \fIproc\fP structure element \fIp_flag\fP.
  712. XThis flag bit prevents any processes having it from using any remote
  713. Xfile system.
  714. XIt is used primarily by \fIrfs_server\fP to prevent ``hopping''
  715. Xacross more than one machine with the remote file system.
  716. X.NH 3
  717. XSetting up VAX\*(Fi Configuration (about 10 minutes)
  718. X.PP
  719. X.FS
  720. XPyramid software does not have a configuration file.
  721. Xconfiguration is done with command\-line shell script arguments.
  722. X.FE
  723. XThe configuration file for VAX machines should now be in \fI~/rfs/sys/conf\fP,
  724. Xbut it is a symbolic link to the real one in \fI/usr/sys/conf\fP,
  725. Xlet us say, FOOVAX.
  726. XYou should remove the link and copy it to this directory so
  727. Xthat you can add three lines to it\*(Fi:
  728. X.FS
  729. XThe RFSDEBUG option gives you the ability to 
  730. Xenable selective portions of the RFS kernel to give out
  731. Xinformation about activity and problems.
  732. XSee the section on debugging.
  733. XCompiling it in has a negligible performance impact (<< %1)
  734. Xif it is not used.
  735. XYou can compile it out later by removing \fIrmt*.o\fP,
  736. Xremoving the RFSDEBUG option line from the config file,
  737. Xrunning config again, and recompiling.
  738. X.FE
  739. X.DS
  740. Xoptions        REMOTEFS    # to compile in REMOTEFS changes
  741. Xoptions        RFSDEBUG    # to compile in debug software (optional)
  742. Xpseudo-device    remotefs        # to include the rfs software in the makefile
  743. X
  744. X    so
  745. X
  746. X% cd ~rfs/sys/conf
  747. X% rm FOOVAX
  748. X% cp /usr/sys/conf/FOOVAX .
  749. X% vi FOOVAX
  750. X< add in the three new lines >
  751. X% mkdir ../FOOVAX            # for the config directory
  752. X% config FOOVAX
  753. X.DE
  754. X.NH 3
  755. XCompiling the RFS Kernel (about 90-120 minutes)
  756. X.PP
  757. XIf you have installed everything correctly
  758. Xand if I have told you all that I should,
  759. Xthen you should now be able to compile the kernel.
  760. XNote that compilation is different for VAX and Pyramid.
  761. X.DS
  762. X    VAX
  763. X% cd ~rfs/sys/FOOVAX
  764. X% make depend
  765. X% make
  766. X
  767. X    PYRAMID
  768. X% mkdir ~rfs/sys/FOOVAX    # not made yet
  769. X% cd ~rfs/sys/FOOVAX
  770. X% cp ../conf/* .        # copy in configuration scripts and makefiles
  771. X% makesys 64 VER=01 N    # you better check with your pyramid rep.
  772. X.DE
  773. XYou should boot the kernel to assure yourself that
  774. Xit won't crash and to prepare for the remaining software.
  775. X.NH 2
  776. XBuilding the User Programs
  777. X.PP
  778. X\fIRmtmnt\fP is to a remote file system what \fI/etc/mount\fP is
  779. Xto a disk file system.
  780. XIn addition,
  781. Xit provides statistics on currently active remote file systems.
  782. X\fIRfs_server\fP
  783. Xprovides name translation to the kernel for pathnames
  784. Xbelow a generic mount point, e.g. \fI/net/foovax/etc/passwd\fP,
  785. Xand it is the system call server which a client talks to.
  786. X.PP
  787. XThere are three new system calls added to the kernel,
  788. Xand there are three new error numbers defined in \fI<errno.h>\fP.
  789. XThe system calls
  790. X\fIremoteon(2)\fP and \fIremoteoff(2)\fP turn on and
  791. Xoff the remote file system,
  792. Xand \fIremotename(2)\fP allows the
  793. Xserver and kernel to talk to each other.
  794. XHence, you must first make a new libc,
  795. Xso that \fIrfs_server\fP and \fIrmtmnt\fP compile and link
  796. Xwithout any undefined symbols,
  797. Xand any new programs that get relinked will be able to print
  798. Xa reasonable message using the standard library call, \fIperror(3)\fP.
  799. X.NH 3
  800. XBuilding a new \fIlibc.a\fP (about 10 minutes)
  801. X.PP
  802. XThe new system calls and the new error messages for \fI/lib/libc.a\fP are:
  803. X.DS
  804. X~rfs/remote/usr.src.lib.libc/gen/errlst.c.diff
  805. X~rfs/remote/usr.src.lib.libc/{vax,pyr}/sys/remoteon.c
  806. X~rfs/remote/usr.src.lib.libc/{vax,pyr}/sys/remoteoff.c
  807. X~rfs/remote/usr.src.lib.libc/{vax,pyr}/sys/remotename.c
  808. X.DE
  809. XThe contents of \fIerrlst.c.diff\fP is a patch file for
  810. X\fI/usr/src/lib/libc/gen/errlst.c\fP\*(Fi.
  811. X.FS
  812. XThe \fIMakefile\fP assumes that general source is in \fI/usr/src\fP.
  813. XThis can be overridden with an assignment on the command line:
  814. X.sp 1
  815. X    # make vax SRC=/usr/othersrcdir
  816. X.sp 1
  817. X.FE
  818. XThe file \fI~rfs/remote/usr.src.lib.libc/Makefile\fP
  819. Xknows how to build a C\-library from the sources and patch files provided.
  820. XBy default, the \fIMakefile\fP will install the new libc in
  821. X\fI/lib/libc.a\fP\*(Fi so you must be root.
  822. X.FS
  823. XYou can install it in \fI~rfs/remote\fP
  824. Xby changing the \fIMakefile\fP variable LIBDIR,
  825. Xor by assigning it on the command line
  826. X.sp 1
  827. X    # make vax LIBDIR=..
  828. X.sp 1
  829. Xbut then you must remember to change the \fIMakefile\fP
  830. Xin ~rfs/remote
  831. Xafter it is generated by \fI~rfs/remote/shells/makemake\fP.
  832. X.FE
  833. X.DS
  834. X% su root
  835. XPassword:
  836. X# cd ~rfs/remote/usr.src.lib.libc
  837. X# make vax    # for VAX BSD 4.2 or 4.3
  838. X    or
  839. X# make pyr    # for Pyramid 2.5
  840. X.DE
  841. X.NH 3
  842. XBuilding a Makefile for \fIRfs_server\fP, and \fIRmtmnt\fP (about 5 minutes)
  843. X.PP
  844. XThere are a variety of makefiles for building the server, \fIrfs_server\fP,
  845. Xand each is built with a command called \fIshells/makemake\fP.
  846. XCurrently there is support for a makefile
  847. Xon a Vax that will run the RFS kernel, for
  848. Xa Pyramid that will run the RFS kernel and
  849. Xfor a Vax that will only be a server (running an ordinary kernel).
  850. XEach is created\*(Fi
  851. X.FS
  852. XThe last command run will leave that kind of makefile in \fI./remote\fP.
  853. X.FE
  854. Xwith one of the following commands\*(Fi:
  855. X.FS
  856. XIf none of these fit your needs,
  857. Xyou must design your own from the files \fImake.base*\fP.
  858. XAn important part of the makefile is the byte\-ordering
  859. Xfor the machine on which the server will run.
  860. XIf your architecture is neither Vax nor Pyramid,
  861. Xyou should compile the program \fI~rfs/remote/byteorder.c\fP
  862. Xand run it to get its opinion.
  863. X.FE
  864. X.DS
  865. X% cd ~rfs/remote
  866. X% shells/makemake vax        # Vax with RFS kernel
  867. X    or
  868. X% shells/makemake vaxnorfs    # Vax without RFS kernel
  869. X    or
  870. X% shells/makemake pyramid    # Pyramid with RFS kernel
  871. X.DE
  872. X.NH 3
  873. XCompiling \fIRmtmnt\fP and \fIRfs_server\fP (about 30 minutes)
  874. X.PP
  875. XNow, compile the server and \fIrmtmnt\fP program\*(Fi,
  876. Xinstalling the binaries as root:
  877. X.FS
  878. XIf you put the new libc.a in ~rfs/remote, instead
  879. Xof following the reccomended procedure,
  880. Xyou should edit the makefile at this point.
  881. X.FE
  882. X.DS
  883. X% cd ~rfs/remote
  884. X% make
  885. X% su root
  886. XPassword:
  887. X# make install
  888. X.DE
  889. X.NH 2
  890. XOther Chores
  891. X.PP
  892. XAt this point,
  893. Xyou should have an RFS kernel running on one or more machines,
  894. Xcall them \fIclient\fPs, and the
  895. Xpotential to run the RFS server on one or more machines,
  896. Xcall them \fIserver\fPs\*(Fi.
  897. X.FS
  898. XAny machine can be both client and server,
  899. Xeven with respect to itself.
  900. X.FE
  901. XBefore starting up any connections,
  902. Xthere are a few extra items that should be tended to.
  903. X.IP \(bu .125i
  904. XAdd the service \fIremotefs\fP to \fI/etc/services\fP,
  905. Xon all server and client machines.
  906. XIt should be a privileged port number, i.e. less than 1024,
  907. Xbecause the server runs as root and does a \fIseteuid(2)\fP
  908. Xto whatever user it thinks it should be.
  909. XI have used port 556 on the machines where I installed RFS.
  910. X.IP \(bu .125i
  911. XAdd the user \fIguest\fP to \fI/etc/passwd\fP on
  912. Xeach server machine.
  913. XThe default permissions for any access to a server machine
  914. Xare mapped to guest (so it shouldn't have wide access).
  915. XThe server process will refuse to run without this user id installed.
  916. X.IP \(bu .125i
  917. XIf you are on a Pyramid,
  918. Xthere is no easy way to turn on the debugging software in the kernel,
  919. Xso there is a program provided;
  920. Xyou should compile it now hand have it ready.
  921. XMore on debugging later.
  922. X.DS
  923. X% cd ~rfs/remote
  924. X% make debug
  925. X.DE
  926. X.NH 2
  927. XStarting up the software
  928. X.PP
  929. XThe server should be started as root.
  930. XFor now, you start it by hand,
  931. Xand then arrange for it to be started automatically.
  932. XThis should be done on all machines that will be servers or
  933. Xclients.
  934. XRemember that \fI/etc/rfs_server\fP is slightly different for
  935. Xa machine running the RFS kernel; see section \fB1.2.2\fP.
  936. X.DS
  937. X% su root
  938. XPassword:
  939. X# /etc/rfs_server
  940. X# vi /etc/rc.local
  941. X< insert at an appropriate place, the lines... >
  942. X    if [ -f /etc/rfs_server ]; then
  943. X        /etc/rfs_server & echo -n ' rfs_server'    >/dev/console
  944. X    fi
  945. X.DE
  946. X.PP
  947. XNext we should set up for loop\-back RFS access just to make
  948. Xsure that everything works.
  949. XNote that the mount point is a file,
  950. Xnot a directory.
  951. XThis is very important.
  952. XThe design decisions are discussed in a separate paper
  953. Xunder \fI~rfs/remote/doc/paper\fP.
  954. XIn a nutshell,
  955. Xusing a file for a mount point
  956. Xallows the natural syntax for file access
  957. X.DS
  958. X% cp /foovax/etc/passwd /feevax/tmp/x
  959. X.DE
  960. Xbut prevents programs like
  961. X.DS
  962. X% find / -print
  963. X.DE
  964. Xfrom finding every file on every remote host.
  965. X.PP
  966. XIf your host name is foovax, then create the file /foovax and
  967. Xmount your host.
  968. XThe use of the file /foovax is not required,
  969. Xbut only suggested as a convention\*(Fi.
  970. XFoovax must be defined in \fI/etc/hosts\fP and \fIrfs_server\fP
  971. Xshould be running.
  972. X.FS
  973. XIt has been pointed out to me that this convention
  974. Xis slightly restrictive for machines whose owners choose
  975. Xinteresting names such as bin and tmp.
  976. X.FE
  977. X.DS
  978. X% touch /foovax
  979. X% /etc/rmtmnt foovax /foovax
  980. X.DE
  981. XIn all likelyhood,
  982. Xyou should not have crashed by this time,
  983. Xbut if there are any problems with the way you installed the software,
  984. Xthey will be encountered now.
  985. XTry the commands
  986. X.DS
  987. X% ls -ld /foovax/
  988. X% ls -ld /foovax/etc
  989. X% ls -l /foovax/etc
  990. X% cd /foovax/etc
  991. X% pwd
  992. X% ls
  993. X.DE
  994. XIf the machine crashes
  995. Xor the result is not what you expected,
  996. Xyou should pull out the stops and start debugging.
  997. XSee the section on debugging.
  998. XIf all goes well,
  999. Xthen try mounting another host, say foo2vax:
  1000. X.DS
  1001. X% touch /foo2vax
  1002. X% /etc/rmtmnt foo2vax /foo2vax
  1003. X% ls -l /foo2vax/etc
  1004. X% ....
  1005. X.DE
  1006. XTry a generic mount point:
  1007. X.DS
  1008. X% touch /net
  1009. X% /etc/rmtmnt -g /net
  1010. X% more /net/anotherhost/etc/passwd
  1011. X.DE
  1012. X.PP
  1013. XFinally,
  1014. Xwhen you are satisfied that everything is working,
  1015. Xyou should install the mount commands in \fI/etc/rc.local\fP.
  1016. XNote that you don't really need the generic mount point
  1017. Xunless you have many workstations that you don't want to explicitly
  1018. Xmount.
  1019. X.DS
  1020. X% su root
  1021. XPassword:
  1022. X# /etc/rfs_server
  1023. X# vi /etc/rc.local
  1024. X< insert at an appropriate place, the lines... >
  1025. X    if [ -f /foovax ]; then
  1026. X        /etc/rmtmnt foovax /foovax
  1027. X    fi
  1028. X    if [ -f /foo2vax ]; then
  1029. X        /etc/rmtmnt foovax /foovax
  1030. X    fi
  1031. X    if [ -f /net ]; then
  1032. X        /etc/rmtmnt -v /net
  1033. X    fi
  1034. X.DE
  1035. X.NH 1
  1036. XGeneral Portability
  1037. X.PP
  1038. XI consider RFS to be ``installable'', not necessarily portable.
  1039. X.PP
  1040. XRFS's server, \fIrfs_server\fP,
  1041. Xdepends very heavily on the BSD signal mechanism,
  1042. Xinheirited file descriptors (sockets to the client),
  1043. Xand the \fIrecv(2)\fP system call using the MSG_PEEK flag.
  1044. X.PP
  1045. XThe RFS kernel depends very heavily on mbuf structures, and the BSD
  1046. Xsocket paradigm.
  1047. X.NH 1
  1048. XAccess Permissions over RFS
  1049. X.PP
  1050. XFor a greater understanding of this discussion,
  1051. Xand the terms ``sentry server'', ``gateway server'',
  1052. XI suggest that the reader familiarize himself
  1053. Xwith the \fIrfs_server(8)\fP man page.
  1054. XThe terms ``client'' and ``server'' are described in section \fI1.3\fP.
  1055. X.PP
  1056. XA permission map is compiled by \fIrfs_server\fP
  1057. Xwhen it starts up
  1058. Xbased on \fI/etc/hosts\fP, \fI/etc/passwd\fP and \fI.rhosts\fP files
  1059. Xunder every user's login directory.
  1060. XIn addition,
  1061. Xwhenever a client does a \fIrmtmnt\fP command,
  1062. Xthat command sends its \fI/etc/passwd\fP file to the sentry server.
  1063. XSimilarly,
  1064. Xif a server receives a call from a client,
  1065. Xbut has not received an \fI/etc/passwd\fP file,
  1066. Xthe server calls the client's server,
  1067. Xand asks for it\*(Fi.
  1068. X.FS
  1069. XIf this fails,
  1070. Xthen the server will return EIO
  1071. Xon all \fIread(2)\fP calls where the file descriptor
  1072. Xis to a directory,
  1073. Xbecause it doesn't know the client architecture's byte order.
  1074. X.FE
  1075. X.PP
  1076. XWhen a server receives a message from a client process
  1077. Xwhose uid number is \fIn\fP,
  1078. Xit consults the client's \fI/etc/passwd\fP file.
  1079. XIf it finds a matching uid number,
  1080. Xthen it checks\*(Fi to see if
  1081. Xthat uid name is allowed login privileges in some
  1082. Xuser's \fI.rhosts\fP file on the server.
  1083. XIf a user allows it,
  1084. Xthen the server for that process sets
  1085. Xthe effective user id
  1086. Xto that user's uid number (with \fIseteuid(2)\fP)
  1087. Xand sets the groups associated with that
  1088. Xuser (with \fIsetgroups(2)\fP).
  1089. X.FS
  1090. XMost of this checking is done when \fIrfs_server\fP first starts up,
  1091. Xand is kept in LRU lists for fast access.
  1092. XMappings from client uid to server uid are already done
  1093. Xby the time a client makes a connection.
  1094. X.FE
  1095. X.PP
  1096. XIf more than one user on the server host
  1097. Xallows login access to that client's user,
  1098. Xthen the last user in the server's \fI/etc/passwd\fP takes precedence.
  1099. XHowever,
  1100. Xif the one of the users on the server hosts has the same uid name
  1101. Xas that on the client,
  1102. Xthat mapping takes precedence over all other mappings.
  1103. XNote that this means the user \fIx\fP on may have remote
  1104. Xlogin privileges for users \fIy\fP and \fIz\fP,
  1105. Xbut his access permissions over RFS will be for one or the other,
  1106. Xnever both.
  1107. X.PP
  1108. XIf a user changes his \fI.rhosts\fP file on a server,
  1109. Xthat change is not noticed until the server is restarted.
  1110. XFortunately,
  1111. Xrestarting the server is simple:
  1112. Xjust run \fIrfs_server\fP again.
  1113. XAs long as the primary log \fI/usr/tmp/rfs_log\fP
  1114. Xstill exists which contains the process id number of the running server,
  1115. Xit is intelligent enough to shutdown the old server.
  1116. X.PP
  1117. XIf the server host on which the user wanted to change his \fI.rhosts\fP file
  1118. Xis currently connected to the client,
  1119. Xthat connection must be severed and a new one started.
  1120. XThis can be done by killing all processes
  1121. Xhaving the SREMOTE bit set\(*Fi on the client machine.
  1122. XThe \fI/etc/rmtmnt\fP command with no arguments will tell
  1123. Xyou how many processes are connected to each server.
  1124. X.FS
  1125. XThe command \fIps axl\fP will show all commands and their per\-process
  1126. Xflag bits.
  1127. Xsimply examine the left\-most field of the \fIps\fP output
  1128. Xlooking for the SREMOTE bit.
  1129. XUnfortunately,
  1130. Xmultiple remote systems may be open,
  1131. Xand \fIps\fP output does not show which process is using which remote hosts
  1132. Xor even if it is using multiple hosts.
  1133. X.FE
  1134. X.PP
  1135. XSimilarly,
  1136. Xif a new user is added to a client's \fI/etc/passwd\fP file,
  1137. Xor an existing user's uid number changes on a client,
  1138. Xthe \fIrfs_server\fP must be started again on each of the server machines,
  1139. Xor the remote file systems can be unmounted and mounted again using
  1140. X\fI/etc/rmtmnt\fP.
  1141. XAgain, however,
  1142. Xif the client host where the change was made is currently connected
  1143. Xto a server,
  1144. Xthen that connection must be severed and a new one started
  1145. Xas described above.
  1146. X.NH 1
  1147. XDebugging
  1148. X.PP
  1149. XAll kernel debugging is accomplished by setting the
  1150. Xglobal variable \fIremote_debug\fP.
  1151. XThe bit definitions are briefly explained in the
  1152. Xfile \fI~rfs/sys/remote/remotefs.h\fP.
  1153. X.PP
  1154. XDebugging on the server is explained briefly in the
  1155. Xman page for \fIrfs_server(8)\fP.
  1156. X.NH 2
  1157. XPlaces to Look if RFS Does Not Work
  1158. X.PP
  1159. XIf the kernel gets hung in startup or does not seem to do
  1160. Xsome of the system calls correctly
  1161. Xcheck the code inserted into \fI~rfs/sys/machine/trap.c\fP for
  1162. Xone of the following problems:
  1163. X.IP \(bu .125i
  1164. XOn the Vax,
  1165. Xthe declarations at the top of the routine are very position
  1166. Xdependent.
  1167. XRFS has some register declarations that must appear last
  1168. Xor the register allocation that the code depends on will be
  1169. Xmessed up.
  1170. X.IP \(bu .125i
  1171. XOn the Pyramid,
  1172. Xsystem calls are made by passing the arguments as arguments
  1173. X(the Vax copies them to an array).
  1174. XCheck to make sure that the code inserted is doing this right,
  1175. Xbecause I only tested it for a week.
  1176. X.PP
  1177. XOn the Pyramid,
  1178. Xdeclarations of variables inside of local blocks
  1179. Xsometimes causes the value of other local variables in outer blocks to
  1180. Xbe corrupted.
  1181. XFor example:
  1182. X.DS
  1183. X    routinex(arg1, ...)
  1184. X    {
  1185. X        register long    a, b, c, ...;    /* lots of variables */
  1186. X        ...
  1187. X        x = y;
  1188. X
  1189. X        { /* start a local block */
  1190. X            register long    z;
  1191. X
  1192. X            z = 1;
  1193. X        }
  1194. X    }
  1195. X.DE
  1196. XThe declaration and use of z
  1197. Xwill probably clobber one of the earlier variables \fIa, b, c, ...\fP.
  1198. XThis is a pretty bad compiler bug, but I think they are aware of it.
  1199. XThis kind of code was completely removed at one time from the
  1200. XRFS source code, but may have crept back in;
  1201. Xbe sure that you don't add any.
  1202. X.PP
  1203. XIf you \fIcd\fP to a remote directory,
  1204. Xbut it always appears as if you are still in the root directory for
  1205. Xthat machine,
  1206. Xit almost certainly has to do with \fIfork(2)\fP or \fIvfork(2)\fP
  1207. Xsystem calls not being sent to the server.
  1208. XCheck the generated table at the end of 
  1209. X\fI~rfs/sys/remote/rmt_data.c\fP to ensure that there is a \fIRFS_\fP
  1210. Xentry for both \fIfork(2)\fP and \fIvfork(2)\fP.
  1211. XIf there isn't, change it by hand or try to fix the shell file
  1212. Xthat generates it in \fI~rfs/sys/remote/remote_mkdata\fP.
  1213. X.NH 1
  1214. XMaking the Software Permanent
  1215. X.PP
  1216. XFirst,
  1217. Xread in the distribution tape again, this
  1218. Xtime putting it in \fI/usr/src/etc\fP;
  1219. Xthis will be the proper resting place for the software that
  1220. Xlives in the directory immediately below the first\-level directory,
  1221. X\fIremote\fP,
  1222. Xbecause the two commands \fI/etc/rfs_server\fP and \fI/etc/rmtmnt\fP
  1223. Xreside there.
  1224. X.PP
  1225. XSecond,
  1226. Xrerun the installation procedure,
  1227. Xthis time instructing \fIrfs_setup\fP to make the installation permanent,
  1228. Xinstead of in the current directory.
  1229. XThe only exception is that the software in \fI~rfs/remote/usr.src.lib.libc\fP
  1230. Xmust be copied by hand to /usr/src/lib/libc and placed in
  1231. Xthe proper directories there, modifying the \fImakefile\fP accordingly.
  1232. X.NH 1
  1233. XCurrent Bugs and Needed Extensions
  1234. X.PP
  1235. XThe bugs listed have only proved irritating for our environment,
  1236. Xbut worthy of note, none the less.
  1237. X.IP \(bu .125i
  1238. XWhen a client fails to connect to a server,
  1239. Xthe internal count of how many processes there are sometimes
  1240. Xgoes awry,
  1241. Xand the kernel (as seen by \fIrmtmnt\fP)
  1242. Xwill insist that it is still closing
  1243. Xwaiting for processes to die that aren't there.
  1244. XThe bug is almost certainly in \fIremote_getconnection()\fP.
  1245. X.IP \(bu .125i
  1246. XWhenever a connection goes down,
  1247. Xthere may be processes still up ``using'' that connection.
  1248. XHowever,
  1249. Xif there are no open files or remote \fIchdir(2)\fP's,
  1250. Xthe kernel could just as well restart the connection
  1251. Xwithout waiting for those processes to die.
  1252. XThis fix would go into \fIremote_getconnection()\fP.
  1253. X.IP \(bu .125i
  1254. XThe server has the beginnings of capability to
  1255. Xdo an asynchronous system call (like reading 10k of data),
  1256. Xbut it has not been fully implemented.
  1257. XA much better solution would be to implement an
  1258. Xatomic \fIwrite(2)\fP system call where
  1259. Xthe writer is guarenteed that no one else
  1260. Xwill be able to write on the same file descriptor (socket,
  1261. Xin this case)
  1262. Xuntil he is done.
  1263. XThis would allow servers to perform system calls
  1264. Xat their own pace sending the results back at any time.
  1265. X.IP \(bu .125i
  1266. XAlong the same lines,
  1267. Ximplementing an atomic message reader system call
  1268. Xthat would allow all servers to be blocked on a read
  1269. Xof the single socket connected to the client.
  1270. XThe reading server would provide a list of process id's
  1271. Xthat he is handling as input arguments along with
  1272. Xfile descriptor, buffer and size.
  1273. XThe kernel would slice up all the messages, handing
  1274. Xeach out to the server that is serving that process.
  1275. XThe only reason it wasn't implemented so far, was to keep the
  1276. Xserver standard.
  1277. X.IP \(bu .125i
  1278. XThe server maps two user id names with the same
  1279. Xnumber on a client to one user id on a server.
  1280. XThe reason is that only the uid number is sent in the messages
  1281. Xto the server.
  1282. XThere is no real fix for this.
  1283. X.IP \(bu .125i
  1284. XThe sentry server has the information about every host in
  1285. Xits memory and hands all this information off to each \fIgateway\fP
  1286. Xserver and its children even though it is never used.
  1287. XIf this was freed when each \fIgateway\fP
  1288. Xserver starts up, the servers would consume fewer memory
  1289. Xand swap resources.
  1290. X.IP \(bu .125i
  1291. XThe server currently does not handle \fI.rhosts\fP
  1292. Xfiles that have entries uttering only a host name.
  1293. XIt also ignores \fI/etc/hosts.equiv\fP.
  1294. X.IP \(bu .125i
  1295. XThis implementation ignores the possibility that the kernel COMPAT
  1296. Xoption may have been used.
  1297. XOld system calls should just fail.
  1298. X.IP \(bu .125i
  1299. XThe \fIpwd\fP command (and library call) does not work
  1300. Xwhile your current directory is under \fI/net/host/somedirectory\fP.
  1301. XBasically, the \fIpwd\fP command discovers that its current directory
  1302. Xis \fI/net/somedirectory\fP
  1303. Xbecause the \fIhost\fP is really only a virtual pathname component.
  1304. XBut when it tries to do
  1305. Xa \fIchdir(2)\fP back to it, it fails.
  1306. XThis is an irritating problem,
  1307. Xbut the only easy solution is for a change in the implementation,
  1308. Xsuch that \fI/net\fP becomes a directory, and the nameserver
  1309. Xcreates files and
  1310. Xdoes an explicit mount for any hosts that the kernel asks about.
  1311. XSo far I have resisted this because it requires another change
  1312. Xto the kernel routine \fInamei()\fP,
  1313. Xand because \fIpwd\fP works just fine if a host explicitly mounted.
  1314. X.IP \(bu .125i
  1315. XI think that RFS may be responsible for dropping an mbuf when a connection
  1316. Xfails, but this is apparently infrequent.
  1317. X.IP \(bu .125i
  1318. X\fIChroot(2)\fP system call is only partially implemented.
  1319. Xand should not be used with a remote directory as an argument.
  1320. X.IP \(bu .125i
  1321. XThe \fIselect(2)\fP and \fIioctl(2)\fP system calls are not yet implemented.
  1322. XThe latter means that the \fItip\fP command won't work with remote
  1323. Xpointers to tty dialers.
  1324. X.IP \(bu .125i
  1325. XThe server allows any unknown user on a client to see
  1326. Xits file system through the guest
  1327. Xaccount.
  1328. XThis is a good default.
  1329. XBut an appropriate extension
  1330. Xwould be a table describing a restricted domain of access,
  1331. Xso that if machines \fIx\fP and \fIy\fP appear in the table,
  1332. Xthey are allowed access through the normal permission scheme
  1333. Xdescribed above.
  1334. XHowever, any machine not in the table would be denied access in general,
  1335. Xso that only users on the client that have been allowed remote logins
  1336. Xvia \fI.rhosts\fP files can have access.
  1337. X.IP \(bu .125i
  1338. XNo fixes have been provided for \fImv(1)\fP or \fIcp(1)\fP
  1339. Xto distinguish the triple device/inode/host for uniqueness.
  1340. XThe information is available:
  1341. Xfor a local file,
  1342. Xthe \fIstat(2)\fP, \fIfstat(2)\fP and \fIlstat(2)\fP
  1343. Xsystem calls return a stat structure whose
  1344. X\fIst_spare1\fP element is 0.
  1345. XIf the file is remote,
  1346. Xthe \fIst_spare1\fP element contains the value \fIn\fP+1
  1347. Xwhere \fIn\fP is the number of the remote host mount point,
  1348. Xas shown by \fI/etc/rmtmnt\fP.
  1349. X.IP \(bu .125i
  1350. XThe server, \fIrfs_server\fP, does not correctly handle situations where
  1351. Xa host has more than one internet address.
  1352. XWhat happens is that all of the user access privileges
  1353. X(distilled from all the .rhosts files)
  1354. Xgets attached to one address, and when a call is made using the
  1355. Xother address, everyone only has the access of the \fIguest\fP user.
  1356. X.IP \(bu .125i
  1357. XSome user commands,
  1358. Xlike \fIchgrp(1)\fP and \fIrn(1)\fP
  1359. Xtry to guess ahead of time whether the kernel will allow you write
  1360. Xpermission on a file.
  1361. XHence, they will fail sometimes where they should not.
  1362. XFor example,
  1363. Xif your user id number on one host is 5 and on
  1364. Xanother host it is 6,
  1365. X\fIchgrp(1)\fP on one host
  1366. Xwill tell you that you cannot change the group of a file that resides on
  1367. Xanother host, even though RFS would allow it.
  1368. X.NH 1
  1369. XConclusions and Plans for the Future
  1370. X.PP
  1371. XRFS is not production quality,
  1372. Xbut is very useful,
  1373. Xproviding reasonably fast file access:
  1374. XI consider rcp unreasonable.
  1375. XI have made this software publicly available in hopes that other
  1376. Xinterested parties might contribute some of the fixes to it.
  1377. XI have other responsibilities and cannot afford to spend the
  1378. Xmany hours necessary to get that last 5 or 10% of quality,
  1379. Xbut perhaps you can help.
  1380. X.PP
  1381. XThe only hope for this software is that it is free and easy
  1382. Xto install and debug.
  1383. XI am more than willing to accept bug reports and fixes for it
  1384. Xuntil this or something else becomes part of the Berkeley Software
  1385. XDistribution.
  1386. SHAREOF
  1387. chmod 664 remote/doc/install.ms
  1388. #
  1389. # remote/doc/paper
  1390. #
  1391. mkdir remote/doc/paper
  1392. chmod 775 remote/doc/paper
  1393. #
  1394. # remote/doc/paper/Makefile
  1395. #
  1396. if [ -f remote/doc/paper/Makefile ]; then 
  1397.     echo -n 'Hit <return> to overwrite remote/doc/paper/Makefile or ^C to quit' 
  1398.     read ans 
  1399.     rm -f remote/doc/paper/Makefile 
  1400. fi 
  1401.  
  1402. sed -e 's/^.//' << \SHAREOF > remote/doc/paper/Makefile
  1403. XRFS = remotefs fig1.mag fig2.mag fig3.mag fig4.mag fig5.mag fig6.mag \
  1404. X    appendixB.out
  1405. X
  1406. Xrfs: $(RFS)
  1407. X    troff $(ONLY) -Tmag -mstek remotefs > image
  1408. X    @sh -c "echo -n Waiting... ; read x"
  1409. X    dmag -w$(WIND) < image
  1410. Xlgp: $(RFS)
  1411. X    ltroff -mstek $(ONLY) remotefs
  1412. X
  1413. X#
  1414. X# run off figure 1 or 2 or 3
  1415. X#
  1416. Xf1: fig1.mag
  1417. X    troff -Tmag -mstek fig1.mag > image
  1418. X    @sh -c "echo -n Waiting... ; read x"
  1419. X    dmag -w$(WIND) < image
  1420. Xf2: fig2.mag
  1421. X    troff -Tmag -mstek fig2.mag > image
  1422. X    @sh -c "echo -n Waiting... ; read x"
  1423. X    dmag -w$(WIND) < image
  1424. Xf3: fig3.mag
  1425. X    troff -Tmag -mstek fig3.mag > image
  1426. X    @sh -c "echo -n Waiting... ; read x"
  1427. X    dmag -w$(WIND) < image
  1428. Xf4: fig4.mag
  1429. X    troff -Tmag -mstek fig4.mag > image
  1430. X    @sh -c "echo -n Waiting... ; read x"
  1431. X    dmag -w$(WIND) < image
  1432. Xf5: fig5.mag
  1433. X    troff -Tmag -mstek fig5.mag > image
  1434. X    @sh -c "echo -n Waiting... ; read x"
  1435. X    dmag -w$(WIND) < image
  1436. Xf5: fig5.mag
  1437. X    troff -Tmag -mstek fig5.mag > image
  1438. X    @sh -c "echo -n Waiting... ; read x"
  1439. X    dmag -w$(WIND) < image
  1440. Xf6: fig6.mag
  1441. X    troff -Tmag -mstek fig6.mag > image
  1442. X    @sh -c "echo -n Waiting... ; read x"
  1443. X    dmag -w$(WIND) < image
  1444. XA: appendixA.out
  1445. X    troff -Tmag -mstek appendixA.out > image
  1446. X    @sh -c "echo -n Waiting... ; read x"
  1447. X    dmag -w$(WIND) < image
  1448. XB: appendixB.out
  1449. X    troff -Tmag -mstek appendixB.out > image
  1450. X    @sh -c "echo -n Waiting... ; read x"
  1451. X    dmag -w$(WIND) < image
  1452. X
  1453. X#
  1454. X# generate figure 1
  1455. X#
  1456. Xfig1.mag: fig1
  1457. X    /lib/cpp -Dfigure1 fig1 | sed -e '/^#/d' | pic -T100 > fig1.mag
  1458. Xfig1.lgp: fig1
  1459. X    /lib/cpp -Dfigure1 fig1 | sed -e '/^#/d' | pic > fig1.lgp
  1460. X
  1461. X#
  1462. X# generate figure 2
  1463. X#
  1464. Xfig2.mag: fig1
  1465. X    /lib/cpp -Dfigure2 fig1 | sed -e '/^#/d' | pic -T100 > fig2.mag
  1466. Xfig2.lgp: fig1
  1467. X    /lib/cpp -Dfigure2 fig1 | sed -e '/^#/d' | pic > fig2.lgp
  1468. X
  1469. X#
  1470. X# generate figure 3
  1471. X#
  1472. Xfig3.mag: fig1
  1473. X    /lib/cpp -Dfigure3 fig1 | sed -e '/^#/d' | pic -T100 > fig3.mag
  1474. Xfig3.lgp: fig1
  1475. X    /lib/cpp -Dfigure3 fig1 | sed -e '/^#/d' | pic > fig3.lgp
  1476. X
  1477. X#
  1478. X# generate figure 4
  1479. X#
  1480. Xfig4.mag: fig4
  1481. X    pic -T100 fig4 > fig4.mag
  1482. Xfig4.lgp: fig4
  1483. X    pic fig4 > fig4.lgp
  1484. X
  1485. X#
  1486. X# generate figure 5
  1487. X#
  1488. Xfig5.mag: fig5
  1489. X    pic -T100 fig5 > fig5.mag
  1490. Xfig5.lgp: fig5
  1491. X    pic fig5 > fig5.lgp
  1492. X
  1493. X#
  1494. X# generate figure 6
  1495. X#
  1496. Xfig6.mag: fig6
  1497. X    pic -T100 fig6 > fig6.mag
  1498. Xfig6.lgp: fig6
  1499. X    pic fig6 > fig6.lgp
  1500. X
  1501. X#
  1502. X# generate appendix A
  1503. X#
  1504. XappendixA.out: appendixA
  1505. X    tbl appendixA > appendixA.out
  1506. X
  1507. X#
  1508. X# generate appendix B
  1509. X#
  1510. XappendixB.out: appendixB
  1511. X    tbl appendixB > appendixB.out
  1512. SHAREOF
  1513. chmod 664 remote/doc/paper/Makefile
  1514. #
  1515. # remote/doc/paper/appendixB
  1516. #
  1517. if [ -f remote/doc/paper/appendixB ]; then 
  1518.     echo -n 'Hit <return> to overwrite remote/doc/paper/appendixB or ^C to quit' 
  1519.     read ans 
  1520.     rm -f remote/doc/paper/appendixB 
  1521. fi 
  1522.  
  1523. sed -e 's/^.//' << \SHAREOF > remote/doc/paper/appendixB
  1524. X.if "\*(.T"mag" \{\
  1525. X.    nr PS 12
  1526. X.    nr VS 14
  1527. X.    ps \n(PS
  1528. X.    vs \n(VS
  1529. X.    pl 9.5i
  1530. X.\}
  1531. X.ds LH \fBAppendix B\fP
  1532. X.BP
  1533. X.NH 1
  1534. XAppendix B
  1535. X.PP
  1536. XThese two tables contain the functions that must be ``changed'' for a remote
  1537. Xor distributed file system to work.
  1538. XThe column headings have the same meaning for both tables,
  1539. Xbut since some system calls have no before and after necessities (column 4),
  1540. Xit is clearer to put them by themselves in \fITable 1\fP.
  1541. X\fITable 2\fP has the rest of the system calls.
  1542. XThe first column, \fBSystem Call\fP, is the name of the system call
  1543. Xas found in section 2 of the UNIX User's Manual.
  1544. X.PP
  1545. XThe second column,
  1546. X\fBInteresting Arguments\fP,
  1547. Xlists the arguments that we are particularly interested in.
  1548. XFor example, \fIaccess()\fP, has two arguments, one a flag and one is
  1549. Xa path.
  1550. XThe path is noteworthy because we must find out what portion of the path
  1551. Xis on a remote host, and what remote host it is on.
  1552. XOther interesting arguments are those with two path names and those
  1553. Xhaving file descriptors.
  1554. XSome may not have any arguments worth considering,
  1555. Xbut are included because of important side effects.
  1556. X.PP
  1557. X\fBFollow Symlinks\fP shows whether \fInamei()\fP must follow
  1558. Xsymbolic links when determining ``remoteness'' (and is not applicable
  1559. Xto system calls that do not deal with path names).
  1560. XThis is an important point,
  1561. Xbut only for an implementation like \fBRemotefs\fP.
  1562. X\fBRemotefs\fP uses another system call, \fIisremote()\fP,
  1563. Xwhen determining what remote host a file is on and what portion
  1564. Xof the path is on that host.
  1565. XNow, the authors of 4.2
  1566. Xdecided when \fInamei()\fP may or may not follow a symbolic link,
  1567. Xand \fIisremote()\fP must do the same for whatever system call is
  1568. Xin operation.
  1569. X.PP
  1570. XThe last column, \fBSpecial Considerations Before & After the Syscall\fP,
  1571. Xshows what preparation
  1572. Xthe local host must do before
  1573. Xsending the system call to a remote host,
  1574. Xsuch as doing a local open to allocate a file descriptor
  1575. Xfor a \fIdup()\fP system call.
  1576. XThe fourth column shows the followup steps that should be taken
  1577. Xafter a successful remote system call.
  1578. X.PP
  1579. XThese descriptions assume that the system call has already been identified
  1580. Xas one that needs to be sent to a remote host.
  1581. XThat is,
  1582. Xat least one of the path names (for those system calls that deal with paths)
  1583. Xis remote,
  1584. Xor that the file descriptor passed as an argument to a system call is
  1585. Xto a remote file,
  1586. Xor even that there has been one or more remote system call requests
  1587. Xof some kind
  1588. X(\fIfork()\fP, \fIvfork()\fP, \fIumask()\fP, \fIexit()\fP).
  1589. X.BP
  1590. X.TS
  1591. Xtab(+) center box;
  1592. Xc | c | c
  1593. Xc | c | c
  1594. Xl | l | c.
  1595. X\fBSystem+Interesting+Follow\fR
  1596. X\fBCall+Arguments+Symlinks\fR
  1597. X=
  1598. X\fIaccess()\fP+One Path Name+yes+
  1599. X\fIstat()\fP+\^+\^
  1600. X\fIutimes()\fP+\^+\^
  1601. X\fItruncate()\fP+\^+\^
  1602. X_
  1603. X\fIchmod()\fP+One Path Name+no
  1604. X\fIchown()\fP+\^+\^
  1605. X\fIlstat()\fP+\^+\^
  1606. X\fImkdir()\fP+\^+\^
  1607. X\fImknod()\fP+\^+\^
  1608. X\fIrmdir()\fP+\^+\^
  1609. X\fIunlink()\fP+\^+\^
  1610. X_
  1611. X\fIfchmod()\fP+File Descriptor+n/a+
  1612. X\fIfchown()\fP+\^+\^
  1613. X\fIfcntl()\fP+\^+\^
  1614. X\fIflock()\fP+\^+\^
  1615. X\fIfstat()\fP+\^+\^
  1616. X\fIfsync()\fP+\^+\^
  1617. X\fIftruncate()\fP+\^+\^
  1618. X\fIioctl()\fP+\^+\^
  1619. X\fIlseek()\fP+\^+\^
  1620. X_
  1621. X.TE
  1622. X.ce 1
  1623. X\fITable 1\fP
  1624. X.BP
  1625. X.TS
  1626. Xtab(+) center box expand;
  1627. Xc | c | c | cw(3.5i)
  1628. Xc | c | c | cw(3.5i)
  1629. Xl | l | c | lw(3.5i).
  1630. X\fBSystem+Interesting+Follow+Special Considerations\fR
  1631. X\fBCall+Arguments+Symlinks+Before & After the Syscall\fR
  1632. X=
  1633. X\fIchdir()\fP+One Path Name+yes+T{
  1634. X\fBAfter:\fP
  1635. XMake note of the system and path name of the \fIchdir()\fP argument.
  1636. XT}
  1637. X_
  1638. X\fIclose()\fP+File Descriptor+n/a+T{
  1639. X\fBAfter:\fP
  1640. XClose the local file descriptor
  1641. XT}
  1642. X_
  1643. X\fIcreat()\fP+One Path Name+yes+T{
  1644. X\fBBefore:\fP
  1645. XAllocate a local file descriptor as a place\-holder.
  1646. X\fIDup2()\fP always closes the file descriptor in
  1647. Xits second argument in anticipation
  1648. Xof putting the new file descriptor at that ordinate value.
  1649. XThat file descriptor must be closed locally before sending
  1650. Xthe request to the remote host.
  1651. X.sp 1
  1652. X\fBAfter:\fP
  1653. XIf the system call was not successful, close the local one.
  1654. XAlso,
  1655. Xthere may need to be some mapping of file descriptors.
  1656. XFor instance,
  1657. Xthe local file descriptor may be 5 while the remote may be 6.
  1658. XHence, every request on fd 5 must be mapped to 6.
  1659. XAlternatively,
  1660. Xthe server may take care of the mapping if the local host sends
  1661. Xthe local file descriptor number to the remote host.
  1662. XT}
  1663. X\fIopen()\fP+One Path Name+\^+\^
  1664. X\fIdup()\fP+File Descriptor+\^+\^
  1665. X\fIdup2()\fP+File Descriptor+\^+\^
  1666. X_
  1667. X\fIexecv()\fP+One Path Name+yes+T{
  1668. X\fBAfter:\fP
  1669. XThe text for the program to be run must be copied
  1670. Xto the local swap space and executed from there.
  1671. XIf it is just a shell file, then it could be run normally,
  1672. Xwith the shell causing a remote open.
  1673. XT}
  1674. X\fIexecve()\fP+\^+\^+\^
  1675. X_
  1676. X\fIexit()\fP+None+n/a+T{
  1677. X\fBAfter:\fP
  1678. XThe \fIexit()\fP must be also run locally.
  1679. XT}
  1680. X_
  1681. X\fIfork()\fP+None+n/a+T{
  1682. X\fBBefore:\fP
  1683. XThe \fIfork()\fP or \fIvfork()\fP should be run locally first
  1684. Xto determine if the resources are available.
  1685. XT}
  1686. X\fIvfork()\fP+\^+\^+\^
  1687. X_
  1688. X\fIlink()\fP+Two Path Names+no+T{
  1689. X\fBBefore:\fP
  1690. XBoth path names must be on the same remote (or local) host.
  1691. XIf not, we can simulate failure locally.
  1692. XT}
  1693. X_
  1694. X\fIread()\fP+File Descriptor++T{
  1695. X\fBAfter:\fP
  1696. XThe data that was actually read by the system call
  1697. Xmust be gotten from the remote host.
  1698. XT}
  1699. X\fIreadlink()\fP+One Path Name+no+\^
  1700. X\fIreadv()\fP+File Descriptor++\^
  1701. X_
  1702. X\fIrename()\fP+Two Path Names+yes+T{
  1703. X\fBBefore:\fP
  1704. XThe two path names must both be on the same remote (or local)
  1705. Xhost.
  1706. XT}
  1707. X_
  1708. X\fIsymlink()\fP+Two Path Names+yes+T{
  1709. X\fBBefore:\fP
  1710. XOnly the second path name should be checked for ``remoteness''.
  1711. XT}
  1712. X_
  1713. X\fIumask()\fP+None+n/a+T{
  1714. X\fBAfter:\fP
  1715. X\fIumask()\fP must also be run locally.
  1716. XT}
  1717. X_
  1718. X\fIwrite()\fP+File Descriptor+n/a+T{
  1719. X\fBBefore:\fP
  1720. XThe data to be written must be sent to the remote host.
  1721. XT}
  1722. X\fIwritev()\fP+\^+\^+\^
  1723. X.TE
  1724. X.ce 1
  1725. X\fITable 2\fP
  1726. SHAREOF
  1727. chmod 664 remote/doc/paper/appendixB
  1728. #
  1729. # remote/doc/paper/fig1
  1730. #
  1731. if [ -f remote/doc/paper/fig1 ]; then 
  1732.     echo -n 'Hit <return> to overwrite remote/doc/paper/fig1 or ^C to quit' 
  1733.     read ans 
  1734.     rm -f remote/doc/paper/fig1 
  1735. fi 
  1736.  
  1737. sed -e 's/^.//' << \SHAREOF > remote/doc/paper/fig1
  1738. X.KF
  1739. X.if "\*(.T"mag" \{\
  1740. X.    nr PS 12
  1741. X.    nr VS 14
  1742. X.    ps \n(PS
  1743. X.    vs \n(VS
  1744. X.\}
  1745. X.PP
  1746. X.PS
  1747. X#ifdef figure1
  1748. Xboxht = .3i
  1749. Xboxwid = .8i
  1750. Xmovewid = .2i
  1751. XSyscalls: [
  1752. X    A: box "read()"; move
  1753. X    B: box "open()"; move
  1754. X    C: box "stat()"; move
  1755. X    D: box "..."
  1756. X]
  1757. X
  1758. Xboxht = last [].ht+1.2i
  1759. Xboxwid = last [].wid+.1i
  1760. XUserlevel: box dashed with .n at last [].n + (0i, .3i)
  1761. Xline from Syscalls.A.s to Userlevel.s
  1762. Xline from Syscalls.B.s to Userlevel.s
  1763. Xline from Syscalls.C.s to Userlevel.s
  1764. Xline from Syscalls.D.s to Userlevel.s
  1765. X"\s+4A User's Program\s-4" at Userlevel.se + (0, .075i) rjust
  1766. X#endif
  1767. X
  1768. X#ifdef figure1
  1769. Xboxwid = boxwid + 1.5i
  1770. Xboxht = boxht + 1i
  1771. XSystem: box dashed with .n at last box.s - (0, .3i)
  1772. X
  1773. X#else
  1774. Xboxwid = 5.5i
  1775. Xboxht = 2i
  1776. XSystem: box dashed
  1777. X#endif
  1778. X"\s+4UNIX Kernel\s-4" at System.se + (0, .075i) rjust
  1779. X
  1780. X#ifdef figure1
  1781. Xarrow from Userlevel.s to System.n
  1782. X#else
  1783. Xarrow from System.n + (0, .3i) to System.n
  1784. X#endif
  1785. Xboxht = .3i
  1786. Xboxwid = 1.5i
  1787. XSysinterface: box "Syscall Interface" dashed .02i with .n at System.n
  1788. X
  1789. Xboxht = .3i
  1790. Xboxwid = .8i
  1791. Xmovewid = .2i
  1792. XRwuio: box "rwuio()" with .w at System.w + (.1i, 0); move
  1793. XCopen: box "copen()"
  1794. X
  1795. Xmovewid = (-.2i)
  1796. XEtc: box "..." with .e at System.e - (.1i, 0)
  1797. XStat1: box "stat1()" with .e at Etc.w - (.2i, 0)
  1798. X
  1799. Xarrow from Sysinterface.s to Copen.n
  1800. X#ifdef figure1
  1801. Xarrow from Sysinterface.s to Rwuio.n
  1802. Xarrow from Sysinterface.s to Etc.n
  1803. Xarrow from Sysinterface.s to Stat1.n
  1804. X#endif
  1805. X
  1806. X#ifdef figure1
  1807. XNamei: box "namei()" at System.c - (0, .4i)
  1808. X#endif
  1809. X#ifdef figure2
  1810. XNamei: box "namei()" at System.c - (0, .4i)
  1811. X#endif
  1812. X#ifdef figure3
  1813. XNamei: box wid 1.8*boxwid ht 2.5*boxht at System.c - (0, .5i)
  1814. X"namei()" at Namei above
  1815. XRemotecheck: box wid 1.15*boxwid ht 1.3*boxht with .se at Namei.se
  1816. X"check for" at Remotecheck above
  1817. X"``remoteness''" at Remotecheck below
  1818. X#endif
  1819. X
  1820. Xspline -> right .4i from Copen.e then to Namei.n - (.1i, 0)
  1821. X#ifdef figure1
  1822. Xspline -> left .4i from Stat1.w then to Namei.n + (.1i, 0)
  1823. Xspline -> down .2i from Etc.s + (.025i, 0) then to Namei.e
  1824. X#endif
  1825. Xboxht = 1i
  1826. Xboxwid = 3i
  1827. X
  1828. XDevices: box dashed with .n at System.s - (0, .3i)
  1829. X"\s+4Device Drivers\s-4" at Devices.se + (0, .075i) rjust
  1830. Xboxht = .5i
  1831. Xboxwid = 1i
  1832. X
  1833. X#ifdef figure1
  1834. XDisk: box dashed .02i with .n at Devices.n
  1835. X#endif
  1836. X
  1837. X#ifdef figure2
  1838. XDisk: box dashed .02i with .ne at Devices.ne - (.2i, 0)
  1839. XPseudo: box dashed .02i with .nw at Devices.nw + (.2i, 0)
  1840. X"Pseudo\-Disk" at Pseudo above
  1841. X"Interface" at Pseudo below
  1842. X#endif
  1843. X
  1844. X#ifdef figure3
  1845. XDisk: box dashed .02i with .ne at Devices.ne - (.2i, 0)
  1846. XNet: box dashed .02i with .nw at Devices.nw + (.2i, 0)
  1847. X"Network" at Net above
  1848. X"Connection" at Net below
  1849. X#endif
  1850. X
  1851. X"Disk" at Disk above
  1852. X"Interface" at Disk below
  1853. X
  1854. X#ifdef figure1
  1855. Xarrow from Rwuio.s to Disk.n - (.025, 0)
  1856. Xarrow from Namei.s to Disk.n + (.025, 0)
  1857. X#endif
  1858. X#ifdef figure2
  1859. Xarrow from Rwuio.s to Pseudo.n - (.025, 0)
  1860. Xarrow from Namei.s to Pseudo.n + (.025, 0)
  1861. X#endif
  1862. X#ifdef figure3
  1863. Xarrow from Rwuio.s to Net.n - (.033, 0)
  1864. Xarrow from Copen.s to Net.n
  1865. Xarrow from Namei.s to Disk.n + (.025, 0)
  1866. X#endif
  1867. X.PE
  1868. X.ce
  1869. X#ifdef figure1
  1870. X\fIFigure 1\fP
  1871. X#endif
  1872. X#ifdef figure2
  1873. X\fIFigure 2\fP
  1874. X#endif
  1875. X#ifdef figure3
  1876. X\fIFigure 3\fP
  1877. X#endif
  1878. X.SP
  1879. X.KE
  1880. SHAREOF
  1881. chmod 664 remote/doc/paper/fig1
  1882. #
  1883. # remote/doc/paper/fig1.mag
  1884. #
  1885. if [ -f remote/doc/paper/fig1.mag ]; then 
  1886.     echo -n 'Hit <return> to overwrite remote/doc/paper/fig1.mag or ^C to quit' 
  1887.     read ans 
  1888.     rm -f remote/doc/paper/fig1.mag 
  1889. fi 
  1890.  
  1891. sed -e 's/^.//' << \SHAREOF > remote/doc/paper/fig1.mag
  1892. SHAREOF
  1893. chmod 644 remote/doc/paper/fig1.mag
  1894. #
  1895. # remote/doc/paper/fig4
  1896. #
  1897. if [ -f remote/doc/paper/fig4 ]; then 
  1898.     echo -n 'Hit <return> to overwrite remote/doc/paper/fig4 or ^C to quit' 
  1899.     read ans 
  1900.     rm -f remote/doc/paper/fig4 
  1901. fi 
  1902.  
  1903. sed -e 's/^.//' << \SHAREOF > remote/doc/paper/fig4
  1904. X.KF
  1905. X.if "\*(.T"mag" \{\
  1906. X.    nr PS 12
  1907. X.    nr VS 14
  1908. X.    ps \n(PS
  1909. X.    vs \n(VS
  1910. X.\}
  1911. X.PP
  1912. X.PS
  1913. Xboxht = .3i
  1914. Xboxwid = .8i
  1915. Xmovewid = .2i
  1916. XSyscalls: [
  1917. X    A: box "read()"; move
  1918. X    B: box "open()"; move
  1919. X    C: box "stat()"; move
  1920. X    D: box "..."
  1921. X]
  1922. Xboxwid = last [].wid
  1923. XRemotecheck: box with .nw at Syscalls.A.sw - (0, .15i)
  1924. X"check for ``remoteness''" at Remotecheck
  1925. X
  1926. Xboxht = last [].ht+1.2i
  1927. Xboxwid = last [].wid+.1i
  1928. XUserlevel: box dashed with .n at last [].n + (0i, .3i)
  1929. Xarrow from Syscalls.A.s to (Syscalls.A.s.x, Remotecheck.n.y)
  1930. Xarrow from Syscalls.B.s to (Syscalls.B.s.x, Remotecheck.n.y)
  1931. Xarrow from Syscalls.C.s to (Syscalls.C.s.x, Remotecheck.n.y)
  1932. Xarrow from Syscalls.D.s to (Syscalls.D.s.x, Remotecheck.n.y)
  1933. Xarrow from Remotecheck.s to Userlevel.s - (0, .3i)
  1934. X"\s+4A User's Program\s-4" at Userlevel.se + (0, .075i) rjust
  1935. X.PE
  1936. X.ce
  1937. X\fIFigure 4\fP
  1938. X.SP
  1939. X.KE
  1940. SHAREOF
  1941. chmod 664 remote/doc/paper/fig4
  1942. #
  1943. # remote/doc/paper/fig5
  1944. #
  1945. if [ -f remote/doc/paper/fig5 ]; then 
  1946.     echo -n 'Hit <return> to overwrite remote/doc/paper/fig5 or ^C to quit' 
  1947.     read ans 
  1948.     rm -f remote/doc/paper/fig5 
  1949. fi 
  1950.  
  1951. sed -e 's/^.//' << \SHAREOF > remote/doc/paper/fig5
  1952. X.DS
  1953. X.if "\*(.T"mag" \{\
  1954. X.    nr PS 12
  1955. X.    nr VS 14
  1956. X.    ps \n(PS
  1957. X.    vs \n(VS
  1958. X.\}
  1959. X.PS
  1960. Xboxht = boxht/2
  1961. Xboxwid = boxwid*2
  1962. XProto: [
  1963. X    A: box "request"
  1964. X    B: box "response" with .n at last box.s - (0, .1)
  1965. X    C: box "request" with .n at last box.s - (0, .1)
  1966. X    D: box "response" with .n at last box.s - (0, .1)
  1967. X    E: box "..." with .n at last box.s - (0, .1)
  1968. X]
  1969. XLocal: box "Local Host" with .e at last [].w - (1i, 0)
  1970. XRemote: box "Remote Host" with .w at last [].e + (1i, 0)
  1971. Xarrow from Local.e to Proto.A.w
  1972. Xarrow from Local.e to Proto.C.w
  1973. Xarrow from Local.e to Proto.E.w
  1974. Xarrow from Remote.w to Proto.B.e
  1975. Xarrow from Remote.w to Proto.D.e
  1976. X.PE
  1977. X.DE
  1978. SHAREOF
  1979. chmod 664 remote/doc/paper/fig5
  1980. #
  1981. # remote/doc/paper/fig6
  1982. #
  1983. if [ -f remote/doc/paper/fig6 ]; then 
  1984.     echo -n 'Hit <return> to overwrite remote/doc/paper/fig6 or ^C to quit' 
  1985.     read ans 
  1986.     rm -f remote/doc/paper/fig6 
  1987. fi 
  1988.  
  1989. sed -e 's/^.//' << \SHAREOF > remote/doc/paper/fig6
  1990. X.DS
  1991. X.if "\*(.T"mag" \{\
  1992. X.    nr PS 12
  1993. X.    nr VS 14
  1994. X.    ps \n(PS
  1995. X.    vs \n(VS
  1996. X.\}
  1997. X.PS
  1998. Xboxht = boxht/2
  1999. Xboxwid = boxwid*2
  2000. XProto: [
  2001. X    A: box "read request"
  2002. X    B: box "read response" with .n at last box.s - (0, .1)
  2003. X    C: box "read request" with .n at last box.s - (0, .1)
  2004. X    D: box "read response" with .n at last box.s - (0, .1)
  2005. X    E: box "continue" with .n at last box.s - (0, .1)
  2006. X    F: box "read response" with .n at last box.s - (0, .1)
  2007. X    G: box "read response" with .n at last box.s - (0, .1)
  2008. X    H: box "..." invis with .n at last box.s - (0, .1)
  2009. X    I: box "stop \fIn\fP" with .n at last box.s - (0, .1)
  2010. X    J: box "read response" with .n at last box.s - (0, .1)
  2011. X    K: box "read response" with .n at last box.s - (0, .1)
  2012. X    L: box "..." invis with .n at last box.s - (0, .1)
  2013. X    M: box "acknowledge" with .n at last box.s - (0, .1)
  2014. X]
  2015. XLocal: box "Local Host" with .e at last [].w - (1i, 0)
  2016. XRemote: box "Remote Host" with .w at last [].e + (1i, 0)
  2017. Xarrow from Local.e to Proto.A.w
  2018. Xarrow from Local.e to Proto.C.w
  2019. Xarrow from Local.e to Proto.E.w
  2020. Xarrow from Local.e to Proto.I.w
  2021. Xarrow from Remote.w to Proto.B.e
  2022. Xarrow from Remote.w to Proto.D.e
  2023. Xarrow from Remote.w to Proto.F.e
  2024. Xarrow from Remote.w to Proto.G.e
  2025. Xarrow from Remote.w to Proto.J.e
  2026. Xarrow from Remote.w to Proto.K.e
  2027. Xarrow from Remote.w to Proto.M.e
  2028. X.PE
  2029. X.DE
  2030. SHAREOF
  2031. chmod 664 remote/doc/paper/fig6
  2032.  
  2033.