Remove -settime/RXAFS_GetTime client support
[openafs.git] / src / afsd / afsd.c
index 96999f0..91d6006 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright 2000, International Business Machines Corporation and others.
  * All Rights Reserved.
- * 
+ *
  * This software has been released under the terms of the IBM Public
  * License.  For details, see the LICENSE file in the top-level source
  * directory or online at http://www.openafs.org/dl/license10.html
   *    -rxmaxmtu   Set the max mtu to help with VPN issues.
   *    -verbose     Be chatty.
   *    -disable-dynamic-vcaches     Disable the use of -stat value as the starting size of
-  *                          the size of the vcache/stat cache pool, 
+  *                          the size of the vcache/stat cache pool,
   *                          but increase that pool dynamically as needed.
   *    -debug     Print out additional debugging info.
   *    -kerndev    [OBSOLETE] The kernel device for AFS.
   *    -dontfork   [OBSOLETE] Don't fork off as a new process.
   *    -daemons   The number of background daemons to start (Default: 2).
   *    -rmtsys    Also fires up an afs remote sys call (e.g. pioctl, setpag)
-  *                support daemon 
+  *                support daemon
   *     -chunksize [n]   2^n is the chunksize to be used.  0 is default.
   *     -dcache    The number of data cache entries.
   *     -biods     Number of bkg I/O daemons (AIX3.1 only)
@@ -55,6 +55,7 @@
 
 #include <afsconfig.h>
 #include <afs/param.h>
+#include <roken.h>
 
 #ifdef IGNORE_SOME_GCC_WARNINGS
 # pragma GCC diagnostic warning "-Wdeprecated-declarations"
 
 #define VFS 1
 
+#include <afs/stds.h>
+#include <afs/opr.h>
+#include <afs/opr_assert.h>
+
 #include <afs/cmd.h>
 
 #include "afsd.h"
 
-#include <assert.h>
-#include <potpourri.h>
 #include <afs/afsutil.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <sys/file.h>
 #include <errno.h>
 #include <sys/time.h>
-#include <dirent.h>
 #include <sys/wait.h>
 
+/* darwin dirent.h doesn't give us the prototypes we want if KERNEL is
+ * defined */
+#if defined(UKERNEL) && defined(AFS_USR_DARWIN_ENV)
+# undef KERNEL
+# include <dirent.h>
+# define KERNEL
+#else
+# include <dirent.h>
+#endif
+
 
 #ifdef HAVE_SYS_PARAM_H
 #include <sys/param.h>
 #include <sys/fs_types.h>
 #endif
 
-#ifdef HAVE_SYS_MOUNT_H
+#if defined(HAVE_SYS_MOUNT_H) && !defined(AFS_ARM_DARWIN_ENV)
 #include <sys/mount.h>
 #endif
 
 #include <mntent.h>
 #endif
 
-#ifdef HAVE_SYS_MOUNT_H
-#include <sys/mount.h>
-#endif
-
 #ifdef HAVE_SYS_VFS_H
 #include <sys/vfs.h>
 #endif
@@ -160,35 +168,33 @@ void set_staticaddrs(void);
 #include <sys/ioctl.h>
 #include <sys/xattr.h>
 #endif
-#include <mach/mach.h>
-#include <mach/mach_port.h>
-#include <mach/mach_interface.h>
-#include <mach/mach_init.h>
-
 #include <CoreFoundation/CoreFoundation.h>
 
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <SystemConfiguration/SCDynamicStore.h>
 
+#ifndef AFS_ARM_DARWIN_ENV
 #include <IOKit/pwr_mgt/IOPMLib.h>
 #include <IOKit/IOMessage.h>
 
 static io_connect_t root_port;
 static IONotificationPortRef notify;
 static io_object_t iterator;
+#endif
+
 static CFRunLoopSourceRef source;
 
 static int event_pid;
 
 #endif /* AFS_DARWIN_ENV */
 
-#if AFS_HAVE_STATVFS
+#if AFS_HAVE_STATVFS || defined(HAVE_SYS_STATVFS_H)
 #include <sys/statvfs.h>
 #else
 #if defined(AFS_SUN_ENV)
 #include <sys/vfs.h>
 #else
-#if !defined(AFS_OSF_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_XBSD_ENV)
+#ifdef HAVE_SYS_STATFS_H
 #include <sys/statfs.h>
 #endif
 #endif
@@ -224,11 +230,6 @@ struct in_addr_42 {
        } S_un_w;
        afs_uint32 S_addr;
     } S_un;
-#define        s_host  S_un.S_un_b.s_b2        /* host on imp */
-#define        s_net   S_un.S_un_b.s_b1        /* network */
-#define        s_imp   S_un.S_un_w.s_w2        /* imp */
-#define        s_impno S_un.S_un_b.s_b4        /* imp # */
-#define        s_lh    S_un.S_un_b.s_b3        /* logical host */
 };
 
 #define        mPrintIPAddr(ipaddr)  printf("[%d.%d.%d.%d] ",          \
@@ -240,37 +241,37 @@ struct in_addr_42 {
 /*
  * Global configuration variables.
  */
-afs_int32 enable_rxbind = 0;
-afs_int32 afs_shutdown = 0;
-afs_int32 cacheBlocks;         /*Num blocks in the cache */
-afs_int32 cacheFiles;          /*Optimal # of files in workstation cache */
-afs_int32 rwpct = 0;
-afs_int32 ropct = 0;
-afs_int32 cacheStatEntries;    /*Number of stat cache entries */
-char cacheBaseDir[1024];       /*Where the workstation AFS cache lives */
-char confDir[1024];            /*Where the workstation AFS configuration lives */
-char fullpn_DCacheFile[1024];  /*Full pathname of DCACHEFILE */
-char fullpn_VolInfoFile[1024]; /*Full pathname of VOLINFOFILE */
-char fullpn_CellInfoFile[1024];        /*Full pathanem of CELLINFOFILE */
-char fullpn_CacheInfo[1024];   /*Full pathname of CACHEINFO */
-char fullpn_VFile[1024];       /*Full pathname of data cache files */
-char *vFilePtr;                        /*Ptr to the number part of above pathname */
-int sawCacheMountDir = 0;      /* from cmd line */
-int sawCacheBaseDir = 0;
-int sawCacheBlocks = 0;
-int sawDCacheSize = 0;
-int sawBiod = 0;
-int sawCacheStatEntries = 0;
+static afs_int32 enable_rxbind = 0;
+static afs_int32 afs_shutdown = 0;
+static afs_int32 cacheBlocks;          /*Num blocks in the cache */
+static afs_int32 cacheFiles;           /*Optimal # of files in workstation cache */
+static afs_int32 rwpct = 0;
+static afs_int32 ropct = 0;
+static afs_int32 cacheStatEntries;     /*Number of stat cache entries */
+static char cacheBaseDir[1024];        /*Where the workstation AFS cache lives */
+static char confDir[1024];             /*Where the workstation AFS configuration lives */
+static char fullpn_DCacheFile[1024];   /*Full pathname of DCACHEFILE */
+static char fullpn_VolInfoFile[1024];  /*Full pathname of VOLINFOFILE */
+static char fullpn_CellInfoFile[1024]; /*Full pathanem of CELLINFOFILE */
+static char fullpn_CacheInfo[1024];    /*Full pathname of CACHEINFO */
+static char fullpn_VFile[1024];        /*Full pathname of data cache files */
+static char *vFilePtr;                 /*Ptr to the number part of above pathname */
+static int sawCacheMountDir = 0;       /* from cmd line */
+static int sawCacheBaseDir = 0;
+static int sawCacheBlocks = 0;
+static int sawDCacheSize = 0;
+#ifdef AFS_AIX32_ENV
+static int sawBiod = 0;
+#endif
+static int sawCacheStatEntries = 0;
 char afsd_cacheMountDir[1024]; /*Mount directory for AFS */
-char rootVolume[64] = "root.afs";      /*AFS root volume name */
-afs_int32 cacheSetTime = FALSE;        /*Keep checking time to avoid drift? */
-afs_int32 isHomeCell;          /*Is current cell info for the home cell? */
+static char rootVolume[64] = "root.afs";       /*AFS root volume name */
 #ifdef AFS_XBSD_ENV
-int createAndTrunc = O_RDWR | O_CREAT | O_TRUNC;       /*Create & truncate on open */
+static int createAndTrunc = O_RDWR | O_CREAT | O_TRUNC;        /*Create & truncate on open */
 #else
-int createAndTrunc = O_CREAT | O_TRUNC;        /*Create & truncate on open */
+static int createAndTrunc = O_CREAT | O_TRUNC; /*Create & truncate on open */
 #endif
-int ownerRWmode = 0600;                /*Read/write OK by owner */
+static int ownerRWmode = 0600;         /*Read/write OK by owner */
 static int filesSet = 0;       /*True if number of files explicitly set */
 static int nFilesPerDir = 2048;        /* # files per cache dir */
 #if defined(AFS_CACHE_BYPASS)
@@ -297,11 +298,12 @@ static int enable_fakestat = 0;   /* enable fakestat support */
 static int enable_backuptree = 0;      /* enable backup tree support */
 static int enable_nomount = 0; /* do not mount */
 static int enable_splitcache = 0;
-int afsd_dynamic_vcaches = 0;  /* Enable dynamic-vcache support */
+static int afsd_dynamic_vcaches = 0;   /* Enable dynamic-vcache support */
 int afsd_verbose = 0;          /*Are we being chatty? */
 int afsd_debug = 0;            /*Are we printing debugging info? */
-int afsd_CloseSynch = 0;       /*Are closes synchronous or not? */
-int rxmaxmtu = 0;       /* Are we forcing a limit on the mtu? */
+static int afsd_CloseSynch = 0;        /*Are closes synchronous or not? */
+static int rxmaxmtu = 0;       /* Are we forcing a limit on the mtu? */
+static int rxmaxfrags = 0;      /* Are we forcing a limit on frags? */
 
 #ifdef AFS_SGI62_ENV
 #define AFSD_INO_T ino64_t
@@ -319,7 +321,7 @@ int *dir_for_V = NULL;              /* Array: dir of each cache file.
                                 * -2: file exists in top-level
                                 * >=0: file exists in Dxxx
                                 */
-#if !defined(AFS_CACHE_VNODE_PATH) && !defined(LINUX_USE_FH)
+#if !defined(AFS_CACHE_VNODE_PATH) && !defined(AFS_LINUX26_ENV)
 AFSD_INO_T *inode_for_V;       /* Array of inodes for desired
                                 * cache files */
 #endif
@@ -334,45 +336,43 @@ int PartSizeOverflow(char *path, int cs);
 #if defined(AFS_SUN510_ENV) && defined(RXK_LISTENER_ENV)
 static void fork_rx_syscall_wait();
 #endif
-#if defined(AFS_SUN510_ENV) || defined(RXK_LISTENER_ENV)
 static void fork_rx_syscall();
-#endif
 static void fork_syscall();
 
-#ifdef AFS_DARWIN_ENV
+#if defined(AFS_DARWIN_ENV) && !defined(AFS_ARM_DARWIN_ENV)
 static void
-afsd_sleep_callback(void * refCon, io_service_t service, 
+afsd_sleep_callback(void * refCon, io_service_t service,
                    natural_t messageType, void * messageArgument )
 {
     switch (messageType) {
     case kIOMessageCanSystemSleep:
-       /* Idle sleep is about to kick in; can 
-          prevent sleep by calling IOCancelPowerChange, otherwise 
+       /* Idle sleep is about to kick in; can
+          prevent sleep by calling IOCancelPowerChange, otherwise
           if we don't ack in 30s the system sleeps anyway */
-       
+
        /* allow it */
        IOAllowPowerChange(root_port, (long)messageArgument);
        break;
-       
+
     case kIOMessageSystemWillSleep:
        /* The system WILL go to sleep. Ack or suffer delay */
-       
+
        IOAllowPowerChange(root_port, (long)messageArgument);
        break;
-       
+
     case kIOMessageSystemWillRestart:
        /* The system WILL restart. Ack or suffer delay */
-       
+
        IOAllowPowerChange(root_port, (long)messageArgument);
        break;
-       
+
     case kIOMessageSystemWillPowerOn:
     case kIOMessageSystemHasPoweredOn:
        /* coming back from sleep */
-       
+
        IOAllowPowerChange(root_port, (long)messageArgument);
        break;
-       
+
     default:
        IOAllowPowerChange(root_port, (long)messageArgument);
        break;
@@ -400,6 +400,10 @@ afsd_update_addresses(CFRunLoopTimerRef timer, void *info)
     } else
        printf("ADVISEADDR: Error in specifying interface addresses:%s\n",
               reason);
+
+    /* Since it's likely this means our DNS server changed, reinit now */
+    if (enable_afsdb)
+       res_init();
 }
 
 /* This function is called when the system's ip addresses may have changed. */
@@ -415,7 +419,7 @@ afsd_ipaddr_callback (SCDynamicStoreRef store, CFArrayRef changed_keys, void *in
       CFRelease (timer);
 }
 
-static void 
+static void
 afsd_event_cleanup(int signo) {
 
     CFRunLoopRemoveSource(CFRunLoopGetCurrent(), source, kCFRunLoopDefaultMode);
@@ -423,7 +427,6 @@ afsd_event_cleanup(int signo) {
     IODeregisterForSystemPower(&iterator);
     IOServiceClose(root_port);
     IONotificationPortDestroy(notify);
-
     exit(0);
 }
 
@@ -435,57 +438,57 @@ afsd_install_events(void)
     SCDynamicStoreRef store;
 
     root_port = IORegisterForSystemPower(0,&notify,afsd_sleep_callback,&iterator);
-    
+
     if (root_port) {
        CFRunLoopAddSource(CFRunLoopGetCurrent(),
                           IONotificationPortGetRunLoopSource(notify),
                           kCFRunLoopDefaultMode);
     }
-    
-    
+
+
     store = SCDynamicStoreCreate (NULL,
                                  CFSTR ("AddIPAddressListChangeCallbackSCF"),
                                  afsd_ipaddr_callback, &ctx);
-    
+
     if (store) {
        const void *keys[1];
-       
+
        /* Request IPV4 address change notification */
        keys[0] = (SCDynamicStoreKeyCreateNetworkServiceEntity
                   (NULL, kSCDynamicStoreDomainState,
                    kSCCompAnyRegex, kSCEntNetIPv4));
-       
+
 #if 0
        /* This should tell us when the hostname(s) change. do we care? */
        keys[N] = SCDynamicStoreKeyCreateHostNames (NULL);
 #endif
-       
+
        if (keys[0] != NULL) {
            CFArrayRef pattern_array;
-           
+
            pattern_array = CFArrayCreate (NULL, keys, 1,
                                           &kCFTypeArrayCallBacks);
-           
+
            if (pattern_array != NULL)
            {
                SCDynamicStoreSetNotificationKeys (store, NULL, pattern_array);
                source = SCDynamicStoreCreateRunLoopSource (NULL, store, 0);
-               
+
                CFRelease (pattern_array);
            }
-           
+
            if (keys[0] != NULL)
                CFRelease (keys[0]);
        }
-       
-       CFRelease (store); 
+
+       CFRelease (store);
     }
-    
+
     if (source != NULL) {
        CFRunLoopAddSource (CFRunLoopGetCurrent(),
                            source, kCFRunLoopDefaultMode);
     }
-    
+
     signal(SIGTERM, afsd_event_cleanup);
 
     CFRunLoopRun();
@@ -588,8 +591,8 @@ ParseCacheInfoFile(void)
 }
 
 /*
- * All failures to open the partition are ignored. Also if the cache dir 
- * isn't a mounted partition it's also ignored since we can't guarantee 
+ * All failures to open the partition are ignored. Also if the cache dir
+ * isn't a mounted partition it's also ignored since we can't guarantee
  * what will be stored afterwards. Too many if's. This is now purely
  * advisory. ODS with over 2G partition also gives warning message.
  *
@@ -602,7 +605,7 @@ PartSizeOverflow(char *path, int cs)
 {
   int bsize = -1;
   afs_int64 totalblks, mint;
-#if AFS_HAVE_STATVFS
+#if AFS_HAVE_STATVFS || defined(HAVE_SYS_STATVFS_H)
     struct statvfs statbuf;
 
     if (statvfs(path, &statbuf) != 0) {
@@ -800,7 +803,7 @@ SetNoBackupAttr(char *fullpn)
 }
 
 static int
-MoveCacheFile(char *basename, int fromDir, int toDir, int cacheFile, 
+MoveCacheFile(char *basename, int fromDir, int toDir, int cacheFile,
              int maxDir)
 {
     static char rn[] = "MoveCacheFile";
@@ -932,7 +935,7 @@ UnlinkUnwantedFile(char *rn, char *fullpn_FileToDelete, char *fileToDelete)
 
 
 static int
-doSweepAFSCache(int *vFilesFound, 
+doSweepAFSCache(int *vFilesFound,
                char *directory,        /* /path/to/cache/directory */
                int dirNum,             /* current directory number */
                int maxDir)             /* maximum directory number */
@@ -985,7 +988,7 @@ doSweepAFSCache(int *vFilesFound,
 #if defined(AFS_SGI62_ENV) || defined(AFS_DARWIN90_ENV)
            printf("\tinode=%" AFS_INT64_FMT ", reclen=%d, name='%s'\n", currp->d_ino,
                   currp->d_reclen, currp->d_name);
-#elif defined(AFS_DFBSD_ENV)
+#elif defined(AFS_DFBSD_ENV) || defined(AFS_USR_DFBSD_ENV)
            printf("\tinode=%ld, name='%s'\n", (long)currp->d_ino, currp->d_name);
 #else
            printf("\tinode=%ld, reclen=%d, name='%s'\n", (long)currp->d_ino,
@@ -1008,7 +1011,7 @@ doSweepAFSCache(int *vFilesFound,
             * file's inode, directory, and bump the number of files found
             * total and in this directory.
             */
-#if !defined(AFS_CACHE_VNODE_PATH) && !defined(LINUX_USE_FH)
+#if !defined(AFS_CACHE_VNODE_PATH) && !defined(AFS_LINUX26_ENV)
            inode_for_V[vFileNum] = currp->d_ino;
 #endif
            dir_for_V[vFileNum] = dirNum;       /* remember this directory */
@@ -1150,7 +1153,7 @@ doSweepAFSCache(int *vFilesFound,
                           vFileNum);
                else {
                    struct stat statb;
-#if !defined(AFS_CACHE_VNODE_PATH) && !defined(LINUX_USE_FH)
+#if !defined(AFS_CACHE_VNODE_PATH) && !defined(AFS_LINUX26_ENV)
                    assert(inode_for_V[vFileNum] == (AFSD_INO_T) 0);
 #endif
                    sprintf(vFilePtr, "D%d/V%d", thisDir, vFileNum);
@@ -1163,7 +1166,7 @@ doSweepAFSCache(int *vFilesFound,
                    if (CreateCacheFile(fullpn_VFile, &statb))
                        printf("%s: Can't create '%s'\n", rn, fullpn_VFile);
                    else {
-#if !defined(AFS_CACHE_VNODE_PATH) && !defined(LINUX_USE_FH)
+#if !defined(AFS_CACHE_VNODE_PATH) && !defined(AFS_LINUX26_ENV)
                        inode_for_V[vFileNum] = statb.st_ino;
 #endif
                        dir_for_V[vFileNum] = thisDir;
@@ -1266,7 +1269,7 @@ CheckCacheBaseDir(char *dir)
        if (res != 0) {
            return "unable to statfs cache base directory";
        }
-#if !defined(LINUX_USE_FH)
+#if !defined(AFS_LINUX26_ENV)
        if (statfsbuf.f_type == 0x52654973) {   /* REISERFS_SUPER_MAGIC */
            return "cannot use reiserfs as cache partition";
        } else if (statfsbuf.f_type == 0x58465342) {    /* XFS_SUPER_MAGIC */
@@ -1405,9 +1408,11 @@ ConfigCell(struct afsconf_cell *aci, void *arock, struct afsconf_dir *adir)
 
     /* figure out if this is the home cell */
     isHomeCell = (strcmp(aci->name, LclCellName) == 0);
-    if (!isHomeCell)
+    if (!isHomeCell) {
        cellFlags = 2;          /* not home, suid is forbidden */
-
+       if (enable_dynroot == 2)
+           cellFlags |= 8; /* don't display foreign cells until looked up */
+    }
     /* build address list */
     for (i = 0; i < MAXHOSTSPERCELL; i++)
        memcpy(&hosts[i], &aci->hostAddr[i].sin_addr, sizeof(afs_int32));
@@ -1448,7 +1453,7 @@ AfsdbLookupHandler(void)
     kernelMsg[1] = 0;
     acellName[0] = '\0';
 
-#ifdef AFS_DARWIN_ENV
+#if defined(AFS_DARWIN_ENV) && !defined(AFS_ARM_DARWIN_ENV)
     /* Fork the event handler also. */
     code = fork();
     if (code == 0) {
@@ -1641,20 +1646,19 @@ daemon_thread(void *rock)
     return NULL;
 }
 
+#ifndef UKERNEL
 static void *
 rmtsysd_thread(void *rock)
 {
     rmtsysd();
     return NULL;
 }
+#endif /* !UKERNEL */
 
 int
 mainproc(struct cmd_syndesc *as, void *arock)
 {
     afs_int32 code;            /*Result of fork() */
-#ifdef AFS_AIX32_ENV
-    int sawBiod = 0;
-#endif
 #ifdef AFS_SUN5_ENV
     struct stat st;
 #endif
@@ -1712,7 +1716,7 @@ mainproc(struct cmd_syndesc *as, void *arock)
     }
     if (as->parms[8].items) {
        /* -nosettime */
-       cacheSetTime = FALSE;
+       /* noop */
     }
     if (as->parms[9].items) {
        /* -verbose */
@@ -1721,6 +1725,10 @@ mainproc(struct cmd_syndesc *as, void *arock)
     if (as->parms[10].items) {
        /* -rmtsys */
        afsd_rmtsys = 1;
+#ifdef UKERNEL
+       printf("-rmtsys not supported for UKERNEL\n");
+       return -1;
+#endif
     }
     if (as->parms[11].items) {
        /* -debug */
@@ -1776,7 +1784,7 @@ mainproc(struct cmd_syndesc *as, void *arock)
     if (as->parms[20].items) {
        /* -shutdown */
        afs_shutdown = 1;
-       /* 
+       /*
         * Cold shutdown is the default
         */
        printf("afsd: Shutting down all afs processes and afs state\n");
@@ -1840,7 +1848,10 @@ mainproc(struct cmd_syndesc *as, void *arock)
     }
     if (as->parms[32].items) {
        /* -settime */
-       cacheSetTime = TRUE;
+       printf("afsd: -settime ignored\n");
+       printf("afsd: the OpenAFS client no longer sets the system time; "
+              "please use NTP or\n");
+       printf("afsd: another such system to synchronize client time\n");
     }
 
     /* set rx_extraPackets */
@@ -1863,7 +1874,7 @@ mainproc(struct cmd_syndesc *as, void *arock)
        else {
            ropct = atoi((char *)c + 1);
            *c = '\0';
-           rwpct = atoi((char *)as->parms[30].items->data);
+           rwpct = atoi((char *)as->parms[34].items->data);
            if ((rwpct != 0) && (ropct != 0) && (ropct + rwpct == 100)) {
                /* -splitcache */
                enable_splitcache = 1;
@@ -1873,7 +1884,7 @@ mainproc(struct cmd_syndesc *as, void *arock)
     if (as->parms[35].items) {
 #ifdef AFS_MAXVCOUNT_ENV
        /* -disable-dynamic-vcaches */
-       afsd_dynamic_vcaches = FALSE;
+       afsd_dynamic_vcaches = 0;
 #else
        printf("afsd: Error toggling flag, dynamically allocated vcaches not supported on your platform\n");
        exit(1);
@@ -1882,7 +1893,7 @@ mainproc(struct cmd_syndesc *as, void *arock)
 #ifdef AFS_MAXVCOUNT_ENV
     else {
        /* -dynamic-vcaches */
-       afsd_dynamic_vcaches = TRUE;
+       afsd_dynamic_vcaches = 1;
     }
 
     if (afsd_verbose)
@@ -1894,6 +1905,14 @@ mainproc(struct cmd_syndesc *as, void *arock)
         /* -rxmaxmtu */
         rxmaxmtu = atoi(as->parms[36].items->data);
     }
+    if (as->parms[37].items) {
+       /* -dynroot-sparse */
+       enable_dynroot = 2;
+    }
+    if (as->parms[38].items) {
+       /* -rxmaxfrags */
+       rxmaxfrags = atoi(as->parms[38].items->data);
+    }
     return 0;
 }
 
@@ -1910,7 +1929,7 @@ afsd_run(void)
     int vFilesFound;           /*How many data cache files were found in sweep */
     int currVFile;             /*Current AFS cache file number passed in */
 
-    /*
+       /*
      * Pull out all the configuration info for the workstation's AFS cache and
      * the cellular community we're willing to let our users see.
      */
@@ -1935,6 +1954,12 @@ afsd_run(void)
        exit(1);
     }
 
+    if (!enable_nomount) {
+       if (afsd_check_mount(rn, afsd_cacheMountDir)) {
+           return -1;
+       }
+    }
+
     /* do some random computations in memcache case to get things to work
      * reasonably no matter which parameters you set.
      */
@@ -1994,7 +2019,7 @@ afsd_run(void)
        /* Disk cache:
         * Compute the number of cache files based on cache size,
         * but only if -files isn't given on the command line.
-        * Don't let # files be so small as to prevent full utilization 
+        * Don't let # files be so small as to prevent full utilization
         * of the cache unless user has explicitly asked for it.
         */
        if (chunkSize == 0) {
@@ -2012,7 +2037,7 @@ afsd_run(void)
 
            cacheFiles = max(cacheFiles, 1000);
 
-           /* Always allow more files than chunks.  Presume average V-file 
+           /* Always allow more files than chunks.  Presume average V-file
             * is ~67% of a chunk...  (another guess, perhaps Honeyman will
             * have a grad student write a paper).  i is KILOBYTES.
             */
@@ -2050,7 +2075,7 @@ afsd_run(void)
        /* This actually needs to
           1) use powers of 2
           2) not second-guess when a chunksize comes from the command line
-          3) be less, um, small. 2^2?? 
+          3) be less, um, small. 2^2??
        */
        /* Sanity check chunkSize */
        i = max(cacheBlocks / 1000, cacheBlocks / cacheFiles);
@@ -2085,7 +2110,7 @@ afsd_run(void)
                   cacheStatEntries);
     }
 
-#if !defined(AFS_CACHE_VNODE_PATH) && !defined(LINUX_USE_FH)
+#if !defined(AFS_CACHE_VNODE_PATH) && !defined(AFS_LINUX26_ENV)
     /*
      * Create and zero the inode table for the desired cache files.
      */
@@ -2128,6 +2153,11 @@ afsd_run(void)
     setpgrp(getpid(), 0);
 #endif /* mac2 */
 
+    /*
+     * Set the primary cell name.
+     */
+    afsd_call_syscall(AFSOP_SET_THISCELL, LclCellName);
+
     /* Initialize RX daemons and services */
 
     /* initialize the rx random number generator from user space */
@@ -2143,7 +2173,7 @@ afsd_run(void)
        if (code > 0) {
            if (enable_rxbind)
                code = code | 0x80000000;
-           afsd_call_syscall(AFSOP_ADVISEADDR, code, addrbuf, maskbuf, mtubuf);
+               afsd_call_syscall(AFSOP_ADVISEADDR, code, addrbuf, maskbuf, mtubuf);
        } else
            printf("ADVISEADDR: Error in specifying interface addresses:%s\n",
                   reason);
@@ -2152,16 +2182,6 @@ afsd_run(void)
     /* Set realtime priority for most threads to same as for biod's. */
     afsd_set_afsd_rtpri();
 
-#ifdef AFS_SGI53_ENV
-#ifdef AFS_SGI61_ENV
-    set_staticaddrs();
-#else /* AFS_SGI61_ENV */
-    code = get_nfsstaticaddr();
-    if (code)
-       afsd_call_syscall(AFSOP_NFSSTATICADDR, code);
-#endif /* AFS_SGI61_ENV */
-#endif /* AFS_SGI_53_ENV */
-
     /* Start listener, then callback listener. Lastly, start rx event daemon.
      * Change in ordering is so that Linux port has socket fd in listener
      * process.
@@ -2183,8 +2203,13 @@ afsd_run(void)
 #endif
     if (afsd_verbose)
        printf("%s: Forking rx callback listener.\n", rn);
+#ifndef RXK_LISTENER_ENV
+    fork_rx_syscall(rn, AFSOP_START_RXCALLBACK, preallocs, enable_peer_stats,
+                    enable_process_stats);
+#else
     fork_syscall(rn, AFSOP_START_RXCALLBACK, preallocs);
-#if defined(AFS_SUN5_ENV) || defined(RXK_LISTENER_ENV)
+#endif
+#if defined(AFS_SUN5_ENV) || defined(RXK_LISTENER_ENV) || defined(RXK_UPCALL_ENV)
     if (afsd_verbose)
        printf("%s: Forking rxevent daemon.\n", rn);
     fork_rx_syscall(rn, AFSOP_RXEVENT_DAEMON);
@@ -2195,7 +2220,6 @@ afsd_run(void)
            printf("%s: Forking AFSDB lookup handler.\n", rn);
        afsd_fork(0, afsdb_thread, NULL);
     }
-
     code = afsd_call_syscall(AFSOP_BASIC_INIT, 1);
     if (code) {
        printf("%s: Error %d in basic initialization.\n", rn, code);
@@ -2217,10 +2241,10 @@ afsd_run(void)
     cparams.cacheDcaches = dCacheSize;
     cparams.cacheVolumes = vCacheSize;
     cparams.chunkSize = chunkSize;
-    cparams.setTimeFlag = cacheSetTime;
+    cparams.setTimeFlag = 0;
     cparams.memCacheFlag = cacheFlags;
     cparams.dynamic_vcaches = afsd_dynamic_vcaches;
-    afsd_call_syscall(AFSOP_CACHEINIT, &cparams);
+       afsd_call_syscall(AFSOP_CACHEINIT, &cparams);
 
     /* do it before we init the cache inodes */
     if (enable_splitcache) {
@@ -2262,7 +2286,7 @@ afsd_run(void)
        printf("%s: Using memory cache, not swept\n", rn);
 
     /*
-     * Pass the kernel the name of the workstation cache file holding the 
+     * Pass the kernel the name of the workstation cache file holding the
      * dcache entries.
      */
     if (afsd_debug)
@@ -2276,10 +2300,20 @@ afsd_run(void)
      * Pass the kernel the name of the workstation cache file holding the
      * cell information.
      */
-    if (afsd_debug)
-       printf("%s: Calling AFSOP_CELLINFO: cell info file is '%s'\n", rn,
-              fullpn_CellInfoFile);
-    afsd_call_syscall(AFSOP_CELLINFO, fullpn_CellInfoFile);
+    if (!(cacheFlags & AFSCALL_INIT_MEMCACHE)) {
+       if (afsd_debug)
+           printf("%s: Calling AFSOP_CELLINFO: cell info file is '%s'\n", rn,
+                  fullpn_CellInfoFile);
+       afsd_call_syscall(AFSOP_CELLINFO, fullpn_CellInfoFile);
+    }
+
+    if (rxmaxfrags) {
+       if (afsd_verbose)
+            printf("%s: Setting rxmaxfrags in kernel = %d\n", rn, rxmaxfrags);
+       code = afsd_call_syscall(AFSOP_SET_RXMAXFRAGS, rxmaxfrags);
+        if (code)
+            printf("%s: Error seting rxmaxfrags\n", rn);
+    }
 
     if (rxmaxmtu) {
        if (afsd_verbose)
@@ -2291,7 +2325,8 @@ afsd_run(void)
 
     if (enable_dynroot) {
        if (afsd_verbose)
-           printf("%s: Enabling dynroot support in kernel.\n", rn);
+           printf("%s: Enabling dynroot support in kernel%s.\n", rn,
+                  (enable_dynroot==2)?", not showing cells.":"");
        code = afsd_call_syscall(AFSOP_SET_DYNROOT, 1);
        if (code)
            printf("%s: Error enabling dynroot support.\n", rn);
@@ -2299,7 +2334,9 @@ afsd_run(void)
 
     if (enable_fakestat) {
        if (afsd_verbose)
-           printf("%s: Enabling fakestat support in kernel.\n", rn);
+           printf("%s: Enabling fakestat support in kernel%s.\n", rn,
+                  (enable_fakestat==2)?" for all mountpoints."
+                  :" for crosscell mountpoints");
        code = afsd_call_syscall(AFSOP_SET_FAKESTAT, enable_fakestat);
        if (code)
            printf("%s: Error enabling fakestat support.\n", rn);
@@ -2319,11 +2356,6 @@ afsd_run(void)
     afsconf_CellApply(cdir, ConfigCell, NULL);
     afsconf_CellAliasApply(cdir, ConfigCellAlias, NULL);
 
-    /*
-     * Set the primary cell name.
-     */
-    afsd_call_syscall(AFSOP_SET_THISCELL, LclCellName);
-
     /* Initialize AFS daemon threads. */
     if (afsd_verbose)
        printf("%s: Forking AFS daemon.\n", rn);
@@ -2412,7 +2444,7 @@ afsd_run(void)
            afsd_call_syscall(AFSOP_CACHEINODE,
                         (afs_uint32) (inode_for_V[currVFile] >> 32),
                         (afs_uint32) (inode_for_V[currVFile] & 0xffffffff));
-#elif !(defined(LINUX_USE_FH) || defined(AFS_CACHE_VNODE_PATH))
+#elif !(defined(AFS_LINUX26_ENV) || defined(AFS_CACHE_VNODE_PATH))
            afsd_call_syscall(AFSOP_CACHEINODE, inode_for_V[currVFile]);
 #else
            printf
@@ -2429,11 +2461,11 @@ afsd_run(void)
      */
     if (afsd_debug)
        printf("%s: Calling AFSOP_GO with cacheSetTime = %d\n", rn,
-              cacheSetTime);
-    afsd_call_syscall(AFSOP_GO, cacheSetTime);
+              0);
+       afsd_call_syscall(AFSOP_GO, 0);
 
     /*
-     * At this point, we have finished passing the kernel all the info 
+     * At this point, we have finished passing the kernel all the info
      * it needs to set up the AFS.  Mount the AFS root.
      */
     printf("%s: All AFS daemons started.\n", rn);
@@ -2446,11 +2478,13 @@ afsd_run(void)
        afsd_mount_afs(rn, afsd_cacheMountDir);
     }
 
+#ifndef UKERNEL
     if (afsd_rmtsys) {
        if (afsd_verbose)
            printf("%s: Forking 'rmtsys' daemon.\n", rn);
        afsd_fork(0, rmtsysd_thread, NULL);
     }
+#endif /* !UKERNEL */
     /*
      * Exit successfully.
      */
@@ -2535,9 +2569,14 @@ afsd_init(void)
                "set rx_extraPackets to this value");
     cmd_AddParm(ts, "-splitcache", CMD_SINGLE, CMD_OPTIONAL,
                "Percentage RW versus RO in cache (specify as 60/40)");
-    cmd_AddParm(ts, "-disable-dynamic-vcaches", CMD_FLAG, CMD_OPTIONAL, 
+    cmd_AddParm(ts, "-disable-dynamic-vcaches", CMD_FLAG, CMD_OPTIONAL,
                "disable stat/vcache cache growing as needed");
     cmd_AddParm(ts, "-rxmaxmtu", CMD_SINGLE, CMD_OPTIONAL, "set rx max MTU to use");
+    cmd_AddParm(ts, "-dynroot-sparse", CMD_FLAG, CMD_OPTIONAL,
+               "Enable dynroot support with minimal cell list");
+    cmd_AddParm(ts, "-rxmaxfrags", CMD_SINGLE, CMD_OPTIONAL,
+                "Set the maximum number of UDP fragments Rx should send/receive"
+                " per Rx packet");
 }
 
 int
@@ -2546,515 +2585,6 @@ afsd_parse(int argc, char **argv)
     return cmd_Dispatch(argc, argv);
 }
 
-#ifdef AFS_SGI53_ENV
-#ifdef AFS_SGI61_ENV
-/* The dwarf structures are searched to find entry points of static functions
- * and the addresses of static variables. The file name as well as the
- * sybmol name is reaquired.
- */
-
-/* Contains list of names to find in given file. */
-typedef struct {
-    char *name;                        /* Name of variable or function. */
-    afs_hyper_t addr;          /* Address of function, undefined if not found. */
-    Dwarf_Half type;           /* DW_AT_location for vars, DW_AT_lowpc for func's */
-    char found;                        /* set if found. */
-} staticAddrList;
-
-typedef struct {
-    char *file;                        /* Name of file containing vars or funcs */
-    staticAddrList *addrList;  /* List of vars and/or funcs. */
-    int nAddrs;                        /* # of addrList's */
-    int found;                 /* set if we've found this file already. */
-} staticNameList;
-
-/* routines used to find addresses in /unix */
-#if defined(AFS_SGI62_ENV) && !defined(AFS_SGI65_ENV)
-void findMDebugStaticAddresses(staticNameList *, int, int);
-#endif
-void findDwarfStaticAddresses(staticNameList *, int);
-void findElfAddresses(Dwarf_Debug, Dwarf_Die, staticNameList *);
-void getElfAddress(Dwarf_Debug, Dwarf_Die, staticAddrList *);
-
-#if defined(AFS_SGI62_ENV) && !defined(AFS_SGI65_ENV)
-#define AFS_N_FILELISTS 2
-#define AFS_SYMS_NEEDED 3
-#else /* AFS_SGI62_ENV */
-#define AFS_N_FILELISTS 1
-#endif /* AFS_SGI62_ENV */
-
-
-
-void
-set_staticaddrs(void)
-{
-    staticNameList fileList[AFS_N_FILELISTS];
-
-    fileList[0].addrList =
-       (staticAddrList *) calloc(1, sizeof(staticAddrList));
-    if (!fileList[0].addrList) {
-       printf("set_staticaddrs: Can't calloc fileList[0].addrList\n");
-       return;
-    }
-    fileList[0].file = "nfs_server.c";
-    fileList[0].found = 0;
-    fileList[0].nAddrs = 1;
-    fileList[0].addrList[0].name = "rfsdisptab_v2";
-    fileList[0].addrList[0].type = DW_AT_location;
-    fileList[0].addrList[0].found = 0;
-
-#if defined(AFS_SGI62_ENV) && !defined(AFS_SGI65_ENV)
-    fileList[1].addrList =
-       (staticAddrList *) calloc(2, sizeof(staticAddrList));
-    if (!fileList[1].addrList) {
-       printf("set_staticaddrs: Can't malloc fileList[1].addrList\n");
-       return;
-    }
-    fileList[1].file = "uipc_socket.c";
-    fileList[1].found = 0;
-    fileList[1].nAddrs = 2;
-    fileList[1].addrList[0].name = "sblock";
-    fileList[1].addrList[0].type = DW_AT_low_pc;
-    fileList[1].addrList[0].found = 0;
-    fileList[1].addrList[1].name = "sbunlock";
-    fileList[1].addrList[1].type = DW_AT_low_pc;
-    fileList[1].addrList[1].found = 0;
-
-    if (64 != sysconf(_SC_KERN_POINTERS))
-       findMDebugStaticAddresses(fileList, AFS_N_FILELISTS, AFS_SYMS_NEEDED);
-    else
-#endif /* AFS_SGI62_ENV */
-       findDwarfStaticAddresses(fileList, AFS_N_FILELISTS);
-
-    if (fileList[0].addrList[0].found) {
-       afsd_call_syscall(AFSOP_NFSSTATICADDR2, fileList[0].addrList[0].addr.high,
-                    fileList[0].addrList[0].addr.low);
-    } else {
-       if (afsd_verbose)
-           printf("NFS V2 is not present in the kernel.\n");
-    }
-    free(fileList[0].addrList);
-#if defined(AFS_SGI62_ENV) && !defined(AFS_SGI65_ENV)
-    if (fileList[1].addrList[0].found && fileList[1].addrList[1].found) {
-       afsd_call_syscall(AFSOP_SBLOCKSTATICADDR2,
-                    fileList[1].addrList[0].addr.high,
-                    fileList[1].addrList[0].addr.low,
-                    fileList[1].addrList[1].addr.high,
-                    fileList[1].addrList[1].addr.low);
-    } else {
-       if (!fileList[1].addrList[0].found)
-           printf("Can't find %s in kernel. Exiting.\n",
-                  fileList[1].addrList[0].name);
-       if (!fileList[1].addrList[0].found)
-           printf("Can't find %s in kernel. Exiting.\n",
-                  fileList[1].addrList[1].name);
-       exit(1);
-    }
-    free(fileList[1].addrList);
-#endif /* AFS_SGI62_ENV */
-}
-
-
-/* Find addresses for static variables and functions. */
-void
-findDwarfStaticAddresses(staticNameList * nameList, int nLists)
-{
-    int fd;
-    int i;
-    int found = 0;
-    int code;
-    char *s;
-    char *hname = (char *)0;
-    Dwarf_Unsigned dwarf_access = O_RDONLY;
-    Dwarf_Debug dwarf_debug;
-    Dwarf_Error dwarf_error;
-    Dwarf_Unsigned dwarf_cu_header_length;
-    Dwarf_Unsigned dwarf_abbrev_offset;
-    Dwarf_Half dwarf_address_size;
-    Dwarf_Unsigned next_cu_header;
-    Dwarf_Die dwarf_die;
-    Dwarf_Die dwarf_next_die;
-    Dwarf_Die dwarf_child_die;
-
-    if (elf_version(EV_CURRENT) == EV_NONE) {
-       printf("findDwarfStaticAddresses: Bad elf version.\n");
-       return;
-    }
-
-    if ((fd = open("/unix", O_RDONLY, 0)) < 0) {
-       printf("findDwarfStaticAddresses: Failed to open /unix.\n");
-       return;
-    }
-    code =
-       dwarf_init(fd, dwarf_access, NULL, NULL, &dwarf_debug, &dwarf_error);
-    if (code != DW_DLV_OK) {
-       /* Nope hope for the elves and dwarves, try intermediate code. */
-       close(fd);
-       return;
-    }
-
-    found = 0;
-    while (1) {
-       /* Run through the headers until we find ones for files we've
-        * specified in nameList.
-        */
-       code =
-           dwarf_next_cu_header(dwarf_debug, &dwarf_cu_header_length, NULL,
-                                &dwarf_abbrev_offset, &dwarf_address_size,
-                                &next_cu_header, &dwarf_error);
-       if (code == DW_DLV_NO_ENTRY) {
-           break;
-       } else if (code == DW_DLV_ERROR) {
-           printf("findDwarfStaticAddresses: Error reading headers: %s\n",
-                  dwarf_errmsg(dwarf_error));
-           break;
-       }
-
-       code = dwarf_siblingof(dwarf_debug, NULL, &dwarf_die, &dwarf_error);
-       if (code != DW_DLV_OK) {
-           printf("findDwarfStaticAddresses: Can't get first die. %s\n",
-                  (code == DW_DLV_ERROR) ? dwarf_errmsg(dwarf_error) : "");
-           break;
-       }
-
-       /* This is the header, test the name. */
-       code = dwarf_diename(dwarf_die, &hname, &dwarf_error);
-       if (code == DW_DLV_OK) {
-           s = strrchr(hname, '/');
-           for (i = 0; i < nLists; i++) {
-               if (s && !strcmp(s + 1, nameList[i].file)) {
-                   findElfAddresses(dwarf_debug, dwarf_die, &nameList[i]);
-                   found++;
-                   break;
-               }
-           }
-       } else {
-           printf
-               ("findDwarfStaticAddresses: Can't get name of current header. %s\n",
-                (code == DW_DLV_ERROR) ? dwarf_errmsg(dwarf_error) : "");
-           break;
-       }
-       dwarf_dealloc(dwarf_debug, hname, DW_DLA_STRING);
-       hname = (char *)0;
-       if (found >= nLists) {  /* we're done */
-           break;
-       }
-    }
-
-    /* Frees up all allocated space. */
-    (void)dwarf_finish(dwarf_debug, &dwarf_error);
-    close(fd);
-}
-
-void
-findElfAddresses(Dwarf_Debug dwarf_debug, Dwarf_Die dwarf_die,
-                staticNameList * nameList)
-{
-    int i;
-    Dwarf_Error dwarf_error;
-    Dwarf_Die dwarf_next_die;
-    Dwarf_Die dwarf_child_die;
-    Dwarf_Attribute dwarf_return_attr;
-    char *vname = (char *)0;
-    int found = 0;
-    int code;
-
-    /* Drop into this die to find names in addrList. */
-    code = dwarf_child(dwarf_die, &dwarf_child_die, &dwarf_error);
-    if (code != DW_DLV_OK) {
-       printf("findElfAddresses: Can't get child die. %s\n",
-              (code == DW_DLV_ERROR) ? dwarf_errmsg(dwarf_error) : "");
-       return;
-    }
-
-    /* Try to find names in each sibling. */
-    dwarf_next_die = (Dwarf_Die) 0;
-    do {
-       code = dwarf_diename(dwarf_child_die, &vname, &dwarf_error);
-       /* It's possible that some siblings don't have names. */
-       if (code == DW_DLV_OK) {
-           for (i = 0; i < nameList->nAddrs; i++) {
-               if (!nameList->addrList[i].found) {
-                   if (!strcmp(vname, nameList->addrList[i].name)) {
-                       getElfAddress(dwarf_debug, dwarf_child_die,
-                                     &(nameList->addrList[i]));
-                       found++;
-                       break;
-                   }
-               }
-           }
-       }
-       if (dwarf_next_die)
-           dwarf_dealloc(dwarf_debug, dwarf_next_die, DW_DLA_DIE);
-
-       if (found >= nameList->nAddrs) {        /* we're done. */
-           break;
-       }
-
-       dwarf_next_die = dwarf_child_die;
-       code =
-           dwarf_siblingof(dwarf_debug, dwarf_next_die, &dwarf_child_die,
-                           &dwarf_error);
-
-    } while (code == DW_DLV_OK);
-}
-
-/* Get address out of current die. */
-void
-getElfAddress(Dwarf_Debug dwarf_debug, Dwarf_Die dwarf_child_die,
-             staticAddrList * addrList)
-{
-    int i;
-    Dwarf_Error dwarf_error;
-    Dwarf_Attribute dwarf_return_attr;
-    Dwarf_Bool dwarf_return_bool;
-    Dwarf_Locdesc *llbuf = NULL;
-    Dwarf_Signed listlen;
-    off64_t addr = (off64_t) 0;
-    int code;
-
-    code =
-       dwarf_hasattr(dwarf_child_die, addrList->type, &dwarf_return_bool,
-                     &dwarf_error);
-    if ((code != DW_DLV_OK) || (!dwarf_return_bool)) {
-       printf("getElfAddress: no address given for %s. %s\n", addrList->name,
-              (code == DW_DLV_ERROR) ? dwarf_errmsg(dwarf_error) : "");
-       return;
-    }
-    code =
-       dwarf_attr(dwarf_child_die, addrList->type, &dwarf_return_attr,
-                  &dwarf_error);
-    if (code != DW_DLV_OK) {
-       printf("getElfAddress: Can't get attribute. %s\n",
-              (code == DW_DLV_ERROR) ? dwarf_errmsg(dwarf_error) : "");
-       return;
-    }
-
-    switch (addrList->type) {
-    case DW_AT_location:
-       code =
-           dwarf_loclist(dwarf_return_attr, &llbuf, &listlen, &dwarf_error);
-       if (code != DW_DLV_OK) {
-           printf("getElfAddress: Can't get location for %s. %s\n",
-                  addrList->name,
-                  (code == DW_DLV_ERROR) ? dwarf_errmsg(dwarf_error) : "");
-           return;
-       }
-       if ((listlen != 1) || (llbuf[0].ld_cents != 1)) {
-           printf("getElfAddress: %s has more than one address.\n",
-                  addrList->name);
-           return;
-       }
-       addr = llbuf[0].ld_s[0].lr_number;
-       break;
-
-    case DW_AT_low_pc:
-       code =
-           dwarf_lowpc(dwarf_child_die, (Dwarf_Addr *) & addr, &dwarf_error);
-       if (code != DW_DLV_OK) {
-           printf("getElfAddress: Can't get lowpc for %s. %s\n",
-                  addrList->name,
-                  (code == DW_DLV_ERROR) ? dwarf_errmsg(dwarf_error) : "");
-           return;
-       }
-       break;
-
-    default:
-       printf("getElfAddress: Bad case %d in switch.\n", addrList->type);
-       return;
-    }
-
-    addrList->addr.high = (addr >> 32) & 0xffffffff;
-    addrList->addr.low = addr & 0xffffffff;
-    addrList->found = 1;
-}
-
-#if defined(AFS_SGI62_ENV) && !defined(AFS_SGI65_ENV)
-/* Find symbols in the .mdebug section for 32 bit kernels. */
-/*
- * do_mdebug()
- * On 32bit platforms, we're still using the ucode compilers to build
- * the kernel, so we need to get our static text/data from the .mdebug
- * section instead of the .dwarf sections.
- */
-/* SearchNameList searches our bizarre structs for the given string.
- * If found, sets the found bit and the address and returns 1.
- * Not found returns 0.
- */
-int
-SearchNameList(char *name, afs_uint32 addr, staticNameList * nameList,
-              int nLists)
-{
-    int i, j;
-    for (i = 0; i < nLists; i++) {
-       for (j = 0; j < nameList[i].nAddrs; j++) {
-           if (nameList[i].addrList[j].found)
-               continue;
-           if (!strcmp(name, nameList[i].addrList[j].name)) {
-               nameList[i].addrList[j].addr.high = 0;
-               nameList[i].addrList[j].addr.low = addr;
-               nameList[i].addrList[j].found = 1;
-               return 1;
-           }
-       }
-    }
-    return 0;
-}
-
-static void
-SearchMDebug(Elf_Scn * scnp, Elf32_Shdr * shdrp, staticNameList * nameList,
-            int nLists, int needed)
-{
-    long *buf = (long *)(elf_getdata(scnp, NULL)->d_buf);
-    u_long addr, mdoff = shdrp->sh_offset;
-    HDRR *hdrp;
-    SYMR *symbase, *symp, *symend;
-    FDR *fdrbase, *fdrp;
-    int i, j;
-    char *strbase, *str;
-    int ifd;
-    int nFound = 0;
-
-    /* get header */
-    addr = (__psunsigned_t) buf;
-    hdrp = (HDRR *) addr;
-
-    /* setup base addresses */
-    addr = (u_long) buf + (u_long) (hdrp->cbFdOffset - mdoff);
-    fdrbase = (FDR *) addr;
-    addr = (u_long) buf + (u_long) (hdrp->cbSymOffset - mdoff);
-    symbase = (SYMR *) addr;
-    addr = (u_long) buf + (u_long) (hdrp->cbSsOffset - mdoff);
-    strbase = (char *)addr;
-
-#define KEEPER(a,b)    ((a == stStaticProc && b == scText) || \
-                        (a == stStatic && (b == scData || b == scBss || \
-                                           b == scSBss || b == scSData)))
-
-    for (fdrp = fdrbase; fdrp < &fdrbase[hdrp->ifdMax]; fdrp++) {
-       str = strbase + fdrp->issBase + fdrp->rss;
-
-       /* local symbols for each fd */
-       for (symp = &symbase[fdrp->isymBase];
-            symp < &symbase[fdrp->isymBase + fdrp->csym]; symp++) {
-           if (KEEPER(symp->st, symp->sc)) {
-               if (symp->value == 0)
-                   continue;
-
-               str = strbase + fdrp->issBase + symp->iss;
-               /* Look for AFS symbols of interest */
-               if (SearchNameList(str, symp->value, nameList, nLists)) {
-                   nFound++;
-                   if (nFound >= needed)
-                       return;
-               }
-           }
-       }
-    }
-}
-
-/*
- * returns section with the name of scn_name, & puts its header in shdr64 or
- * shdr32 based on elf's file type
- *
- */
-Elf_Scn *
-findMDebugSection(Elf * elf, char *scn_name)
-{
-    Elf64_Ehdr *ehdr64;
-    Elf32_Ehdr *ehdr32;
-    Elf_Scn *scn = NULL;
-    Elf64_Shdr *shdr64;
-    Elf32_Shdr *shdr32;
-
-    if ((ehdr32 = elf32_getehdr(elf)) == NULL)
-       return (NULL);
-    do {
-       if ((scn = elf_nextscn(elf, scn)) == NULL)
-           break;
-       if ((shdr32 = elf32_getshdr(scn)) == NULL)
-           return (NULL);
-    } while (strcmp
-            (scn_name,
-             elf_strptr(elf, ehdr32->e_shstrndx, shdr32->sh_name)));
-
-    return (scn);
-}
-
-
-void
-findMDebugStaticAddresses(staticNameList * nameList, int nLists, int needed)
-{
-    int fd;
-    Elf *elf;
-    Elf_Scn *mdebug_scn;
-    Elf32_Shdr *mdebug_shdr;
-    char *names;
-
-    if ((fd = open("/unix", O_RDONLY)) == -1) {
-       printf("findMDebugStaticAddresses: Failed to open /unix.\n");
-       return;
-    }
-
-    (void)elf_version(EV_CURRENT);
-    if ((elf = elf_begin(fd, ELF_C_READ, NULL)) == NULL) {
-       printf
-           ("findMDebugStaticAddresses: /unix doesn't seem to be an elf file\n");
-       close(fd);
-       return;
-    }
-    mdebug_scn = findMDebugSection(elf, ".mdebug");
-    if (!mdebug_scn) {
-       printf("findMDebugStaticAddresses: Can't find .mdebug section.\n");
-       goto find_end;
-    }
-    mdebug_shdr = elf32_getshdr(mdebug_scn);
-    if (!mdebug_shdr) {
-       printf("findMDebugStaticAddresses: Can't find .mdebug header.\n");
-       goto find_end;
-    }
-
-    (void)SearchMDebug(mdebug_scn, mdebug_shdr, nameList, nLists, needed);
-
-  find_end:
-    elf_end(elf);
-    close(fd);
-}
-#endif /* AFS_SGI62_ENV */
-
-#else /* AFS_SGI61_ENV */
-#include <nlist.h>
-struct nlist nlunix[] = {
-    {"rfsdisptab_v2"},
-    {0},
-};
-
-get_nfsstaticaddr()
-{
-    int i, j, kmem, count;
-
-    if ((kmem = open("/dev/kmem", O_RDONLY)) < 0) {
-       printf("Warning: can't open /dev/kmem\n");
-       return 0;
-    }
-    if ((j = nlist("/unix", nlunix)) < 0) {
-       printf("Warning: can't nlist /unix\n");
-       return 0;
-    }
-    i = nlunix[0].n_value;
-    if (lseek(kmem, i, L_SET /*0 */ ) != i) {
-       printf("Warning: can't lseek to %x\n", i);
-       return 0;
-    }
-    if ((j = read(kmem, &count, sizeof count)) != sizeof count) {
-       printf("WARNING: kmem read at %x failed\n", i);
-       return 0;
-    }
-    return i;
-}
-#endif /* AFS_SGI61_ENV */
-#endif /* AFS_SGI53_ENV */
-
 struct afsd_syscall_args {
     long syscall;
     long param1;
@@ -3134,7 +2664,6 @@ fork_syscall(const char *rn, long syscall, long param1, long param2,
     fork_syscall_impl(0, 0, rn, syscall, param1, param2, param3, param4, param5);
 }
 
-#if defined(AFS_SUN510_ENV) || defined(RXK_LISTENER_ENV)
 /**
  * call a syscall in another process or thread, and give it RX priority.
  */
@@ -3144,7 +2673,6 @@ fork_rx_syscall(const char *rn, long syscall, long param1, long param2,
 {
     fork_syscall_impl(1, 0, rn, syscall, param1, param2, param3, param4, param5);
 }
-#endif /* AFS_SUN510_ENV || RXK_LISTENER_ENV */
 
 #if defined(AFS_SUN510_ENV) && defined(RXK_LISTENER_ENV)
 /**