Lines Matching defs:dsmp

120 run_script(dhcp_smach_t *dsmp, const char *event, int fd)
145 (void) execl(path, name, dsmp->dsm_name, event, NULL);
196 script_init(dhcp_smach_t *dsmp)
198 dsmp->dsm_script_pid = -1;
199 dsmp->dsm_script_helper_pid = -1;
200 dsmp->dsm_script_event_id = -1;
201 dsmp->dsm_script_fd = -1;
202 dsmp->dsm_script_callback = NULL;
203 dsmp->dsm_script_event = NULL;
204 dsmp->dsm_callback_arg = NULL;
215 script_cleanup(dhcp_smach_t *dsmp)
221 dsmp->dsm_script_pid = -1;
222 dsmp->dsm_script_helper_pid = -1;
224 if (dsmp->dsm_script_fd != -1) {
225 assert(dsmp->dsm_script_event_id != -1);
226 (void) iu_unregister_event(eh, dsmp->dsm_script_event_id, NULL);
227 (void) close(dsmp->dsm_script_fd);
229 assert(dsmp->dsm_script_callback != NULL);
230 dsmp->dsm_script_callback(dsmp, dsmp->dsm_callback_arg);
231 script_init(dsmp);
233 release_smach(dsmp); /* hold from script_start() */
282 script_start(dhcp_smach_t *dsmp, const char *event,
292 if (dsmp->dsm_script_pid != -1) {
295 script_stop(dsmp);
328 run_script(dsmp, event, fds[1]);
335 if (read(fds[0], &dsmp->dsm_script_pid, sizeof (pid_t)) !=
338 dsmp->dsm_script_pid = -1;
343 dsmp->dsm_script_helper_pid = pid;
344 event_id = iu_register_event(eh, fds[0], POLLIN, script_exit, dsmp);
347 script_stop(dsmp);
352 dsmp->dsm_script_event_id = event_id;
353 dsmp->dsm_script_callback = callback;
354 dsmp->dsm_script_event = event;
355 dsmp->dsm_callback_arg = arg;
356 dsmp->dsm_script_fd = fds[0];
357 hold_smach(dsmp);
362 n = callback(dsmp, arg);
377 script_stop(dhcp_smach_t *dsmp)
379 if (dsmp->dsm_script_pid != -1) {
380 assert(dsmp->dsm_script_helper_pid != -1);
387 (void) kill(dsmp->dsm_script_pid, SIGTERM);
388 (void) kill(dsmp->dsm_script_helper_pid, SIGTERM);
391 script_cleanup(dsmp);