Beispiel #1
0
extern int klogd_main(int argc, char **argv)
{
	/* no options, no getopt */
	int opt;
	int doFork = TRUE;

	/* do normal option parsing */
	while ((opt = getopt(argc, argv, "n")) > 0) {
		switch (opt) {
			case 'n':
				doFork = FALSE;
				break;
			default:
				show_usage();
		}
	}

	if (doFork) {
#if !defined(__UCLIBC__) || defined(__UCLIBC_HAS_MMU__)
		if (daemon(0, 1) < 0)
			perror_msg_and_die("daemon");
#else
			error_msg_and_die("daemon not supported");
#endif
	}
	doKlogd();
	
	return EXIT_SUCCESS;
}
extern int klogd_main(int argc, char **argv)
{
	/* no options, no getopt */
	int opt;
	int doFork = TRUE;
	unsigned char console_log_level = -1;

	/* do normal option parsing */
	while ((opt = getopt(argc, argv, "c:n")) > 0) {
		switch (opt) {
		case 'c':
			if ((optarg == NULL) || (optarg[1] != '\0')) {
				bb_show_usage();
			}
			/* Valid levels are between 1 and 8 */
			console_log_level = *optarg - '1';
			if (console_log_level > 7) {
				bb_show_usage();
			}
			console_log_level++;

			break;
		case 'n':
			doFork = FALSE;
			break;
		default:
			bb_show_usage();
		}
	}

	if (doFork) {
#if defined(__uClinux__)
		vfork_daemon_rexec(0, 1, argc, argv, "-n");
#else /* __uClinux__ */
		if (daemon(0, 1) < 0)
			bb_perror_msg_and_die("daemon");
#endif /* __uClinux__ */
	}
	doKlogd(console_log_level);

	return EXIT_SUCCESS;
}
Beispiel #3
0
extern int klogd_main(int argc, char **argv)
{
	/* no options, no getopt */
	int opt;
#ifndef __uClinux__ /* fork() not available in uClinux */
	int doFork = TRUE;
#endif  /* __uClinux__ */

	/* do normal option parsing */
	while ((opt = getopt(argc, argv, "nd")) > 0) {
		switch (opt) {
			case 'n':
#ifndef __uClinux__	/* fork() not available in uClinux */
				doFork = FALSE;
#endif  /* __uClinux__ */
				break;
#ifdef ASUS
 			case 'd': /* Add by Joey */
				logAll = TRUE;
                		break;
#endif
			default:
				show_usage();
		}
	}

#ifndef __uClinux__	/* fork() not available in uClinux */
	if (doFork == TRUE) {
		if (daemon(0, 1) < 0)
			perror_msg_and_die("daemon");
	}
#endif  /* __uClinux__ */

	doKlogd();
	
	return EXIT_SUCCESS;
}