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

Diff of /trunk/src/rc.c

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

Revision 3007 Revision 3040
28#include <stdbool.h> 28#include <stdbool.h>
29#include <stdio.h> 29#include <stdio.h>
30#include <stdlib.h> 30#include <stdlib.h>
31#include <signal.h> 31#include <signal.h>
32#include <string.h> 32#include <string.h>
33#include <strings.h>
33#include <syslog.h> 34#include <syslog.h>
34#include <termios.h> 35#include <termios.h>
35#include <unistd.h> 36#include <unistd.h>
36 37
37#include "builtins.h" 38#include "builtins.h"
69static char **newenv = NULL; 70static char **newenv = NULL;
70static char **coldplugged_services = NULL; 71static char **coldplugged_services = NULL;
71static char **stop_services = NULL; 72static char **stop_services = NULL;
72static char **start_services = NULL; 73static char **start_services = NULL;
73static rc_depinfo_t *deptree = NULL; 74static rc_depinfo_t *deptree = NULL;
74static char **types = NULL;
75static char *tmp = NULL; 75static char *tmp = NULL;
76 76
77struct termios *termios_orig = NULL; 77struct termios *termios_orig = NULL;
78 78
79typedef struct pidlist 79typedef struct pidlist
80{ 80{
81 pid_t pid; 81 pid_t pid;
82 struct pidlist *next; 82 struct pidlist *next;
83} pidlist_t; 83} pidlist_t;
84static pidlist_t *service_pids = NULL; 84static pidlist_t *service_pids = NULL;
85
86static const char *types_n[] = { "needsme", NULL };
87static const char *types_nua[] = { "ineed", "iuse", "iafter", NULL };
85 88
86static void cleanup (void) 89static void cleanup (void)
87{ 90{
88 if (applet && strcmp (applet, "rc") == 0) { 91 if (applet && strcmp (applet, "rc") == 0) {
89 pidlist_t *pl = service_pids; 92 pidlist_t *pl = service_pids;
105 rc_strlist_free (newenv); 108 rc_strlist_free (newenv);
106 rc_strlist_free (coldplugged_services); 109 rc_strlist_free (coldplugged_services);
107 rc_strlist_free (stop_services); 110 rc_strlist_free (stop_services);
108 rc_strlist_free (start_services); 111 rc_strlist_free (start_services);
109 rc_deptree_free (deptree); 112 rc_deptree_free (deptree);
110 rc_strlist_free (types);
111 113
112 /* Clean runlevel start, stop markers */ 114 /* Clean runlevel start, stop markers */
113 if (! rc_in_plugin) { 115 if (! rc_in_plugin) {
114 rmdir (RC_STARTING); 116 rmdir (RC_STARTING);
115 rmdir (RC_STOPPING); 117 rmdir (RC_STOPPING);
190 192
191 if (argc > 0) { 193 if (argc > 0) {
192 for (i = 0; i < argc; i++) 194 for (i = 0; i < argc; i++)
193 l += strlen (argv[i]) + 1; 195 l += strlen (argv[i]) + 1;
194 196
195 message = rc_xmalloc (l); 197 message = xmalloc (l);
196 p = message; 198 p = message;
197 199
198 for (i = 0; i < argc; i++) { 200 for (i = 0; i < argc; i++) {
199 if (i > 0) 201 if (i > 0)
200 *p++ = ' '; 202 *p++ = ' ';
203 } 205 }
204 *p = 0; 206 *p = 0;
205 } 207 }
206 208
207 if (message) 209 if (message)
208 fmt = rc_xstrdup ("%s"); 210 fmt = xstrdup ("%s");
209 211
210 if (strcmp (applet, "einfo") == 0) 212 if (strcmp (applet, "einfo") == 0)
211 einfo (fmt, message); 213 einfo (fmt, message);
212 else if (strcmp (applet, "einfon") == 0) 214 else if (strcmp (applet, "einfon") == 0)
213 einfon (fmt, message); 215 einfon (fmt, message);
314 ok = rc_service_mark (argv[0], RC_SERVICE_STOPPING); 316 ok = rc_service_mark (argv[0], RC_SERVICE_STOPPING);
315 else if (strcmp (applet, "mark_service_stopping") == 0) 317 else if (strcmp (applet, "mark_service_stopping") == 0)
316 ok = rc_service_mark (argv[0], RC_SERVICE_STOPPING); 318 ok = rc_service_mark (argv[0], RC_SERVICE_STOPPING);
317 else if (strcmp (applet, "mark_service_coldplugged") == 0) 319 else if (strcmp (applet, "mark_service_coldplugged") == 0)
318 ok = rc_service_mark (argv[0], RC_SERVICE_COLDPLUGGED); 320 ok = rc_service_mark (argv[0], RC_SERVICE_COLDPLUGGED);
321 else if (strcmp (applet, "mark_service_failed") == 0)
322 ok = rc_service_mark (argv[0], RC_SERVICE_FAILED);
319 else 323 else
320 eerrorx ("%s: unknown applet", applet); 324 eerrorx ("%s: unknown applet", applet);
321 325
322 /* If we're marking ourselves then we need to inform our parent runscript 326 /* If we're marking ourselves then we need to inform our parent runscript
323 process so they do not mark us based on our exit code */ 327 process so they do not mark us based on our exit code */
336 in control as well */ 340 in control as well */
337 l = strlen (RC_SVCDIR "exclusive") + 341 l = strlen (RC_SVCDIR "exclusive") +
338 strlen (svcname) + 342 strlen (svcname) +
339 strlen (runscript_pid) + 343 strlen (runscript_pid) +
340 4; 344 4;
341 mtime = rc_xmalloc (l); 345 mtime = xmalloc (l);
342 snprintf (mtime, l, RC_SVCDIR "exclusive/%s.%s", 346 snprintf (mtime, l, RC_SVCDIR "exclusive/%s.%s",
343 svcname, runscript_pid); 347 svcname, runscript_pid);
344 if (rc_exists (mtime) && unlink (mtime) != 0) 348 if (exists (mtime) && unlink (mtime) != 0)
345 eerror ("%s: unlink: %s", applet, strerror (errno)); 349 eerror ("%s: unlink: %s", applet, strerror (errno));
346 free (mtime); 350 free (mtime);
347 } 351 }
348 352
349 return (ok ? EXIT_SUCCESS : EXIT_FAILURE); 353 return (ok ? EXIT_SUCCESS : EXIT_FAILURE);
377 381
378#ifdef __linux__ 382#ifdef __linux__
379static char *proc_getent (const char *ent) 383static char *proc_getent (const char *ent)
380{ 384{
381 FILE *fp; 385 FILE *fp;
382 char buffer[RC_LINEBUFFER]; 386 char *buffer;
383 char *p; 387 char *p;
384 char *value = NULL; 388 char *value = NULL;
385 int i; 389 int i;
386 390
387 if (! rc_exists ("/proc/cmdline")) 391 if (! exists ("/proc/cmdline"))
388 return (NULL); 392 return (NULL);
389 393
390 if (! (fp = fopen ("/proc/cmdline", "r"))) { 394 if (! (fp = fopen ("/proc/cmdline", "r"))) {
391 eerror ("failed to open `/proc/cmdline': %s", strerror (errno)); 395 eerror ("failed to open `/proc/cmdline': %s", strerror (errno));
392 return (NULL); 396 return (NULL);
393 } 397 }
394 398
395 memset (buffer, 0, sizeof (buffer)); 399 buffer = xmalloc (sizeof (char) * RC_LINEBUFFER);
400 memset (buffer, 0, RC_LINEBUFFER);
396 if (fgets (buffer, RC_LINEBUFFER, fp) && 401 if (fgets (buffer, RC_LINEBUFFER, fp) &&
397 (p = strstr (buffer, ent))) 402 (p = strstr (buffer, ent)))
398 { 403 {
399 i = p - buffer; 404 i = p - buffer;
400 if (i == '\0' || buffer[i - 1] == ' ') { 405 if (i == '\0' || buffer[i - 1] == ' ') {
404 buffer[i] = 0; 409 buffer[i] = 0;
405 410
406 p += strlen (ent); 411 p += strlen (ent);
407 if (*p == '=') 412 if (*p == '=')
408 p++; 413 p++;
409 value = strdup (strsep (&p, " ")); 414 value = xstrdup (strsep (&p, " "));
410 } 415 }
411 } else 416 } else
412 errno = ENOENT; 417 errno = ENOENT;
418 free (buffer);
413 fclose (fp); 419 fclose (fp);
414 420
415 return (value); 421 return (value);
416} 422}
417#endif 423#endif
426 return (false); 432 return (false);
427 433
428 /* Now save our terminal settings. We need to restore them at exit as we 434 /* Now save our terminal settings. We need to restore them at exit as we
429 will be changing it for non-blocking reads for Interactive */ 435 will be changing it for non-blocking reads for Interactive */
430 if (! termios_orig) { 436 if (! termios_orig) {
431 termios_orig = rc_xmalloc (sizeof (struct termios)); 437 termios_orig = xmalloc (sizeof (struct termios));
432 tcgetattr (fd, termios_orig); 438 tcgetattr (fd, termios_orig);
433 } 439 }
434 440
435 tcgetattr (fd, &termios); 441 tcgetattr (fd, &termios);
436 termios.c_lflag &= ~(ICANON | ECHO); 442 termios.c_lflag &= ~(ICANON | ECHO);
545 if (! level || 551 if (! level ||
546 strcmp (level, getenv ("RC_BOOTLEVEL")) == 0 || 552 strcmp (level, getenv ("RC_BOOTLEVEL")) == 0 ||
547 strcmp (level, RC_LEVEL_SINGLE) == 0 || 553 strcmp (level, RC_LEVEL_SINGLE) == 0 ||
548 strcmp (level, RC_LEVEL_SYSINIT) == 0) 554 strcmp (level, RC_LEVEL_SYSINIT) == 0)
549 { 555 {
550 if (rc_exists (RC_KSOFTLEVEL) && 556 if (exists (RC_KSOFTLEVEL) &&
551 unlink (RC_KSOFTLEVEL) != 0) 557 unlink (RC_KSOFTLEVEL) != 0)
552 eerror ("unlink `%s': %s", RC_KSOFTLEVEL, strerror (errno)); 558 eerror ("unlink `%s': %s", RC_KSOFTLEVEL, strerror (errno));
553 return; 559 return;
554 } 560 }
555 561
565static int get_ksoftlevel (char *buffer, int buffer_len) 571static int get_ksoftlevel (char *buffer, int buffer_len)
566{ 572{
567 FILE *fp; 573 FILE *fp;
568 int i = 0; 574 int i = 0;
569 575
570 if (! rc_exists (RC_KSOFTLEVEL)) 576 if (! exists (RC_KSOFTLEVEL))
571 return (0); 577 return (0);
572 578
573 if (! (fp = fopen (RC_KSOFTLEVEL, "r"))) { 579 if (! (fp = fopen (RC_KSOFTLEVEL, "r"))) {
574 eerror ("fopen `%s': %s", RC_KSOFTLEVEL, strerror (errno)); 580 eerror ("fopen `%s': %s", RC_KSOFTLEVEL, strerror (errno));
575 return (-1); 581 return (-1);
595{ 601{
596 pidlist_t *sp = service_pids; 602 pidlist_t *sp = service_pids;
597 if (sp) { 603 if (sp) {
598 while (sp->next) 604 while (sp->next)
599 sp = sp->next; 605 sp = sp->next;
600 sp->next = rc_xmalloc (sizeof (pidlist_t)); 606 sp->next = xmalloc (sizeof (pidlist_t));
601 sp = sp->next; 607 sp = sp->next;
602 } else 608 } else
603 sp = service_pids = rc_xmalloc (sizeof (pidlist_t)); 609 sp = service_pids = xmalloc (sizeof (pidlist_t));
604 memset (sp, 0, sizeof (pidlist_t)); 610 memset (sp, 0, sizeof (pidlist_t));
605 sp->pid = pid; 611 sp->pid = pid;
606} 612}
607 613
608static void remove_pid (pid_t pid) 614static void remove_pid (pid_t pid)
728 734
729#include "_usage.h" 735#include "_usage.h"
730#define getoptstring getoptstring_COMMON 736#define getoptstring getoptstring_COMMON
731static struct option longopts[] = { 737static struct option longopts[] = {
732 longopts_COMMON 738 longopts_COMMON
733 { NULL, 0, NULL, 0}
734}; 739};
735static const char * const longopts_help[] = { 740static const char * const longopts_help[] = {
736 longopts_help_COMMON 741 longopts_help_COMMON
737}; 742};
738#include "_usage.c" 743#include "_usage.c"
755 DIR *dp; 760 DIR *dp;
756 struct dirent *d; 761 struct dirent *d;
757 762
758 atexit (cleanup); 763 atexit (cleanup);
759 if (argv[0]) 764 if (argv[0])
760 applet = rc_xstrdup (basename (argv[0])); 765 applet = xstrdup (basename (argv[0]));
761 766
762 if (! applet) 767 if (! applet)
763 eerrorx ("arguments required"); 768 eerrorx ("arguments required");
764 769
765 /* These used to be programs in their own right, so we shouldn't 770 /* These used to be programs in their own right, so we shouldn't
856 /* No clearenv present here then. 861 /* No clearenv present here then.
857 We could manipulate environ directly ourselves, but it seems that 862 We could manipulate environ directly ourselves, but it seems that
858 some kernels bitch about this according to the environ man pages 863 some kernels bitch about this according to the environ man pages
859 so we walk though environ and call unsetenv for each value. */ 864 so we walk though environ and call unsetenv for each value. */
860 while (environ[0]) { 865 while (environ[0]) {
861 tmp = rc_xstrdup (environ[0]); 866 tmp = xstrdup (environ[0]);
862 p = tmp; 867 p = tmp;
863 var = strsep (&p, "="); 868 var = strsep (&p, "=");
864 unsetenv (var); 869 unsetenv (var);
865 free (tmp); 870 free (tmp);
866 } 871 }
896 901
897 /* Export our PID */ 902 /* Export our PID */
898 snprintf (pidstr, sizeof (pidstr), "%d", getpid ()); 903 snprintf (pidstr, sizeof (pidstr), "%d", getpid ());
899 setenv ("RC_PID", pidstr, 1); 904 setenv ("RC_PID", pidstr, 1);
900 905
901 interactive = rc_exists (INTERACTIVE); 906 interactive = exists (INTERACTIVE);
902 rc_plugin_load (); 907 rc_plugin_load ();
903 908
904 /* Load current softlevel */ 909 /* Load current softlevel */
905 bootlevel = getenv ("RC_BOOTLEVEL"); 910 bootlevel = getenv ("RC_BOOTLEVEL");
906 runlevel = rc_runlevel_get (); 911 runlevel = rc_runlevel_get ();
923#endif 928#endif
924 929
925 /* exec init-early.sh if it exists 930 /* exec init-early.sh if it exists
926 * This should just setup the console to use the correct 931 * This should just setup the console to use the correct
927 * font. Maybe it should setup the keyboard too? */ 932 * font. Maybe it should setup the keyboard too? */
928 if (rc_exists (INITEARLYSH)) 933 if (exists (INITEARLYSH))
929 run_script (INITEARLYSH); 934 run_script (INITEARLYSH);
930 935
931 uname (&uts); 936 uname (&uts);
932 937
933 printf ("\n"); 938 printf ("\n");
1055 strerror (errno)); 1060 strerror (errno));
1056 free (tmp); 1061 free (tmp);
1057 } 1062 }
1058 } 1063 }
1059 closedir (dp); 1064 closedir (dp);
1060 rmdir (RC_SVCDIR "/failed");
1061 } 1065 }
1062 1066
1063 mkdir (RC_STOPPING, 0755); 1067 mkdir (RC_STOPPING, 0755);
1064 1068
1065#ifdef __linux__ 1069#ifdef __linux__
1102#if defined(__DragonFly__) || defined(__FreeBSD__) 1106#if defined(__DragonFly__) || defined(__FreeBSD__)
1103 /* The net interfaces are easy - they're all in net /dev/net :) */ 1107 /* The net interfaces are easy - they're all in net /dev/net :) */
1104 if ((dp = opendir ("/dev/net"))) { 1108 if ((dp = opendir ("/dev/net"))) {
1105 while ((d = readdir (dp))) { 1109 while ((d = readdir (dp))) {
1106 i = (strlen ("net.") + strlen (d->d_name) + 1); 1110 i = (strlen ("net.") + strlen (d->d_name) + 1);
1107 tmp = rc_xmalloc (sizeof (char *) * i); 1111 tmp = xmalloc (sizeof (char) * i);
1108 snprintf (tmp, i, "net.%s", d->d_name); 1112 snprintf (tmp, i, "net.%s", d->d_name);
1109 if (rc_service_exists (tmp) && 1113 if (rc_service_exists (tmp) &&
1110 rc_service_plugable (tmp)) 1114 rc_service_plugable (tmp))
1111 rc_service_mark (tmp, RC_SERVICE_COLDPLUGGED); 1115 rc_service_mark (tmp, RC_SERVICE_COLDPLUGGED);
1112 CHAR_FREE (tmp); 1116 CHAR_FREE (tmp);
1123 strncmp (d->d_name, "ums", 3) == 0) 1127 strncmp (d->d_name, "ums", 3) == 0)
1124 { 1128 {
1125 char *p = d->d_name + 3; 1129 char *p = d->d_name + 3;
1126 if (p && isdigit (*p)) { 1130 if (p && isdigit (*p)) {
1127 i = (strlen ("moused.") + strlen (d->d_name) + 1); 1131 i = (strlen ("moused.") + strlen (d->d_name) + 1);
1128 tmp = rc_xmalloc (sizeof (char *) * i); 1132 tmp = xmalloc (sizeof (char) * i);
1129 snprintf (tmp, i, "moused.%s", d->d_name); 1133 snprintf (tmp, i, "moused.%s", d->d_name);
1130 if (rc_service_exists (tmp) && rc_service_plugable (tmp)) 1134 if (rc_service_exists (tmp) && rc_service_plugable (tmp))
1131 rc_service_mark (tmp, RC_SERVICE_COLDPLUGGED); 1135 rc_service_mark (tmp, RC_SERVICE_COLDPLUGGED);
1132 CHAR_FREE (tmp); 1136 CHAR_FREE (tmp);
1133 } 1137 }
1148 1152
1149 tmplist = rc_services_in_state (RC_SERVICE_STARTED); 1153 tmplist = rc_services_in_state (RC_SERVICE_STARTED);
1150 rc_strlist_join (&stop_services, tmplist); 1154 rc_strlist_join (&stop_services, tmplist);
1151 rc_strlist_free (tmplist); 1155 rc_strlist_free (tmplist);
1152 1156
1153 types = NULL;
1154 rc_strlist_add (&types, "ineed");
1155 rc_strlist_add (&types, "iuse");
1156 rc_strlist_add (&types, "iafter");
1157
1158 deporder = rc_deptree_depends (deptree, types, stop_services, 1157 deporder = rc_deptree_depends (deptree, types_nua,
1158 (const char **) stop_services,
1159 runlevel, depoptions | RC_DEP_STOP); 1159 runlevel, depoptions | RC_DEP_STOP);
1160 1160
1161 rc_strlist_free (stop_services); 1161 rc_strlist_free (stop_services);
1162 rc_strlist_free (types);
1163 types = NULL;
1164 stop_services = deporder; 1162 stop_services = deporder;
1165 deporder = NULL; 1163 deporder = NULL;
1166 rc_strlist_reverse (stop_services); 1164 rc_strlist_reverse (stop_services);
1167 1165
1168 /* Load our list of coldplugged services */ 1166 /* Load our list of coldplugged services */
1207 1205
1208 /* Save out softlevel now */ 1206 /* Save out softlevel now */
1209 if (going_down) 1207 if (going_down)
1210 rc_runlevel_set (newlevel); 1208 rc_runlevel_set (newlevel);
1211 1209
1212 types = NULL;
1213 rc_strlist_add (&types, "needsme");
1214 /* Now stop the services that shouldn't be running */ 1210 /* Now stop the services that shouldn't be running */
1215 STRLIST_FOREACH (stop_services, service, i) { 1211 STRLIST_FOREACH (stop_services, service, i) {
1216 bool found = false; 1212 bool found = false;
1217 char *conf = NULL; 1213 char *conf = NULL;
1218 char **stopdeps = NULL; 1214 char **stopdeps = NULL;
1243 int len; 1239 int len;
1244 if (! newlevel) 1240 if (! newlevel)
1245 continue; 1241 continue;
1246 1242
1247 len = strlen (service) + strlen (runlevel) + 2; 1243 len = strlen (service) + strlen (runlevel) + 2;
1248 tmp = rc_xmalloc (sizeof (char *) * len); 1244 tmp = xmalloc (sizeof (char) * len);
1249 snprintf (tmp, len, "%s.%s", service, runlevel); 1245 snprintf (tmp, len, "%s.%s", service, runlevel);
1250 conf = rc_strcatpaths (RC_CONFDIR, tmp, (char *) NULL); 1246 conf = rc_strcatpaths (RC_CONFDIR, tmp, (char *) NULL);
1251 found = rc_exists (conf); 1247 found = exists (conf);
1252 CHAR_FREE (conf); 1248 CHAR_FREE (conf);
1253 CHAR_FREE (tmp); 1249 CHAR_FREE (tmp);
1254 if (! found) { 1250 if (! found) {
1255 len = strlen (service) + strlen (newlevel) + 2; 1251 len = strlen (service) + strlen (newlevel) + 2;
1256 tmp = rc_xmalloc (sizeof (char *) * len); 1252 tmp = xmalloc (sizeof (char) * len);
1257 snprintf (tmp, len, "%s.%s", service, newlevel); 1253 snprintf (tmp, len, "%s.%s", service, newlevel);
1258 conf = rc_strcatpaths (RC_CONFDIR, tmp, (char *) NULL); 1254 conf = rc_strcatpaths (RC_CONFDIR, tmp, (char *) NULL);
1259 found = rc_exists (conf); 1255 found = exists (conf);
1260 CHAR_FREE (conf); 1256 CHAR_FREE (conf);
1261 CHAR_FREE (tmp); 1257 CHAR_FREE (tmp);
1262 if (!found) 1258 if (!found)
1263 continue; 1259 continue;
1264 } 1260 }
1269 } 1265 }
1270 1266
1271 /* We got this far! Or last check is to see if any any service that 1267 /* We got this far! Or last check is to see if any any service that
1272 going to be started depends on us */ 1268 going to be started depends on us */
1273 rc_strlist_add (&stopdeps, service); 1269 rc_strlist_add (&stopdeps, service);
1274 deporder = rc_deptree_depends (deptree, types, stopdeps, 1270 deporder = rc_deptree_depends (deptree, types_n,
1271 (const char **) stopdeps,
1275 runlevel, RC_DEP_STRICT); 1272 runlevel, RC_DEP_STRICT);
1276 rc_strlist_free (stopdeps); 1273 rc_strlist_free (stopdeps);
1277 stopdeps = NULL; 1274 stopdeps = NULL;
1278 found = false; 1275 found = false;
1279 STRLIST_FOREACH (deporder, svc1, j) { 1276 STRLIST_FOREACH (deporder, svc1, j) {
1293 pid_t pid = rc_service_stop (service); 1290 pid_t pid = rc_service_stop (service);
1294 if (pid > 0 && ! rc_env_bool ("RC_PARALLEL")) 1291 if (pid > 0 && ! rc_env_bool ("RC_PARALLEL"))
1295 wait_pid (pid); 1292 wait_pid (pid);
1296 } 1293 }
1297 } 1294 }
1298 rc_strlist_free (types);
1299 types = NULL;
1300 1295
1301 /* Wait for our services to finish */ 1296 /* Wait for our services to finish */
1302 wait_for_services (); 1297 wait_for_services ();
1303 1298
1304 /* Notify the plugins we have finished */ 1299 /* Notify the plugins we have finished */
1308 1303
1309 /* Store the new runlevel */ 1304 /* Store the new runlevel */
1310 if (newlevel) { 1305 if (newlevel) {
1311 rc_runlevel_set (newlevel); 1306 rc_runlevel_set (newlevel);
1312 free (runlevel); 1307 free (runlevel);
1313 runlevel = rc_xstrdup (newlevel); 1308 runlevel = xstrdup (newlevel);
1314 setenv ("RC_SOFTLEVEL", runlevel, 1); 1309 setenv ("RC_SOFTLEVEL", runlevel, 1);
1315 } 1310 }
1316 1311
1317 /* Run the halt script if needed */ 1312 /* Run the halt script if needed */
1318 if (strcmp (runlevel, RC_LEVEL_SHUTDOWN) == 0 || 1313 if (strcmp (runlevel, RC_LEVEL_SHUTDOWN) == 0 ||
1323 applet, HALTSH, strerror (errno)); 1318 applet, HALTSH, strerror (errno));
1324 } 1319 }
1325 1320
1326 /* Single user is done now */ 1321 /* Single user is done now */
1327 if (strcmp (runlevel, RC_LEVEL_SINGLE) == 0) { 1322 if (strcmp (runlevel, RC_LEVEL_SINGLE) == 0) {
1328 if (rc_exists (INTERACTIVE)) 1323 if (exists (INTERACTIVE))
1329 unlink (INTERACTIVE); 1324 unlink (INTERACTIVE);
1330 sulogin (false); 1325 sulogin (false);
1331 } 1326 }
1332 1327
1333 mkdir (RC_STARTING, 0755); 1328 mkdir (RC_STARTING, 0755);
1336 /* Re-add our coldplugged services if they stopped */ 1331 /* Re-add our coldplugged services if they stopped */
1337 STRLIST_FOREACH (coldplugged_services, service, i) 1332 STRLIST_FOREACH (coldplugged_services, service, i)
1338 rc_service_mark (service, RC_SERVICE_COLDPLUGGED); 1333 rc_service_mark (service, RC_SERVICE_COLDPLUGGED);
1339 1334
1340 /* Order the services to start */ 1335 /* Order the services to start */
1341 rc_strlist_add (&types, "ineed");
1342 rc_strlist_add (&types, "iuse");
1343 rc_strlist_add (&types, "iafter");
1344 deporder = rc_deptree_depends (deptree, types, start_services, 1336 deporder = rc_deptree_depends (deptree, types_nua,
1337 (const char **) start_services,
1345 runlevel, depoptions | RC_DEP_START); 1338 runlevel, depoptions | RC_DEP_START);
1346 rc_strlist_free (types);
1347 types = NULL;
1348 rc_strlist_free (start_services); 1339 rc_strlist_free (start_services);
1349 start_services = deporder; 1340 start_services = deporder;
1350 deporder = NULL; 1341 deporder = NULL;
1351 1342
1352#ifdef __linux__ 1343#ifdef __linux__
1421 1412
1422 /* Store our interactive status for boot */ 1413 /* Store our interactive status for boot */
1423 if (interactive && strcmp (runlevel, bootlevel) == 0) 1414 if (interactive && strcmp (runlevel, bootlevel) == 0)
1424 mark_interactive (); 1415 mark_interactive ();
1425 else { 1416 else {
1426 if (rc_exists (INTERACTIVE)) 1417 if (exists (INTERACTIVE))
1427 unlink (INTERACTIVE); 1418 unlink (INTERACTIVE);
1428 } 1419 }
1429 1420
1430 return (EXIT_SUCCESS); 1421 return (EXIT_SUCCESS);
1431} 1422}

Legend:
Removed from v.3007  
changed lines
  Added in v.3040

  ViewVC Help
Powered by ViewVC 1.1.20