5 #include <rpcsvc/sm_inter.h>
7 /* Default timeout can be changed using clnt_control() */
8 static struct timeval TIMEOUT = { 25, 0 };
15 static struct sm_stat_res res;
17 bzero((char *)&res, sizeof(res));
18 if (clnt_call(clnt, SM_STAT, (xdrproc_t)xdr_sm_name, argp,
19 (xdrproc_t)xdr_sm_stat_res, &res, TIMEOUT) != RPC_SUCCESS) {
31 static struct sm_stat_res res;
33 bzero((char *)&res, sizeof(res));
34 if (clnt_call(clnt, SM_MON, (xdrproc_t)xdr_mon, argp,
35 (xdrproc_t)xdr_sm_stat_res, &res, TIMEOUT) != RPC_SUCCESS) {
43 sm_unmon_1(argp, clnt)
47 static struct sm_stat res;
49 bzero((char *)&res, sizeof(res));
50 if (clnt_call(clnt, SM_UNMON, (xdrproc_t)xdr_mon_id, argp,
51 (xdrproc_t)xdr_sm_stat, &res, TIMEOUT) != RPC_SUCCESS) {
59 sm_unmon_all_1(argp, clnt)
63 static struct sm_stat res;
65 bzero((char *)&res, sizeof(res));
66 if (clnt_call(clnt, SM_UNMON_ALL, (xdrproc_t)xdr_my_id, argp,
67 (xdrproc_t)xdr_sm_stat, &res, TIMEOUT) != RPC_SUCCESS) {
75 sm_simu_crash_1(argp, clnt)
81 bzero((char *)&res, sizeof(res));
82 if (clnt_call(clnt, SM_SIMU_CRASH, (xdrproc_t)xdr_void, argp,
83 (xdrproc_t)xdr_void, &res, TIMEOUT) != RPC_SUCCESS) {
86 return ((void *)&res);
90 int main(int argc, char **argv)
99 fprintf(stderr, "usage: test <hostname> | crash\n");
100 fprintf(stderr, "always talks to statd at localhost\n");
104 printf("Creating client for localhost\n" );
105 cli = clnt_create("localhost", SM_PROG, SM_VERS, "udp");
108 printf("Failed to create client\n");
112 mon.mon_id.mon_name = argv[1];
113 mon.mon_id.my_id.my_name = argv[1];
114 mon.mon_id.my_id.my_prog = SM_PROG;
115 mon.mon_id.my_id.my_vers = SM_VERS;
116 mon.mon_id.my_id.my_proc = 1; /* have it call sm_stat() !!! */
118 if (strcmp(argv[1], "crash"))
121 struct sm_stat_res *res;
123 res = sm_mon_1(&mon, cli);
125 printf("Success!\n");
131 out = sm_simu_crash_1(&dummy, cli);
133 printf("Success!\n");