| … | |
… | |
| 129 | free (path); |
129 | free (path); |
| 130 | return (retval); |
130 | return (retval); |
| 131 | } |
131 | } |
| 132 | librc_hidden_def(rc_runlevel_exists) |
132 | librc_hidden_def(rc_runlevel_exists) |
| 133 | |
133 | |
| 134 | /* Resolve a service name to it's full path */ |
134 | /* Resolve a service name to it's full path */ |
| 135 | char *rc_service_resolve (const char *service) |
135 | char *rc_service_resolve (const char *service) |
| 136 | { |
136 | { |
| 137 | char buffer[PATH_MAX]; |
137 | char buffer[PATH_MAX]; |
| 138 | char *file; |
138 | char *file; |
| 139 | int r = 0; |
139 | int r = 0; |
| … | |
… | |
| 439 | |
439 | |
| 440 | return (state); |
440 | return (state); |
| 441 | } |
441 | } |
| 442 | librc_hidden_def(rc_service_state) |
442 | librc_hidden_def(rc_service_state) |
| 443 | |
443 | |
| 444 | char *rc_service_option_get (const char *service, const char *option) |
444 | char *rc_service_value_get (const char *service, const char *option) |
| 445 | { |
445 | { |
| 446 | FILE *fp; |
446 | FILE *fp; |
| 447 | char buffer[RC_LINEBUFFER]; |
447 | char buffer[RC_LINEBUFFER]; |
| 448 | char *file = rc_strcatpaths (RC_SVCDIR, "options", service, option, |
448 | char *file = rc_strcatpaths (RC_SVCDIR, "options", service, option, |
| 449 | (char *) NULL); |
449 | (char *) NULL); |
| … | |
… | |
| 457 | } |
457 | } |
| 458 | free (file); |
458 | free (file); |
| 459 | |
459 | |
| 460 | return (value); |
460 | return (value); |
| 461 | } |
461 | } |
| 462 | librc_hidden_def(rc_service_option_get) |
462 | librc_hidden_def(rc_service_value_get) |
| 463 | |
463 | |
| 464 | bool rc_service_option_set (const char *service, const char *option, |
464 | bool rc_service_value_set (const char *service, const char *option, |
| 465 | const char *value) |
465 | const char *value) |
| 466 | { |
466 | { |
| 467 | FILE *fp; |
467 | FILE *fp; |
| 468 | char *path = rc_strcatpaths (RC_SVCDIR, "options", service, (char *) NULL); |
468 | char *path = rc_strcatpaths (RC_SVCDIR, "options", service, (char *) NULL); |
| 469 | char *file = rc_strcatpaths (path, option, (char *) NULL); |
469 | char *file = rc_strcatpaths (path, option, (char *) NULL); |
| 470 | bool retval = false; |
470 | bool retval = false; |
| … | |
… | |
| 486 | |
486 | |
| 487 | free (path); |
487 | free (path); |
| 488 | free (file); |
488 | free (file); |
| 489 | return (retval); |
489 | return (retval); |
| 490 | } |
490 | } |
| 491 | librc_hidden_def(rc_service_option_set) |
491 | librc_hidden_def(rc_service_value_set) |
| 492 | |
492 | |
| 493 | static pid_t _exec_service (const char *service, const char *arg) |
493 | static pid_t _exec_service (const char *service, const char *arg) |
| 494 | { |
494 | { |
| 495 | char *file; |
495 | char *file; |
| 496 | char *fifo; |
496 | char *fifo; |
| … | |
… | |
| 526 | free (fifo); |
526 | free (fifo); |
| 527 | free (file); |
527 | free (file); |
| 528 | |
528 | |
| 529 | if (pid == -1) |
529 | if (pid == -1) |
| 530 | fprintf (stderr, "vfork: %s\n", strerror (errno)); |
530 | fprintf (stderr, "vfork: %s\n", strerror (errno)); |
| 531 | |
531 | |
| 532 | return (pid); |
532 | return (pid); |
| 533 | } |
533 | } |
| 534 | |
534 | |
| 535 | int rc_waitpid (pid_t pid) |
535 | int rc_waitpid (pid_t pid) |
| 536 | { |
536 | { |