gatesgarth migration: sysvinit: update to recipe v2.97
https://jira.digi.com/browse/DEL-7508 Signed-off-by: Arturo Buzarra <arturo.buzarra@digi.com>
This commit is contained in:
parent
0479a31f66
commit
b2152d4721
|
|
@ -4,56 +4,71 @@ Subject: [PATCH] sysvinit: disable all cpus but cpu0 for halt/reboot
|
|||
|
||||
Signed-off-by: Javier Viguera <javier.viguera@digi.com>
|
||||
---
|
||||
src/Makefile | 6 +++---
|
||||
src/halt.c | 20 +++++++++++-------
|
||||
src/init.c | 5 +++++
|
||||
src/Makefile | 6 ++---
|
||||
src/halt.c | 20 ++++++++++------
|
||||
src/init.c | 5 ++++
|
||||
src/shutdown.c | 3 +++
|
||||
src/sysfs_cpu.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
src/sysfs_cpu.h | 24 ++++++++++++++++++++++
|
||||
src/sysfs_cpu.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
src/sysfs_cpu.h | 24 +++++++++++++++++++
|
||||
6 files changed, 111 insertions(+), 10 deletions(-)
|
||||
create mode 100644 src/sysfs_cpu.c
|
||||
create mode 100644 src/sysfs_cpu.h
|
||||
|
||||
diff --git a/src/Makefile b/src/Makefile
|
||||
index a6f9f4052926..d5bd705955c5 100644
|
||||
index 1b368dc..b22fd52 100644
|
||||
--- a/src/Makefile
|
||||
+++ b/src/Makefile
|
||||
@@ -101,9 +101,9 @@ all: $(BIN) $(SBIN) $(USRBIN)
|
||||
@@ -107,14 +107,14 @@ all: $(BIN) $(SBIN) $(USRBIN)
|
||||
# $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
|
||||
#%.o: %.c
|
||||
# $(CC) $(CFLAGS) $(CPPFLAGS) -c $^ -o $@
|
||||
|
||||
init: LDLIBS += $(INITLIBS) $(STATIC)
|
||||
-init: init.o init_utmp.o
|
||||
+init: init.o init_utmp.o sysfs_cpu.o
|
||||
-init: init.o init_utmp.o runlevellog.o
|
||||
+init: init.o init_utmp.o runlevellog.o sysfs_cpu.o
|
||||
|
||||
-halt: halt.o ifdown.o hddown.o utmp.o
|
||||
+halt: halt.o ifdown.o hddown.o utmp.o sysfs_cpu.o
|
||||
halt: LDLIBS += $(STATIC)
|
||||
-halt: halt.o ifdown.o hddown.o utmp.o runlevellog.o
|
||||
+halt: halt.o ifdown.o hddown.o utmp.o runlevellog.o sysfs_cpu.o
|
||||
|
||||
last: LDLIBS += $(STATIC)
|
||||
last: last.o
|
||||
|
||||
@@ -120,7 +120,7 @@ sulogin: sulogin.o
|
||||
logsave: LDLIBS += $(STATIC)
|
||||
@@ -137,11 +137,11 @@ sulogin: sulogin.o consoles.o
|
||||
|
||||
wall: LDLIBS += $(STATIC)
|
||||
wall: dowall.o wall.o
|
||||
|
||||
shutdown: LDLIBS += $(STATIC)
|
||||
-shutdown: dowall.o shutdown.o utmp.o
|
||||
+shutdown: dowall.o shutdown.o utmp.o sysfs_cpu.o
|
||||
|
||||
bootlogd: LDLIBS += -lutil
|
||||
bootlogd: LDLIBS += -lutil $(STATIC)
|
||||
bootlogd: bootlogd.o
|
||||
|
||||
readbootlog: LDLIBS += $(STATIC)
|
||||
diff --git a/src/halt.c b/src/halt.c
|
||||
index 499e9734056c..7ded393caf46 100644
|
||||
index a469147..f51d0cb 100644
|
||||
--- a/src/halt.c
|
||||
+++ b/src/halt.c
|
||||
@@ -57,6 +57,7 @@
|
||||
@@ -56,10 +56,11 @@
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <getopt.h>
|
||||
#include "reboot.h"
|
||||
#include "runlevellog.h"
|
||||
+#include "sysfs_cpu.h"
|
||||
|
||||
char *Version = "@(#)halt 2.86 31-Jul-2004 miquels@cistron.nl";
|
||||
char *progname;
|
||||
@@ -241,13 +242,18 @@ int main(int argc, char **argv)
|
||||
|
||||
(void)chdir("/");
|
||||
#define KERNEL_MONITOR 1 /* If halt() puts you into the kernel monitor. */
|
||||
@@ -253,17 +254,22 @@ int main(int argc, char **argv)
|
||||
if (chdir("/")) {
|
||||
fprintf(stderr, "%s: chdir(/): %m\n", progname);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
- if (!do_hard && !do_nothing) {
|
||||
- /*
|
||||
|
|
@ -61,7 +76,7 @@ index 499e9734056c..7ded393caf46 100644
|
|||
- */
|
||||
- c = get_runlevel();
|
||||
- if (c != '0' && c != '6')
|
||||
- do_shutdown(do_reboot ? "-r" : "-h", tm);
|
||||
- do_shutdown(do_reboot ? "-r" : "-h", do_poweroff, tm);
|
||||
+ if (!do_nothing) {
|
||||
+ if (!do_hard) {
|
||||
+ /*
|
||||
|
|
@ -69,7 +84,7 @@ index 499e9734056c..7ded393caf46 100644
|
|||
+ */
|
||||
+ c = get_runlevel();
|
||||
+ if (c != '0' && c != '6')
|
||||
+ do_shutdown(do_reboot ? "-r" : "-h", tm);
|
||||
+ do_shutdown(do_reboot ? "-r" : "-h", do_poweroff, tm);
|
||||
+ } else {
|
||||
+ /* Disable cores for halt/reboot */
|
||||
+ sysfs_disable_cpu_all();
|
||||
|
|
@ -77,22 +92,30 @@ index 499e9734056c..7ded393caf46 100644
|
|||
}
|
||||
|
||||
/*
|
||||
* Record the fact that we're going down
|
||||
*/
|
||||
diff --git a/src/init.c b/src/init.c
|
||||
index 27532aded622..84cb03523677 100644
|
||||
index 78ae760..432f0e5 100644
|
||||
--- a/src/init.c
|
||||
+++ b/src/init.c
|
||||
@@ -78,6 +78,7 @@
|
||||
@@ -93,10 +93,11 @@ extern char **environ;
|
||||
#include "initreq.h"
|
||||
#include "paths.h"
|
||||
#include "reboot.h"
|
||||
#include "runlevellog.h"
|
||||
#include "set.h"
|
||||
+#include "sysfs_cpu.h"
|
||||
|
||||
#ifndef SIGPWR
|
||||
# define SIGPWR SIGUSR2
|
||||
@@ -2731,6 +2732,10 @@ int telinit(char *progname, int argc, char **argv)
|
||||
#endif
|
||||
|
||||
@@ -3016,10 +3017,14 @@ int telinit(char *progname, int argc, char **argv)
|
||||
if (!strchr("0123456789SsQqAaBbCcUu", argv[optind][0]))
|
||||
usage(progname);
|
||||
request.cmd = INIT_CMD_RUNLVL;
|
||||
request.runlevel = env ? 0 : argv[optind][0];
|
||||
request.sleeptime = sltime;
|
||||
request.runlevel = argv[optind][0];
|
||||
request.sleeptime = sleep_time;
|
||||
+
|
||||
+ /* Disable cores for halt/reboot */
|
||||
+ if (request.runlevel == '0' || request.runlevel == '6')
|
||||
|
|
@ -100,11 +123,15 @@ index 27532aded622..84cb03523677 100644
|
|||
}
|
||||
|
||||
/* Change to the root directory. */
|
||||
if (0 != chdir("/"))
|
||||
initlog(L_VB, "unable to chdir to /: %s",
|
||||
diff --git a/src/shutdown.c b/src/shutdown.c
|
||||
index 7e997da84e3a..f3b5aae2f07a 100644
|
||||
index c49795f..48e65d1 100644
|
||||
--- a/src/shutdown.c
|
||||
+++ b/src/shutdown.c
|
||||
@@ -326,6 +326,9 @@ void fastdown()
|
||||
@@ -344,10 +344,13 @@ void fastdown()
|
||||
else
|
||||
script = REBOOTSCRIPT2;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -114,9 +141,11 @@ index 7e997da84e3a..f3b5aae2f07a 100644
|
|||
/* First close all files. */
|
||||
for(i = 0; i < 3; i++)
|
||||
if (!isatty(i)) {
|
||||
close(i);
|
||||
open("/dev/null", O_RDWR);
|
||||
diff --git a/src/sysfs_cpu.c b/src/sysfs_cpu.c
|
||||
new file mode 100644
|
||||
index 000000000000..fe14ff71c382
|
||||
index 0000000..fe14ff7
|
||||
--- /dev/null
|
||||
+++ b/src/sysfs_cpu.c
|
||||
@@ -0,0 +1,63 @@
|
||||
|
|
@ -185,7 +214,7 @@ index 000000000000..fe14ff71c382
|
|||
+}
|
||||
diff --git a/src/sysfs_cpu.h b/src/sysfs_cpu.h
|
||||
new file mode 100644
|
||||
index 000000000000..7728d52fe4d9
|
||||
index 0000000..7728d52
|
||||
--- /dev/null
|
||||
+++ b/src/sysfs_cpu.h
|
||||
@@ -0,0 +1,24 @@
|
||||
Loading…
Reference in New Issue