2 static const char rcsid[] =
10 #include <rpcsvc/sm_inter.h>
12 /* Default timeout can be changed using clnt_control() */
13 static struct timeval TIMEOUT = { 25, 0 };
20 static struct sm_stat_res res;
22 bzero((char *)&res, sizeof(res));
23 if (clnt_call(clnt, SM_STAT, (xdrproc_t)xdr_sm_name, argp,
24 (xdrproc_t)xdr_sm_stat_res, &res, TIMEOUT) != RPC_SUCCESS) {
36 static struct sm_stat_res res;
38 bzero((char *)&res, sizeof(res));
39 if (clnt_call(clnt, SM_MON, (xdrproc_t)xdr_mon, argp,
40 (xdrproc_t)xdr_sm_stat_res, &res, TIMEOUT) != RPC_SUCCESS) {
48 sm_unmon_1(argp, clnt)
52 static struct sm_stat res;
54 bzero((char *)&res, sizeof(res));
55 if (clnt_call(clnt, SM_UNMON, (xdrproc_t)xdr_mon_id, argp,
56 (xdrproc_t)xdr_sm_stat, &res, TIMEOUT) != RPC_SUCCESS) {
64 sm_unmon_all_1(argp, clnt)
68 static struct sm_stat res;
70 bzero((char *)&res, sizeof(res));
71 if (clnt_call(clnt, SM_UNMON_ALL, (xdrproc_t)xdr_my_id, argp,
72 (xdrproc_t)xdr_sm_stat, &res, TIMEOUT) != RPC_SUCCESS) {
80 sm_simu_crash_1(argp, clnt)
86 bzero((char *)&res, sizeof(res));
87 if (clnt_call(clnt, SM_SIMU_CRASH, (xdrproc_t)xdr_void, argp,
88 (xdrproc_t)xdr_void, &res, TIMEOUT) != RPC_SUCCESS) {
91 return ((void *)&res);
95 int main(int argc, char **argv)
104 fprintf(stderr, "usage: test <hostname> | crash\n");
105 fprintf(stderr, "always talks to statd at localhost\n");
109 printf("Creating client for localhost\n" );
110 cli = clnt_create("localhost", SM_PROG, SM_VERS, "udp");
113 printf("Failed to create client\n");
117 mon.mon_id.mon_name = argv[1];
118 mon.mon_id.my_id.my_name = argv[1];
119 mon.mon_id.my_id.my_prog = SM_PROG;
120 mon.mon_id.my_id.my_vers = SM_VERS;
121 mon.mon_id.my_id.my_proc = 1; /* have it call sm_stat() !!! */
123 if (strcmp(argv[1], "crash"))
126 struct sm_stat_res *res;
128 res = sm_mon_1(&mon, cli);
130 printf("Success!\n");
136 out = sm_simu_crash_1(&dummy, cli);
138 printf("Success!\n");