/[baselayout]/trunk/src/runscript.c
Gentoo

Diff of /trunk/src/runscript.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 2740 Revision 2741
45static char **tmplist = NULL; 45static char **tmplist = NULL;
46static char **providelist = NULL; 46static char **providelist = NULL;
47static char **types = NULL; 47static char **types = NULL;
48static char **restart_services = NULL; 48static char **restart_services = NULL;
49static char **need_services = NULL; 49static char **need_services = NULL;
50static char **use_services = NULL;
50static char **env = NULL; 51static char **env = NULL;
51static char *tmp = NULL; 52static char *tmp = NULL;
52static char *softlevel = NULL; 53static char *softlevel = NULL;
53static bool sighup = false; 54static bool sighup = false;
54static char *ibsave = NULL; 55static char *ibsave = NULL;
252 rc_strlist_free (services); 253 rc_strlist_free (services);
253 rc_strlist_free (types); 254 rc_strlist_free (types);
254 rc_strlist_free (svclist); 255 rc_strlist_free (svclist);
255 rc_strlist_free (providelist); 256 rc_strlist_free (providelist);
256 rc_strlist_free (need_services); 257 rc_strlist_free (need_services);
258 rc_strlist_free (use_services);
257 rc_strlist_free (tmplist); 259 rc_strlist_free (tmplist);
258 free (ibsave); 260 free (ibsave);
259 261
260 if (in_control ()) { 262 if (in_control ()) {
261 if (rc_service_state (applet, rc_service_stopping)) { 263 if (rc_service_state (applet, rc_service_stopping)) {
630 rc_strlist_free (types); 632 rc_strlist_free (types);
631 types = rc_strlist_add (NULL, "ineed"); 633 types = rc_strlist_add (NULL, "ineed");
632 rc_strlist_free (need_services); 634 rc_strlist_free (need_services);
633 need_services = rc_get_depends (deptree, types, svclist, 635 need_services = rc_get_depends (deptree, types, svclist,
634 softlevel, depoptions); 636 softlevel, depoptions);
637
635 types = rc_strlist_add (types, "iuse"); 638 types = rc_strlist_add (types, "iuse");
639 rc_strlist_free (use_services);
640 use_services = rc_get_depends (deptree, types, svclist,
641 softlevel, depoptions);
642
636 if (! rc_runlevel_starting ()) { 643 if (! rc_runlevel_starting ()) {
637 services = rc_get_depends (deptree, types, svclist,
638 softlevel, depoptions);
639 STRLIST_FOREACH (services, svc, i) 644 STRLIST_FOREACH (use_services, svc, i)
640 if (rc_service_state (svc, rc_service_stopped)) { 645 if (rc_service_state (svc, rc_service_stopped)) {
641 pid_t pid = rc_start_service (svc); 646 pid_t pid = rc_start_service (svc);
642 if (! rc_is_env ("RC_PARALLEL", "yes")) 647 if (! rc_is_env ("RC_PARALLEL", "yes"))
643 rc_waitpid (pid); 648 rc_waitpid (pid);
644 } 649 }
645
646 rc_strlist_free (services);
647 } 650 }
648 651
649 /* Now wait for them to start */ 652 /* Now wait for them to start */
650 types = rc_strlist_add (types, "iafter"); 653 types = rc_strlist_add (types, "iafter");
651 services = rc_get_depends (deptree, types, svclist, 654 services = rc_get_depends (deptree, types, svclist,
654 /* We use tmplist to hold our scheduled by list */ 657 /* We use tmplist to hold our scheduled by list */
655 rc_strlist_free (tmplist); 658 rc_strlist_free (tmplist);
656 tmplist = NULL; 659 tmplist = NULL;
657 660
658 STRLIST_FOREACH (services, svc, i) { 661 STRLIST_FOREACH (services, svc, i) {
659 /* don't wait for services which went inactive but are now in
660 * starting state */
661 if (rc_service_state (svc, rc_service_started) || 662 if (rc_service_state (svc, rc_service_started))
662 (rc_service_state (svc, rc_service_starting) &&
663 rc_service_state(svc, rc_service_wasinactive)))
664 continue; 663 continue;
664
665 /* Don't wait for services which went inactive but are now in
666 * starting state which we are after */
667 if (rc_service_state (svc, rc_service_starting) &&
668 rc_service_state(svc, rc_service_wasinactive)) {
669 bool use = false;
670 STRLIST_FOREACH (use_services, svc2, j)
671 if (strcmp (svc, svc2) == 0) {
672 use = true;
673 break;
674 }
675 if (! use)
676 continue;
677 }
665 678
666 if (! rc_wait_service (svc)) 679 if (! rc_wait_service (svc))
667 eerror ("%s: timed out waiting for %s", applet, svc); 680 eerror ("%s: timed out waiting for %s", applet, svc);
668 if (rc_service_state (svc, rc_service_started)) 681 if (rc_service_state (svc, rc_service_started))
669 continue; 682 continue;

Legend:
Removed from v.2740  
changed lines
  Added in v.2741

  ViewVC Help
Powered by ViewVC 1.1.20