ksoftlevel -> krunlevel

This commit is contained in:
Roy Marples 2008-03-21 10:34:09 +00:00
parent 494fb0a5f6
commit fe90a548b5

View File

@ -358,7 +358,7 @@ static void single_user(void)
applet, strerror(errno)); applet, strerror(errno));
} }
static bool set_ksoftlevel(const char *level) static bool set_krunlevel(const char *level)
{ {
FILE *fp; FILE *fp;
@ -383,7 +383,7 @@ static bool set_ksoftlevel(const char *level)
return true; return true;
} }
static int get_ksoftlevel(char *buffer, int buffer_len) static int get_krunlevel(char *buffer, int buffer_len)
{ {
FILE *fp; FILE *fp;
int i = 0; int i = 0;
@ -690,9 +690,9 @@ static void do_newlevel(const char *newlevel)
#ifdef __linux__ #ifdef __linux__
/* If we requested a softlevel, save it now */ /* If we requested a softlevel, save it now */
set_ksoftlevel(NULL); set_krunlevel(NULL);
if ((cmd = proc_getent("softlevel"))) { if ((cmd = proc_getent("softlevel"))) {
set_ksoftlevel(cmd); set_krunlevel(cmd);
free(cmd); free(cmd);
} }
#endif #endif
@ -714,7 +714,7 @@ static void do_newlevel(const char *newlevel)
strcmp(RUNLEVEL, "1") != 0)) strcmp(RUNLEVEL, "1") != 0))
{ {
/* Remember the current runlevel for when we come back */ /* Remember the current runlevel for when we come back */
set_ksoftlevel(runlevel); set_krunlevel(runlevel);
single_user(); single_user();
} }
#endif #endif
@ -921,7 +921,7 @@ int main(int argc, char **argv)
RC_STRING *service; RC_STRING *service;
bool going_down = false; bool going_down = false;
int depoptions = RC_DEP_STRICT | RC_DEP_TRACE; int depoptions = RC_DEP_STRICT | RC_DEP_TRACE;
char ksoftbuffer [PATH_MAX]; char krunlevel [PATH_MAX];
char pidstr[6]; char pidstr[6];
int opt; int opt;
bool parallel; bool parallel;
@ -978,7 +978,7 @@ int main(int argc, char **argv)
case 'o': case 'o':
if (*optarg == '\0') if (*optarg == '\0')
optarg = NULL; optarg = NULL;
exit(set_ksoftlevel(optarg) ? EXIT_SUCCESS : EXIT_FAILURE); exit(set_krunlevel(optarg) ? EXIT_SUCCESS : EXIT_FAILURE);
/* NOTREACHED */ /* NOTREACHED */
case 's': case 's':
newlevel = rc_service_resolve(optarg); newlevel = rc_service_resolve(optarg);
@ -1029,24 +1029,24 @@ int main(int argc, char **argv)
/* Now we start handling our children */ /* Now we start handling our children */
signal_setup(SIGCHLD, handle_signal); signal_setup(SIGCHLD, handle_signal);
/* We should only use ksoftlevel if we were in single user mode /* We should only use krunlevel if we were in single user mode
* If not, we need to erase ksoftlevel now. */ * If not, we need to erase krunlevel now. */
if (PREVLEVEL && if (PREVLEVEL &&
(strcmp(PREVLEVEL, "1") == 0 || (strcmp(PREVLEVEL, "1") == 0 ||
strcmp(PREVLEVEL, "S") == 0 || strcmp(PREVLEVEL, "S") == 0 ||
strcmp(PREVLEVEL, "N") == 0)) strcmp(PREVLEVEL, "N") == 0))
{ {
/* Try not to join boot and ksoftlevels together */ /* Try not to join boot and krunlevels together */
if (! newlevel || if (! newlevel ||
strcmp(newlevel, getenv("RC_BOOTLEVEL")) != 0) strcmp(newlevel, getenv("RC_BOOTLEVEL")) != 0)
if (get_ksoftlevel(ksoftbuffer, sizeof(ksoftbuffer))) if (get_krunlevel(krunlevel, sizeof(krunlevel)))
newlevel = ksoftbuffer; newlevel = krunlevel;
} else if (! RUNLEVEL || } else if (! RUNLEVEL ||
(strcmp(RUNLEVEL, "1") != 0 && (strcmp(RUNLEVEL, "1") != 0 &&
strcmp(RUNLEVEL, "S") != 0 && strcmp(RUNLEVEL, "S") != 0 &&
strcmp(RUNLEVEL, "N") != 0)) strcmp(RUNLEVEL, "N") != 0))
{ {
set_ksoftlevel(NULL); set_krunlevel(NULL);
} }
if (newlevel && if (newlevel &&