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 committed 2008-05-02 15:34:13 -03:00
1 parent 5acd2cd441
commit 9d164ac312
3 files changed
+11 -25

No files matched your search

+1 -1
View File
@@ -7,7 +7,7 @@ O.4 ()
- add services.sh example and nash-hotplug patch for Mandriva - add services.sh example and nash-hotplug patch for Mandriva
- mount /proc/bus/usb in Mandriva - mount /proc/bus/usb in Mandriva
- finit-mdv checks filesystem if CHECKFS= parameter is specified - finit-mdv checks filesystem if CHECKFS= parameter is specified
- add runtime debug to finit-alt if DEBUG parameter is specified
0.3 (20080223) 0.3 (20080223)
- Change poweroff method to reboot(RB_POWER_OFF) (Metalshark) - 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" # Default user for finit-alt if not "user"
#DEFUSER = fred #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 # Use -march=pentium-m to build for Eeepc
CFLAGS += -march=pentium-m CFLAGS += -march=pentium-m
+10 -21
View File
@@ -40,14 +40,6 @@ THE SOFTWARE.
#include "helpers.h" #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 #ifndef DEFUSER
#define DEFUSER "user" #define DEFUSER "user"
#endif #endif
@@ -110,6 +102,7 @@ int main()
struct sigaction sa, act; struct sigaction sa, act;
char *x; char *x;
sigset_t nmask, nmask2; sigset_t nmask, nmask2;
int debug = 0;
puts("finit-alt " VERSION " (built " __DATE__ " by " WHOAMI ")"); puts("finit-alt " VERSION " (built " __DATE__ " by " WHOAMI ")");
@@ -164,6 +157,9 @@ int main()
reboot(RB_AUTOBOOT); reboot(RB_AUTOBOOT);
} }
#endif #endif
if ((strstr(line, "DEBUG"))) {
debug = 1;
}
fclose(f); fclose(f);
} }
@@ -172,8 +168,6 @@ int main()
/* /*
* Mount filesystems * Mount filesystems
*/ */
debug("mount filesystems");
#ifdef REMOUNT_ROOTFS_RW #ifdef REMOUNT_ROOTFS_RW
system("/bin/mount -n -o remount,rw /"); system("/bin/mount -n -o remount,rw /");
#endif #endif
@@ -194,7 +188,6 @@ int main()
mount(SYSROOT, "/", NULL, MS_MOVE, NULL); mount(SYSROOT, "/", NULL, MS_MOVE, NULL);
#ifdef MAKE_DEVICES #ifdef MAKE_DEVICES
debug("make devices");
mkdir("/dev/input", 0755); mkdir("/dev/input", 0755);
chardev("/dev/urandom", 0666, 1, 9); chardev("/dev/urandom", 0666, 1, 9);
chardev("/dev/ptmx", 0666, 5, 2); chardev("/dev/ptmx", 0666, 5, 2);
@@ -300,8 +293,6 @@ int main()
mkdir("/tmp/.ICE-unix", 01777); mkdir("/tmp/.ICE-unix", 01777);
umask(022); umask(022);
debug("forking");
if (!fork()) { if (!fork()) {
/* child process */ /* child process */
@@ -336,13 +327,12 @@ int main()
#endif #endif
while (access("/tmp/shutdown", F_OK) < 0) { while (access("/tmp/shutdown", F_OK) < 0) {
debug("start X as " DEFUSER); if (debug) {
#ifdef DEBUG system("su -c startx -l " DEFUSER);
system("su -c startx -l " DEFUSER); system("/bin/sh");
system("/bin/sh"); } else {
#else system("su -c startx -l " DEFUSER " &> /dev/null");
system("su -c startx -l " DEFUSER " &> /dev/null"); }
#endif
} }
exit(0); exit(0);
@@ -366,7 +356,6 @@ int main()
*/ */
void shutdown(int sig) void shutdown(int sig)
{ {
debug("shutdown");
touch("/tmp/shutdown"); touch("/tmp/shutdown");
kill(-1, SIGTERM); kill(-1, SIGTERM);