Enable runtime debug in finit-alt if DEBUG parameter is specified

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
This commit is contained in:
Claudio Matsuoka
2008-05-02 15:34:13 -03:00
parent 5acd2cd441
commit 9d164ac312
3 changed files with 11 additions and 25 deletions
+1 -1
View File
@@ -7,7 +7,7 @@ O.4 ()
- add services.sh example and nash-hotplug patch for Mandriva
- mount /proc/bus/usb in Mandriva
- finit-mdv checks filesystem if CHECKFS= parameter is specified
- add runtime debug to finit-alt if DEBUG parameter is specified
0.3 (20080223)
- Change poweroff method to reboot(RB_POWER_OFF) (Metalshark)
-3
View File
@@ -16,9 +16,6 @@ BINS = finit finit-mod finit-mdv
# Default user for finit-alt if not "user"
#DEFUSER = fred
# Add -DDEBUG to build with debug messages, also drops to terminal after X
#CFLAGS += -DDEBUG
# Use -march=pentium-m to build for Eeepc
CFLAGS += -march=pentium-m
+10 -21
View File
@@ -40,14 +40,6 @@ THE SOFTWARE.
#include "helpers.h"
#ifdef DEBUG
#define debug(x...) do { \
printf("finit: %d: ", __LINE__); printf(x); printf("\n"); \
} while (0)
#else
#define debug(x...)
#endif
#ifndef DEFUSER
#define DEFUSER "user"
#endif
@@ -110,6 +102,7 @@ int main()
struct sigaction sa, act;
char *x;
sigset_t nmask, nmask2;
int debug = 0;
puts("finit-alt " VERSION " (built " __DATE__ " by " WHOAMI ")");
@@ -164,6 +157,9 @@ int main()
reboot(RB_AUTOBOOT);
}
#endif
if ((strstr(line, "DEBUG"))) {
debug = 1;
}
fclose(f);
}
@@ -172,8 +168,6 @@ int main()
/*
* Mount filesystems
*/
debug("mount filesystems");
#ifdef REMOUNT_ROOTFS_RW
system("/bin/mount -n -o remount,rw /");
#endif
@@ -194,7 +188,6 @@ int main()
mount(SYSROOT, "/", NULL, MS_MOVE, NULL);
#ifdef MAKE_DEVICES
debug("make devices");
mkdir("/dev/input", 0755);
chardev("/dev/urandom", 0666, 1, 9);
chardev("/dev/ptmx", 0666, 5, 2);
@@ -300,8 +293,6 @@ int main()
mkdir("/tmp/.ICE-unix", 01777);
umask(022);
debug("forking");
if (!fork()) {
/* child process */
@@ -336,13 +327,12 @@ int main()
#endif
while (access("/tmp/shutdown", F_OK) < 0) {
debug("start X as " DEFUSER);
#ifdef DEBUG
system("su -c startx -l " DEFUSER);
system("/bin/sh");
#else
system("su -c startx -l " DEFUSER " &> /dev/null");
#endif
if (debug) {
system("su -c startx -l " DEFUSER);
system("/bin/sh");
} else {
system("su -c startx -l " DEFUSER " &> /dev/null");
}
}
exit(0);
@@ -366,7 +356,6 @@ int main()
*/
void shutdown(int sig)
{
debug("shutdown");
touch("/tmp/shutdown");
kill(-1, SIGTERM);