mirror of
https://github.com/troglobit/finit.git
synced 2026-11-29 21:08:21 +00:00
Change poweroff method to reboot(RB_POWER_OFF) (Metalshark)
Metalshark says: February 19th, 2008 at 9:10 pm There is an issue with some ACPI/Kernel combinations to do with shutdown. It isn’t always powering off (tried /proc/acpi and /sys methods) - however removing all the fd > 5 stuff and putting in the simple line “reboot(RB_POWER_OFF);” worked for all thus far. Although semantically incorrect it is a working solution. Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
This commit is contained in:
1 parent
7137573534
commit
fb8c341168
3 files changed
+7
-14
No files matched your search
@@ -6,6 +6,7 @@ LIBS =
|
|||||||
VERSION = 0.3-pre
|
VERSION = 0.3-pre
|
||||||
PKG = finit-$(VERSION)
|
PKG = finit-$(VERSION)
|
||||||
DFILES = Makefile README finit.c finit-mod.c finit-alt.c helpers.c helpers.h
|
DFILES = Makefile README finit.c finit-mod.c finit-alt.c helpers.c helpers.h
|
||||||
|
BINS = finit finit-mod finit-mdv
|
||||||
|
|
||||||
|
|
||||||
#### Configurable parameters
|
#### Configurable parameters
|
||||||
@@ -31,7 +32,7 @@ CFLAGS += -march=pentium-m
|
|||||||
.c.o:
|
.c.o:
|
||||||
$(CC) -c $(CFLAGS) -o $*.o $<
|
$(CC) -c $(CFLAGS) -o $*.o $<
|
||||||
|
|
||||||
all: finit finit-mod finit-mdv
|
all: $(BINS)
|
||||||
|
|
||||||
finit: finit.o
|
finit: finit.o
|
||||||
$(LD) $(LDFLAGS) -o $@ $+ $(LIBS)
|
$(LD) $(LDFLAGS) -o $@ $+ $(LIBS)
|
||||||
@@ -49,7 +50,7 @@ finit-mdv.o: finit-alt.c Makefile
|
|||||||
$(CC) -c $(CFLAGS) -DDIST_MDV -o $@ finit-alt.c
|
$(CC) -c $(CFLAGS) -DDIST_MDV -o $@ finit-alt.c
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.o core *~
|
rm -f *.o core *~ $(BINS)
|
||||||
|
|
||||||
finit.o: finit.c Makefile
|
finit.o: finit.c Makefile
|
||||||
|
|
||||||
|
|||||||
+1
-6
@@ -328,8 +328,6 @@ int main()
|
|||||||
*/
|
*/
|
||||||
void shutdown(int sig)
|
void shutdown(int sig)
|
||||||
{
|
{
|
||||||
int fd;
|
|
||||||
|
|
||||||
debug("shutdown");
|
debug("shutdown");
|
||||||
touch("/tmp/shutdown");
|
touch("/tmp/shutdown");
|
||||||
|
|
||||||
@@ -354,10 +352,7 @@ void shutdown(int sig)
|
|||||||
if (sig == SIGINT || sig == SIGUSR1)
|
if (sig == SIGINT || sig == SIGUSR1)
|
||||||
reboot(RB_AUTOBOOT);
|
reboot(RB_AUTOBOOT);
|
||||||
|
|
||||||
if ((fd = open("/sys/power/state", O_WRONLY)) >= 0) {
|
reboot(RB_POWER_OFF);
|
||||||
write(fd, "5", 1);
|
|
||||||
close(fd);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+3
-6
@@ -38,6 +38,8 @@ Changelog from the original Eeepc fastinit:
|
|||||||
- Set loopback interface using direct calls instead of system("ifconfig")
|
- Set loopback interface using direct calls instead of system("ifconfig")
|
||||||
- Copy 4096 data block in C instead of system("cat") or system("dd")
|
- Copy 4096 data block in C instead of system("cat") or system("dd")
|
||||||
- Draw shutdown splash screen using C calls instead of system("echo;cat")
|
- Draw shutdown splash screen using C calls instead of system("echo;cat")
|
||||||
|
- Change poweroff method from writing 5 to /sys/power/state to
|
||||||
|
reboot(RB_POWER_OFF) (by Metalshark)
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -271,8 +273,6 @@ int main()
|
|||||||
*/
|
*/
|
||||||
void shutdown(int sig)
|
void shutdown(int sig)
|
||||||
{
|
{
|
||||||
int fd;
|
|
||||||
|
|
||||||
touch("/tmp/shutdown");
|
touch("/tmp/shutdown");
|
||||||
|
|
||||||
kill(-1, SIGTERM);
|
kill(-1, SIGTERM);
|
||||||
@@ -296,10 +296,7 @@ void shutdown(int sig)
|
|||||||
if (sig == SIGINT || sig == SIGUSR1)
|
if (sig == SIGINT || sig == SIGUSR1)
|
||||||
reboot(RB_AUTOBOOT);
|
reboot(RB_AUTOBOOT);
|
||||||
|
|
||||||
if ((fd = open("/sys/power/state", O_WRONLY)) >= 0) {
|
reboot(RB_POWER_OFF);
|
||||||
write(fd, "5", 1);
|
|
||||||
close(fd);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user