X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=blobdiff_plain;f=utils%2Fstatd%2Fsimulate.c;h=de8f1c947e0ef0e0238503479e493d10f3061efd;hp=4b8d59cad042b9dbf0d68788e047217eab7419c7;hb=c481a5416e5b937541205da23cde15cdabf106c1;hpb=b63400dcb05eee79666bade57558279fd15f0318 diff --git a/utils/statd/simulate.c b/utils/statd/simulate.c index 4b8d59c..de8f1c9 100644 --- a/utils/statd/simulate.c +++ b/utils/statd/simulate.c @@ -18,6 +18,7 @@ #include #include #include +#include #include "statd.h" #include "sim_sm_inter.h" @@ -71,7 +72,7 @@ simulate_mon (char *calling, char *monitoring, char *as, char *proggy, sm_stat_res *result; mon mon; - dprintf (L_DEBUG, "Calling %s (as %s) to monitor %s", calling, as, + dprintf (N_DEBUG, "Calling %s (as %s) to monitor %s", calling, as, monitoring); if ((client = clnt_create (calling, SM_PROG, SM_VERS, "udp")) == NULL) @@ -91,11 +92,11 @@ simulate_mon (char *calling, char *monitoring, char *as, char *proggy, free (mon.mon_id.my_id.my_name); if (result->res_stat != STAT_SUCC) { - log (L_FATAL, "SM_MON request failed, state: %d", result->state); + note (N_FATAL, "SM_MON request failed, state: %d", result->state); exit (0); } else { - dprintf (L_DEBUG, "SM_MON result successful, state: %d\n", result->state); - dprintf (L_DEBUG, "Waiting for callback."); + dprintf (N_DEBUG, "SM_MON result successful, state: %d\n", result->state); + dprintf (N_DEBUG, "Waiting for callback."); daemon_simulator (); exit (0); } @@ -108,7 +109,7 @@ simulate_unmon (char *calling, char *unmonitoring, char *as, char *proggy) sm_stat *result; mon_id mon_id; - dprintf (L_DEBUG, "Calling %s (as %s) to unmonitor %s", calling, as, + dprintf (N_DEBUG, "Calling %s (as %s) to unmonitor %s", calling, as, unmonitoring); if ((client = clnt_create (calling, SM_PROG, SM_VERS, "udp")) == NULL) @@ -124,7 +125,7 @@ simulate_unmon (char *calling, char *unmonitoring, char *as, char *proggy) die ("%s", clnt_sperror (client, "sm_unmon_1")); free (mon_id.my_id.my_name); - dprintf (L_DEBUG, "SM_UNMON request returned state: %d\n", result->state); + dprintf (N_DEBUG, "SM_UNMON request returned state: %d\n", result->state); exit (0); } @@ -135,7 +136,7 @@ simulate_unmon_all (char *calling, char *as, char *proggy) sm_stat *result; my_id my_id; - dprintf (L_DEBUG, "Calling %s (as %s) to unmonitor all hosts", calling, as); + dprintf (N_DEBUG, "Calling %s (as %s) to unmonitor all hosts", calling, as); if ((client = clnt_create (calling, SM_PROG, SM_VERS, "udp")) == NULL) die ("%s", clnt_spcreateerror ("clnt_create")); @@ -149,7 +150,7 @@ simulate_unmon_all (char *calling, char *as, char *proggy) die ("%s", clnt_sperror (client, "sm_unmon_all_1")); free (my_id.my_name); - dprintf (L_DEBUG, "SM_UNMON_ALL request returned state: %d\n", result->state); + dprintf (N_DEBUG, "SM_UNMON_ALL request returned state: %d\n", result->state); exit (0); } @@ -183,10 +184,10 @@ simulate_stat (char *calling, char *monitoring) die ("%s", clnt_sperror (client, "sm_stat_1")); if (result->res_stat == STAT_SUCC) - dprintf (L_DEBUG, "STAT_SUCC from %s for %s, state: %d", calling, + dprintf (N_DEBUG, "STAT_SUCC from %s for %s, state: %d", calling, monitoring, result->state); else - dprintf (L_DEBUG, "STAT_FAIL from %s for %s, state: %d", calling, + dprintf (N_DEBUG, "STAT_FAIL from %s for %s, state: %d", calling, monitoring, result->state); exit (0); @@ -195,7 +196,7 @@ simulate_stat (char *calling, char *monitoring) static void sim_killer (int sig) { - log (L_FATAL, "Simulator caught signal %d, un-registering and exiting.", sig); + note (N_FATAL, "Simulator caught signal %d, un-registering and exiting.", sig); pmap_unset (sim_port, SIM_SM_VERS); exit (0); } @@ -207,8 +208,8 @@ daemon_simulator (void) signal (SIGINT, sim_killer); signal (SIGTERM, sim_killer); pmap_unset (sim_port, SIM_SM_VERS); - do_regist (sim_port, sim_sm_prog_1); -/* do_regist (sim_port, (__dispatch_fn_t)sim_sm_prog_1); */ + /* this registers both UDP and TCP services */ + rpc_init("statd", sim_port, SIM_SM_VERS, sim_sm_prog_1, 0); svc_run (); pmap_unset (sim_port, SIM_SM_VERS); } @@ -218,7 +219,7 @@ sim_sm_mon_1_svc (struct status *argp, struct svc_req *rqstp) { static char *result; - dprintf (L_DEBUG, "Recieved state %d for mon_name %s (opaque \"%s\")", + dprintf (N_DEBUG, "Recieved state %d for mon_name %s (opaque \"%s\")", argp->state, argp->mon_name, argp->priv); svc_exit (); return ((void *)&result);