bozo: Tidy header includes
[openafs.git] / src / bozo / bnode.c
index fd9603a..e348f63 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
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID
-    ("$Header$");
+#include <afs/procmgmt.h>
+#include <roken.h>
 
 #include <stddef.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <errno.h>
-#include <sys/types.h>
-#ifdef AFS_NT40_ENV
-#include <io.h>
-#else
-#include <sys/file.h>
-#include <sys/time.h>
-#endif
-#ifdef BOZO_SAVE_CORES
-#include <time.h>
-#endif
-#include <sys/stat.h>
-
-#ifdef HAVE_STRING_H
-#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
 
-#include <afs/procmgmt.h>      /* signal(), kill(), wait(), etc. */
 #include <lwp.h>
+#include <rx/rx.h>
 #include <afs/audit.h>
 #include <afs/afsutil.h>
 #include <afs/fileutil.h>
+
 #include "bnode.h"
+#include "bosprototypes.h"
 
-#if defined(AFS_AIX_ENV) || defined(AFS_SUN4_ENV)
-/* All known versions of AIX lack WCOREDUMP but this works */
-#define WCOREDUMP(x) ((x) & 0x80)
+#ifndef WCOREDUMP
+#define WCOREDUMP(x) ((x) & 0200)
 #endif
 
 #define BNODE_LWP_STACKSIZE    (16 * 1024)
@@ -61,15 +40,18 @@ static struct bnode_stats {
     int weirdPids;
 } bnode_stats;
 
+extern const char *DoCore;
 #ifndef AFS_NT40_ENV
 extern char **environ;         /* env structure */
 #endif
 
+int hdl_notifier(struct bnode_proc *tp);
+
 /* Remember the name of the process, if any, that failed last */
 static void
-RememberProcName(register struct bnode_proc *ap)
+RememberProcName(struct bnode_proc *ap)
 {
-    register struct bnode *tbnodep;
+    struct bnode *tbnodep;
 
     tbnodep = ap->bnode;
     if (tbnodep->lastErrorName) {
@@ -86,9 +68,14 @@ RememberProcName(register struct bnode_proc *ap)
  * be stored.
  */
 int
-bnode_CoreName(register struct bnode *abnode, char *acoreName, char *abuffer)
-{
-    strcpy(abuffer, AFSDIR_SERVER_CORELOG_FILEPATH);
+bnode_CoreName(struct bnode *abnode, char *acoreName, char *abuffer)
+{
+    if (DoCore) {
+       strcpy(abuffer, DoCore);
+       strcat(abuffer, "/");
+       strcat(abuffer, AFSDIR_CORE_FILE);
+    } else
+       strcpy(abuffer, AFSDIR_SERVER_CORELOG_FILEPATH);
     if (acoreName) {
        strcat(abuffer, acoreName);
        strcat(abuffer, ".");
@@ -99,62 +86,104 @@ bnode_CoreName(register struct bnode *abnode, char *acoreName, char *abuffer)
 
 /* save core file, if any */
 static void
-SaveCore(register struct bnode *abnode, register struct bnode_proc
+SaveCore(struct bnode *abnode, struct bnode_proc
         *aproc)
 {
     char tbuffer[256];
     struct stat tstat;
-    register afs_int32 code;
+    afs_int32 code = 0;
+    char *corefile = NULL;
 #ifdef BOZO_SAVE_CORES
     struct timeval Start;
     struct tm *TimeFields;
     char FileName[256];
 #endif
 
-    code = stat(AFSDIR_SERVER_CORELOG_FILEPATH, &tstat);
+    /* Linux always appends the PID to core dumps from threaded processes, so
+     * we have to scan the directory to find core files under another name. */
+    if (DoCore) {
+       strcpy(tbuffer, DoCore);
+       strcat(tbuffer, "/");
+       strcat(tbuffer, AFSDIR_CORE_FILE);
+    } else
+       code = stat(AFSDIR_SERVER_CORELOG_FILEPATH, &tstat);
+    if (code) {
+        DIR *logdir;
+        struct dirent *file;
+        size_t length;
+        unsigned long pid;
+       const char *coredir = AFSDIR_LOGS_DIR;
+
+       if (DoCore)
+         coredir = DoCore;
+
+       logdir = opendir(coredir);
+        if (logdir == NULL)
+            return;
+        while ((file = readdir(logdir)) != NULL) {
+            if (strncmp(file->d_name, "core.", 5) != 0)
+                continue;
+            pid = atol(file->d_name + 5);
+            if (pid == aproc->pid) {
+                length = strlen(coredir) + strlen(file->d_name) + 2;
+                corefile = malloc(length);
+                if (corefile == NULL) {
+                    closedir(logdir);
+                    return;
+                }
+                snprintf(corefile, length, "%s/%s", coredir, file->d_name);
+                code = 0;
+                break;
+            }
+        }
+        closedir(logdir);
+    } else {
+       corefile = strdup(tbuffer);
+    }
     if (code)
        return;
 
     bnode_CoreName(abnode, aproc->coreName, tbuffer);
 #ifdef BOZO_SAVE_CORES
-    TM_GetTimeOfDay(&Start, 0);
+    FT_GetTimeOfDay(&Start, 0);
     TimeFields = localtime(&Start.tv_sec);
     sprintf(FileName, "%s.%d%02d%02d%02d%02d%02d", tbuffer,
-           TimeFields->tm_year, TimeFields->tm_mon + 1, TimeFields->tm_mday,
+           TimeFields->tm_year + 1900, TimeFields->tm_mon + 1, TimeFields->tm_mday,
            TimeFields->tm_hour, TimeFields->tm_min, TimeFields->tm_sec);
     strcpy(tbuffer, FileName);
 #endif
-    code = renamefile(AFSDIR_SERVER_CORELOG_FILEPATH, tbuffer);
+    code = renamefile(corefile, tbuffer);
+    free(corefile);
 }
 
 int
-bnode_GetString(register struct bnode *abnode, register char *abuffer,
-               register afs_int32 alen)
+bnode_GetString(struct bnode *abnode, char *abuffer,
+               afs_int32 alen)
 {
     return BOP_GETSTRING(abnode, abuffer, alen);
 }
 
 int
-bnode_GetParm(register struct bnode *abnode, register afs_int32 aindex,
-             register char *abuffer, afs_int32 alen)
+bnode_GetParm(struct bnode *abnode, afs_int32 aindex,
+             char *abuffer, afs_int32 alen)
 {
     return BOP_GETPARM(abnode, aindex, abuffer, alen);
 }
 
 int
-bnode_GetStat(register struct bnode *abnode, register afs_int32 * astatus)
+bnode_GetStat(struct bnode *abnode, afs_int32 * astatus)
 {
     return BOP_GETSTAT(abnode, astatus);
 }
 
 int
-bnode_RestartP(register struct bnode *abnode)
+bnode_RestartP(struct bnode *abnode)
 {
     return BOP_RESTARTP(abnode);
 }
 
 static int
-bnode_Check(register struct bnode *abnode)
+bnode_Check(struct bnode *abnode)
 {
     if (abnode->flags & BNODE_WAIT) {
        abnode->flags &= ~BNODE_WAIT;
@@ -165,17 +194,17 @@ bnode_Check(register struct bnode *abnode)
 
 /* tell if an instance has a core file */
 int
-bnode_HasCore(register struct bnode *abnode)
+bnode_HasCore(struct bnode *abnode)
 {
     return BOP_HASCORE(abnode);
 }
 
 /* wait for all bnodes to stabilize */
 int
-bnode_WaitAll()
+bnode_WaitAll(void)
 {
-    register struct bnode *tb;
-    register afs_int32 code;
+    struct bnode *tb;
+    afs_int32 code;
     afs_int32 stat;
 
   retry:
@@ -199,9 +228,9 @@ bnode_WaitAll()
 
 /* wait until bnode status is correct */
 int
-bnode_WaitStatus(register struct bnode *abnode, int astatus)
+bnode_WaitStatus(struct bnode *abnode, int astatus)
 {
-    register afs_int32 code;
+    afs_int32 code;
     afs_int32 stat;
 
     bnode_Hold(abnode);
@@ -227,7 +256,7 @@ bnode_WaitStatus(register struct bnode *abnode, int astatus)
 }
 
 int
-bnode_SetStat(register struct bnode *abnode, register int agoal)
+bnode_SetStat(struct bnode *abnode, int agoal)
 {
     abnode->goal = agoal;
     bnode_Check(abnode);
@@ -237,7 +266,7 @@ bnode_SetStat(register struct bnode *abnode, register int agoal)
 }
 
 int
-bnode_SetGoal(register struct bnode *abnode, register int agoal)
+bnode_SetGoal(struct bnode *abnode, int agoal)
 {
     abnode->goal = agoal;
     bnode_Check(abnode);
@@ -245,7 +274,7 @@ bnode_SetGoal(register struct bnode *abnode, register int agoal)
 }
 
 int
-bnode_SetFileGoal(register struct bnode *abnode, register int agoal)
+bnode_SetFileGoal(struct bnode *abnode, int agoal)
 {
     if (abnode->fileGoal == agoal)
        return 0;               /* already done */
@@ -256,10 +285,10 @@ bnode_SetFileGoal(register struct bnode *abnode, register int agoal)
 
 /* apply a function to all bnodes in the system */
 int
-bnode_ApplyInstance(int (*aproc) (), char *arock)
+bnode_ApplyInstance(int (*aproc) (struct bnode *tb, void *), void *arock)
 {
-    register struct bnode *tb, *nb;
-    register afs_int32 code;
+    struct bnode *tb, *nb;
+    afs_int32 code;
 
     for (tb = allBnodes; tb; tb = nb) {
        nb = tb->next;
@@ -271,9 +300,9 @@ bnode_ApplyInstance(int (*aproc) (), char *arock)
 }
 
 struct bnode *
-bnode_FindInstance(register char *aname)
+bnode_FindInstance(char *aname)
 {
-    register struct bnode *tb;
+    struct bnode *tb;
 
     for (tb = allBnodes; tb; tb = tb->next) {
        if (!strcmp(tb->name, aname))
@@ -283,9 +312,9 @@ bnode_FindInstance(register char *aname)
 }
 
 static struct bnode_type *
-FindType(register char *aname)
+FindType(char *aname)
 {
-    register struct bnode_type *tt;
+    struct bnode_type *tt;
 
     for (tt = allTypes; tt; tt = tt->next) {
        if (!strcmp(tt->name, aname))
@@ -297,7 +326,7 @@ FindType(register char *aname)
 int
 bnode_Register(char *atype, struct bnode_ops *aprocs, int anparms)
 {
-    register struct bnode_type *tt;
+    struct bnode_type *tt;
 
     for (tt = allTypes; tt; tt = tt->next) {
        if (!strcmp(tt->name, atype))
@@ -317,7 +346,7 @@ bnode_Register(char *atype, struct bnode_ops *aprocs, int anparms)
 afs_int32
 bnode_Create(char *atype, char *ainstance, struct bnode ** abp, char *ap1,
             char *ap2, char *ap3, char *ap4, char *ap5, char *notifier,
-            int fileGoal)
+            int fileGoal, int rewritefile)
 {
     struct bnode_type *type;
     struct bnode *tb;
@@ -354,20 +383,23 @@ bnode_Create(char *atype, char *ainstance, struct bnode ** abp, char *ap1,
     *abp = tb;
     tb->type = type;
 
-    /* The fs_create above calls bnode_InitBnode() which always sets the 
+    /* The fs_create above calls bnode_InitBnode() which always sets the
      ** fileGoal to BSTAT_NORMAL .... overwrite it with whatever is passed into
      ** this function as a parameter... */
     tb->fileGoal = fileGoal;
 
     bnode_SetStat(tb, tb->goal);       /* nudge it once */
-    WriteBozoFile(0);
+
+    if (rewritefile != 0)
+       WriteBozoFile(0);
+
     return 0;
 }
 
 int
 bnode_DeleteName(char *ainstance)
 {
-    register struct bnode *tb;
+    struct bnode *tb;
 
     tb = bnode_FindInstance(ainstance);
     if (!tb)
@@ -377,14 +409,14 @@ bnode_DeleteName(char *ainstance)
 }
 
 int
-bnode_Hold(register struct bnode *abnode)
+bnode_Hold(struct bnode *abnode)
 {
     abnode->refCount++;
     return 0;
 }
 
 int
-bnode_Release(register struct bnode *abnode)
+bnode_Release(struct bnode *abnode)
 {
     abnode->refCount--;
     if (abnode->refCount == 0 && abnode->flags & BNODE_DELETE) {
@@ -395,10 +427,10 @@ bnode_Release(register struct bnode *abnode)
 }
 
 int
-bnode_Delete(register struct bnode *abnode)
+bnode_Delete(struct bnode *abnode)
 {
-    register afs_int32 code;
-    register struct bnode **lb, *ub;
+    afs_int32 code;
+    struct bnode **lb, *ub;
     afs_int32 temp;
 
     if (abnode->refCount != 0) {
@@ -431,14 +463,14 @@ bnode_Delete(register struct bnode *abnode)
 
 /* function to tell if there's a timeout coming up */
 int
-bnode_PendingTimeout(register struct bnode *abnode)
+bnode_PendingTimeout(struct bnode *abnode)
 {
     return (abnode->flags & BNODE_NEEDTIMEOUT);
 }
 
 /* function called to set / clear periodic bnode wakeup times */
 int
-bnode_SetTimeout(register struct bnode *abnode, afs_int32 atimeout)
+bnode_SetTimeout(struct bnode *abnode, afs_int32 atimeout)
 {
     if (atimeout != 0) {
        abnode->nextTimeout = FT_ApproxTime() + atimeout;
@@ -453,7 +485,7 @@ bnode_SetTimeout(register struct bnode *abnode, afs_int32 atimeout)
 
 /* used by new bnode creation code to format bnode header */
 int
-bnode_InitBnode(register struct bnode *abnode, struct bnode_ops *abnodeops,
+bnode_InitBnode(struct bnode *abnode, struct bnode_ops *abnodeops,
                char *aname)
 {
     struct bnode **lb, *nb;
@@ -477,9 +509,9 @@ bnode_InitBnode(register struct bnode *abnode, struct bnode_ops *abnodeops,
 }
 
 static int
-DeleteProc(register struct bnode_proc *abproc)
+DeleteProc(struct bnode_proc *abproc)
 {
-    register struct bnode_proc **pb, *tb;
+    struct bnode_proc **pb, *tb;
     struct bnode_proc *nb;
 
     for (pb = &allProcs, tb = *pb; tb; pb = &tb->next, tb = nb) {
@@ -494,13 +526,13 @@ DeleteProc(register struct bnode_proc *abproc)
 }
 
 /* bnode lwp executes this code repeatedly */
-static int
-bproc()
+static void *
+bproc(void *unused)
 {
-    register afs_int32 code;
-    register struct bnode *tb;
-    register afs_int32 temp;
-    register struct bnode_proc *tp;
+    afs_int32 code;
+    struct bnode *tb;
+    afs_int32 temp;
+    struct bnode_proc *tp;
     struct bnode *nb;
     int options;               /* must not be register */
     struct timeval tv;
@@ -644,14 +676,15 @@ bproc()
            }
        }
     }
+    return NULL;
 }
 
 static afs_int32
-SendNotifierData(register int fd, register struct bnode_proc *tp)
+SendNotifierData(int fd, struct bnode_proc *tp)
 {
-    register struct bnode *tb = tp->bnode;
+    struct bnode *tb = tp->bnode;
     char buffer[1000], *bufp = buffer, *buf1;
-    register int len;
+    int len;
 
     /*
      * First sent out the bnode_proc struct
@@ -664,15 +697,15 @@ SendNotifierData(register int fd, register struct bnode_proc *tp)
        buf1 = "(null)";
     (void)sprintf(bufp, "coreName: %s\n", buf1);
     bufp += strlen(bufp);
-    (void)sprintf(bufp, "pid: %ld\n", tp->pid);
+    (void)sprintf(bufp, "pid: %ld\n", afs_printable_int32_ld(tp->pid));
     bufp += strlen(bufp);
-    (void)sprintf(bufp, "lastExit: %ld\n", tp->lastExit);
+    (void)sprintf(bufp, "lastExit: %ld\n", afs_printable_int32_ld(tp->lastExit));
     bufp += strlen(bufp);
 #ifdef notdef
-    (void)sprintf(bufp, "lastSignal: %ld\n", tp->lastSignal);
+    (void)sprintf(bufp, "lastSignal: %ld\n", afs_printable_int32_ld(tp->lastSignal));
     bufp += strlen(bufp);
 #endif
-    (void)sprintf(bufp, "flags: %ld\n", tp->flags);
+    (void)sprintf(bufp, "flags: %ld\n", afs_printable_int32_ld(tp->flags));
     bufp += strlen(bufp);
     (void)sprintf(bufp, "END bnode_proc\n");
     bufp += strlen(bufp);
@@ -689,21 +722,21 @@ SendNotifierData(register int fd, register struct bnode_proc *tp)
     bufp += strlen(bufp);
     (void)sprintf(bufp, "name: %s\n", tb->name);
     bufp += strlen(bufp);
-    (void)sprintf(bufp, "rsTime: %ld\n", tb->rsTime);
+    (void)sprintf(bufp, "rsTime: %ld\n", afs_printable_int32_ld(tb->rsTime));
     bufp += strlen(bufp);
-    (void)sprintf(bufp, "rsCount: %ld\n", tb->rsCount);
+    (void)sprintf(bufp, "rsCount: %ld\n", afs_printable_int32_ld(tb->rsCount));
     bufp += strlen(bufp);
-    (void)sprintf(bufp, "procStartTime: %ld\n", tb->procStartTime);
+    (void)sprintf(bufp, "procStartTime: %ld\n", afs_printable_int32_ld(tb->procStartTime));
     bufp += strlen(bufp);
-    (void)sprintf(bufp, "procStarts: %ld\n", tb->procStarts);
+    (void)sprintf(bufp, "procStarts: %ld\n", afs_printable_int32_ld(tb->procStarts));
     bufp += strlen(bufp);
-    (void)sprintf(bufp, "lastAnyExit: %ld\n", tb->lastAnyExit);
+    (void)sprintf(bufp, "lastAnyExit: %ld\n", afs_printable_int32_ld(tb->lastAnyExit));
     bufp += strlen(bufp);
-    (void)sprintf(bufp, "lastErrorExit: %ld\n", tb->lastErrorExit);
+    (void)sprintf(bufp, "lastErrorExit: %ld\n", afs_printable_int32_ld(tb->lastErrorExit));
     bufp += strlen(bufp);
-    (void)sprintf(bufp, "errorCode: %ld\n", tb->errorCode);
+    (void)sprintf(bufp, "errorCode: %ld\n", afs_printable_int32_ld(tb->errorCode));
     bufp += strlen(bufp);
-    (void)sprintf(bufp, "errorSignal: %ld\n", tb->errorSignal);
+    (void)sprintf(bufp, "errorSignal: %ld\n", afs_printable_int32_ld(tb->errorSignal));
     bufp += strlen(bufp);
 /*
     (void) sprintf(bufp, "lastErrorName: %s\n", tb->lastErrorName);
@@ -717,13 +750,14 @@ SendNotifierData(register int fd, register struct bnode_proc *tp)
     if (write(fd, buffer, len) < 0) {
        return -1;
     }
+    return 0;
 }
 
 int
 hdl_notifier(struct bnode_proc *tp)
 {
 #ifndef AFS_NT40_ENV           /* NT notifier callout not yet implemented */
-    int code, pid, status;
+    int code, pid;
     struct stat tstat;
 
     if (stat(tp->bnode->notifier, &tstat)) {
@@ -740,7 +774,7 @@ hdl_notifier(struct bnode_proc *tp)
        ec = setsid();
 #elif defined(AFS_DARWIN90_ENV)
        ec = setpgid(0, 0);
-#elif defined(AFS_LINUX20_ENV) || defined(AFS_AIX_ENV) 
+#elif defined(AFS_LINUX20_ENV) || defined(AFS_AIX_ENV)
        ec = setpgrp();
 #else
        ec = setpgrp(0, 0);
@@ -766,9 +800,11 @@ hdl_notifier(struct bnode_proc *tp)
 
 /* Called by IOMGR at low priority on IOMGR's stack shortly after a SIGCHLD
  * occurs.  Wakes up bproc do redo things */
-int
-bnode_SoftInt(int asignal)
+void *
+bnode_SoftInt(void *param)
 {
+    /* int asignal = (int) param; */
+
     IOMGR_Cancel(bproc_pid);
     return 0;
 }
@@ -779,24 +815,22 @@ bnode_SoftInt(int asignal)
 void
 bnode_Int(int asignal)
 {
-    extern void bozo_ShutdownAndExit();
-
-    if (asignal == SIGQUIT) {
-       IOMGR_SoftSig(bozo_ShutdownAndExit, (char *)asignal);
+    if (asignal == SIGQUIT || asignal == SIGTERM) {
+       IOMGR_SoftSig(bozo_ShutdownAndExit, (void *)(intptr_t)asignal);
     } else {
-       IOMGR_SoftSig(bnode_SoftInt, (char *)asignal);
+       IOMGR_SoftSig(bnode_SoftInt, (void *)(intptr_t)asignal);
     }
 }
 
 
 /* intialize the whole system */
 int
-bnode_Init()
+bnode_Init(void)
 {
     PROCESS junk;
-    register afs_int32 code;
+    afs_int32 code;
     struct sigaction newaction;
-    static initDone = 0;
+    static int initDone = 0;
 
     if (initDone)
        return 0;
@@ -809,7 +843,7 @@ bnode_Init()
                             "bnode-manager", &bproc_pid);
     if (code)
        return code;
-    memset((char *)&newaction, 0, sizeof(newaction));
+    memset(&newaction, 0, sizeof(newaction));
     newaction.sa_handler = bnode_Int;
     code = sigaction(SIGCHLD, &newaction, NULL);
     if (code)
@@ -817,14 +851,17 @@ bnode_Init()
     code = sigaction(SIGQUIT, &newaction, NULL);
     if (code)
        return errno;
+    code = sigaction(SIGTERM, &newaction, NULL);
+    if (code)
+       return errno;
     return code;
 }
 
 /* free token list returned by parseLine */
 int
-bnode_FreeTokens(register struct bnode_token *alist)
+bnode_FreeTokens(struct bnode_token *alist)
 {
-    register struct bnode_token *nlist;
+    struct bnode_token *nlist;
     for (; alist; alist = nlist) {
        nlist = alist->next;
        free(alist->key);
@@ -846,11 +883,11 @@ int
 bnode_ParseLine(char *aline, struct bnode_token **alist)
 {
     char tbuffer[256];
-    register char *tptr;
+    char *tptr = NULL;
     int inToken;
     struct bnode_token *first, *last;
-    register struct bnode_token *ttok;
-    register int tc;
+    struct bnode_token *ttok;
+    int tc;
 
     inToken = 0;               /* not copying token chars at start */
     first = (struct bnode_token *)0;
@@ -912,8 +949,6 @@ bnode_NewProc(struct bnode *abnode, char *aexecString, char *coreName,
     tp = (struct bnode_proc *)malloc(sizeof(struct bnode_proc));
     memset(tp, 0, sizeof(struct bnode_proc));
     tp->next = allProcs;
-    allProcs = tp;
-    *aproc = tp;
     tp->bnode = abnode;
     tp->comLine = aexecString;
     tp->coreName = coreName;   /* may be null */
@@ -937,6 +972,8 @@ bnode_NewProc(struct bnode *abnode, char *aexecString, char *coreName,
     }
 
     bnode_FreeTokens(tlist);
+    allProcs = tp;
+    *aproc = tp;
     tp->pid = cpid;
     tp->flags = BPROC_STARTED;
     tp->flags &= ~BPROC_EXITED;
@@ -945,9 +982,9 @@ bnode_NewProc(struct bnode *abnode, char *aexecString, char *coreName,
 }
 
 int
-bnode_StopProc(register struct bnode_proc *aproc, int asignal)
+bnode_StopProc(struct bnode_proc *aproc, int asignal)
 {
-    register int code;
+    int code;
     if (!(aproc->flags & BPROC_STARTED) || (aproc->flags & BPROC_EXITED))
        return BZNOTACTIVE;
 
@@ -960,9 +997,9 @@ bnode_StopProc(register struct bnode_proc *aproc, int asignal)
 }
 
 int
-bnode_Deactivate(register struct bnode *abnode)
+bnode_Deactivate(struct bnode *abnode)
 {
-    register struct bnode **pb, *tb;
+    struct bnode **pb, *tb;
     struct bnode *nb;
     if (!(abnode->flags & BNODE_ACTIVE))
        return BZNOTACTIVE;