Remove a pointer->integer warning in fstrace.c
[openafs.git] / src / venus / fstrace.c
index b627fba..4f46bf1 100644 (file)
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID
-    ("$Header$");
 
 #include <stdio.h>
 #include <sys/types.h>
+#include <unistd.h>
 #if !defined(AFS_SUN3_ENV) && !defined(sys_vax_ul43) 
 #include <time.h>
 /*#ifdef       AFS_AIX_ENV*/
@@ -27,19 +26,16 @@ RCSID
 #undef abs
 #include <stdlib.h>
 
-#ifdef HAVE_STRING_H
 #include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
 
 #include <afs/stds.h>
 #include <afs/cmd.h>
 #include <afs/afs_args.h>
 #include <afs/icl.h>
 #include <afs/afsutil.h>
+#include <rx/rx.h>
+#include <afs/vice.h>
+#include <afs/sys_prototypes.h>
 
 #if defined(AFS_OSF_ENV) || defined(AFS_SGI61_ENV) || (defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL))
 /* For SGI 6.2, this is changed to 1 if it's a 32 bit kernel. */
@@ -74,6 +70,20 @@ set_kernel_sizeof_long(void)
 #endif /* AFS_SGI62_ENV */
 #endif /* AFS_SGI61_ENV */
 
+int afs_syscall(long call, long parm0, long parm1, long parm2, long parm3,
+               long parm4, long parm5, long parm6);
+void dce1_error_inq_text(afs_uint32 status_to_convert,
+                        char *error_text, int *status);
+int icl_CreateSetWithFlags(char *name, struct afs_icl_log *baseLogp,
+                          struct afs_icl_log *fatalLogp, afs_uint32 flags,
+                          struct afs_icl_set **outSetpp);
+int icl_LogHold(register struct afs_icl_log *logp);
+int icl_LogUse(register struct afs_icl_log *logp);
+int icl_LogReleNL(register struct afs_icl_log *logp);
+int icl_LogRele(register struct afs_icl_log *logp);
+int icl_ZeroLog(register struct afs_icl_log *logp);
+int icl_LogFreeUse(register struct afs_icl_log *logp);
+
 #define BUFFER_MULTIPLIER     1024
 
 /* make it big enough to snapshot everything at once, since
@@ -87,8 +97,8 @@ struct logInfo {
 } *allInfo = 0;
 
 char dumpFileName[256] = "";
-RegisterIclDumpFileName(name)
-     char *name;
+void
+RegisterIclDumpFileName(char *name)
 {
     (void)sprintf(dumpFileName, "icl.%.250s", name);
 }
@@ -104,10 +114,8 @@ char *name;
 /* given a type and an address, get the size of the thing
  * in words.
  */
-static
-icl_GetSize(type, addr)
-     afs_int32 type;
-     char *addr;
+static int
+icl_GetSize(afs_int32 type, char *addr)
 {
     int rsize;
     int tsize;
@@ -124,11 +132,7 @@ icl_GetSize(type, addr)
  */
 #if defined(AFS_SGI61_ENV) || (defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL))
 static int
-CheckTypes(bufferp, typesp, typeCount, outMsgBuffer)
-     char *bufferp;
-     int *typesp;
-     int typeCount;
-     char *outMsgBuffer;
+CheckTypes(char *bufferp, int *typesp, int typeCount, char *outMsgBuffer)
 {
     register char tc;
     int inPercent;
@@ -202,11 +206,8 @@ CheckTypes(bufferp, typesp, typeCount, outMsgBuffer)
     /* not reached */
 }
 #else /* AFS_SGI61_ENV */
-static
-CheckTypes(bufferp, typesp, typeCount)
-     char *bufferp;
-     int *typesp;
-     int typeCount;
+static int
+CheckTypes(char *bufferp, int *typesp, int typeCount)
 {
     register char tc;
     int inPercent;
@@ -258,11 +259,8 @@ CheckTypes(bufferp, typesp, typeCount)
 #if defined(AFS_SGI61_ENV) && !defined(AFS_SGI62_ENV)
 #define uint64_t long long
 #endif
-static
-DisplayRecord(outFilep, alp, rsize)
-     FILE *outFilep;
-     register afs_int32 *alp;
-     afs_int32 rsize;
+static void
+DisplayRecord(FILE *outFilep, register afs_int32 *alp, afs_int32 rsize)
 {
     char msgBuffer[1024];
 #if defined(AFS_SGI61_ENV) || (defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL))
@@ -284,7 +282,7 @@ DisplayRecord(outFilep, alp, rsize)
     int pftix;                 /* index in printfTypes */
     int status;
     int printed;               /* did we print the string yet? */
-    afs_int32 *tlp;
+    time_t tmv;
 
     /* decode parameters */
     temp = alp[0];             /* type encoded in low-order 24 bits, t0 high */
@@ -354,7 +352,8 @@ DisplayRecord(outFilep, alp, rsize)
 #endif /* AFS_SGI64_ENV */
            break;
        case ICL_TYPE_UNIXDATE:
-           printfParms[pfpix++] = (long)ctime((time_t *) & alp[pix]);
+           tmv = alp[pix];
+           printfParms[pfpix++] = (long)ctime(&tmv);
            break;
        default:
            printf("DisplayRecord: Bad type %d in decode switch.\n", type);
@@ -399,7 +398,7 @@ DisplayRecord(outFilep, alp, rsize)
                        fprintf(outFilep, "%s", printfStrings[pfpix++]);
                        break;
                    case 2:     /* signed integer */
-                       fprintf(outFilep, "%lld", printfParms[pfpix++]);
+                       fprintf(outFilep, "%" AFS_INT64_FMT, printfParms[pfpix++]);
                        break;
                    case 3:     /* unsigned integer */
                        fprintf(outFilep, "%llu", printfParms[pfpix++]);
@@ -450,8 +449,9 @@ DisplayRecord(outFilep, alp, rsize)
     }
     if (!printed) {
        if (alp[1] == ICL_INFO_TIMESTAMP) {
+           tmv = alp[4];
            fprintf(outFilep, "time %d.%06d, pid %u: %s\n", alp[3] / 1000000,
-                   alp[3] % 1000000, alp[2], ctime((time_t *) & alp[4]));
+                   alp[3] % 1000000, alp[2], ctime(&tmv));
        } else {
            fprintf(outFilep, "raw op %d, time %d.%06d, pid %u\n", alp[1],
                    alp[3] / 1000000, alp[3] % 1000000, alp[2]);
@@ -472,7 +472,7 @@ DisplayRecord(outFilep, alp, rsize)
                    tempParam = alp[pix];
                    tempParam <<= 32;
                    tempParam |= alp[pix + 1];
-                   fprintf(outFilep, "p%d:%lld ", i, tempParam);
+                   fprintf(outFilep, "p%d:%" AFS_INT64_FMT " ", i, tempParam);
 #else /* AFS_SGI61_ENV */
                    fprintf(outFilep, "p%d:%d ", i, alp[pix]);
 #endif /* AFS_SGI61_ENV */
@@ -500,8 +500,9 @@ DisplayRecord(outFilep, alp, rsize)
                    fprintf(outFilep, "p%d:%s ", i, (char *)&alp[pix]);
                    break;
                case ICL_TYPE_UNIXDATE:
+                   tmv = alp[pix];
                    fprintf(outFilep, "p%d:%s ", i,
-                           ctime((time_t *) & alp[pix]));
+                           ctime(&tmv));
                    break;
                default:
                    printf
@@ -528,931 +529,6 @@ DisplayRecord(outFilep, alp, rsize)
 #endif
 #include <nl_types.h>
 
-#if    defined(AFS_OSF_ENV) && !defined(AFS_OSF20_ENV)
-#include <fcntl.h>
-static nl_catd catopen1();
-nl_catd NLcatopen();
-static nl_catd _do1_open();
-static nl_catd cat_already_open();
-static int make_sets();
-static FILE *open1catfile();
-static void add_open_cat();
-static void cat_hard_close();
-extern char *strchr();
-
-static int catpid[NL_MAXOPEN];
-static CATD *catsopen[NL_MAXOPEN];
-#define PATH_FORMAT     "/usr/lib/nls/msg/%L/%N:/etc/nls/msg/%L/%N"
-#define DEFAULT_LANG    "C"
-#define TOO_MANY_HOLES(num_holes, num_non_holes) \
-    (((num_holes) > 100) && ((num_holes) > (num_non_holes)))
-
-char *
-rmalloc(n)
-     int n;
-
-       /*----  n: the number of bytes to be malloc'ed  ----*/
-{
-    char *t;
-
-    t = (char *)malloc(n);
-    if (!t)
-       printf("Failed to get mem\n");
-    return (t);
-}
-
-#ifdef notdef
-#endif
-nl_catd
-catopen1(cat, dummy)
-     char *cat;
-     int dummy;
-       /*---- char *cat:  the name of the cat to be opened ----*/
-       /*---- int dummy:  dummy variable  ----*/
-
-{
-    int errno_save;
-    nl_catd _do_open();                    /*---- routine that actually opens 
-                                          the catalog ---- */
-    CATD *catd;
-
-    errno_save = errno;
-
-/*
-       if (catd = cat_already_open(cat)) {
-               catd->_count = catd->_count + 1;
-               return(catd);
-       }
-*/
-    catd = (CATD *) rmalloc(sizeof(CATD));
-    if (catd == NULL)
-       return (CATD_ERR);
-    catd->_name = (char *)rmalloc(strlen(cat) + 1);
-    if (catd->_name == NULL)
-       return (CATD_ERR);
-    strcpy(catd->_name, cat);
-    catd->_fd = FALSE;
-    catd->_magic = CAT_MAGIC;
-    catd->_mem = FALSE;
-#ifndef        AFS_OSF20_ENV
-    catd->_pid = getpid();
-#endif
-    catd->_count = 1;
-    if (_do1_open(catd) != CATD_ERR)
-       return (catd);
-    else {
-       free(catd->_name);
-       free(catd);
-       return (CATD_ERR);
-    }
-}
-
-
-
-nl_catd
-_do1_open(catd)
-     nl_catd catd;
-
-       /*---- pointer to the partially set up cat descriptor ----*/
-
-{
-    int make_sets();           /*---- routine to unpack the sets into 
-                                               fast acccess mode ----*/
-    void add_open_cat();       /*---- routine to keep a list of 
-                                               opened cats ----*/
-    /*long */ int magic;
-    int i;                     /*---- Misc counter(s) used for loop */
-    struct _catset cs;
-    int errno_save;
-    int num_holes;
-
-    errno_save = errno;
-
-    catd->_fd = open1catfile(catd->_name);
-    if (!catd->_fd) {
-       return (CATD_ERR);
-    }
-    fread((void *)&magic, (size_t) 4, (size_t) 1, catd->_fd);
-    if (magic != CAT_MAGIC) {
-       printf("Magic was %x instead of %x -> %x\n", magic, CAT_MAGIC,
-              CATD_ERR);
-/*
-               fclose(catd->_fd);
-               catd->_fd = NULL;
-               return( CATD_ERR );
-*/
-    }
-/*     if ((catd->_mem = shmat((int)fileno(catd->_fd), NULL, SHM_MAP | SHM_RDONLY))
-           == (char * )ERR ) {   */
-
-    if (1) {                   /* disable the shmat, share memory segemnt */
-
-/*______________________________________________________________________
-       If the file can not be mapped then simulate mapping for the index
-       table so that make_sets cat set things up. (rmalloc an area big
-       enough for the index table and read the whole thing in)
-  ______________________________________________________________________*/
-
-       /* reset the file pointer to the beginning of catalog */
-       fseek(catd->_fd, (long)0, 0);
-
-       /* malloc the header, if fails return error */
-       catd->_hd = (struct _header *)rmalloc(sizeof(struct _header));
-       if (catd->_hd == NULL)
-           return (CATD_ERR);
-
-       /* read in the whole header */
-       fread((void *)catd->_hd, (size_t) sizeof(struct _header), (size_t) 1,
-             catd->_fd);
-
-       /* cs is a dummpy to hold a set temperorily. The purpose of */
-       /* this for loop is to fread the whole catalog so that the  */
-       /* file pointer will be moved to the end of the catalog.    */
-       for (i = 0; i < catd->_hd->_n_sets; i++) {
-           fread((void *)&cs, (size_t) 4, (size_t) 1, catd->_fd);
-           fseek(catd->_fd, (long)(cs._n_msgs * sizeof(struct _msgptr)), 1);
-       }
-
-       /* after the for loop, ftell returns the byte offset of the */
-       /* end of the catalog relative to the begining of the file. */
-       /* i.e. i contains the byte offset of the whole catalog.    */
-       i = ftell(catd->_fd);
-
-       /* malloc _mem as a temp pointer to hold the entire catalog. */
-       catd->_mem = (char *)rmalloc(i);
-       if (catd->_mem == NULL)
-           return (CATD_ERR);
-
-       /* reset the file pointer to the begining. */
-       fseek(catd->_fd, (long)0, 0);
-
-       /* read in the whole catalog into _mem */
-       fread((void *)catd->_mem, (size_t) i, (size_t) 1, catd->_fd);
-
-       /*
-        * If there aren't many holes in the set numbers,
-        * fully expand the compacted set array from the
-        * catalog.  Then in catgets(), we'll be able to use
-        * the set number to index directly into the expanded
-        * array.
-        *
-        * If there are a lot of holes, leave the set array
-        * compacted.  In catgets(), we'll search through it
-        * for the requested set.
-        */
-
-       num_holes = catd->_hd->_setmax - catd->_hd->_n_sets;
-       if (!TOO_MANY_HOLES(num_holes, catd->_hd->_n_sets)) {
-           catd->_sets_expanded = TRUE;
-           catd->_n_sets = catd->_hd->_setmax;
-       } else {
-           catd->_sets_expanded = FALSE;
-           catd->_n_sets = catd->_hd->_n_sets - 1;
-       }
-
-       /* malloc one extra set more than the max. set index */
-       catd->_set =
-           (struct _catset *)rmalloc((catd->_n_sets + 1) *
-                                     sizeof(struct _catset));
-       if (catd->_set == NULL)
-           return (CATD_ERR);
-
-       /* save the max. set number in catd->_setmax */
-       catd->_setmax = catd->_hd->_setmax;
-       /* call make_set to malloc memory for every message */
-       if (make_sets(catd) == -1)
-           return (CATD_ERR);
-       free(catd->_mem);
-       catd->_mem = FALSE;
-       add_open_cat(catd);
-       return (catd);
-    } else {
-
-/*______________________________________________________________________
-       Normal mapping has occurred, set a few things up and call make_sets
-  ______________________________________________________________________*/
-
-       catd->_hd = (struct _header *)(catd->_mem);
-       catd->_setmax = catd->_hd->_setmax;
-       catd->_set =
-           (struct _catset *)rmalloc((catd->_hd->_setmax + 1) *
-                                     sizeof(struct _catset));
-       if (catd->_set == NULL)
-           return (CATD_ERR);
-       if (make_sets(catd) == -1)
-           return (CATD_ERR);
-       add_open_cat(catd);
-       return (catd);
-    }
-}
-
-
-static void
-add_open_cat(catd)
-     nl_catd catd;
-               /*---- catd to be added to the list of catalogs ----*/
-
-{
-    int i = 0;         /*---- Misc counter(s) used for loops ----*/
-    while (i < NL_MAXOPEN && catsopen[i]) {
-       if (!strcmp(catd->_name, catsopen[i]->_name)
-#ifndef        AFS_OSF20_ENV
-           && getpid() == catsopen[i]->_pid)
-#else
-           )
-#endif
-           return;             /*---- The catalog is already here ----*/
-       i++;
-    }
-
-    if (i < NL_MAXOPEN) {
-       catsopen[i] = catd;
-       catpid[i] = getpid();
-    }
-}
-
-
-/*
- * 
- * NAME: make_sets
- *
- * FUNCTION: Expands the compacted version of the catalog index table into
- *     the fast access memory version.
- *
- * EXECUTION ENVIRONMENT:
- *
- *     Make_set executes under a process.      
- *
- * RETURNS: int
- */
-
-
-static int
-make_sets(catd)
-     nl_catd catd;
-{
-    struct _catset *cset;
-    char *base = catd->_mem;
-    int n_sets = catd->_hd->_n_sets;
-    int i;             /*---- Misc counter(s) used for loops ----*/
-    int j;             /*---- Misc counter(s) used for loops ----*/
-    int msgmax;                /*---- The maximum number of _messages in a set ----*/
-    char *cmpct_set_ptr;       /*---- pointer into the index table ----*/
-    struct _catset cs;         /*---- used to look at the sets in the table -*/
-    int num_holes;
-
-    cmpct_set_ptr = base + sizeof(struct _header);
-
-    for (i = 0; i < n_sets; i++) {
-       /* loop through each compacted set */
-
-       cs = *(struct _catset *)cmpct_set_ptr;
-       /* set the _catset ptr to the base of the current 
-        * compacted set.        */
-
-       cs._mp =
-           (struct _msgptr *)(cmpct_set_ptr + 2 * sizeof(unsigned short));
-       /* set the ms array ptr to the base of
-        * compacted array of _msgptr's     */
-
-       cset =
-           (catd->_sets_expanded) ? &catd->_set[cs._setno] : &catd->_set[i];
-
-       /*
-        * If there aren't many holes in the message numbers,
-        * fully expand the compacted message array from the
-        * catalog.  Then in catgets(), we'll be able to use
-        * the message number to index directly into the
-        * expanded array.
-        *
-        * If there are many holes, leave the message array
-        * compacted.  In catgets(), we'll search through it
-        * for the requested message.
-        */
-
-       msgmax = cs._mp[cs._n_msgs - 1]._msgno;
-       num_holes = msgmax - cs._n_msgs;
-       if (!TOO_MANY_HOLES(num_holes, cs._n_msgs)) {
-           cset->_msgs_expanded = TRUE;
-           cset->_n_msgs = msgmax;
-       } else {
-           cset->_msgs_expanded = FALSE;
-           cset->_n_msgs = cs._n_msgs - 1;
-       }
-
-       cset->_mp =
-           (struct _msgptr *)rmalloc((1 + cset->_n_msgs) *
-                                     sizeof(struct _msgptr));
-       if (cset->_mp == NULL)
-           return (-1);
-
-       cset->_msgtxt =
-           (char **)rmalloc((1 + cset->_n_msgs) * sizeof(char *));
-       if (cset->_msgtxt == NULL)
-           return (-1);
-
-       if (cset->_msgs_expanded) {
-           for (j = 0; j < cs._n_msgs; j++) {
-               cset->_mp[cs._mp[j]._msgno] = cs._mp[j];
-           }
-       } else {
-           for (j = 0; j < cs._n_msgs; j++) {
-               cset->_mp[j] = cs._mp[j];
-           }
-       }
-
-       cset->_setno = cs._setno;
-       /* Superfluous but should have the correct data. Increment 
-        * the base of the set pointer.          */
-
-       cmpct_set_ptr +=
-           2 * sizeof(unsigned short) + cs._n_msgs * sizeof(struct _msgptr);
-    }
-    return (0);
-}
-
-
-
-/*
- * 
- * NAME: opencatfile
- *
- * FUNCTION: Opens a catalog file, looking in the language path first (if 
- *     there is no slash) and returns a pointer to the file stream.
- *                                                                    
- * EXECUTION ENVIRONMENT:
- *
- *     Opencatfile executes under a process.   
- *
- * RETURNS:  Returns a pointer to the file stream, and a NULL pointer on
- *     failure.
- */
-
-static FILE *
-open1catfile(file)
-     char *file;
-{
-    extern char *getenv();
-    char fl[PATH_MAX];         /*---- place to hold full path ----*/
-    char *nlspath;             /*---- pointer to the nlspath val ----*/
-    FILE *fp;                  /*---- file pointer ----*/
-    char cpth[PATH_MAX];       /*---- current value of nlspath ----*/
-    char *p, *np;
-    char *fulllang;            /* %L language value */
-    char lang[PATH_MAX];       /* %l language value */
-    char *territory;           /* %t language value */
-    char *codeset;             /* %c language value */
-    char *ptr;                 /* for decompose of $LANG */
-    char *str;
-    char *optr;
-    int nchars;
-    int lenstr;
-    char outptr[PATH_MAX];
-    int valid;
-
-    if (strchr(file, '/')) {
-       if ((fp = fopen(file, "r"))) {
-           fcntl(fileno(fp), F_SETFD, 1);
-           /* set the close-on-exec flag for
-            * child process                */
-           return (fp);
-       }
-    } else {
-       if (!(nlspath = getenv("NLSPATH")))
-           nlspath = PATH_FORMAT;
-       if (!(fulllang = getenv("LANG")))
-           fulllang = DEFAULT_LANG;
-       if (fulllang == DEFAULT_LANG)
-           nlspath = PATH_FORMAT;      /* if fullang is C, use the 
-                                        * the default nlspath:    */
-
-       /*
-        ** LANG is a composite of three fields:
-        ** language_territory.codeset
-        ** and we're going to break it into those
-        ** three fields.
-        */
-
-       strcpy(lang, fulllang);
-
-       territory = "";
-       codeset = "";
-
-       ptr = strchr(lang, '_');
-       if (ptr != NULL) {
-           territory = ptr + 1;
-           *ptr = '\0';
-           ptr = strchr(territory, '.');
-           if (ptr != NULL) {
-               codeset = ptr + 1;
-               *ptr = '\0';
-           }
-       } else {
-           ptr = strchr(lang, '.');
-           if (ptr != NULL) {
-               codeset = ptr + 1;
-               *ptr = '\0';
-           }
-       }
-
-       np = nlspath;
-       while (*np) {
-           p = cpth;
-           while (*np && *np != ':')
-               *p++ = *np++;
-           *p = '\0';
-           if (*np)                                    /*----  iff on a colon then advance --*/
-               np++;
-           valid = 0;
-           if (strlen(cpth)) {
-               ptr = cpth;
-               optr = outptr;
-
-               nchars = 0;
-               while (*ptr != '\0') {
-                   while ((*ptr != '\0') && (*ptr != '%')
-                          && (nchars < PATH_MAX)) {
-                       *(optr++) = *(ptr++);
-                       nchars++;
-                   }
-                   if (*ptr == '%') {
-                       switch (*(++ptr)) {
-                       case '%':
-                           str = "%";
-                           break;
-                       case 'L':
-                           str = fulllang;
-                           break;
-                       case 'N':
-                           valid = 1;
-                           str = file;
-                           break;
-                       case 'l':
-                           str = lang;
-                           break;
-                       case 't':
-                           str = territory;
-                           break;
-                       case 'c':
-                           str = codeset;
-                           break;
-                       default:
-                           str = "";
-                           break;
-                       }
-                       lenstr = strlen(str);
-                       nchars += lenstr;
-                       if (nchars < PATH_MAX) {
-                           strcpy(optr, str);
-                           optr += lenstr;
-                       } else {
-                           break;
-                       }
-                       ptr++;
-                   } else {
-                       if (nchars >= PATH_MAX) {
-                           break;
-                       }
-                   }
-               }
-               *optr = '\0';
-               strcpy(cpth, outptr);
-           } else {                    /*----  iff leading | trailing | 
-                                                adjacent colons ... --*/
-               valid = 1;
-               strcpy(cpth, file);
-           }
-           if (valid == 1 && (fp = fopen(cpth, "r"))) {
-               fcntl(fileno(fp), F_SETFD, 1);
-               /* set the close-on-exec flag for
-                * child process                */
-               return (fp);
-           }
-       }
-       if (fp = fopen(file, "r")) {
-           fcntl(fileno(fp), F_SETFD, 1);
-           /* set the close-on-exec flag for
-            * child process                */
-           return (fp);
-       }
-    }
-    return (NULL);
-}
-
-
-
-
-
-/*
- * 
- * NAME: cat_already_open
- *
- * FUNCTION: Checkes to see if a specific cat has already been opened.
- *                                                                    
- * EXECUTION ENVIRONMENT:
- *
- *     Cat_already_open executes under a process.
- *
- * RETURNS: Returns a pointer to the existing CATD if one exists, and 
- *     a NULL pointer if no CATD exists.
- */
-
-static nl_catd
-cat_already_open(cat)
-     char *cat;
-                       /*---- name of the catalog to be opened ----*/
-
-{
-    int i;                     /*---- Misc counter(s) used for loops ----*/
-
-    for (i = 0; i < NL_MAXOPEN && catsopen[i]; i++) {
-#ifndef        AFS_OSF20_ENV
-       if (!strcmp(cat, catsopen[i]->_name) && getpid() == catsopen[i]->_pid) {
-#else
-       if (!strcmp(cat, catsopen[i]->_name)) {
-#endif
-           return (catsopen[i]);
-       }
-    }
-    return (0);
-}
-
-
-int
-catclose1(catd)                                        /*---- the catd to be closed ----*/
-     nl_catd catd;     /*---- the catd to be closed ----*/
-
-{
-    int i;
-
-
-    if (catd == CATD_ERR)
-       return (-1);
-    for (i = 0; i < NL_MAXOPEN && catsopen[i]; i++) {
-#ifndef        AFS_OSF20_ENV
-       if (catd == catsopen[i] && getpid() == catsopen[i]->_pid)
-#else
-       if (catd == catsopen[i])
-#endif
-           break;
-    }
-    if (i == NL_MAXOPEN || catsopen[i] == NULL)
-       return (-1);
-    if (catd->_fd == (FILE *) NULL)
-                               /*----  return if this is an extra open or
-                                       a bad catalog discriptor         ----*/
-       return (-1);
-    if (cat_already_open(catd->_name)) {
-       if (catd->_count == 1) {
-           cat_hard_close(catd);
-           return (0);                 /*--- the last legal clsoe ---*/
-       } else if (catd->_count > 1) {
-           catd->_count = catd->_count - 1;
-           return (0);                 /*--- a legal close ---*/
-       } else
-           return (-1);                /*--- an extra illegal close ---*/
-    } else {
-       return (-1);
-    }
-}
-
-static void
-cat_hard_close(catd)
-     nl_catd catd;
-               /*---- the catd to be closed ----*/
-
-{
-    int i;                     /*---- Misc counter(s) used for loops ----*/
-    int j;                     /*----  Misc counter ----*/
-
-    if (catd == CATD_ERR)
-       return;
-
-/*______________________________________________________________________
-       remove any entry for the catalog in the catsopen array
-  ______________________________________________________________________*/
-
-    for (i = 0; i < NL_MAXOPEN && catsopen[i]; i++) {
-       if (catd == catsopen[i]) {
-           for (; i < NL_MAXOPEN - 1; i++) {
-               catsopen[i] = catsopen[i + 1];
-               catpid[i] = catpid[i + 1];
-           }
-           catsopen[i] = NULL;
-           catpid[i] = 0;
-       }
-    }
-
-/*______________________________________________________________________
-       close the cat and free up the memory
-  ______________________________________________________________________*/
-    if (catd->_mem == FALSE) {
-       for (i = 0; i <= catd->_n_sets; i++) {
-           if (catd->_set[i]._mp)
-               free(catd->_set[i]._mp);
-                       /*---- free the _message pointer arrays ----*/
-
-           if (catd->_set[i]._msgtxt) {
-               for (j = 0; j <= catd->_set[i]._n_msgs; j++) {
-                   if (catd->_set[i]._msgtxt[j]) {
-/*                                     free(catd->_set[i]._msgtxt[j]);*/
-                   }
-               }
-               if (catd->_set[i]._msgtxt)
-                   free(catd->_set[i]._msgtxt);
-           }
-       }
-    }
-
-    if (catd->_fd)
-       fclose(catd->_fd);              /*---- close the ctatlog ----*/
-    if (catd->_set)
-       free(catd->_set);               /*---- free the sets ----*/
-    if (catd->_name)
-       free(catd->_name);              /*---- free the name ----*/
-    if (catd->_hd)
-       free(catd->_hd);                /*---- free the header ----*/
-    if (catd)
-       free(catd);                     /*---- free the catd ----*/
-}
-
-static char *
-_do1_read_msg(nl_catd catd, int setno, int msgno)
-
-       /*---- catd: the catd of the catalog to be read from ----*/
-       /*---- setno: the set number of the message ----*/
-       /*---- msgno: the msgno of the message ----*/
-{
-    nl_catd catd1;             /*--- catd for different process ----*/
-    char *_read1_msg();
-
-#ifndef        AFS_OSF20_ENV
-    if (getpid() == catd->_pid)
-#else
-    if (1)
-#endif
-       return (_read1_msg(catd, setno, msgno));
-    else {
-       /*
-        * Since our pid is different from the one in
-        * catd, catd must have come from a catopen()
-        * in our parent.  We need a catd of our own.
-        * The first time through here, the call to
-        * catopen() creates a new catd and we try to
-        * open its message catalog.  After that, the
-        * catopen() just retrieves the catd.
-        */
-       if (((catd1 = catopen1(catd->_name, 0)) != CATD_ERR)
-           && ((catd1->_fd == NL_FILE_CLOSED && _do1_open(catd1) != CATD_ERR)
-               || (catd1->_fd != NL_FILE_UNUSED)))
-           return (_read1_msg(catd1, setno, msgno));
-       else
-           return (NULL);
-    }
-}
-
-
-struct _catset *_cat1_get_catset();
-static struct _msgptr *_cat1_get_msgptr();
-static char *
-_read1_msg(nl_catd catd, int setno, int msgno)
-{
-    struct _catset *set;       /*--- ptr to set's _catset structure ---*/
-    struct _msgptr *msg;       /*--- ptr to msg's _msgptr structure ---*/
-    char **msgtxt;             /*--- temporary pointer to the message text
-                                      for speed.  ----*/
-
-    set = _cat1_get_catset(catd, setno);
-    if (set) {
-       msg = _cat1_get_msgptr(set, msgno);
-       if (msg) {
-           msgtxt = &set->_msgtxt[msg - set->_mp];
-           if (1 /*!*msgtxt */ ) {
-               *msgtxt = (char *)malloc(msg->_msglen + 1);
-               if (!*msgtxt)
-                   return (NULL);
-
-               fseek(catd->_fd, (long)msg->_offset, 0);
-               if (fread
-                   ((void *)*msgtxt, (size_t) (msg->_msglen + 1), (size_t) 1,
-                    catd->_fd) != 1)
-                   return (NULL);
-           }
-
-           return (*msgtxt);
-       }
-    }
-    return (NULL);
-}
-
-/*
- * NAME: compare_sets
- *                                                                    
- * FUNCTION: Compare function used by bsearch() in _cat_get_catset().
- *                                                                    
- * ARGUMENTS:
- *      key             - pointer to set number we're searching for
- *      element         - pointer to current _catset structure
- *
- * RETURNS: Returns -1, 0, or 1, depending on whether the set number
- *          is less than, equal to, or greater than the set number of
- *          the _catset structure.
- *
- */
-
-static int
-compare_sets(const void *key, const void *element)
-{
-    int *setno = (int *)key;
-    struct _catset *set = (struct _catset *)element;
-
-    if (*setno < set->_setno)
-       return -1;
-    if (*setno > set->_setno)
-       return 1;
-
-    return 0;
-}
-
-
-/*
- * NAME: _cat_get_catset
- *                                                                    
- * FUNCTION: Find a set in the catd->_set array.  Assumes that the
- *           sets in the array are sorted by increasing set number.
- *                                                                    
- * ARGUMENTS:
- *      catd            - catalog descripter obtained from catopen()
- *      setno           - message catalogue set number
- *
- * RETURNS: Returns a pointer to the set on success.
- *      On any error, returns NULL.
- *
- */
-
-struct _catset *
-_cat1_get_catset(nl_catd catd, int setno)
-{
-    struct _catset *set;
-
-    if ((catd == (nl_catd) NULL) || (catd == CATD_ERR))
-       return (struct _catset *)NULL;
-
-    if (catd->_sets_expanded) {
-       if ((setno < 0) || (setno > catd->_n_sets))
-           return (struct _catset *)NULL;
-
-       set = &catd->_set[setno];
-
-       /*
-        * Catch empty elements in the array.  They aren't
-        * real sets.
-        */
-
-       if (set->_mp == (struct _msgptr *)NULL)
-           return (struct _catset *)NULL;
-    } else {
-       set =
-           (struct _catset *)bsearch((void *)&setno, catd->_set,
-                                     catd->_n_sets + 1,
-                                     sizeof(struct _catset), compare_sets);
-
-       /*
-        * Since the sets are compacted, there aren't any
-        * empty elements in the array to check for.
-        */
-    }
-
-    return set;
-}
-
-
-/*
- * NAME: compare_msgs
- *                                                                    
- * FUNCTION: Compare function used by bsearch() in _cat_get_msgptr().
- *                                                                    
- * ARGUMENTS:
- *      key             - pointer to message number we're searching for
- *      element         - pointer to current _msgptr structure
- *
- * RETURNS: Returns -1, 0, or 1, depending on whether the message
- *          number is less than, equal to, or greater than the message
- *          number of the _msgptr structure.
- *
- */
-
-static int
-compare_msgs(const void *key, const void *element)
-{
-    int *msgno = (int *)key;
-    struct _msgptr *msg = (struct _msgptr *)element;
-
-    if (*msgno < msg->_msgno)
-       return -1;
-    if (*msgno > msg->_msgno)
-       return 1;
-
-    return 0;
-}
-
-/*
- * NAME: _cat1_get_msgptr
- *                                                                    
- * FUNCTION: Find a message in a set's set->_mp array.  Assumes that
- *           the messages in the array are sorted by increasing
- *           message number.
- *                                                                    
- * ARGUMENTS:
- *      set             - ptr to _catset structure
- *      msgno           - message catalogue message number
- *
- * RETURNS: Returns a pointer to the message on success.
- *      On any error, returns NULL.
- *
- */
-static struct _msgptr *
-_cat1_get_msgptr(struct _catset *set, int msgno)
-{
-    struct _msgptr *msg;
-
-    if (set == (struct _catset *)NULL)
-       return (struct _msgptr *)NULL;
-
-    if (set->_mp == (struct _msgptr *)NULL)    /* empty set */
-       return (struct _msgptr *)NULL;
-
-    if (set->_msgs_expanded) {
-       if ((msgno < 0) || (msgno > set->_n_msgs))
-           return (struct _msgptr *)NULL;
-
-       msg = &set->_mp[msgno];
-
-       /*
-        * Catch empty elements in the array.  They aren't
-        * real messages.
-        */
-
-       if (!msg->_offset)
-           return (struct _msgptr *)NULL;
-    } else {
-       msg =
-           (struct _msgptr *)bsearch((void *)&msgno, set->_mp,
-                                     set->_n_msgs + 1,
-                                     sizeof(struct _msgptr), compare_msgs);
-
-       /*
-        * Since the messages are compacted, there aren't any
-        * empty elements in the array to check for.
-        */
-    }
-
-    return msg;
-}
-
-char *
-catgets1(nl_catd catd, int setno, int msgno, char *def)
-       /*---- catd: the catd to get the message from ----*/
-       /*---- setno: the set number of the message ----*/
-       /*---- msgno: the message number of the message ----*/
-       /*---- def: the default string to be returned ----*/
-{
-    int errno_save;
-    char *_do_read_msg();
-    char *m;
-    errno_save = errno;
-
-    if (catd == NULL || catd == CATD_ERR || catd->_magic != CAT_MAGIC
-       || catd->_fd == NL_FILE_UNUSED) {
-       return (def);
-    }
-    if (catd->_fd == NL_FILE_CLOSED) {
-       catd = _do1_open(catd);
-       if (catd == CATD_ERR)
-           return (def);
-    }
-
-    if (catd->_mem) {          /*----  for mapped files ----*/
-       if (setno <= catd->_hd->_setmax) {
-           if (msgno < catd->_set[setno]._n_msgs) {
-               if (catd->_set[setno]._mp[msgno]._offset) {
-                   return (catd->_mem +
-                           catd->_set[setno]._mp[msgno]._offset);
-               }
-           }
-       }
-       return (def);
-    } else {   /*---- for unmapped files ----*/
-       m = _do1_read_msg(catd, setno, msgno);
-       if (m == NULL)
-           return (def);
-       else
-           return (m);
-    }
-}
-
-#endif
-
 #define FACILITY_CODE_MASK          0xF0000000
 #define FACILITY_CODE_SHIFT         28
 
@@ -1465,37 +541,26 @@ catgets1(nl_catd catd, int setno, int msgno, char *def)
 #define NO_MESSAGE                  "THIS IS NOT A MESSAGE"
 
 /*
- * The system-dependant location for the catalog files is defined in sysconf.h
- * RPC_DEFAULT_NLSPATH should be defined in sysconf.h. Otherwise we use
- * /usr/afs/etc/C/%s.cat 
+ * We use NLS message catalog functions to convert numbers to human-readable
+ * strings.  The message catalog will be in AFSDIR_DATA_DIR, which is
+ * ${datadir}/openafs with normal paths and /usr/vice/etc (for historical
+ * compatibility) for Transarc paths.
  */
 
-#ifndef RPC_NLS_FORMAT
-#define RPC_NLS_FORMAT "%s.cat"
-#endif
-
-dce1_error_inq_text(status_to_convert, error_text, status)
-     afs_uint32 status_to_convert;
-     unsigned char *error_text;
-     int *status;
-
+void
+dce1_error_inq_text(afs_uint32 status_to_convert, 
+                  char *error_text, int *status)
 {
     unsigned short facility_code;
     unsigned short component_code;
     unsigned short status_code;
-    unsigned short i, failed = 0;
+    unsigned short i;
     nl_catd catd;
     char component_name[4];
     char *facility_name;
     char filename_prefix[7];
-    char nls_filename[11];
-    char alt_filename[80];
+    char nls_filename[80];
     char *message;
-#if defined(AFS_64BITPOINTER_ENV)
-    long J;
-#else
-    int J;
-#endif
     static char *facility_names[] = {
        "xxx",
        "afs"
@@ -1550,66 +615,26 @@ dce1_error_inq_text(status_to_convert, error_text, status)
        component_name[i] += (component_name[i] <= 26) ? 'a' : ('0' - 27);
     }
     sprintf(filename_prefix, "%3s%3s", facility_name, component_name);
-    sprintf(nls_filename, RPC_NLS_FORMAT, filename_prefix);
 
     /*
-     * Open the message file
+     * We do not use the normal NLS message catalog search path since our use
+     * message catalogs isn't a typical use.  It wouldn't make sense to
+     * install this special message catalog in with internationalization
+     * catalogs.
      */
-#if    defined(AFS_OSF_ENV)
-#if    defined(AFS_OSF20_ENV)
-    catd = (nl_catd) catopen(nls_filename, 0);
-#else
-    catd = (nl_catd) catopen1(nls_filename, 0);
-#endif
-#else
-#if defined(AFS_64BITPOINTER_ENV)
-    J = (long)catopen(nls_filename, 0);
-#else
-    J = (int)catopen(nls_filename, 0);
-#endif
-    catd = (nl_catd) J;
-#endif
-    if (catd == (nl_catd) - 1) {
-       /*
-        * If we did not succeed in opening message file using NLSPATH,
-        * try to open the message file in a well-known default area
-        */
-      tryagain:
-#ifndef RPC_DEFAULT_NLSPATH
-       sprintf(alt_filename, "%s/C/%s.cat", AFSDIR_CLIENT_ETC_DIRPATH,
-               filename_prefix);
-#else
-       sprintf(alt_filename, RPC_DEFAULT_NLSPATH, filename_prefix);
-#endif
+    afs_snprintf(nls_filename, sizeof(nls_filename), "%s/C/%s.cat",
+                AFSDIR_CLIENT_DATA_DIRPATH, filename_prefix);
 
-#if    defined(AFS_OSF_ENV)
-#if    defined(AFS_OSF20_ENV)
-       catd = (nl_catd) catopen(alt_filename, 0);
-#else
-       catd = (nl_catd) catopen1(alt_filename, 0);
-#endif
-#else
-#if defined(AFS_64BITPOINTER_ENV)
-        J = (long)catopen(alt_filename, 0);
-#else
-       J = (int)catopen(alt_filename, 0);
-#endif
-       catd = (nl_catd) J;
-#endif
-       if (catd == (nl_catd) - 1) {
-           sprintf((char *)error_text, "status %08x (%s / %s)",
-                   status_to_convert, facility_name, component_name);
-           return;
-       }
+    catd = catopen(nls_filename, 0);
+    if (catd == (nl_catd) -1) {
+       sprintf((char *)error_text, "status %08x (%s / %s)",
+               status_to_convert, facility_name, component_name);
+       return;
     }
     /*
      * try to get the specified message from the file
      */
-#if    defined(AFS_OSF_ENV) && !defined(AFS_OSF20_ENV)
-    message = (char *)catgets1(catd, 1, status_code, NO_MESSAGE);
-#else
     message = (char *)catgets(catd, 1, status_code, NO_MESSAGE);
-#endif
     /*
      * if everything went well, return the resulting message
      */
@@ -1620,30 +645,14 @@ dce1_error_inq_text(status_to_convert, error_text, status)
            *status = 0;
        }
     } else {
-       if (!failed) {
-           failed = 1;
-#if defined(AFS_OSF_ENV) && !defined(AFS_OSF20_ENV)
-           catclose1(catd);
-#else
-           catclose(catd);
-#endif
-           goto tryagain;
-       }
        sprintf((char *)error_text, "status %08x (%s / %s)",
                status_to_convert, facility_name, component_name);
     }
-#if    defined(AFS_OSF_ENV) && !defined(AFS_OSF20_ENV)
-    catclose1(catd);
-#else
     catclose(catd);
-#endif
-
 }
 
-
-icl_DumpKernel(outFilep, setname)
-     FILE *outFilep;
-     char *setname;
+int
+icl_DumpKernel(FILE *outFilep, char *setname)
 {
     afs_int32 bufferSize = 0;
     afs_int32 *bufferp;
@@ -1663,7 +672,7 @@ icl_DumpKernel(outFilep, setname)
        for (i = 0; i < ICL_LOGSPERSET; i++) {
            code =
                afs_syscall(AFSCALL_ICL, ICL_OP_ENUMLOGSBYSET, (long)setname,
-                           i, (long)tname, sizeof(tname));
+                           i, (long)tname, sizeof(tname), 0, 0);
            if (code) {
                if (errno == EBADF) {
                    code = 0;
@@ -1673,7 +682,7 @@ icl_DumpKernel(outFilep, setname)
            }
            code =
                afs_syscall(AFSCALL_ICL, ICL_OP_GETLOGINFO, (long)tname,
-                           (long)&dummy, (long)&dummy2, 0);
+                           (long)&dummy, (long)&dummy2, 0, 0, 0);
            if (code)
                break;
            found++;
@@ -1692,7 +701,7 @@ icl_DumpKernel(outFilep, setname)
        for (i = 0; i < 1000; i++) {
            code =
                afs_syscall(AFSCALL_ICL, ICL_OP_ENUMLOGS, i, (long)tname,
-                           sizeof(tname), (long)&dummy);
+                           sizeof(tname), (long)&dummy, 0, 0);
            if (code)
                break;
            if (dummy > bufferSize)     /* find biggest log */
@@ -1728,7 +737,7 @@ icl_DumpKernel(outFilep, setname)
            code =
                afs_syscall(AFSCALL_ICL, ICL_OP_COPYOUT, (long)lip->name,
                            (long)(bufferp + nwords), bufferSize - nwords,
-                           (long)&i);
+                           (long)&i, 0, 0);
            if (code < 0) {
                /* otherwise we've got an error */
                fprintf(outFilep, "Returned error %d dumping log.\n", errno);
@@ -1782,38 +791,38 @@ icl_DumpKernel(outFilep, setname)
 }
 
 /* clear out log 'name' */
-icl_ClearLog(name)
-     char *name;
+int
+icl_ClearLog(char *name)
 {
     afs_int32 code;
 
-    code = afs_syscall(AFSCALL_ICL, ICL_OP_CLRLOG, (long)name, 0, 0, 0);
+    code = afs_syscall(AFSCALL_ICL, ICL_OP_CLRLOG, (long)name, 0, 0, 0, 0, 0);
     return code;
 }
 
 /* clear out set 'name' */
-icl_ClearSet(name)
-     char *name;
+int
+icl_ClearSet(char *name)
 {
     afs_int32 code;
 
-    code = afs_syscall(AFSCALL_ICL, ICL_OP_CLRSET, (long)name, 0, 0, 0);
+    code = afs_syscall(AFSCALL_ICL, ICL_OP_CLRSET, (long)name, 0, 0, 0, 0, 0);
     return code;
 }
 
 /* clear out all logs */
-icl_ClearAll()
+int
+icl_ClearAll(void)
 {
     afs_int32 code;
 
-    code = afs_syscall(AFSCALL_ICL, ICL_OP_CLRALL, 0, 0, 0, 0);
+    code = afs_syscall(AFSCALL_ICL, ICL_OP_CLRALL, 0, 0, 0, 0, 0, 0);
     return code;
 }
 
 /* list out all available sets to outFileP */
 int
-icl_ListSets(outFileP)
-     FILE *outFileP;
+icl_ListSets(FILE *outFileP)
 {
     int i;
     afs_int32 code = 0;
@@ -1823,7 +832,7 @@ icl_ListSets(outFileP)
     for (i = 0; i < 1000; i++) {
        code =
            afs_syscall(AFSCALL_ICL, ICL_OP_ENUMSETS, i, (long)tname,
-                       sizeof(tname), (long)&states);
+                       sizeof(tname), (long)&states, 0, 0);
        if (code)
            break;
        (void)fprintf(outFileP, "%s %s%s%s\n", tname,
@@ -1837,9 +846,7 @@ icl_ListSets(outFileP)
 
 /* list out all available logs to outFileP */
 int
-icl_ListLogs(outFileP, int32flg)
-     FILE *outFileP;
-     int int32flg;
+icl_ListLogs(FILE *outFileP, int int32flg)
 {
     int i;
     int allocated;
@@ -1850,14 +857,14 @@ icl_ListLogs(outFileP, int32flg)
     for (i = 0; i < 1000; i++) {
        code =
            afs_syscall(AFSCALL_ICL, ICL_OP_ENUMLOGS, i, (long)tname,
-                       sizeof(tname), (long)&logSize);
+                       sizeof(tname), (long)&logSize, 0, 0);
        if (code)
            break;
        if (int32flg) {
            /* get more information on the log */
            code =
                afs_syscall(AFSCALL_ICL, ICL_OP_GETLOGINFO, (long)tname,
-                           (long)&logSize, (long)&allocated, 0);
+                           (long)&logSize, (long)&allocated, 0, 0, 0);
            if (code)
                break;
            (void)fprintf(outFileP, "%s : %d kbytes (%s)\n", tname,
@@ -1872,10 +879,7 @@ icl_ListLogs(outFileP, int32flg)
 
 /* list out all available logs to outFileP */
 int
-icl_ListLogsBySet(outFileP, setname, int32flg)
-     FILE *outFileP;
-     char *setname;
-     int int32flg;
+icl_ListLogsBySet(FILE *outFileP, char *setname, int int32flg)
 {
     int i;
     afs_int32 code = 0;
@@ -1886,7 +890,7 @@ icl_ListLogsBySet(outFileP, setname, int32flg)
     for (i = 0; i < ICL_LOGSPERSET; i++) {
        code =
            afs_syscall(AFSCALL_ICL, ICL_OP_ENUMLOGSBYSET, (long)setname, i,
-                       (long)tname, sizeof(tname));
+                       (long)tname, sizeof(tname), 0, 0);
        if (code) {
            if (errno == EBADF) {
                code = 0;
@@ -1898,7 +902,7 @@ icl_ListLogsBySet(outFileP, setname, int32flg)
            /* get more information on the log */
            code =
                afs_syscall(AFSCALL_ICL, ICL_OP_GETLOGINFO, (long)tname,
-                           (long)&logSize, (long)&allocated, 0);
+                           (long)&logSize, (long)&allocated, 0, 0, 0);
            if (code)
                break;
            (void)fprintf(outFileP, "%s : %d kbytes (%s)\n", tname,
@@ -1913,72 +917,60 @@ icl_ListLogsBySet(outFileP, setname, int32flg)
 
 /* activate/deactivate/free specified set */
 int
-icl_ChangeSetState(name, op)
-     char *name;
-     afs_int32 op;
+icl_ChangeSetState(char *name, afs_int32 op)
 {
     afs_int32 code;
 
-    code = afs_syscall(AFSCALL_ICL, ICL_OP_SETSTAT, (long)name, op, 0, 0);
+    code = afs_syscall(AFSCALL_ICL, ICL_OP_SETSTAT, (long)name, op, 0, 0, 0, 0);
     return code;
 }
 
 /* activate/deactivate/free all sets */
 int
-icl_ChangeAllSetState(op)
-     afs_int32 op;
+icl_ChangeAllSetState(afs_int32 op)
 {
     afs_int32 code;
 
-    code = afs_syscall(AFSCALL_ICL, ICL_OP_SETSTATALL, op, 0, 0, 0);
+    code = afs_syscall(AFSCALL_ICL, ICL_OP_SETSTATALL, op, 0, 0, 0, 0, 0);
     return code;
 }
 
 /* set size if log */
 int
-icl_ChangeLogSize(name, logSize)
-     char *name;
-     afs_int32 logSize;
+icl_ChangeLogSize(char *name, afs_int32 logSize)
 {
     afs_int32 code;
 
     code =
        afs_syscall(AFSCALL_ICL, ICL_OP_SETLOGSIZE, (long)name, logSize, 0,
-                   0);
+                   0, 0, 0);
     return code;
 }
 
 /* get logsize of specified log */
 int
-icl_GetLogsize(logname, logSizeP, allocatedP)
-     char *logname;
-     afs_int32 *logSizeP;
-     int *allocatedP;
+icl_GetLogsize(char *logname, afs_int32 *logSizeP, int *allocatedP)
 {
     afs_int32 code;
     code =
        afs_syscall(AFSCALL_ICL, ICL_OP_GETLOGINFO, (long)logname,
-                   (long)logSizeP, (long)allocatedP, 0);
+                   (long)logSizeP, (long)allocatedP, 0, 0, 0);
     return code;
 }
 
 /* get state of specified set */
 int
-icl_GetSetState(setname, stateP)
-     char *setname;
-     afs_int32 *stateP;
+icl_GetSetState(char *setname, afs_int32 *stateP)
 {
     afs_int32 code;
     code =
        afs_syscall(AFSCALL_ICL, ICL_OP_GETSETINFO, (long)setname,
-                   (long)stateP, 0, 0);
+                   (long)stateP, 0, 0, 0, 0);
     return code;
 }
 
-icl_TailKernel(outFilep, logname, waitTime)
-     FILE *outFilep;
-     char *logname;
-     afs_int32 waitTime;
+int
+icl_TailKernel(FILE *outFilep, char *logname, afs_int32 waitTime)
 {
     afs_int32 bufferSize = 0;
     afs_int32 newBufferSize;
@@ -1989,12 +981,11 @@ icl_TailKernel(outFilep, logname, waitTime)
     afs_int32 ix;
     afs_int32 rlength;
     int allocated;
-    struct logInfo *lip;
 
     /* get information about the specified log */
     code =
        afs_syscall(AFSCALL_ICL, ICL_OP_GETLOGINFO, (long)logname,
-                   (long)&bufferSize, (long)&allocated, 0);
+                   (long)&bufferSize, (long)&allocated, 0, 0, 0);
     if (code) {
        if (errno == ENOENT)
            (void)fprintf(stderr, "'%s' not found\n", logname);
@@ -2031,7 +1022,7 @@ icl_TailKernel(outFilep, logname, waitTime)
            code =
                afs_syscall(AFSCALL_ICL, ICL_OP_COPYOUTCLR, (long)logname,
                            (long)(bufferp + nwords), bufferSize - nwords,
-                           (long)&i);
+                           (long)&i, 0, 0);
            if (code < 0) {
                /* otherwise we've got an error */
                fprintf(stderr, "returned error %d dumping log.\n", errno);
@@ -2079,7 +1070,7 @@ icl_TailKernel(outFilep, logname, waitTime)
        /* see if things have changed */
        code =
            afs_syscall(AFSCALL_ICL, ICL_OP_GETLOGINFO, (long)logname,
-                       (long)&newBufferSize, (long)&allocated, 0);
+                       (long)&newBufferSize, (long)&allocated, 0, 0, 0);
        if (code) {
            if (errno == ENOENT)
                (void)fprintf(stderr, "'%s' not found\n", logname);
@@ -2122,8 +1113,9 @@ icl_TailKernel(outFilep, logname, waitTime)
 }
 
 #if !defined(AFS_SGI_ENV)
-afs_syscall(call, parm0, parm1, parm2, parm3, parm4, parm5, parm6)
-     long call, parm0, parm1, parm2, parm3, parm4, parm5, parm6;
+int
+afs_syscall(long call, long parm0, long parm1, long parm2, long parm3, 
+           long parm4, long parm5, long parm6)
 {
     int code, rval;
 #ifdef AFS_LINUX20_ENV
@@ -2143,7 +1135,7 @@ afs_syscall(call, parm0, parm1, parm2, parm3, parm4, parm5, parm6)
 #endif
     /* Linux can only handle 5 arguments in the actual syscall. */
     if (call == AFSCALL_ICL) {
-       rval = proc_afs_syscall(call, parm0, parm1, parm2, eparm, &code);
+       rval = proc_afs_syscall(call, parm0, parm1, parm2, (long)eparm, &code);
        if (rval)
            code = syscall(AFS_SYSCALL, call, parm0, parm1, parm2, eparm);
     } else {
@@ -2179,7 +1171,8 @@ afs_syscall(call, parm0, parm1, parm2, parm3, parm4, parm5, parm6)
 int icl_inited = 0;
 
 /* init function, called once, under icl_lock */
-icl_Init()
+int
+icl_Init(void)
 {
     icl_inited = 1;
 
@@ -2190,11 +1183,9 @@ icl_Init()
     return 0;
 }
 
-icl_CreateSet(name, baseLogp, fatalLogp, outSetpp)
-     char *name;
-     struct afs_icl_log *baseLogp;
-     struct afs_icl_log *fatalLogp;
-     struct afs_icl_set **outSetpp;
+int
+icl_CreateSet(char *name, struct afs_icl_log *baseLogp, 
+             struct afs_icl_log *fatalLogp, struct afs_icl_set **outSetpp)
 {
     return icl_CreateSetWithFlags(name, baseLogp, fatalLogp, /*flags */ 0,
                                  outSetpp);
@@ -2206,12 +1197,10 @@ icl_CreateSet(name, baseLogp, fatalLogp, outSetpp)
  * addds references from the new icl_set.  When the set is destroyed,
  * those references will be released.
  */
-icl_CreateSetWithFlags(name, baseLogp, fatalLogp, flags, outSetpp)
-     char *name;
-     struct afs_icl_log *baseLogp;
-     struct afs_icl_log *fatalLogp;
-     afs_uint32 flags;
-     struct afs_icl_set **outSetpp;
+int
+icl_CreateSetWithFlags(char *name, struct afs_icl_log *baseLogp, 
+                      struct afs_icl_log *fatalLogp, afs_uint32 flags, 
+                      struct afs_icl_set **outSetpp)
 {
     register struct afs_icl_set *setp;
     register int i;
@@ -2276,10 +1265,8 @@ icl_CreateSetWithFlags(name, baseLogp, fatalLogp, flags, outSetpp)
 }
 
 /* function to change event enabling information for a particular set */
-icl_SetEnable(setp, eventID, setValue)
-     struct afs_icl_set *setp;
-     afs_int32 eventID;
-     int setValue;
+int
+icl_SetEnable(struct afs_icl_set *setp, afs_int32 eventID, int setValue)
 {
     char *tp;
 
@@ -2298,10 +1285,8 @@ icl_SetEnable(setp, eventID, setValue)
  * for tracing.  If *getValuep is set to 0, the event is disabled,
  * otherwise it is enabled.  All events start out enabled by default.
  */
-icl_GetEnable(setp, eventID, getValuep)
-     struct afs_icl_set *setp;
-     afs_int32 eventID;
-     int *getValuep;
+int
+icl_GetEnable(struct afs_icl_set *setp, afs_int32 eventID, int *getValuep)
 {
     if (!ICL_EVENTOK(setp, eventID)) {
        return -1;
@@ -2314,16 +1299,16 @@ icl_GetEnable(setp, eventID, getValuep)
 }
 
 /* hold and release event sets */
-icl_SetHold(setp)
-     register struct afs_icl_set *setp;
+int
+icl_SetHold(register struct afs_icl_set *setp)
 {
     setp->refCount++;
     return 0;
 }
 
 /* free a set.  Called with icl_lock locked */
-icl_ZapSet(setp)
-     register struct afs_icl_set *setp;
+int
+icl_ZapSet(register struct afs_icl_set *setp)
 {
     register struct afs_icl_set **lpp, *tp;
     int i;
@@ -2336,7 +1321,7 @@ icl_ZapSet(setp)
            osi_Free(setp->name, 1 + strlen(setp->name));
            osi_Free(setp->eventFlags, ICL_EVENTBYTES(setp->nevents));
            for (i = 0; i < ICL_LOGSPERSET; i++) {
-               if (tlp = setp->logs[i])
+               if ((tlp = setp->logs[i]))
                    icl_LogReleNL(tlp);
            }
            osi_Free(setp, sizeof(struct afs_icl_set));
@@ -2347,8 +1332,8 @@ icl_ZapSet(setp)
 }
 
 /* do the release, watching for deleted entries */
-icl_SetRele(setp)
-     register struct afs_icl_set *setp;
+int
+icl_SetRele(register struct afs_icl_set *setp)
 {
     if (--setp->refCount == 0 && (setp->states & ICL_SETF_DELETED)) {
        icl_ZapSet(setp);       /* destroys setp's lock! */
@@ -2357,8 +1342,8 @@ icl_SetRele(setp)
 }
 
 /* free a set entry, dropping its reference count */
-icl_SetFree(setp)
-     register struct afs_icl_set *setp;
+int
+icl_SetFree(register struct afs_icl_set *setp)
 {
     setp->states |= ICL_SETF_DELETED;
     icl_SetRele(setp);
@@ -2367,8 +1352,7 @@ icl_SetFree(setp)
 
 /* find a set by name, returning it held */
 struct afs_icl_set *
-icl_FindSet(name)
-     char *name;
+icl_FindSet(char *name)
 {
     register struct afs_icl_set *tp;
 
@@ -2383,8 +1367,8 @@ icl_FindSet(name)
 }
 
 /* zero out all the logs in the set */
-icl_ZeroSet(setp)
-     struct afs_icl_set *setp;
+int
+icl_ZeroSet(struct afs_icl_set *setp)
 {
     register int i;
     int code = 0;
@@ -2404,9 +1388,9 @@ icl_ZeroSet(setp)
     return code;
 }
 
-icl_EnumerateSets(aproc, arock)
-     int (*aproc) ();
-     char *arock;
+int
+icl_EnumerateSets(int (*aproc) (char *, void *, struct afs_icl_set *), 
+                 void *arock)
 {
     register struct afs_icl_set *tp, *np;
     register afs_int32 code;
@@ -2424,13 +1408,11 @@ icl_EnumerateSets(aproc, arock)
     return code;
 }
 
-icl_AddLogToSet(setp, newlogp)
-     struct afs_icl_set *setp;
-     struct afs_icl_log *newlogp;
+int
+icl_AddLogToSet(struct afs_icl_set *setp, struct afs_icl_log *newlogp)
 {
     register int i;
     int code = -1;
-    struct afs_icl_log *logp;
 
     for (i = 0; i < ICL_LOGSPERSET; i++) {
        if (!setp->logs[i]) {
@@ -2447,9 +1429,8 @@ icl_AddLogToSet(setp, newlogp)
     return code;
 }
 
-icl_SetSetStat(setp, op)
-     struct afs_icl_set *setp;
-     int op;
+int
+icl_SetSetStat(struct afs_icl_set *setp, int op)
 {
     int i;
     afs_int32 code;
@@ -2519,24 +1500,24 @@ icl_SetSetStat(setp, op)
 struct afs_icl_log *afs_icl_allLogs = 0;
 
 /* hold and release logs */
-icl_LogHold(logp)
-     register struct afs_icl_log *logp;
+int
+icl_LogHold(register struct afs_icl_log *logp)
 {
     logp->refCount++;
     return 0;
 }
 
 /* hold and release logs, called with lock already held */
-icl_LogHoldNL(logp)
-     register struct afs_icl_log *logp;
+int
+icl_LogHoldNL(register struct afs_icl_log *logp)
 {
     logp->refCount++;
     return 0;
 }
 
 /* keep track of how many sets believe the log itself is allocated */
-icl_LogUse(logp)
-     register struct afs_icl_log *logp;
+int
+icl_LogUse(register struct afs_icl_log *logp)
 {
     if (logp->setCount == 0) {
        /* this is the first set actually using the log -- allocate it */
@@ -2552,8 +1533,8 @@ icl_LogUse(logp)
 }
 
 /* decrement the number of real users of the log, free if possible */
-icl_LogFreeUse(logp)
-     register struct afs_icl_log *logp;
+int
+icl_LogFreeUse(register struct afs_icl_log *logp)
 {
     if (--logp->setCount == 0) {
        /* no more users -- free it (but keep log structure around) */
@@ -2566,9 +1547,8 @@ icl_LogFreeUse(logp)
 }
 
 /* set the size of the log to 'logSize' */
-icl_LogSetSize(logp, logSize)
-     register struct afs_icl_log *logp;
-     afs_int32 logSize;
+int
+icl_LogSetSize(register struct afs_icl_log *logp, afs_int32 logSize)
 {
     if (!logp->datap) {
        /* nothing to worry about since it's not allocated */
@@ -2588,8 +1568,8 @@ icl_LogSetSize(logp, logSize)
 }
 
 /* free a log.  Called with icl_lock locked. */
-icl_ZapLog(logp)
-     register struct afs_icl_log *logp;
+int
+icl_ZapLog(register struct afs_icl_log *logp)
 {
     register struct afs_icl_log **lpp, *tp;
 
@@ -2607,8 +1587,8 @@ icl_ZapLog(logp)
 }
 
 /* do the release, watching for deleted entries */
-icl_LogRele(logp)
-     register struct afs_icl_log *logp;
+int
+icl_LogRele(register struct afs_icl_log *logp)
 {
     if (--logp->refCount == 0 && (logp->states & ICL_LOGF_DELETED)) {
        icl_ZapLog(logp);       /* destroys logp's lock! */
@@ -2617,8 +1597,8 @@ icl_LogRele(logp)
 }
 
 /* do the release, watching for deleted entries, log already held */
-icl_LogReleNL(logp)
-     register struct afs_icl_log *logp;
+int
+icl_LogReleNL(register struct afs_icl_log *logp)
 {
     if (--logp->refCount == 0 && (logp->states & ICL_LOGF_DELETED)) {
        icl_ZapLog(logp);       /* destroys logp's lock! */
@@ -2636,8 +1616,8 @@ icl_ZeroLog(register struct afs_icl_log *logp)
 }
 
 /* free a log entry, and drop its reference count */
-icl_LogFree(logp)
-     register struct afs_icl_log *logp;
+int
+icl_LogFree(register struct afs_icl_log *logp)
 {
     logp->states |= ICL_LOGF_DELETED;
     icl_LogRele(logp);
@@ -2647,8 +1627,8 @@ icl_LogFree(logp)
 
 int
 icl_EnumerateLogs(int (*aproc)
-                   (char *name, char *arock, struct afs_icl_log * tp),
-                 char *arock)
+                   (char *name, void *arock, struct afs_icl_log * tp),
+                 void *arock)
 {
     register struct afs_icl_log *tp;
     register afs_int32 code;
@@ -2667,7 +1647,7 @@ icl_EnumerateLogs(int (*aproc)
 
 
 afs_icl_bulkSetinfo_t *
-GetBulkSetInfo()
+GetBulkSetInfo(void)
 {
     unsigned int infoSize;
 
@@ -2688,7 +1668,7 @@ GetBulkSetInfo()
 }
 
 afs_icl_bulkLoginfo_t *
-GetBulkLogInfo()
+GetBulkLogInfo(void)
 {
     unsigned int infoSize;
 
@@ -2709,17 +1689,13 @@ GetBulkLogInfo()
 }
 
 
-static
-DoDump(as, arock)
-     register struct cmd_syndesc *as;
-     char *arock;
+static int
+DoDump(struct cmd_syndesc *as, void *arock)
 {
     afs_int32 code = 0;
     afs_int32 tcode;
     afs_int32 waitTime = 10 /* seconds */ ;
-    int error = 0;
     char *logname;
-    char *filename;
     FILE *outfp = stdout;
     time_t startTime;
     struct cmd_item *itemp;
@@ -2783,12 +1759,12 @@ DoDump(as, arock)
 }
 
 static void
-SetUpDump()
+SetUpDump(void)
 {
     struct cmd_syndesc *dumpSyntax;
 
     dumpSyntax =
-       cmd_CreateSyntax("dump", DoDump, (char *)NULL, "dump AFS trace logs");
+       cmd_CreateSyntax("dump", DoDump, NULL, "dump AFS trace logs");
     (void)cmd_AddParm(dumpSyntax, "-set", CMD_LIST, CMD_OPTIONAL, "set_name");
     (void)cmd_AddParm(dumpSyntax, "-follow", CMD_SINGLE, CMD_OPTIONAL,
                      "log_name");
@@ -2798,10 +1774,8 @@ SetUpDump()
                      "seconds_between_reads");
 }
 
-static
-DoShowLog(as, arock)
-     register struct cmd_syndesc *as;
-     char *arock;
+static int
+DoShowLog(register struct cmd_syndesc *as, void *arock)
 {
     afs_int32 retVal = 0;
     afs_int32 code = 0;
@@ -2859,22 +1833,20 @@ DoShowLog(as, arock)
 }
 
 static void
-SetUpShowLog()
+SetUpShowLog(void)
 {
     struct cmd_syndesc *showSyntax;
 
     showSyntax =
-       cmd_CreateSyntax("lslog", DoShowLog, (char *)NULL,
+       cmd_CreateSyntax("lslog", DoShowLog, NULL,
                         "list available logs");
     (void)cmd_AddParm(showSyntax, "-set", CMD_LIST, CMD_OPTIONAL, "set_name");
     (void)cmd_AddParm(showSyntax, "-log", CMD_LIST, CMD_OPTIONAL, "log_name");
     (void)cmd_AddParm(showSyntax, "-long", CMD_FLAG, CMD_OPTIONAL, "");
 }
 
-static
-DoShowSet(as, arock)
-     register struct cmd_syndesc *as;
-     char *arock;
+static int
+DoShowSet(register struct cmd_syndesc *as, void *arock)
 {
     afs_int32 retVal = 0;
     afs_int32 code = 0;
@@ -2917,20 +1889,18 @@ DoShowSet(as, arock)
 }
 
 static void
-SetUpShowSet()
+SetUpShowSet(void)
 {
     struct cmd_syndesc *showSyntax;
 
     showSyntax =
-       cmd_CreateSyntax("lsset", DoShowSet, (char *)NULL,
+       cmd_CreateSyntax("lsset", DoShowSet, NULL,
                         "list available event sets");
     (void)cmd_AddParm(showSyntax, "-set", CMD_LIST, CMD_OPTIONAL, "set_name");
 }
 
-static
-DoClear(as, arock)
-     register struct cmd_syndesc *as;
-     char *arock;
+static int
+DoClear(register struct cmd_syndesc *as, void *arock)
 {
     afs_int32 retVal = 0;
     afs_int32 code = 0;
@@ -2976,12 +1946,12 @@ DoClear(as, arock)
 }
 
 static void
-SetUpClear()
+SetUpClear(void)
 {
     struct cmd_syndesc *clearSyntax;
 
     clearSyntax =
-       cmd_CreateSyntax("clear", DoClear, (char *)NULL,
+       cmd_CreateSyntax("clear", DoClear, NULL,
                         "clear logs by logname or by event set");
     (void)cmd_AddParm(clearSyntax, "-set", CMD_LIST, CMD_OPTIONAL,
                      "set_name");
@@ -2989,10 +1959,8 @@ SetUpClear()
                      "log_name");
 }
 
-static
-DoSet(as, arock)
-     register struct cmd_syndesc *as;
-     char *arock;
+static int
+DoSet(register struct cmd_syndesc *as, void *arock)
 {
     afs_int32 retVal = 0;
     afs_int32 code = 0;
@@ -3065,12 +2033,12 @@ DoSet(as, arock)
 }
 
 static void
-SetUpSet()
+SetUpSet(void)
 {
     struct cmd_syndesc *setSyntax;
 
     setSyntax =
-       cmd_CreateSyntax("setset", DoSet, (char *)NULL,
+       cmd_CreateSyntax("setset", DoSet, NULL,
                         "set state of event sets");
     (void)cmd_AddParm(setSyntax, "-set", CMD_LIST, CMD_OPTIONAL, "set_name");
     (void)cmd_AddParm(setSyntax, "-active", CMD_FLAG, CMD_OPTIONAL, "");
@@ -3078,10 +2046,8 @@ SetUpSet()
     (void)cmd_AddParm(setSyntax, "-dormant", CMD_FLAG, CMD_OPTIONAL, "");
 }
 
-static
-DoResize(as, arock)
-     register struct cmd_syndesc *as;
-     char *arock;
+static int
+DoResize(register struct cmd_syndesc *as, void *arock)
 {
     afs_int32 retVal = 0;
     afs_int32 code = 0;
@@ -3099,7 +2065,7 @@ DoResize(as, arock)
        bufferSize = ICL_DEFAULT_LOGSIZE;
 
     /* set the size of the specified logs */
-    if (itemp = as->parms[0].items) {
+    if ((itemp = as->parms[0].items)) {
        for (; itemp; itemp = itemp->next) {
            code = icl_ChangeLogSize(itemp->data, bufferSize);
            if (code) {
@@ -3124,12 +2090,12 @@ DoResize(as, arock)
 }
 
 static void
-SetUpResize()
+SetUpResize(void)
 {
     struct cmd_syndesc *setsizeSyntax;
 
     setsizeSyntax =
-       cmd_CreateSyntax("setlog", DoResize, (char *)NULL,
+       cmd_CreateSyntax("setlog", DoResize, NULL,
                         "set the size of a log");
     (void)cmd_AddParm(setsizeSyntax, "-log", CMD_LIST, CMD_OPTIONAL,
                      "log_name");
@@ -3139,9 +2105,8 @@ SetUpResize()
 
 #include "AFS_component_version_number.c"
 
-main(argc, argv)
-     IN int argc;
-     IN char *argv[];
+int
+main(int argc, char *argv[])
 {
     setlocale(LC_ALL, "");
 #ifdef AFS_SGI62_ENV
@@ -3161,7 +2126,8 @@ main(argc, argv)
 #else
 #include "AFS_component_version_number.c"
 
-main()
+int
+main(int argc, char *argv[])
 {
     printf("fstrace is NOT supported for this OS\n");
 }