summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--utils/statd/callback.c4
-rw-r--r--utils/statd/log.c8
-rw-r--r--utils/statd/log.h16
-rw-r--r--utils/statd/misc.c6
-rw-r--r--utils/statd/monitor.c36
-rw-r--r--utils/statd/notify.c4
-rw-r--r--utils/statd/rmtcall.c46
-rw-r--r--utils/statd/simu.c2
-rw-r--r--utils/statd/simulate.c24
-rw-r--r--utils/statd/stat.c6
-rw-r--r--utils/statd/statd.c12
-rw-r--r--utils/statd/state.c12
-rw-r--r--utils/statd/svc_run.c6
14 files changed, 97 insertions, 91 deletions
diff --git a/ChangeLog b/ChangeLog
index 75a025c..26fc697 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2003-08-22 Chip Salzenberg <chip@pobox.com>
+
+ * utils/statd/{log.h,log.c}: Rename log() to note() and L_* to
+ N_*, to avoid conflict with ISO C built-in log() function.
+ * utils/statd/*.c: Use note().
+
2003-08-20 Chip Salzenberg <chip@pobox.com>
* debian/changelog: Version 1.0.5-2.
diff --git a/utils/statd/callback.c b/utils/statd/callback.c
index c9c686d..0947727 100644
--- a/utils/statd/callback.c
+++ b/utils/statd/callback.c
@@ -26,14 +26,14 @@ sm_notify_1_svc(struct stat_chge *argp, struct svc_req *rqstp)
notify_list *lp, *call;
static char *result = NULL;
- dprintf(L_DEBUG, "Received SM_NOTIFY from %s, state: %d",
+ dprintf(N_DEBUG, "Received SM_NOTIFY from %s, state: %d",
argp->mon_name, argp->state);
/* quick check - don't bother if we're not monitoring anyone */
/* LH - this was != MULL, meaning that if anyone _was_ in our RTNL,
* we'd never pass this point. */
if (!(lp = rtnl)) {
- log(L_WARNING, "SM_NOTIFY from %s while not monitoring any hosts.",
+ note(N_WARNING, "SM_NOTIFY from %s while not monitoring any hosts.",
argp->mon_name, argp->state);
return ((void *) &result);
}
diff --git a/utils/statd/log.c b/utils/statd/log.c
index a8414b7..008f036 100644
--- a/utils/statd/log.c
+++ b/utils/statd/log.c
@@ -36,7 +36,7 @@ void log_init()
mypid = getpid();
- log(L_WARNING,"Version %s Starting",version_p);
+ note(N_WARNING,"Version %s Starting",version_p);
}
void log_background(void)
@@ -54,7 +54,7 @@ void die(char *fmt, ...)
va_end(ap);
buffer[1023]=0;
- log(L_FATAL, "%s", buffer);
+ note(N_FATAL, "%s", buffer);
#ifndef DEBUG
exit (2);
@@ -63,7 +63,7 @@ void die(char *fmt, ...)
#endif
}
-void log(int level, char *fmt, ...)
+void note(int level, char *fmt, ...)
{
char buffer[1024];
va_list ap;
@@ -73,7 +73,7 @@ void log(int level, char *fmt, ...)
va_end(ap);
buffer[1023]=0;
- if ((!(run_mode & MODE_LOG_STDERR)) && (level < L_DEBUG)) {
+ if ((!(run_mode & MODE_LOG_STDERR)) && (level < N_DEBUG)) {
syslog(level, "%s", buffer);
} else if (run_mode & MODE_LOG_STDERR) {
/* Log everything, including dprintf() stuff to stderr */
diff --git a/utils/statd/log.h b/utils/statd/log.h
index 723e6e3..49f801a 100644
--- a/utils/statd/log.h
+++ b/utils/statd/log.h
@@ -20,23 +20,23 @@ void log_init();
void log_background(void);
void log_enable(int facility);
int log_enabled(int facility);
-void log(int level, char *fmt, ...);
+void note(int level, char *fmt, ...);
void die(char *fmt, ...);
/*
* Map per-application severity to system severity. What's fatal for
* lockd is merely an itching spot from the universe's point of view.
*/
-#define L_CRIT LOG_CRIT
-#define L_FATAL LOG_ERR
-#define L_ERROR LOG_WARNING
-#define L_WARNING LOG_NOTICE
-#define L_DEBUG LOG_DEBUG
+#define N_CRIT LOG_CRIT
+#define N_FATAL LOG_ERR
+#define N_ERROR LOG_WARNING
+#define N_WARNING LOG_NOTICE
+#define N_DEBUG LOG_DEBUG
#ifdef DEBUG
-#define dprintf log
+#define dprintf note
#else
-#define dprintf if (run_mode & MODE_LOG_STDERR) log
+#define dprintf if (run_mode & MODE_LOG_STDERR) note
#endif
#endif /* _LOCKD_LOG_H_ */
diff --git a/utils/statd/misc.c b/utils/statd/misc.c
index d2365d6..a3752bb 100644
--- a/utils/statd/misc.c
+++ b/utils/statd/misc.c
@@ -64,10 +64,10 @@ xunlink (char *path, char *host, short int check)
if (!check || !nlist_gethost(rtnl, host, 0)) {
if (unlink (tozap) == -1)
- log (L_ERROR, "unlink (%s): %s", tozap, strerror (errno));
+ note (N_ERROR, "unlink (%s): %s", tozap, strerror (errno));
else
- dprintf (L_DEBUG, "Unlinked %s", tozap);
+ dprintf (N_DEBUG, "Unlinked %s", tozap);
}
else
- dprintf (L_DEBUG, "Not unlinking %s--host still monitored.", tozap);
+ dprintf (N_DEBUG, "Not unlinking %s--host still monitored.", tozap);
}
diff --git a/utils/statd/monitor.c b/utils/statd/monitor.c
index 732bf82..8c1bb50 100644
--- a/utils/statd/monitor.c
+++ b/utils/statd/monitor.c
@@ -58,7 +58,7 @@ sm_mon_1_svc(struct mon *argp, struct svc_req *rqstp)
*/
caller = svc_getcaller(rqstp->rq_xprt)->sin_addr;
if (caller.s_addr != htonl(INADDR_LOOPBACK)) {
- log(L_WARNING,
+ note(N_WARNING,
"Call to statd from non-local host %s",
inet_ntoa(caller));
goto failure;
@@ -77,7 +77,7 @@ sm_mon_1_svc(struct mon *argp, struct svc_req *rqstp)
if (id->my_prog != 100021 ||
(id->my_proc != 16 && id->my_proc != 24))
{
- log(L_WARNING,
+ note(N_WARNING,
"Attempt to register callback to %d/%d",
id->my_prog, id->my_proc);
goto failure;
@@ -87,7 +87,7 @@ sm_mon_1_svc(struct mon *argp, struct svc_req *rqstp)
* Again, specific to the linux kernel lockd.
*/
if (!inet_aton(mon_name, &mon_addr)) {
- log(L_WARNING,
+ note(N_WARNING,
"Attempt to register host %s (not a dotted quad)",
mon_name);
goto failure;
@@ -100,15 +100,15 @@ sm_mon_1_svc(struct mon *argp, struct svc_req *rqstp)
/* must check for /'s in hostname! See CERT's CA-96.09 for details. */
if (strchr(mon_name, '/')) {
- log(L_CRIT, "SM_MON request for hostname containing '/': %s",
+ note(N_CRIT, "SM_MON request for hostname containing '/': %s",
mon_name);
- log(L_CRIT, "POSSIBLE SPOOF/ATTACK ATTEMPT!");
+ note(N_CRIT, "POSSIBLE SPOOF/ATTACK ATTEMPT!");
goto failure;
} else if (gethostbyname(mon_name) == NULL) {
- log(L_WARNING, "gethostbyname error for %s", mon_name);
+ note(N_WARNING, "gethostbyname error for %s", mon_name);
goto failure;
} else if (!(hostinfo = gethostbyname(my_name))) {
- log(L_WARNING, "gethostbyname error for %s", my_name);
+ note(N_WARNING, "gethostbyname error for %s", my_name);
goto failure;
} else
my_addr = *(struct in_addr *) hostinfo->h_addr;
@@ -134,7 +134,7 @@ sm_mon_1_svc(struct mon *argp, struct svc_req *rqstp)
NL_MY_PROG(temp) == id->my_prog &&
NL_MY_VERS(temp) == id->my_vers) {
/* Hey! We already know you guys! */
- dprintf(L_DEBUG,
+ dprintf(N_DEBUG,
"Duplicate SM_MON request for %s "
"from procedure on %s",
mon_name, my_name);
@@ -153,7 +153,7 @@ sm_mon_1_svc(struct mon *argp, struct svc_req *rqstp)
* doesn't fail. (I should probably fix this assumption.)
*/
if (!(clnt = nlist_new(my_name, mon_name, 0))) {
- log(L_WARNING, "out of memory");
+ note(N_WARNING, "out of memory");
goto failure;
}
@@ -171,7 +171,7 @@ sm_mon_1_svc(struct mon *argp, struct svc_req *rqstp)
sprintf(path, "%s/%s", SM_DIR, mon_name);
if ((fd = open(path, O_WRONLY|O_SYNC|O_CREAT, S_IRUSR|S_IWUSR)) < 0) {
/* Didn't fly. We won't monitor. */
- log(L_ERROR, "creat(%s) failed: %m", path);
+ note(N_ERROR, "creat(%s) failed: %m", path);
nlist_free(NULL, clnt);
free(path);
goto failure;
@@ -182,11 +182,11 @@ sm_mon_1_svc(struct mon *argp, struct svc_req *rqstp)
result.res_stat = STAT_SUCC;
result.state = MY_STATE;
- dprintf(L_DEBUG, "MONITORING %s for %s", mon_name, my_name);
+ dprintf(N_DEBUG, "MONITORING %s for %s", mon_name, my_name);
return (&result);
failure:
- log(L_WARNING, "STAT_FAIL to %s for SM_MON of %s", my_name, mon_name);
+ note(N_WARNING, "STAT_FAIL to %s for SM_MON of %s", my_name, mon_name);
return (&result);
}
@@ -212,7 +212,7 @@ sm_unmon_1_svc(struct mon_id *argp, struct svc_req *rqstp)
/* Check if we're monitoring anyone. */
if (!(clnt = rtnl)) {
- log(L_WARNING,
+ note(N_WARNING,
"Received SM_UNMON request from %s for %s while not "
"monitoring any hosts.", my_name, argp->mon_name);
return (&result);
@@ -230,7 +230,7 @@ sm_unmon_1_svc(struct mon_id *argp, struct svc_req *rqstp)
NL_MY_PROG(clnt) == id->my_prog &&
NL_MY_VERS(clnt) == id->my_vers) {
/* Match! */
- dprintf(L_DEBUG, "UNMONITORING %s for %s",
+ dprintf(N_DEBUG, "UNMONITORING %s for %s",
mon_name, my_name);
nlist_free(&rtnl, clnt);
xunlink(SM_DIR, mon_name, 1);
@@ -240,7 +240,7 @@ sm_unmon_1_svc(struct mon_id *argp, struct svc_req *rqstp)
clnt = NL_NEXT(clnt);
}
- log(L_WARNING, "Received erroneous SM_UNMON request from %s for %s",
+ note(N_WARNING, "Received erroneous SM_UNMON request from %s for %s",
my_name, mon_name);
return (&result);
}
@@ -256,7 +256,7 @@ sm_unmon_all_1_svc(struct my_id *argp, struct svc_req *rqstp)
result.state = MY_STATE;
if (!(clnt = rtnl)) {
- log(L_WARNING, "Received SM_UNMON_ALL request from %s "
+ note(N_WARNING, "Received SM_UNMON_ALL request from %s "
"while not monitoring any hosts", argp->my_name);
return (&result);
}
@@ -269,7 +269,7 @@ sm_unmon_all_1_svc(struct my_id *argp, struct svc_req *rqstp)
char mon_name[SM_MAXSTRLEN + 1];
notify_list *temp;
- dprintf(L_DEBUG,
+ dprintf(N_DEBUG,
"UNMONITORING (SM_UNMON_ALL) %s for %s",
NL_MON_NAME(clnt), NL_MY_NAME(clnt));
strncpy(mon_name, NL_MON_NAME(clnt),
@@ -285,7 +285,7 @@ sm_unmon_all_1_svc(struct my_id *argp, struct svc_req *rqstp)
}
if (!count) {
- dprintf(L_DEBUG, "SM_UNMON_ALL request from %s with no "
+ dprintf(N_DEBUG, "SM_UNMON_ALL request from %s with no "
"SM_MON requests from it.", argp->my_name);
}
diff --git a/utils/statd/notify.c b/utils/statd/notify.c
index c3b4ca5..ffe2da6 100644
--- a/utils/statd/notify.c
+++ b/utils/statd/notify.c
@@ -54,10 +54,10 @@ notify_hosts(void)
|| matchhostname(de->d_name, "localhost")) {
char *fname;
fname=xmalloc(strlen(SM_BAK_DIR)+sizeof(de->d_name)+2);
- dprintf(L_DEBUG, "We're on our own notify list?!?");
+ dprintf(N_DEBUG, "We're on our own notify list?!?");
sprintf(fname, "%s/%s", SM_BAK_DIR, de->d_name);
if (unlink(fname))
- log(L_ERROR, "unlink(%s): %s",
+ note(N_ERROR, "unlink(%s): %s",
fname, strerror(errno));
free(fname);
continue;
diff --git a/utils/statd/rmtcall.c b/utils/statd/rmtcall.c
index f01faba..2997254 100644
--- a/utils/statd/rmtcall.c
+++ b/utils/statd/rmtcall.c
@@ -56,7 +56,7 @@ statd_get_socket(int port)
return sockfd;
if ((sockfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) {
- log(L_CRIT, "Can't create socket: %m");
+ note(N_CRIT, "Can't create socket: %m");
return -1;
}
@@ -66,7 +66,7 @@ statd_get_socket(int port)
sin.sin_family = AF_INET;
sin.sin_port = port;
if (bindresvport(sockfd, &sin) < 0) {
- dprintf(L_WARNING,
+ dprintf(N_WARNING,
"process_hosts: can't bind to reserved port\n");
}
@@ -90,7 +90,7 @@ try_to_resolve(notify_list *lp)
else
hname = NL_MY_NAME(lp);
if (!inet_aton(hname, &(NL_ADDR(lp)))) {
- log(L_ERROR, "%s is not an dotted-quad address", hname);
+ note(N_ERROR, "%s is not an dotted-quad address", hname);
NL_TIMES(lp) = 0;
return 0;
}
@@ -113,7 +113,7 @@ try_to_resolve(notify_list *lp)
else
hname = NL_MY_NAME(lp);
- dprintf(L_DEBUG, "Trying to resolve %s.", hname);
+ dprintf(N_DEBUG, "Trying to resolve %s.", hname);
if (!(hp = gethostbyname(hname))) {
herror("gethostbyname");
NL_TIMES(lp) -= 1;
@@ -121,7 +121,7 @@ try_to_resolve(notify_list *lp)
}
if (hp->h_addrtype != AF_INET) {
- log(L_ERROR, "%s is not an AF_INET address", hname);
+ note(N_ERROR, "%s is not an AF_INET address", hname);
NL_TIMES(lp) = 0;
return 0;
}
@@ -130,7 +130,7 @@ try_to_resolve(notify_list *lp)
* alternation because one interface might be down/unreachable. */
NL_ADDR(lp) = *(struct in_addr *) hp->h_addr;
- dprintf(L_DEBUG, "address of %s is %s", hname, inet_ntoa(NL_ADDR(lp)));
+ dprintf(N_DEBUG, "address of %s is %s", hname, inet_ntoa(NL_ADDR(lp)));
return 1;
}
#endif
@@ -181,7 +181,7 @@ xmit_call(int sockfd, struct sockaddr_in *sin,
/* Encode the RPC header part and payload */
if (!xdr_callmsg(xdrs, &mesg) || !func(xdrs, obj)) {
- dprintf(L_WARNING, "xmit_mesg: can't encode RPC message!\n");
+ dprintf(N_WARNING, "xmit_mesg: can't encode RPC message!\n");
xdr_destroy(xdrs);
return 0;
}
@@ -191,9 +191,9 @@ xmit_call(int sockfd, struct sockaddr_in *sin,
if ((err = sendto(sockfd, msgbuf, msglen, 0,
(struct sockaddr *) sin, sizeof(*sin))) < 0) {
- dprintf(L_WARNING, "xmit_mesg: sendto failed: %m");
+ dprintf(N_WARNING, "xmit_mesg: sendto failed: %m");
} else if (err != msglen) {
- dprintf(L_WARNING, "xmit_mesg: short write: %m\n");
+ dprintf(N_WARNING, "xmit_mesg: short write: %m\n");
}
xdr_destroy(xdrs);
@@ -213,7 +213,7 @@ recv_rply(int sockfd, struct sockaddr_in *sin, u_long *portp)
/* Receive message */
if ((msglen = recvfrom(sockfd, msgbuf, sizeof(msgbuf), 0,
(struct sockaddr *) sin, &alen)) < 0) {
- dprintf(L_WARNING, "recv_rply: recvfrom failed: %m");
+ dprintf(N_WARNING, "recv_rply: recvfrom failed: %m");
return NULL;
}
@@ -225,18 +225,18 @@ recv_rply(int sockfd, struct sockaddr_in *sin, u_long *portp)
mesg.rm_reply.rp_acpt.ar_results.proc = (xdrproc_t) xdr_void;
if (!xdr_replymsg(xdrs, &mesg)) {
- log(L_WARNING, "recv_rply: can't decode RPC message!\n");
+ note(N_WARNING, "recv_rply: can't decode RPC message!\n");
goto done;
}
if (mesg.rm_reply.rp_stat != 0) {
- log(L_WARNING, "recv_rply: [%s] RPC status %d\n",
+ note(N_WARNING, "recv_rply: [%s] RPC status %d\n",
inet_ntoa(sin->sin_addr),
mesg.rm_reply.rp_stat);
goto done;
}
if (mesg.rm_reply.rp_acpt.ar_stat != 0) {
- log(L_WARNING, "recv_rply: [%s] RPC status %d\n",
+ note(N_WARNING, "recv_rply: [%s] RPC status %d\n",
inet_ntoa(sin->sin_addr),
mesg.rm_reply.rp_acpt.ar_stat);
goto done;
@@ -253,13 +253,13 @@ recv_rply(int sockfd, struct sockaddr_in *sin, u_long *portp)
strncpy (addr, inet_ntoa(lp->addr),
sizeof (addr) - 1);
addr [sizeof (addr) - 1] = '\0';
- dprintf(L_WARNING, "address mismatch: "
+ dprintf(N_WARNING, "address mismatch: "
"expected %s, got %s\n",
addr, inet_ntoa(sin->sin_addr));
}
if (lp->port == 0) {
if (!xdr_u_long(xdrs, portp)) {
- log(L_WARNING, "recv_rply: [%s] "
+ note(N_WARNING, "recv_rply: [%s] "
"can't decode reply body!\n",
inet_ntoa(sin->sin_addr));
lp = NULL;
@@ -290,7 +290,7 @@ process_entry(int sockfd, notify_list *lp)
if (lp->addr.s_addr == INADDR_ANY && !try_to_resolve(lp))
return NL_TIMES(lp);
if (NL_TIMES(lp) == 0) {
- log(L_DEBUG, "Cannot notify %s, giving up.\n",
+ note(N_DEBUG, "Cannot notify %s, giving up.\n",
inet_ntoa(NL_ADDR(lp)));
return 0;
}
@@ -328,14 +328,14 @@ process_entry(int sockfd, notify_list *lp)
memcpy(new_status.priv, NL_PRIV(lp), SM_PRIV_SIZE);
break;
default:
- log(L_ERROR, "notify_host: unknown notify type %d",
+ note(N_ERROR, "notify_host: unknown notify type %d",
NL_TYPE(lp));
return 0;
}
lp->xid = xmit_call(sockfd, &sin, prog, vers, proc, func, objp);
if (!lp->xid) {
- log(L_WARNING, "notify_host: failed to notify %s\n",
+ note(N_WARNING, "notify_host: failed to notify %s\n",
inet_ntoa(lp->addr));
}
NL_TIMES(lp) -= 1;
@@ -368,15 +368,15 @@ process_reply(FD_SET_TYPE *rfds)
nlist_insert_timer(&notify, lp);
return 1;
}
- log(L_WARNING, "recv_rply: [%s] service %d not registered",
+ note(N_WARNING, "recv_rply: [%s] service %d not registered",
inet_ntoa(lp->addr),
NL_TYPE(lp) == NOTIFY_REBOOT? SM_PROG : NL_MY_PROG(lp));
} else if (NL_TYPE(lp) == NOTIFY_REBOOT) {
- dprintf(L_DEBUG, "Notification of %s succeeded.",
+ dprintf(N_DEBUG, "Notification of %s succeeded.",
NL_MON_NAME(lp));
xunlink(SM_BAK_DIR, NL_MON_NAME(lp), 0);
} else {
- dprintf(L_DEBUG, "Callback to %s (for %d) succeeded.",
+ dprintf(N_DEBUG, "Callback to %s (for %d) succeeded.",
NL_MY_NAME(lp), NL_MON_NAME(lp));
}
nlist_free(&notify, lp);
@@ -404,14 +404,14 @@ process_notify_list(void)
nlist_remove(&notify, entry);
nlist_insert_timer(&notify, entry);
} else if (NL_TYPE(entry) == NOTIFY_CALLBACK) {
- log(L_ERROR,
+ note(N_ERROR,
"Can't callback %s (%d,%d), giving up.",
NL_MY_NAME(entry),
NL_MY_PROG(entry),
NL_MY_VERS(entry));
nlist_free(&notify, entry);
} else {
- log(L_ERROR,
+ note(N_ERROR,
"Can't notify %s, giving up.",
NL_MON_NAME(entry));
xunlink(SM_BAK_DIR, NL_MON_NAME(entry), 0);
diff --git a/utils/statd/simu.c b/utils/statd/simu.c
index fa4e3a6..78a6ee2 100644
--- a/utils/statd/simu.c
+++ b/utils/statd/simu.c
@@ -19,7 +19,7 @@ sm_simu_crash_1_svc (void *argp, struct svc_req *rqstp)
{
static char *result = NULL;
- log (L_WARNING, "*** SIMULATING CRASH! ***");
+ note (N_WARNING, "*** SIMULATING CRASH! ***");
my_svc_exit ();
if (rtnl)
diff --git a/utils/statd/simulate.c b/utils/statd/simulate.c
index 3bebfc7..de8f1c9 100644
--- a/utils/statd/simulate.c
+++ b/utils/statd/simulate.c
@@ -72,7 +72,7 @@ simulate_mon (char *calling, char *monitoring, char *as, char *proggy,
sm_stat_res *result;
mon mon;
- dprintf (L_DEBUG, "Calling %s (as %s) to monitor %s", calling, as,
+ dprintf (N_DEBUG, "Calling %s (as %s) to monitor %s", calling, as,
monitoring);
if ((client = clnt_create (calling, SM_PROG, SM_VERS, "udp")) == NULL)
@@ -92,11 +92,11 @@ simulate_mon (char *calling, char *monitoring, char *as, char *proggy,
free (mon.mon_id.my_id.my_name);
if (result->res_stat != STAT_SUCC) {
- log (L_FATAL, "SM_MON request failed, state: %d", result->state);
+ note (N_FATAL, "SM_MON request failed, state: %d", result->state);
exit (0);
} else {
- dprintf (L_DEBUG, "SM_MON result successful, state: %d\n", result->state);
- dprintf (L_DEBUG, "Waiting for callback.");
+ dprintf (N_DEBUG, "SM_MON result successful, state: %d\n", result->state);
+ dprintf (N_DEBUG, "Waiting for callback.");
daemon_simulator ();
exit (0);
}
@@ -109,7 +109,7 @@ simulate_unmon (char *calling, char *unmonitoring, char *as, char *proggy)
sm_stat *result;
mon_id mon_id;
- dprintf (L_DEBUG, "Calling %s (as %s) to unmonitor %s", calling, as,
+ dprintf (N_DEBUG, "Calling %s (as %s) to unmonitor %s", calling, as,
unmonitoring);
if ((client = clnt_create (calling, SM_PROG, SM_VERS, "udp")) == NULL)
@@ -125,7 +125,7 @@ simulate_unmon (char *calling, char *unmonitoring, char *as, char *proggy)
die ("%s", clnt_sperror (client, "sm_unmon_1"));
free (mon_id.my_id.my_name);
- dprintf (L_DEBUG, "SM_UNMON request returned state: %d\n", result->state);
+ dprintf (N_DEBUG, "SM_UNMON request returned state: %d\n", result->state);
exit (0);
}
@@ -136,7 +136,7 @@ simulate_unmon_all (char *calling, char *as, char *proggy)
sm_stat *result;
my_id my_id;
- dprintf (L_DEBUG, "Calling %s (as %s) to unmonitor all hosts", calling, as);
+ dprintf (N_DEBUG, "Calling %s (as %s) to unmonitor all hosts", calling, as);
if ((client = clnt_create (calling, SM_PROG, SM_VERS, "udp")) == NULL)
die ("%s", clnt_spcreateerror ("clnt_create"));
@@ -150,7 +150,7 @@ simulate_unmon_all (char *calling, char *as, char *proggy)
die ("%s", clnt_sperror (client, "sm_unmon_all_1"));
free (my_id.my_name);
- dprintf (L_DEBUG, "SM_UNMON_ALL request returned state: %d\n", result->state);
+ dprintf (N_DEBUG, "SM_UNMON_ALL request returned state: %d\n", result->state);
exit (0);
}
@@ -184,10 +184,10 @@ simulate_stat (char *calling, char *monitoring)
die ("%s", clnt_sperror (client, "sm_stat_1"));
if (result->res_stat == STAT_SUCC)
- dprintf (L_DEBUG, "STAT_SUCC from %s for %s, state: %d", calling,
+ dprintf (N_DEBUG, "STAT_SUCC from %s for %s, state: %d", calling,
monitoring, result->state);
else
- dprintf (L_DEBUG, "STAT_FAIL from %s for %s, state: %d", calling,
+ dprintf (N_DEBUG, "STAT_FAIL from %s for %s, state: %d", calling,
monitoring, result->state);
exit (0);
@@ -196,7 +196,7 @@ simulate_stat (char *calling, char *monitoring)
static void
sim_killer (int sig)
{
- log (L_FATAL, "Simulator caught signal %d, un-registering and exiting.", sig);
+ note (N_FATAL, "Simulator caught signal %d, un-registering and exiting.", sig);
pmap_unset (sim_port, SIM_SM_VERS);
exit (0);
}
@@ -219,7 +219,7 @@ sim_sm_mon_1_svc (struct status *argp, struct svc_req *rqstp)
{
static char *result;
- dprintf (L_DEBUG, "Recieved state %d for mon_name %s (opaque \"%s\")",
+ dprintf (N_DEBUG, "Recieved state %d for mon_name %s (opaque \"%s\")",
argp->state, argp->mon_name, argp->priv);
svc_exit ();
return ((void *)&result);
diff --git a/utils/statd/stat.c b/utils/statd/stat.c
index 021e786..7d9d1b1 100644
--- a/utils/statd/stat.c
+++ b/utils/statd/stat.c
@@ -25,12 +25,12 @@ sm_stat_1_svc (struct sm_name *argp, struct svc_req *rqstp)
static sm_stat_res result;
if (gethostbyname (argp->mon_name) == NULL) {
- log (L_WARNING, "gethostbyname error for %s", argp->mon_name);
+ note (N_WARNING, "gethostbyname error for %s", argp->mon_name);
result.res_stat = STAT_FAIL;
- dprintf (L_DEBUG, "STAT_FAIL for %s", argp->mon_name);
+ dprintf (N_DEBUG, "STAT_FAIL for %s", argp->mon_name);
} else {
result.res_stat = STAT_SUCC;
- dprintf (L_DEBUG, "STAT_SUCC for %s", argp->mon_name);
+ dprintf (N_DEBUG, "STAT_SUCC for %s", argp->mon_name);
}
result.state = MY_STATE;
return(&result);
diff --git a/utils/statd/statd.c b/utils/statd/statd.c
index dbd73b3..93c394f 100644
--- a/utils/statd/statd.c
+++ b/utils/statd/statd.c
@@ -94,7 +94,7 @@ sm_prog_1_wrapper (struct svc_req *rqstp, register SVCXPRT *transp)
static void
killer (int sig)
{
- log (L_FATAL, "Caught signal %d, un-registering and exiting.", sig);
+ note (N_FATAL, "Caught signal %d, un-registering and exiting.", sig);
if (!(run_mode & MODE_NOTIFY_ONLY))
pmap_unset (SM_PROG, SM_VERS);
@@ -122,11 +122,11 @@ static void log_modes(void)
{
strcat(buf,"Notify-Only ");
}
- log(L_WARNING,buf);
+ note(N_WARNING,buf);
/* future: IP aliasing
if (run_mode & MODE_NOTIFY_ONLY)
{
- dprintf(L_DEBUG,"Notify IP: %s",svr_addr);
+ dprintf(N_DEBUG,"Notify IP: %s",svr_addr);
} */
}
@@ -164,7 +164,7 @@ static void create_pidfile(void)
fprintf(fp, "%d\n", getpid());
pidfd = dup(fileno(fp));
if (fclose(fp) < 0)
- log(L_WARNING, "Flushing pid file failed.\n");
+ note(N_WARNING, "Flushing pid file failed.\n");
}
static void truncate_pidfile(void)
@@ -182,7 +182,7 @@ static void drop_privs(void)
st.st_uid = 0;
if (st.st_uid == 0) {
- log(L_WARNING, "statd running as root. chown %s to choose different user\n",
+ note(N_WARNING, "statd running as root. chown %s to choose different user\n",
SM_DIR);
return;
}
@@ -195,7 +195,7 @@ static void drop_privs(void)
setgroups(0, NULL);
if (setgid(st.st_gid) == -1
|| setuid(st.st_uid) == -1) {
- log(L_ERROR, "Fail to drop privileges");
+ note(N_ERROR, "Fail to drop privileges");
exit(1);
}
}
diff --git a/utils/statd/state.c b/utils/statd/state.c
index 6becdc7..c241985 100644
--- a/utils/statd/state.c
+++ b/utils/statd/state.c
@@ -34,7 +34,7 @@ change_state (void)
die ("read (%s): %s", SM_STAT_PATH, strerror (errno));
if (size != 0 && size != sizeof MY_STATE) {
- log (L_ERROR, "Error in status file format...correcting.");
+ note (N_ERROR, "Error in status file format...correcting.");
if (close (fd) == -1)
die ("close (%s): %s", SM_STAT_PATH, strerror (errno));
@@ -42,7 +42,7 @@ change_state (void)
if ((fd = creat (SM_STAT_PATH, S_IRUSR | S_IWUSR)) == -1)
die ("creat (%s): %s", SM_STAT_PATH, strerror (errno));
}
- log (L_DEBUG, "New state: %u", (++MY_STATE % 2) ? MY_STATE : ++MY_STATE);
+ note (N_DEBUG, "New state: %u", (++MY_STATE % 2) ? MY_STATE : ++MY_STATE);
if (lseek (fd, 0, SEEK_SET) == -1)
die ("lseek (%s): %s", SM_STAT_PATH, strerror (errno));
@@ -51,10 +51,10 @@ change_state (void)
die ("write (%s): %s", SM_STAT_PATH, strerror (errno));
if (fsync (fd) == -1)
- log (L_ERROR, "fsync (%s): %s", SM_STAT_PATH, strerror (errno));
+ note (N_ERROR, "fsync (%s): %s", SM_STAT_PATH, strerror (errno));
if (close (fd) == -1)
- log (L_ERROR, "close (%s): %s", SM_STAT_PATH, strerror (errno));
+ note (N_ERROR, "close (%s): %s", SM_STAT_PATH, strerror (errno));
if (MY_NAME == NULL) {
char fullhost[SM_MAXSTRLEN + 1];
@@ -64,7 +64,7 @@ change_state (void)
die ("gethostname: %s", strerror (errno));
if ((hostinfo = gethostbyname (fullhost)) == NULL)
- log (L_ERROR, "gethostbyname error for %s", fullhost);
+ note (N_ERROR, "gethostbyname error for %s", fullhost);
else {
strncpy (fullhost, hostinfo->h_name, sizeof (fullhost) - 1);
fullhost[sizeof (fullhost) - 1] = '\0';
@@ -122,5 +122,5 @@ shuffle_dirs (void)
free(dst);
}
if (closedir (nld) == -1)
- log (L_ERROR, "closedir (%s): %s", SM_DIR, strerror (errno));
+ note (N_ERROR, "closedir (%s): %s", SM_DIR, strerror (errno));
}
diff --git a/utils/statd/svc_run.c b/utils/statd/svc_run.c
index 0adbbbe..393a2fd 100644
--- a/utils/statd/svc_run.c
+++ b/utils/statd/svc_run.c
@@ -98,12 +98,12 @@ my_svc_run(void)
tv.tv_sec = NL_WHEN(notify) - now;
tv.tv_usec = 0;
- dprintf(L_DEBUG, "Waiting for reply... (timeo %d)",
+ dprintf(N_DEBUG, "Waiting for reply... (timeo %d)",
tv.tv_sec);
selret = select(FD_SETSIZE, &readfds,
(void *) 0, (void *) 0, &tv);
} else {
- dprintf(L_DEBUG, "Waiting for client connections.");
+ dprintf(N_DEBUG, "Waiting for client connections.");
selret = select(FD_SETSIZE, &readfds,
(void *) 0, (void *) 0, (struct timeval *) 0);
}
@@ -113,7 +113,7 @@ my_svc_run(void)
if (errno == EINTR || errno == ECONNREFUSED
|| errno == ENETUNREACH || errno == EHOSTUNREACH)
continue;
- log(L_ERROR, "my_svc_run() - select: %m");
+ note(N_ERROR, "my_svc_run() - select: %m");
return;
case 0: