1 /* $NetBSD: test.c,v 1.1 1997/03/10 06:28:32 scottr Exp $ */
5 __RCSID("$NetBSD: statd.c,v 1.4 1997/10/17 13:21:06 lukem Exp $");
10 #include <rpcsvc/sm_inter.h>
13 /* Default timeout can be changed using clnt_control() */
14 static struct timeval TIMEOUT
= {25, 0};
21 static struct sm_stat_res res
;
23 bzero((char *) &res
, sizeof(res
));
24 if (clnt_call(clnt
, SM_STAT
, xdr_sm_name
, argp
, xdr_sm_stat_res
,
25 &res
, TIMEOUT
) != RPC_SUCCESS
)
36 static struct sm_stat_res res
;
38 bzero((char *) &res
, sizeof(res
));
39 if (clnt_call(clnt
, SM_MON
, xdr_mon
, argp
, xdr_sm_stat_res
,
40 &res
, TIMEOUT
) != RPC_SUCCESS
)
47 sm_unmon_1(argp
, clnt
)
51 static struct sm_stat res
;
53 bzero((char *) &res
, sizeof(res
));
54 if (clnt_call(clnt
, SM_UNMON
, xdr_mon_id
, argp
, xdr_sm_stat
,
55 &res
, TIMEOUT
) != RPC_SUCCESS
)
62 sm_unmon_all_1(argp
, clnt
)
66 static struct sm_stat res
;
68 bzero((char *) &res
, sizeof(res
));
69 if (clnt_call(clnt
, SM_UNMON_ALL
, xdr_my_id
, argp
, xdr_sm_stat
,
70 &res
, TIMEOUT
) != RPC_SUCCESS
)
77 sm_simu_crash_1(argp
, clnt
)
83 bzero((char *) &res
, sizeof(res
));
84 if (clnt_call(clnt
, SM_SIMU_CRASH
, xdr_void
, argp
, xdr_void
,
85 &res
, TIMEOUT
) != RPC_SUCCESS
)
87 return ((void *) &res
);
102 warnx("usage: test {<hostname> | crash}");
103 errx(1, "Always talks to statd at localhost");
105 printf("Creating client for localhost\n");
106 cli
= clnt_create("localhost", SM_PROG
, SM_VERS
, "udp");
108 errx(1, "Failed to create client");
110 mon
.mon_id
.mon_name
= argv
[1];
111 mon
.mon_id
.my_id
.my_name
= argv
[1];
112 mon
.mon_id
.my_id
.my_prog
= SM_PROG
;
113 mon
.mon_id
.my_id
.my_vers
= SM_VERS
;
114 mon
.mon_id
.my_id
.my_proc
= 1; /* have it call sm_stat() !!! */
116 if (strcmp(argv
[1], "crash")) {
118 struct sm_stat_res
*res
;
119 if (res
= sm_mon_1(&mon
, cli
))
120 printf("Success!\n");
124 if (out
= sm_simu_crash_1(&dummy
, cli
))
125 printf("Success!\n");