summaryrefslogtreecommitdiffstats
path: root/utils/statd/stat.c
diff options
context:
space:
mode:
authorhjl <hjl>1999-10-18 23:21:12 +0000
committerhjl <hjl>1999-10-18 23:21:12 +0000
commit8b7ad01b14df1e7529b9ba8a1ea17df0d6004ef9 (patch)
tree0904ef8554ed680fe3244fa618685e1fb7ea148b /utils/statd/stat.c
downloadnfs-utils-8b7ad01b14df1e7529b9ba8a1ea17df0d6004ef9.tar.gz
nfs-utils-8b7ad01b14df1e7529b9ba8a1ea17df0d6004ef9.tar.xz
nfs-utils-8b7ad01b14df1e7529b9ba8a1ea17df0d6004ef9.zip
Initial revision
Diffstat (limited to 'utils/statd/stat.c')
-rw-r--r--utils/statd/stat.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/utils/statd/stat.c b/utils/statd/stat.c
new file mode 100644
index 0000000..021e786
--- /dev/null
+++ b/utils/statd/stat.c
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 1995, 1997, 1999 Jeffrey A. Uphoff
+ * Modified by Olaf Kirch, 1996.
+ *
+ * NSM for Linux.
+ */
+
+#include "config.h"
+#include <netdb.h>
+#include "statd.h"
+
+/*
+ * Services SM_STAT requests.
+ *
+ * According the the X/Open spec's on this procedure: "Implementations
+ * should not rely on this procedure being operative. In many current
+ * implementations of the NSM it will always return a 'STAT_FAIL'
+ * status." My implementation is operative; it returns 'STAT_SUCC'
+ * whenever it can resolve the hostname that it's being asked to
+ * monitor, and returns 'STAT_FAIL' otherwise.
+ */
+struct sm_stat_res *
+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);
+ result.res_stat = STAT_FAIL;
+ dprintf (L_DEBUG, "STAT_FAIL for %s", argp->mon_name);
+ } else {
+ result.res_stat = STAT_SUCC;
+ dprintf (L_DEBUG, "STAT_SUCC for %s", argp->mon_name);
+ }
+ result.state = MY_STATE;
+ return(&result);
+}