Remove loader from the reboot/shutdown/halt picture.
Right now, rebooting/halting after installation is handled in at least
three places: anaconda knows how to do some things, loader knows how to do
some others, and init knows how to do everything. loader really just does a
bunch of signal handling and process exit status checking to figure out how
to signal init which is completely unnecessary. Instead, loader should just
exec anaconda and then get out of the picture.
---
loader/loader.c | 68 +++---------------------------------------------------
1 files changed, 4 insertions(+), 64 deletions(-)
diff --git a/loader/loader.c b/loader/loader.c
index cd3e178..5502553 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -123,9 +123,6 @@ uint64_t flags = LOADER_FLAGS_SELINUX;
int num_link_checks = 5;
int post_link_sleep = 0;
if (!FL_TESTING(flags)) {
- int pid, status, rc;
char *fmt;
if (FL_RESCUE(flags)) {
@@ -2263,44 +2234,13 @@ int main(int argc, char ** argv) {
}
printf(fmt, VERSION, getProductName());
- if (!(pid = fork())) {
- if (execv(anacondaArgs[0], anacondaArgs) == -1) {
- fprintf(stderr,"exec of anaconda failed: %m
");
- doExit(1);
- }
- }
-
- waitpid(pid, &status, 0);
-
- if (!WIFEXITED(status) || (WIFEXITED(status) && WEXITSTATUS(status))) {
- rc = 1;
- } else {
- rc = 0;
- }
-
- if ((rc == 0) && (FL_POWEROFF(flags) || FL_HALT(flags))) {
- if (!(pid = fork())) {
- char * cmd = (FL_POWEROFF(flags) ? strdup("/sbin/poweroff") :
- strdup("/sbin/halt"));
- if (execl(cmd, cmd, NULL) == -1) {
- fprintf(stderr, "exec of poweroff failed: %m
");
- doExit(1);
- }
- }
- waitpid(pid, &status, 0);
+ if (execv(anacondaArgs[0], anacondaArgs) == -1) {
+ fprintf(stderr,"exec of anaconda failed: %m
");
+ doExit(1);
}
-
- stop_fw_loader(&loaderData);
-#if defined(__s390__) || defined(__s390x__)
- /* at the latest possibility signal init=linuxrc.s390 to reboot/halt */
- logMessage(INFO, "Sending signal %d to process %d
",
- init_sig, init_pid);
- kill(init_pid, init_sig);
-#endif
- doExit(rc);
}
- doExit(1);
+ return 0;
}
/* vim:set sw=4 sts=4 et: */
--
1.6.5.1
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
11-24-2009, 12:41 PM
Steffen Maier
Remove loader from the reboot/shutdown/halt picture.
comment inline
On 11/23/2009 09:40 PM, Chris Lumens wrote:
> Right now, rebooting/halting after installation is handled in at least
> three places: anaconda knows how to do some things, loader knows how to do
> some others, and init knows how to do everything. loader really just does a
> bunch of signal handling and process exit status checking to figure out how
> to signal init which is completely unnecessary. Instead, loader should just
> exec anaconda and then get out of the picture.
> ---
> loader/loader.c | 68 +++---------------------------------------------------
> 1 files changed, 4 insertions(+), 64 deletions(-)
>
> diff --git a/loader/loader.c b/loader/loader.c
> index cd3e178..5502553 100644
> --- a/loader/loader.c
> +++ b/loader/loader.c
> @@ -123,9 +123,6 @@ uint64_t flags = LOADER_FLAGS_SELINUX;
> int num_link_checks = 5;
> int post_link_sleep = 0;
>
> -static pid_t init_pid = 1;
> -static int init_sig = SIGUSR1; /* default to shutdown=halt */
> -
> static struct installMethod installMethods[] = {
> { N_("Local CD/DVD"), 0, DEVICE_CDROM, mountCdromImage },
> { N_("Hard drive"), 0, DEVICE_DISK, mountHardDrive },
> @@ -1726,11 +1723,6 @@ static void setupBacktrace(void)
> backtrace(&array, 1);
> }
>
> -void loaderUsrXHandler(int signum) {
> - logMessage(INFO, "Remembering signal %d
", signum);
> - init_sig = signum;
> -}
> -
> static int anaconda_trace_init(void) {
> #ifdef USE_MTRACE
> setenv("MALLOC_TRACE","/malloc",1);
> @@ -1802,26 +1794,6 @@ int main(int argc, char ** argv) {
> { NULL },
> };
>
> - /* get init PID if we have it */
> - if ((f = fopen("/var/run/init.pid", "r")) != NULL) {
> - char linebuf[256];
> - memset(linebuf, ' ', sizeof(linebuf));
> -
> - while (fgets(linebuf, sizeof(linebuf) - 1, f) != NULL) {
> - errno = 0;
> - init_pid = strtol((const char *) &linebuf, NULL, 10);
> - if (errno == EINVAL || errno == ERANGE) {
> - logMessage(ERROR, "%s (%d): %m", __func__, __LINE__);
> - init_pid = 1;
> - }
> - }
> -
> - fclose(f);
> - }
> -
> - signal(SIGUSR1, loaderUsrXHandler);
> - signal(SIGUSR2, loaderUsrXHandler);
> -
> /* Make sure sort order is right. */
> setenv ("LC_COLLATE", "C", 1);
>
> @@ -2253,7 +2225,6 @@ int main(int argc, char ** argv) {
> closeLog();
>
> if (!FL_TESTING(flags)) {
> - int pid, status, rc;
> char *fmt;
>
> if (FL_RESCUE(flags)) {
> @@ -2263,44 +2234,13 @@ int main(int argc, char ** argv) {
> }
> printf(fmt, VERSION, getProductName());
>
> - if (!(pid = fork())) {
> - if (execv(anacondaArgs[0], anacondaArgs) == -1) {
> - fprintf(stderr,"exec of anaconda failed: %m
");
> - doExit(1);
> - }
> - }
> -
> - waitpid(pid, &status, 0);
> -
> - if (!WIFEXITED(status) || (WIFEXITED(status) && WEXITSTATUS(status))) {
> - rc = 1;
> - } else {
> - rc = 0;
> - }
> -
> - if ((rc == 0) && (FL_POWEROFF(flags) || FL_HALT(flags))) {
> - if (!(pid = fork())) {
> - char * cmd = (FL_POWEROFF(flags) ? strdup("/sbin/poweroff") :
> - strdup("/sbin/halt"));
> - if (execl(cmd, cmd, NULL) == -1) {
> - fprintf(stderr, "exec of poweroff failed: %m
");
> - doExit(1);
> - }
> - }
> - waitpid(pid, &status, 0);
> + if (execv(anacondaArgs[0], anacondaArgs) == -1) {
> + fprintf(stderr,"exec of anaconda failed: %m
");
> + doExit(1);
> }
> -
> - stop_fw_loader(&loaderData);
> -#if defined(__s390__) || defined(__s390x__)
> - /* at the latest possibility signal init=linuxrc.s390 to reboot/halt */
> - logMessage(INFO, "Sending signal %d to process %d
",
> - init_sig, init_pid);
> - kill(init_pid, init_sig);
> -#endif
I guess util.py:reIPLtrigger() would now have to call init
(=linuxrc.s390) as reboot or halt instead of killing its parent loader
with SIGUSR2 or SIGUSR1.
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
11-24-2009, 01:07 PM
Steffen Maier
Remove loader from the reboot/shutdown/halt picture.
On 11/24/2009 02:41 PM, Steffen Maier wrote:
> comment inline
>
> On 11/23/2009 09:40 PM, Chris Lumens wrote:
>> Right now, rebooting/halting after installation is handled in at least
>> three places: anaconda knows how to do some things, loader knows how to do
>> some others, and init knows how to do everything. loader really just does a
>> bunch of signal handling and process exit status checking to figure out how
>> to signal init which is completely unnecessary. Instead, loader should just
>> exec anaconda and then get out of the picture.
>> ---
>> loader/loader.c | 68 +++---------------------------------------------------
>> 1 files changed, 4 insertions(+), 64 deletions(-)
>>
>> diff --git a/loader/loader.c b/loader/loader.c
>> index cd3e178..5502553 100644
>> --- a/loader/loader.c
>> +++ b/loader/loader.c
>> -#if defined(__s390__) || defined(__s390x__)
>> - /* at the latest possibility signal init=linuxrc.s390 to reboot/halt */
>> - logMessage(INFO, "Sending signal %d to process %d
",
>> - init_sig, init_pid);
>> - kill(init_pid, init_sig);
>> -#endif
>
> I guess util.py:reIPLtrigger() would now have to call init
> (=linuxrc.s390) as reboot or halt instead of killing its parent loader
> with SIGUSR2 or SIGUSR1.
Sorry, I just realized that this would prematurely kill the installation
process. Up to now we relied on loader deferring the init signalling for
shutdown to the latest point which is after anaconda terminated. From
the top of my head I currently have no idea for how to solve this.
Reipl just needs some way for anaconda to dynamically tell init whether
it should reboot or halt.
Steffen
Linux on System z Development
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
12-01-2009, 08:32 PM
Chris Lumens
Remove loader from the reboot/shutdown/halt picture.
Right now, rebooting/halting after installation is handled in at least
three places: anaconda knows how to do some things, loader knows how to do
some others, and init knows how to do everything. loader really just does a
bunch of signal handling and process exit status checking to figure out how
to signal init which is completely unnecessary. Instead, loader should just
exec anaconda and then get out of the picture.
---
loader/loader.c | 68 +++---------------------------------------------------
1 files changed, 4 insertions(+), 64 deletions(-)
diff --git a/loader/loader.c b/loader/loader.c
index cd3e178..5502553 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -123,9 +123,6 @@ uint64_t flags = LOADER_FLAGS_SELINUX;
int num_link_checks = 5;
int post_link_sleep = 0;