~ubuntu-branches/debian/stretch/nfs-utils/stretch

« back to all changes in this revision

Viewing changes to utils/statd/simulate.c

  • Committer: Bazaar Package Importer
  • Author(s): Anibal Monsalve Salazar, Anibal Monsalve Salazar, Ben Hutchings
  • Date: 2010-04-06 16:11:22 UTC
  • mfrom: (1.2.18 upstream)
  • Revision ID: james.westby@ubuntu.com-20100406161122-x7erw0q8xiitoyp6
Tags: 1:1.2.2-1
[ Anibal Monsalve Salazar ]
* New upstream release 
  Build depend on libcap-dev
  Set configure option --enable-nfsv41
* X-ref nfsd({7,8})
  02-524255-manpages.patch by Cyril Brulebois
  Closes: 524255

[ Ben Hutchings ]
* Change maintainer to Debian kernel team; move Aníbal to uploaders and
  add myself to uploaders
* Check for nfsd in /proc/filesystems rather than looking for signs of it in
  /proc/kallsyms (Closes: #563104, #572736)
* Document the -n option to svcgssd, thanks to Alberto Gonzalez Iniesta
  (Closes: #451402, #550270)
* Replace upstream reference in package descriptions with Homepage fields,
  and do not refer to the obsolete CVS repository
* Update policy version to 3.8.4; no changes required
* Override lintian error 'init.d-script-missing-dependency-on-remote_fs';
  the init script does work without /usr mounted

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
void
39
39
simulator (int argc, char **argv)
40
40
{
41
 
  log_enable (1);
 
41
  xlog_stderr (1);
 
42
  xlog_syslog (0);
 
43
  xlog_open ("statd simulator");
42
44
 
43
45
  if (argc == 2)
44
46
    if (!strcasecmp (*argv, "crash"))
61
63
      simulate_mon (*(&argv[1]), *(&argv[2]), *(&argv[3]), *(&argv[4]),
62
64
                    *(&argv[5]));
63
65
  }
64
 
  die ("WTF?  Give me something I can use!");
 
66
  xlog_err ("WTF?  Give me something I can use!");
65
67
}
66
68
 
67
69
static void
72
74
  sm_stat_res *result;
73
75
  mon mon;
74
76
 
75
 
  dprintf (N_DEBUG, "Calling %s (as %s) to monitor %s", calling, as,
 
77
  xlog (D_GENERAL, "Calling %s (as %s) to monitor %s", calling, as,
76
78
           monitoring);
77
79
 
78
80
  if ((client = clnt_create (calling, SM_PROG, SM_VERS, "udp")) == NULL)
79
 
    die ("%s", clnt_spcreateerror ("clnt_create"));
 
81
    xlog_err ("%s", clnt_spcreateerror ("clnt_create"));
80
82
 
81
83
  memcpy (mon.priv, fool, SM_PRIV_SIZE);
82
84
  mon.mon_id.my_id.my_name = xstrdup (as);
87
89
  mon.mon_id.mon_name = monitoring;
88
90
 
89
91
  if (!(result = sm_mon_1 (&mon, client)))
90
 
    die ("%s", clnt_sperror (client, "sm_mon_1"));
 
92
    xlog_err ("%s", clnt_sperror (client, "sm_mon_1"));
91
93
 
92
94
  free (mon.mon_id.my_id.my_name);
93
95
 
94
96
  if (result->res_stat != STAT_SUCC) {
95
 
    note (N_FATAL, "SM_MON request failed, state: %d", result->state);
96
 
    exit (0);
 
97
    xlog_err ("SM_MON request failed, state: %d", result->state);
97
98
  } else {
98
 
    dprintf (N_DEBUG, "SM_MON result successful, state: %d\n", result->state);
99
 
    dprintf (N_DEBUG, "Waiting for callback.");
 
99
    xlog (D_GENERAL, "SM_MON result successful, state: %d\n", result->state);
 
100
    xlog (D_GENERAL, "Waiting for callback");
100
101
    daemon_simulator ();
101
102
    exit (0);
102
103
  }
109
110
  sm_stat *result;
110
111
  mon_id mon_id;
111
112
 
112
 
  dprintf (N_DEBUG, "Calling %s (as %s) to unmonitor %s", calling, as,
 
113
  xlog (D_GENERAL, "Calling %s (as %s) to unmonitor %s", calling, as,
113
114
           unmonitoring);
114
115
 
115
116
  if ((client = clnt_create (calling, SM_PROG, SM_VERS, "udp")) == NULL)
116
 
    die ("%s", clnt_spcreateerror ("clnt_create"));
 
117
    xlog_err ("%s", clnt_spcreateerror ("clnt_create"));
117
118
 
118
119
  mon_id.my_id.my_name = xstrdup (as);
119
120
  mon_id.my_id.my_prog = atoi (proggy) * SIM_SM_PROG;
122
123
  mon_id.mon_name = unmonitoring;
123
124
 
124
125
  if (!(result = sm_unmon_1 (&mon_id, client)))
125
 
    die ("%s", clnt_sperror (client, "sm_unmon_1"));
 
126
    xlog_err ("%s", clnt_sperror (client, "sm_unmon_1"));
126
127
 
127
128
  free (mon_id.my_id.my_name);
128
 
  dprintf (N_DEBUG, "SM_UNMON request returned state: %d\n", result->state);
 
129
  xlog (D_GENERAL, "SM_UNMON request returned state: %d\n", result->state);
129
130
  exit (0);
130
131
}
131
132
 
136
137
  sm_stat *result;
137
138
  my_id my_id;
138
139
 
139
 
  dprintf (N_DEBUG, "Calling %s (as %s) to unmonitor all hosts", calling, as);
 
140
  xlog (D_GENERAL, "Calling %s (as %s) to unmonitor all hosts", calling, as);
140
141
 
141
142
  if ((client = clnt_create (calling, SM_PROG, SM_VERS, "udp")) == NULL)
142
 
    die ("%s", clnt_spcreateerror ("clnt_create"));
 
143
    xlog_err ("%s", clnt_spcreateerror ("clnt_create"));
143
144
 
144
145
  my_id.my_name = xstrdup (as);
145
146
  my_id.my_prog = atoi (proggy) * SIM_SM_PROG;
147
148
  my_id.my_proc = SIM_SM_MON;
148
149
 
149
150
  if (!(result = sm_unmon_all_1 (&my_id, client)))
150
 
    die ("%s", clnt_sperror (client, "sm_unmon_all_1"));
 
151
    xlog_err ("%s", clnt_sperror (client, "sm_unmon_all_1"));
151
152
 
152
153
  free (my_id.my_name);
153
 
  dprintf (N_DEBUG, "SM_UNMON_ALL request returned state: %d\n", result->state);
 
154
  xlog (D_GENERAL, "SM_UNMON_ALL request returned state: %d\n", result->state);
154
155
  exit (0);
155
156
}
156
157
 
160
161
  CLIENT *client;
161
162
 
162
163
  if ((client = clnt_create (host, SM_PROG, SM_VERS, "udp")) == NULL)
163
 
    die ("%s", clnt_spcreateerror ("clnt_create"));
 
164
    xlog_err ("%s", clnt_spcreateerror ("clnt_create"));
164
165
 
165
166
  if (!sm_simu_crash_1 (NULL, client))
166
 
    die ("%s", clnt_sperror (client, "sm_simu_crash_1"));
 
167
    xlog_err ("%s", clnt_sperror (client, "sm_simu_crash_1"));
167
168
 
168
169
  exit (0);
169
170
}
176
177
  sm_stat_res *result;
177
178
  
178
179
  if ((client = clnt_create (calling, SM_PROG, SM_VERS, "udp")) == NULL)
179
 
    die ("%s", clnt_spcreateerror ("clnt_create"));
 
180
    xlog_err ("%s", clnt_spcreateerror ("clnt_create"));
180
181
 
181
182
  checking.mon_name = monitoring;
182
183
 
183
184
  if (!(result = sm_stat_1 (&checking, client)))
184
 
    die ("%s", clnt_sperror (client, "sm_stat_1"));
 
185
    xlog_err ("%s", clnt_sperror (client, "sm_stat_1"));
185
186
 
186
187
  if (result->res_stat == STAT_SUCC)
187
 
    dprintf (N_DEBUG, "STAT_SUCC from %s for %s, state: %d", calling,
 
188
    xlog (D_GENERAL, "STAT_SUCC from %s for %s, state: %d", calling,
188
189
             monitoring, result->state);
189
190
  else
190
 
    dprintf (N_DEBUG, "STAT_FAIL from %s for %s, state: %d", calling,
 
191
    xlog (D_GENERAL, "STAT_FAIL from %s for %s, state: %d", calling,
191
192
             monitoring, result->state);
192
193
 
193
194
  exit (0);
196
197
static void
197
198
sim_killer (int sig)
198
199
{
199
 
  note (N_FATAL, "Simulator caught signal %d, un-registering and exiting.", sig);
200
200
  pmap_unset (sim_port, SIM_SM_VERS);
201
 
  exit (0);
 
201
  xlog_err ("Simulator caught signal %d, un-registering and exiting", sig);
202
202
}
203
203
 
204
204
static void
219
219
{
220
220
  static char *result;
221
221
 
222
 
  dprintf (N_DEBUG, "Recieved state %d for mon_name %s (opaque \"%s\")",
 
222
  xlog (D_GENERAL, "Recieved state %d for mon_name %s (opaque \"%s\")",
223
223
           argp->state, argp->mon_name, argp->priv);
224
224
  svc_exit ();
225
225
  return ((void *)&result);