[OpenAFS-devel] bosserver cleanup
Christof Hanke
hanke@rzg.mpg.de
Fri, 10 Feb 2006 13:46:00 +0100
This is a multi-part message in MIME format.
--------------060509090109070704070102
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
>
>
> I don't think it's confusing, and I don't think there's any reason to
> rename it or to avoid using the unified logging code. This is
> essentially a transition in progress; it's appropriate to modify the
> bosserver to use it, but not to design something completely new and
> duplicate code that we are trying to unify just because you don't like
> the name of something.
>
> -- Jeff
Ok, it's not that I "just" don't like the name. I just thought it might
appear to some people as a a kind of "namespace violation". The more
such "violation" you have the less readble the code gets, but that's
just my opinion.
But nevermind,
here's now a version using the ViceLog-macro.
Christof
--------------060509090109070704070102
Content-Type: text/plain;
name="bozo-patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="bozo-patch"
Index: src/bozo/fsbnodeops.c
===================================================================
--- src/bozo/fsbnodeops.c (revision 2071)
+++ src/bozo/fsbnodeops.c (working copy)
@@ -308,21 +308,21 @@
/* construct local paths from canonical (wire-format) paths */
if (ConstructLocalBinPath(afilecmd, &fileCmdpath)) {
- bozo_Log("BNODE: command path invalid '%s'\n", afilecmd);
+ ViceLog(0,("BNODE: command path invalid '%s'\n", afilecmd));
bailout = 1;
}
if (ConstructLocalBinPath(avolcmd, &volCmdpath)) {
- bozo_Log("BNODE: command path invalid '%s'\n", avolcmd);
+ ViceLog(0,("BNODE: command path invalid '%s'\n", avolcmd));
bailout = 1;
}
if (ConstructLocalBinPath(asalcmd, &salCmdpath)) {
- bozo_Log("BNODE: command path invalid '%s'\n", asalcmd);
+ ViceLog(0,("BNODE: command path invalid '%s'\n", asalcmd));
bailout = 1;
}
if (ascancmd && strlen(ascancmd)) {
if (ConstructLocalBinPath(ascancmd, &scanCmdpath)) {
- bozo_Log("BNODE: command path invalid '%s'\n", ascancmd);
+ ViceLog(0,("BNODE: command path invalid '%s'\n", ascancmd));
bailout = 1;
}
}
@@ -333,7 +333,7 @@
AppendExecutableExtension(cmdname);
#endif
if (stat(cmdname, &tstat)) {
- bozo_Log("BNODE: file server binary '%s' not found\n", cmdname);
+ ViceLog(0,("BNODE: file server binary '%s' not found\n", cmdname));
bailout = 1;
}
@@ -342,7 +342,7 @@
AppendExecutableExtension(cmdname);
#endif
if (stat(cmdname, &tstat)) {
- bozo_Log("BNODE: volume server binary '%s' not found\n", cmdname);
+ ViceLog(0,("BNODE: volume server binary '%s' not found\n", cmdname));
bailout = 1;
}
@@ -351,7 +351,7 @@
AppendExecutableExtension(cmdname);
#endif
if (stat(cmdname, &tstat)) {
- bozo_Log("BNODE: salvager binary '%s' not found\n", cmdname);
+ ViceLog(0,("BNODE: salvager binary '%s' not found\n", cmdname));
bailout = 1;
}
@@ -361,7 +361,7 @@
AppendExecutableExtension(cmdname);
#endif
if (stat(cmdname, &tstat)) {
- bozo_Log("BNODE: scanner binary '%s' not found\n", cmdname);
+ ViceLog(0,("BNODE: scanner binary '%s' not found\n", cmdname));
bailout = 1;
}
}
@@ -408,36 +408,36 @@
if (!abnode->volKillSent && now - abnode->timeSDStarted > SDTIME) {
bnode_StopProc(abnode->volProc, SIGKILL);
abnode->volKillSent = 1;
- bozo_Log
- ("bos shutdown: volserver failed to shutdown within %d seconds\n",
- SDTIME);
+ ViceLog
+ (0,("bos shutdown: volserver failed to shutdown within %d seconds\n",
+ SDTIME));
}
}
if (abnode->salSDW) {
if (!abnode->salKillSent && now - abnode->timeSDStarted > SDTIME) {
bnode_StopProc(abnode->salProc, SIGKILL);
abnode->salKillSent = 1;
- bozo_Log
- ("bos shutdown: salvager failed to shutdown within %d seconds\n",
- SDTIME);
+ ViceLog
+ (0,("bos shutdown: salvager failed to shutdown within %d seconds\n",
+ SDTIME));
}
}
if (abnode->fileSDW) {
if (!abnode->fileKillSent && now - abnode->timeSDStarted > FSSDTIME) {
bnode_StopProc(abnode->fileProc, SIGKILL);
abnode->fileKillSent = 1;
- bozo_Log
- ("bos shutdown: fileserver failed to shutdown within %d seconds\n",
- FSSDTIME);
+ ViceLog
+ (0,("bos shutdown: fileserver failed to shutdown within %d seconds\n",
+ FSSDTIME));
}
}
if (abnode->scanSDW) {
if (!abnode->scanKillSent && now - abnode->timeSDStarted > SDTIME) {
bnode_StopProc(abnode->scanProc, SIGKILL);
abnode->scanKillSent = 1;
- bozo_Log
- ("bos shutdown: scanner failed to shutdown within %d seconds\n",
- SDTIME);
+ ViceLog
+ (0,("bos shutdown: scanner failed to shutdown within %d seconds\n",
+ SDTIME));
}
}
SetNeedsClock(abnode);
@@ -546,8 +546,8 @@
* tells us if we need to run the salvager or not */
if (abnode->fileRunning) {
if (abnode->salRunning) {
- bozo_Log("Salvager running along with file server!\n");
- bozo_Log("Emergency shutdown\n");
+ ViceLog(0,("Salvager running along with file server!\n"));
+ ViceLog(0,("Emergency shutdown\n"));
emergency = 1;
bnode_SetGoal(abnode, BSTAT_SHUTDOWN);
bnode_StopProc(abnode->salProc, SIGKILL);
Index: src/bozo/ezbnodeops.c
===================================================================
--- src/bozo/ezbnodeops.c (revision 2071)
+++ src/bozo/ezbnodeops.c (working copy)
@@ -106,7 +106,7 @@
char *cmdpath;
if (ConstructLocalBinPath(acommand, &cmdpath)) {
- bozo_Log("BNODE: command path invalid '%s'\n", acommand);
+ ViceLog(0,("BNODE: command path invalid '%s'\n", acommand));
return NULL;
}
Index: src/bozo/bosoprocs.c
===================================================================
--- src/bozo/bosoprocs.c (revision 2071)
+++ src/bozo/bosoprocs.c (working copy)
@@ -100,7 +100,7 @@
goto fail;
}
if (DoLogging)
- bozo_Log("%s is executing SetRestartTime\n", caller);
+ ViceLog(0,("%s is executing SetRestartTime\n", caller));
code = 0; /* assume success */
switch (atype) {
@@ -148,7 +148,7 @@
}
#endif
if (DoLogging)
- bozo_Log("%s is executing the shell command '%s'\n", caller, acmd);
+ ViceLog(0,("%s is executing the shell command '%s'\n", caller, acmd));
/* should copy output to acall, but don't yet cause its hard */
/* hard... NOT! Nnow _at least_ return the exit status */
@@ -226,7 +226,7 @@
}
if (DoLogging)
- bozo_Log("%s is executing UnInstall '%s'\n", caller, filepath);
+ ViceLog(0,("%s is executing UnInstall '%s'\n", caller, filepath));
strcpy(fpBak, filepath);
strcat(fpBak, ".BAK");
@@ -329,7 +329,7 @@
free(fpp);
if (DoLogging)
- bozo_Log("%s is executing Install '%s'\n", caller, filepath);
+ ViceLog(0,("%s is executing Install '%s'\n", caller, filepath));
/* open file */
fpp = filepath + strlen(filepath);
@@ -405,7 +405,7 @@
goto fail;
}
if (DoLogging)
- bozo_Log("%s is executing SetCellName '%s'\n", caller, aname);
+ ViceLog(0,("%s is executing SetCellName '%s'\n", caller, aname));
code =
afsconf_GetExtendedCellInfo(bozo_confdir, NULL, NULL, &tcell,
@@ -415,9 +415,9 @@
/* Check that tcell has enough space for the new cellname. */
if (strlen(aname) > sizeof tcell.name - 1) {
- bozo_Log
- ("ERROR: SetCellName: cell name '%s' exceeds %ld bytes (cell name not changed)\n",
- aname, (long)(sizeof tcell.name - 1));
+ ViceLog
+ (0,("ERROR: SetCellName: cell name '%s' exceeds %ld bytes (cell name not changed)\n",
+ aname, (long)(sizeof tcell.name - 1)));
code = BZDOM;
goto fail;
}
@@ -510,7 +510,7 @@
goto fail;
}
if (DoLogging)
- bozo_Log("%s is executing DeleteCellHost '%s'\n", caller, aname);
+ ViceLog(0,("%s is executing DeleteCellHost '%s'\n", caller, aname));
code =
afsconf_GetExtendedCellInfo(bozo_confdir, NULL, NULL, &tcell,
@@ -561,7 +561,7 @@
goto fail;
}
if (DoLogging)
- bozo_Log("%s is executing AddCellHost '%s'\n", caller, aname);
+ ViceLog(0,("%s is executing AddCellHost '%s'\n", caller, aname));
code =
afsconf_GetExtendedCellInfo(bozo_confdir, NULL, NULL, &tcell,
@@ -595,19 +595,19 @@
*/
if (tcell.numServers >
sizeof tcell.hostAddr / sizeof tcell.hostAddr[0]) {
- bozo_Log
- ("ERROR: AddCellHost: attempt to add more than %ld database servers (database server '%s' not added)\n",
+ ViceLog
+ (0,("ERROR: AddCellHost: attempt to add more than %ld database servers (database server '%s' not added)\n",
(long)(sizeof tcell.hostAddr / sizeof tcell.hostAddr[0]),
- aname);
+ aname));
code = BZDOM;
goto fail;
}
/* Check that tcell has enough space for the new hostname. */
if (strlen(aname) > sizeof tcell.hostName[0] - 1) {
- bozo_Log
- ("ERROR: AddCellHost: host name '%s' exceeds %ld bytes (not added)\n",
- aname, (long)(sizeof tcell.hostName[0] - 1));
+ ViceLog
+ (0,("ERROR: AddCellHost: host name '%s' exceeds %ld bytes (not added)\n",
+ aname, (long)(sizeof tcell.hostName[0] - 1)));
code = BZDOM;
goto fail;
}
@@ -645,7 +645,7 @@
goto fail;
}
if (DoLogging)
- bozo_Log("%s is executing ListKeys\n", caller);
+ ViceLog(0,("%s is executing ListKeys\n", caller));
code = afsconf_GetKeys(bozo_confdir, &tkeys);
if (code)
@@ -705,7 +705,7 @@
goto fail;
}
if (DoLogging)
- bozo_Log("%s is executing AddKey\n", caller);
+ ViceLog(0,("%s is executing AddKey\n", caller));
code = afsconf_AddKey(bozo_confdir, an, akey, 0);
if (code == AFSCONF_KEYINUSE)
@@ -728,7 +728,7 @@
goto fail;
}
if (DoLogging)
- bozo_Log("%s is executing Set No Authentication\n", caller);
+ ViceLog(0,("%s is executing Set No Authentication\n", caller));
afsconf_SetNoAuthFlag(bozo_confdir, aflag);
@@ -750,7 +750,7 @@
goto fail;
}
if (DoLogging)
- bozo_Log("%s is executing DeleteKey\n", caller);
+ ViceLog(0,("%s is executing DeleteKey\n", caller));
code = afsconf_DeleteKey(bozo_confdir, an);
@@ -791,7 +791,7 @@
goto fail;
}
if (DoLogging)
- bozo_Log("%s is executing Add SuperUser '%s'\n", caller, aname);
+ ViceLog(0,("%s is executing Add SuperUser '%s'\n", caller, aname));
code = afsconf_AddUser(bozo_confdir, aname);
@@ -814,7 +814,7 @@
}
if (DoLogging)
- bozo_Log("%s is executing Delete SuperUser '%s'\n", caller, aname);
+ ViceLog(0,("%s is executing Delete SuperUser '%s'\n", caller, aname));
code = afsconf_DeleteUser(bozo_confdir, aname);
@@ -875,7 +875,7 @@
}
if (DoLogging)
- bozo_Log("%s is executing Wait for All\n", caller);
+ ViceLog(0,("%s is executing Wait for All\n", caller));
code = bnode_WaitAll();
@@ -903,7 +903,7 @@
}
#endif
if (DoLogging)
- bozo_Log("%s is executing DeleteBnode '%s'\n", caller, ainstance);
+ ViceLog(0,("%s is executing DeleteBnode '%s'\n", caller, ainstance));
code = bnode_DeleteName(ainstance);
@@ -967,7 +967,7 @@
goto fail;
}
if (DoLogging)
- bozo_Log("%s is executing ShutdownAll\n", caller);
+ ViceLog(0,("%s is executing ShutdownAll\n", caller));
code = bnode_ApplyInstance(sdproc, NULL);
@@ -989,7 +989,7 @@
goto fail;
}
if (DoLogging)
- bozo_Log("%s is executing RestartAll\n", caller);
+ ViceLog(0,("%s is executing RestartAll\n", caller));
/* start shutdown of all processes */
code = bnode_ApplyInstance(sdproc, NULL);
@@ -1022,7 +1022,7 @@
goto fail;
}
if (DoLogging)
- bozo_Log("%s is executing ReBozo\n", caller);
+ ViceLog(0,("%s is executing ReBozo\n", caller));
/* start shutdown of all processes */
code = bnode_ApplyInstance(sdproc, NULL);
@@ -1066,7 +1066,7 @@
goto fail;
}
if (DoLogging)
- bozo_Log("%s is executing StartupAll\n", caller);
+ ViceLog(0,("%s is executing StartupAll\n", caller));
code = bnode_ApplyInstance(stproc, NULL);
fail:
@@ -1088,7 +1088,7 @@
goto fail;
}
if (DoLogging)
- bozo_Log("%s is executing Restart '%s'\n", caller, ainstance);
+ ViceLog(0,("%s is executing Restart '%s'\n", caller, ainstance));
tb = bnode_FindInstance(ainstance);
if (!tb) {
@@ -1126,7 +1126,7 @@
goto fail;
}
if (DoLogging)
- bozo_Log("%s is executing SetTempStatus '%s'\n", caller, ainstance);
+ ViceLog(0,("%s is executing SetTempStatus '%s'\n", caller, ainstance));
tb = bnode_FindInstance(ainstance);
if (!tb) {
@@ -1158,8 +1158,8 @@
goto fail;
}
if (DoLogging)
- bozo_Log("%s is executing SetStatus '%s' (status = %d)\n", caller,
- ainstance, astatus);
+ ViceLog(0,("%s is executing SetStatus '%s' (status = %d)\n", caller,
+ ainstance, astatus));
tb = bnode_FindInstance(ainstance);
if (!tb) {
@@ -1266,7 +1266,7 @@
}
#endif
if (DoLogging)
- bozo_Log("%s is executing Prune (flags=%d)\n", caller, aflags);
+ ViceLog(0,("%s is executing Prune (flags=%d)\n", caller, aflags));
/* first scan AFS binary directory */
dirp = opendir(AFSDIR_SERVER_BIN_DIRPATH);
@@ -1412,19 +1412,19 @@
for (i = 0; i < bozo_nbosEntryStats; i++) {
struct bozo_bosEntryStats *e = &bozo_bosEntryStats[i];
if (!StatEachEntry(e)) {
- bozo_Log("unhappy with %s which is a %s that should "
+ ViceLog(0,("unhappy with %s which is a %s that should "
"have at least rights %o, at most rights %o %s\n",
e->path, e->dir ? "dir" : "file", e->reqPerm,
(~e->proPerm & 0777),
- e->rootOwner ? ", owned by root" : "");
+ e->rootOwner ? ", owned by root" : ""));
result = 0;
break;
}
}
if (result != lastResult) { /* log changes */
- bozo_Log("Server directory access is %sokay\n",
- (result ? "" : "not "));
+ ViceLog(0,("Server directory access is %sokay\n",
+ (result ? "" : "not ")));
}
lastResult = result;
return lastResult;
@@ -1542,7 +1542,7 @@
return BZNOENT;
}
if (DoLogging)
- bozo_Log("%s is executing GetLog '%s'\n", caller, logpath);
+ ViceLog(0,("%s is executing GetLog '%s'\n", caller, logpath));
tfile = fopen(logpath, "r");
free(logpath);
@@ -1667,9 +1667,9 @@
{
int code;
- bozo_Log
- ("Shutdown of BOS server and processes in response to signal %d\n",
- asignal);
+ ViceLog
+ (0,("Shutdown of BOS server and processes in response to signal %d\n",
+ asignal));
/* start shutdown of all processes */
if ((code = bnode_ApplyInstance(sdproc, NULL)) == 0) {
@@ -1678,8 +1678,8 @@
}
if (code) {
- bozo_Log("Shutdown incomplete (code = %d); manual cleanup required\n",
- code);
+ ViceLog(0,("Shutdown incomplete (code = %d); manual cleanup required\n",
+ code));
}
rx_Finalize();
Index: src/bozo/bosserver.c
===================================================================
--- src/bozo/bosserver.c (revision 2071)
+++ src/bozo/bosserver.c (working copy)
@@ -53,19 +53,13 @@
extern int RXSTATS_ExecuteRequest();
extern struct bnode_ops fsbnode_ops, ezbnode_ops, cronbnode_ops;
-void bozo_Log();
struct afsconf_dir *bozo_confdir = 0; /* bozo configuration dir */
static char *bozo_pid;
struct rx_securityClass *bozo_rxsc[3];
const char *bozo_fileName;
-FILE *bozo_logFile;
int DoLogging = 0;
-int DoSyslog = 0;
-#ifndef AFS_NT40_ENV
-int DoSyslogFacility = LOG_DAEMON;
-#endif
static afs_int32 nextRestart;
static afs_int32 nextDay;
@@ -132,10 +126,10 @@
}
#ifndef AFS_NT40_ENV
/* if syslog logging is on, pass "-syslog" to new bosserver */
- if (DoSyslog) {
+ if (serverLogSyslog) {
char *arg = (char *)malloc(40); /* enough for -syslog=# */
- if (DoSyslogFacility != LOG_DAEMON) {
- snprintf(arg, 40, "-syslog=%d", DoSyslogFacility);
+ if (serverLogSyslogFacility != LOG_DAEMON) {
+ snprintf(arg, 40, "-syslog=%d", serverLogSyslogFacility);
} else {
strcpy(arg, "-syslog");
}
@@ -522,7 +516,7 @@
#ifdef BOS_RESTRICTED_MODE
if (bozo_restdisable) {
- bozo_Log("Restricted mode disabled by signal\n");
+ ViceLog(0,("Restricted mode disabled by signal\n"));
bozo_restdisable = 0;
}
#endif
@@ -793,10 +787,10 @@
#ifndef AFS_NT40_ENV
else if (strcmp(argv[code], "-syslog") == 0) {
/* set syslog logging flag */
- DoSyslog = 1;
+ serverLogSyslog = 1;
} else if (strncmp(argv[code], "-syslog=", 8) == 0) {
- DoSyslog = 1;
- DoSyslogFacility = atoi(argv[code] + 8);
+ serverLogSyslog = 1;
+ serverLogSyslogFacility = atoi(argv[i] + 8);
} else if (strcmp(argv[code], "-nofork") == 0) {
nofork = 1;
}
@@ -900,42 +894,29 @@
daemon(1, 0);
#endif /* ! AFS_NT40_ENV */
- if ((!DoSyslog)
+ if ((!serverLogSyslog)
#ifndef AFS_NT40_ENV
&& ((lstat(AFSDIR_BOZLOG_FILE, &sb) == 0) &&
!(S_ISFIFO(sb.st_mode)))
#endif
) {
- strcpy(namebuf, AFSDIR_BOZLOG_FILE);
- strcat(namebuf, ".old");
- renamefile(AFSDIR_BOZLOG_FILE, namebuf); /* try rename first */
- bozo_logFile = fopen(AFSDIR_BOZLOG_FILE, "a");
- if (!bozo_logFile) {
- printf("bosserver: can't initialize log file (%s).\n",
- AFSDIR_SERVER_BOZLOG_FILEPATH);
- exit(1);
- }
- /* keep log closed normally, so can be removed */
- fclose(bozo_logFile);
- } else {
-#ifndef AFS_NT40_ENV
- openlog("bosserver", LOG_PID, DoSyslogFacility);
-#endif
- }
-
+ OpenLog(AFSDIR_SERVER_BOZLOG_FILEPATH);
+ SetupLogSignals();
+ }
+
/* Write current state of directory permissions to log file */
DirAccessOK();
for (i = 0; i < 10; i++) {
code = rx_Init(htons(AFSCONF_NANNYPORT));
if (code) {
- bozo_Log("can't initialize rx: code=%d\n", code);
+ ViceLog(0,("can't initialize rx: code=%d\n", code));
sleep(3);
} else
break;
}
if (i >= 10) {
- bozo_Log("Bos giving up, can't initialize rx\n");
+ ViceLog(0,("Bos giving up, can't initialize rx\n"));
exit(code);
}
@@ -952,12 +933,12 @@
tcell.numServers = 1;
code = gethostname(tcell.hostName[0], MAXHOSTCHARS);
if (code) {
- bozo_Log("failed to get hostname, code %d\n", errno);
+ ViceLog(0,("failed to get hostname, code %d\n", errno));
exit(1);
}
if (tcell.hostName[0][0] == 0) {
- bozo_Log("host name not set, can't start\n");
- bozo_Log("try the 'hostname' command\n");
+ ViceLog(0,("host name not set, can't start\n"));
+ ViceLog(0,("try the 'hostname' command\n"));
exit(1);
}
memset(tcell.hostAddr, 0, sizeof(tcell.hostAddr)); /* not computed */
@@ -965,24 +946,24 @@
afsconf_SetCellInfo(bozo_confdir, AFSDIR_SERVER_ETC_DIRPATH,
&tcell);
if (code) {
- bozo_Log
- ("could not create cell database in '%s' (code %d), quitting\n",
- AFSDIR_SERVER_ETC_DIRPATH, code);
+ ViceLog
+ (0,("could not create cell database in '%s' (code %d), quitting\n",
+ AFSDIR_SERVER_ETC_DIRPATH, code));
exit(1);
}
tdir = afsconf_Open(AFSDIR_SERVER_ETC_DIRPATH);
if (!tdir) {
- bozo_Log
- ("failed to open newly-created cell database, quitting\n");
+ ViceLog
+ (0,("failed to open newly-created cell database, quitting\n"));
exit(1);
}
}
/* read init file, starting up programs */
if (code = ReadBozoFile(0)) {
- bozo_Log
- ("bosserver: Something is wrong (%d) with the bos configuration file %s; aborting\n",
- code, AFSDIR_SERVER_BOZCONF_FILEPATH);
+ ViceLog
+ (0,("bosserver: Something is wrong (%d) with the bos configuration file %s; aborting\n",
+ code, AFSDIR_SERVER_BOZCONF_FILEPATH));
exit(code);
}
@@ -1022,40 +1003,3 @@
rx_StartServer(1); /* donate this process */
}
-void
-bozo_Log(char *a, char *b, char *c, char *d, char *e, char *f)
-{
- char tdate[26];
- time_t myTime;
-
- if (DoSyslog) {
-#ifndef AFS_NT40_ENV
- syslog(LOG_INFO, a, b, c, d, e, f);
-#endif
- } else {
- myTime = time(0);
- strcpy(tdate, ctime(&myTime)); /* copy out of static area asap */
- tdate[24] = ':';
-
- /* log normally closed, so can be removed */
-
- bozo_logFile = fopen(AFSDIR_SERVER_BOZLOG_FILEPATH, "a");
- if (bozo_logFile == NULL) {
- printf("bosserver: WARNING: problem with %s",
- AFSDIR_SERVER_BOZLOG_FILEPATH);
- fflush(stdout);
- }
-
- if (bozo_logFile) {
- fprintf(bozo_logFile, "%s ", tdate);
- fprintf(bozo_logFile, a, b, c, d, e, f);
- fflush(bozo_logFile);
- } else {
- printf("%s ", tdate);
- printf(a, b, c, d, e, f);
- }
-
- /* close so rm BosLog works */
- fclose(bozo_logFile);
- }
-}
Index: src/bozo/bnode.c
===================================================================
--- src/bozo/bnode.c (revision 2071)
+++ src/bozo/bnode.c (working copy)
@@ -333,14 +333,14 @@
if (notifier && strcmp(notifier, NONOTIFIER)) {
/* construct local path from canonical (wire-format) path */
if (ConstructLocalBinPath(notifier, ¬ifierpath)) {
- bozo_Log("BNODE-Create: Notifier program path invalid '%s'\n",
- notifier);
+ ViceLog(0,("BNODE-Create: Notifier program path invalid '%s'\n",
+ notifier));
return BZNOCREATE;
}
if (stat(notifierpath, &tstat)) {
- bozo_Log("BNODE-Create: Notifier program '%s' not found\n",
- notifierpath);
+ ViceLog(0,("BNODE-Create: Notifier program '%s' not found\n",
+ notifierpath));
free(notifierpath);
return BZNOCREATE;
}
@@ -588,11 +588,11 @@
tb->errorSignal = 0;
}
if (tp->coreName)
- bozo_Log("%s:%s exited with code %d\n", tb->name,
- tp->coreName, tp->lastExit);
+ ViceLog(0,("%s:%s exited with code %d\n", tb->name,
+ tp->coreName, tp->lastExit));
else
- bozo_Log("%s exited with code %d\n", tb->name,
- tp->lastExit);
+ ViceLog(0,("%s exited with code %d\n", tb->name,
+ tp->lastExit));
} else {
/* Signal occurred, perhaps spurious due to shutdown request.
* If due to a shutdown request, don't overwrite last error
@@ -608,22 +608,22 @@
RememberProcName(tp);
}
if (tp->coreName)
- bozo_Log("%s:%s exited on signal %d%s\n",
+ ViceLog(0,("%s:%s exited on signal %d%s\n",
tb->name, tp->coreName, tp->lastSignal,
WCOREDUMP(status) ? " (core dumped)" :
- "");
+ ""));
else
- bozo_Log("%s exited on signal %d%s\n", tb->name,
+ ViceLog(0,("%s exited on signal %d%s\n", tb->name,
tp->lastSignal,
WCOREDUMP(status) ? " (core dumped)" :
- "");
+ ""));
SaveCore(tb, tp);
}
tb->lastAnyExit = FT_ApproxTime();
if (tb->notifier) {
- bozo_Log("BNODE: Notifier %s will be called\n",
- tb->notifier);
+ ViceLog(0,("BNODE: Notifier %s will be called\n",
+ tb->notifier));
hdl_notifier(tp);
}
BOP_PROCEXIT(tb, tp);
@@ -633,9 +633,9 @@
/* 10 in 10 seconds */
tb->flags |= BNODE_ERRORSTOP;
bnode_SetGoal(tb, BSTAT_SHUTDOWN);
- bozo_Log
- ("BNODE '%s' repeatedly failed to start, perhaps missing executable.\n",
- tb->name);
+ ViceLog
+ (0,("BNODE '%s' repeatedly failed to start, perhaps missing executable.\n",
+ tb->name));
}
bnode_Release(tb); /* bnode delete can happen here */
DeleteProc(tp);
@@ -727,8 +727,8 @@
struct stat tstat;
if (stat(tp->bnode->notifier, &tstat)) {
- bozo_Log("BNODE: Failed to find notifier '%s'; ignored\n",
- tp->bnode->notifier);
+ ViceLog(0,("BNODE: Failed to find notifier '%s'; ignored\n",
+ tp->bnode->notifier));
return (1);
}
if ((pid = fork()) == 0) {
@@ -747,8 +747,8 @@
#endif
fout = popen(tb->notifier, "w");
if (fout == NULL) {
- bozo_Log("BNODE: Failed to find notifier '%s'; ignored\n",
- tb->notifier);
+ ViceLog(0,("BNODE: Failed to find notifier '%s'; ignored\n",
+ tb->notifier));
perror(tb->notifier);
exit(1);
}
@@ -756,8 +756,8 @@
pclose(fout);
exit(0);
} else if (pid < 0) {
- bozo_Log("Failed to fork creating process to handle notifier '%s'\n",
- tp->bnode->notifier);
+ ViceLog(0,("Failed to fork creating process to handle notifier '%s'\n",
+ tp->bnode->notifier));
return -1;
}
#endif /* AFS_NT40_ENV */
@@ -930,7 +930,7 @@
osi_audit(BOSSpawnProcEvent, 0, AUD_STR, aexecString, AUD_END);
if (cpid == (pid_t) - 1) {
- bozo_Log("Failed to spawn process for bnode '%s'\n", abnode->name);
+ ViceLog(0,("Failed to spawn process for bnode '%s'\n", abnode->name));
bnode_FreeTokens(tlist);
free(tp);
return errno;
Index: src/bozo/cronbnodeops.c
===================================================================
--- src/bozo/cronbnodeops.c (revision 2071)
+++ src/bozo/cronbnodeops.c (working copy)
@@ -116,8 +116,8 @@
abnode->lastStart = FT_ApproxTime();
code = bnode_NewProc(abnode, abnode->command, NULL, &tp);
if (code) {
- bozo_Log("cron bnode %s failed to start (code %d)\n",
- abnode->b.name, code);
+ ViceLog(0,("cron bnode %s failed to start (code %d)\n",
+ abnode->b.name, code));
return code;
}
abnode->everRun = 1;
@@ -163,7 +163,7 @@
/* construct local path from canonical (wire-format) path */
if (ConstructLocalBinPath(acommand, &cmdpath)) {
- bozo_Log("BNODE: command path invalid '%s'\n", acommand);
+ ViceLog(0,("BNODE: command path invalid '%s'\n", acommand));
return NULL;
}
@@ -199,8 +199,8 @@
bnode_SetTimeout(abnode, 0);
code = bnode_NewProc(abnode, abnode->command, NULL, &tp);
if (code) {
- bozo_Log("cron failed to start bnode %s (code %d)\n",
- abnode->b.name, code);
+ ViceLog(0,("cron failed to start bnode %s (code %d)\n",
+ abnode->b.name, code));
return code;
}
abnode->everRun = 1;
@@ -279,11 +279,11 @@
/* log interesting errors for folks */
if (aproc->lastSignal)
- bozo_Log("cron job %s exited due to signal %d\n", abnode->b.name,
- aproc->lastSignal);
+ ViceLog(0,("cron job %s exited due to signal %d\n", abnode->b.name,
+ aproc->lastSignal));
else if (aproc->lastExit)
- bozo_Log("cron job %s exited with non-zero code %d\n", abnode->b.name,
- aproc->lastExit);
+ ViceLog(0,("cron job %s exited with non-zero code %d\n", abnode->b.name,
+ aproc->lastExit));
abnode->waitingForShutdown = 0;
abnode->running = 0;
--------------060509090109070704070102--