]> git.decadent.org.uk Git - nfs-utils.git/blob - utils/statd/stat.c
7d9d1b1a44060343a1d554bc473567d95e809bf7
[nfs-utils.git] / utils / statd / stat.c
1 /*
2  * Copyright (C) 1995, 1997, 1999 Jeffrey A. Uphoff
3  * Modified by Olaf Kirch, 1996.
4  *
5  * NSM for Linux.
6  */
7
8 #include "config.h"
9 #include <netdb.h>
10 #include "statd.h"
11
12 /* 
13  * Services SM_STAT requests.
14  *
15  * According the the X/Open spec's on this procedure: "Implementations
16  * should not rely on this procedure being operative.  In many current
17  * implementations of the NSM it will always return a 'STAT_FAIL'
18  * status."  My implementation is operative; it returns 'STAT_SUCC'
19  * whenever it can resolve the hostname that it's being asked to
20  * monitor, and returns 'STAT_FAIL' otherwise.
21  */
22 struct sm_stat_res * 
23 sm_stat_1_svc (struct sm_name *argp, struct svc_req *rqstp)
24 {
25   static sm_stat_res result;
26
27   if (gethostbyname (argp->mon_name) == NULL) {
28     note (N_WARNING, "gethostbyname error for %s", argp->mon_name);
29     result.res_stat = STAT_FAIL;
30     dprintf (N_DEBUG, "STAT_FAIL for %s", argp->mon_name);
31   } else {
32     result.res_stat = STAT_SUCC;
33     dprintf (N_DEBUG, "STAT_SUCC for %s", argp->mon_name);
34   }
35   result.state = MY_STATE;
36   return(&result);
37 }