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

Diff of /trunk/src/rc.c

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

Revision 2857 Revision 2882
1090 correct order for stopping them */ 1090 correct order for stopping them */
1091 stop_services = rc_ls_dir (stop_services, RC_SVCDIR_STARTING, RC_LS_INITD); 1091 stop_services = rc_ls_dir (stop_services, RC_SVCDIR_STARTING, RC_LS_INITD);
1092 stop_services = rc_ls_dir (stop_services, RC_SVCDIR_INACTIVE, RC_LS_INITD); 1092 stop_services = rc_ls_dir (stop_services, RC_SVCDIR_INACTIVE, RC_LS_INITD);
1093 stop_services = rc_ls_dir (stop_services, RC_SVCDIR_STARTED, RC_LS_INITD); 1093 stop_services = rc_ls_dir (stop_services, RC_SVCDIR_STARTED, RC_LS_INITD);
1094 1094
1095 types = NULL;
1095 types = rc_strlist_add (NULL, "ineed"); 1096 rc_strlist_add (&types, "ineed");
1096 types = rc_strlist_add (types, "iuse"); 1097 rc_strlist_add (&types, "iuse");
1097 types = rc_strlist_add (types, "iafter"); 1098 rc_strlist_add (&types, "iafter");
1098 deporder = rc_get_depends (deptree, types, stop_services, 1099 deporder = rc_get_depends (deptree, types, stop_services,
1099 runlevel, depoptions | RC_DEP_STOP); 1100 runlevel, depoptions | RC_DEP_STOP);
1100 rc_strlist_free (stop_services); 1101 rc_strlist_free (stop_services);
1101 rc_strlist_free (types); 1102 rc_strlist_free (types);
1103 types = NULL;
1102 stop_services = deporder; 1104 stop_services = deporder;
1103 deporder = NULL; 1105 deporder = NULL;
1104 types = NULL;
1105 rc_strlist_reverse (stop_services); 1106 rc_strlist_reverse (stop_services);
1106 1107
1107 /* Load our list of coldplugged services */ 1108 /* Load our list of coldplugged services */
1108 coldplugged_services = rc_ls_dir (coldplugged_services, 1109 coldplugged_services = rc_ls_dir (coldplugged_services,
1109 RC_SVCDIR_COLDPLUGGED, RC_LS_INITD); 1110 RC_SVCDIR_COLDPLUGGED, RC_LS_INITD);
1113 if (newlevel && strcmp (newlevel, bootlevel) == 0) { 1114 if (newlevel && strcmp (newlevel, bootlevel) == 0) {
1114 if (coldplugged_services) { 1115 if (coldplugged_services) {
1115 einfon ("Device initiated services:"); 1116 einfon ("Device initiated services:");
1116 STRLIST_FOREACH (coldplugged_services, service, i) { 1117 STRLIST_FOREACH (coldplugged_services, service, i) {
1117 printf (" %s", service); 1118 printf (" %s", service);
1118 start_services = rc_strlist_add (start_services, service); 1119 rc_strlist_add (&start_services, service);
1119 } 1120 }
1120 printf ("\n"); 1121 printf ("\n");
1121 } 1122 }
1122 tmp = rc_strcatpaths (RC_RUNLEVELDIR, newlevel ? newlevel : runlevel, 1123 tmp = rc_strcatpaths (RC_RUNLEVELDIR, newlevel ? newlevel : runlevel,
1123 (char *) NULL); 1124 (char *) NULL);
1138 services = rc_services_in_runlevel (newlevel ? newlevel : runlevel); 1139 services = rc_services_in_runlevel (newlevel ? newlevel : runlevel);
1139 start_services = rc_strlist_join (start_services, services); 1140 start_services = rc_strlist_join (start_services, services);
1140 services = NULL; 1141 services = NULL;
1141 1142
1142 STRLIST_FOREACH (coldplugged_services, service, i) 1143 STRLIST_FOREACH (coldplugged_services, service, i)
1143 start_services = rc_strlist_add (start_services, service); 1144 rc_strlist_add (&start_services, service);
1144 1145
1145 } 1146 }
1146 } 1147 }
1147 1148
1148 /* Save out softlevel now */ 1149 /* Save out softlevel now */
1149 if (going_down) 1150 if (going_down)
1150 rc_set_runlevel (newlevel); 1151 rc_set_runlevel (newlevel);
1151 1152
1153 types = NULL;
1152 types = rc_strlist_add (NULL, "needsme"); 1154 rc_strlist_add (&types, "needsme");
1153 /* Now stop the services that shouldn't be running */ 1155 /* Now stop the services that shouldn't be running */
1154 STRLIST_FOREACH (stop_services, service, i) { 1156 STRLIST_FOREACH (stop_services, service, i) {
1155 bool found = false; 1157 bool found = false;
1156 char *conf = NULL; 1158 char *conf = NULL;
1157 char **stopdeps = NULL; 1159 char **stopdeps = NULL;
1207 continue; 1209 continue;
1208 } 1210 }
1209 1211
1210 /* We got this far! Or last check is to see if any any service that 1212 /* We got this far! Or last check is to see if any any service that
1211 going to be started depends on us */ 1213 going to be started depends on us */
1212 stopdeps = rc_strlist_add (stopdeps, service); 1214 rc_strlist_add (&stopdeps, service);
1213 deporder = rc_get_depends (deptree, types, stopdeps, 1215 deporder = rc_get_depends (deptree, types, stopdeps,
1214 runlevel, RC_DEP_STRICT); 1216 runlevel, RC_DEP_STRICT);
1215 rc_strlist_free (stopdeps); 1217 rc_strlist_free (stopdeps);
1216 stopdeps = NULL; 1218 stopdeps = NULL;
1217 found = false; 1219 found = false;
1274 /* Re-add our coldplugged services if they stopped */ 1276 /* Re-add our coldplugged services if they stopped */
1275 STRLIST_FOREACH (coldplugged_services, service, i) 1277 STRLIST_FOREACH (coldplugged_services, service, i)
1276 rc_mark_service (service, rc_service_coldplugged); 1278 rc_mark_service (service, rc_service_coldplugged);
1277 1279
1278 /* Order the services to start */ 1280 /* Order the services to start */
1279 types = rc_strlist_add (NULL, "ineed"); 1281 rc_strlist_add (&types, "ineed");
1280 types = rc_strlist_add (types, "iuse"); 1282 rc_strlist_add (&types, "iuse");
1281 types = rc_strlist_add (types, "iafter"); 1283 rc_strlist_add (&types, "iafter");
1282 deporder = rc_get_depends (deptree, types, start_services, 1284 deporder = rc_get_depends (deptree, types, start_services,
1283 runlevel, depoptions | RC_DEP_START); 1285 runlevel, depoptions | RC_DEP_START);
1284 rc_strlist_free (types); 1286 rc_strlist_free (types);
1285 types = NULL; 1287 types = NULL;
1286 rc_strlist_free (start_services); 1288 rc_strlist_free (start_services);

Legend:
Removed from v.2857  
changed lines
  Added in v.2882

  ViewVC Help
Powered by ViewVC 1.1.20