]>
git.saurik.com Git - apple/network_cmds.git/blob - rpc_statd.tproj/test.c
3 static const char rcsid
[] =
9 #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
, xdr_sm_name
, argp
, xdr_sm_stat_res
, &res
, TIMEOUT
) != RPC_SUCCESS
) {
35 static struct sm_stat_res res
;
37 bzero((char *)&res
, sizeof(res
));
38 if (clnt_call(clnt
, SM_MON
, xdr_mon
, argp
, xdr_sm_stat_res
, &res
, TIMEOUT
) != RPC_SUCCESS
) {
46 sm_unmon_1(argp
, clnt
)
50 static struct sm_stat res
;
52 bzero((char *)&res
, sizeof(res
));
53 if (clnt_call(clnt
, SM_UNMON
, xdr_mon_id
, argp
, xdr_sm_stat
, &res
, TIMEOUT
) != RPC_SUCCESS
) {
61 sm_unmon_all_1(argp
, clnt
)
65 static struct sm_stat res
;
67 bzero((char *)&res
, sizeof(res
));
68 if (clnt_call(clnt
, SM_UNMON_ALL
, xdr_my_id
, argp
, xdr_sm_stat
, &res
, TIMEOUT
) != RPC_SUCCESS
) {
76 sm_simu_crash_1(argp
, clnt
)
82 bzero((char *)&res
, sizeof(res
));
83 if (clnt_call(clnt
, SM_SIMU_CRASH
, xdr_void
, argp
, 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
;
122 if (res
= sm_mon_1(&mon
, cli
))
124 printf("Success!\n");
133 if (out
= sm_simu_crash_1(&dummy
, cli
))
135 printf("Success!\n");