Changeset 89
- Timestamp:
- 07/01/05 08:59:10 (4 years ago)
- Files:
-
- debian/changelog (modified) (1 diff)
- src/main.c (modified) (4 diffs)
- src/main.h (modified) (1 diff)
- src/opts.c (modified) (2 diffs)
- src/state.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
debian/changelog
r85 r89 4 4 * Custom signal handlers are now reusable 5 5 * Signal-triggered stats dump now goes to log if appropriate 6 * New -v|--verbose option logs state transitions and other debug info 6 7 7 8 -- Jeroen T. Vermeulen <jtv@sipa.or.th> Wed, 29 June 2005 14:10:00 +0700 src/main.c
r85 r89 55 55 56 56 bool quiet = false; 57 bool verbose = false; 57 58 58 59 char localbuf[8192]; … … 75 76 return NULL; 76 77 } 78 79 char *set_verbose(long long dummy) 80 { 81 verbose = true; 82 return NULL; 83 } 84 85 86 bool main_check_config(void) 87 { 88 CHECK_CONFIG_ERR(quiet && verbose); 89 return true; 90 } 91 92 77 93 78 94 /// Was a dump of statistics requested? … … 242 258 if (godaemon) 243 259 { 260 if (verbose) log_msg(LOG_DEBUG, "daemonizing..."); 244 261 const pid_t pid = daemonize(); 245 262 if (unlikely(pid < 0)) … … 255 272 */ 256 273 lseek(pidfd, 0, SEEK_SET); 274 if (verbose) log_int(LOG_DEBUG, "got process id", pid); 257 275 return writepid(pid) ? EXIT_SUCCESS : EXIT_FAILURE; 258 276 } src/main.h
r59 r89 47 47 /// Suppress informational output and warnings? 48 48 extern bool quiet; 49 /// Print debug output when changing state and such? 50 extern bool verbose; 49 51 50 52 char *set_daemon(long long dummy); 51 53 char *set_pidfile(long long dummy); 52 54 char *set_quiet(long long dummy); 55 char *set_verbose(long long dummy); 56 57 bool main_check_config(void); 53 58 54 59 #endif src/opts.c
r81 r89 90 90 { "upper_freelimit", 'u', at_num, 0, 100, set_upper_freelimit, 91 91 "Reduce swapspace if more than n% is free" }, 92 { "verbose", 'v', at_none, 0, 0, set_verbose, 93 "Print lots of debug information" }, 92 94 { "version", 'V', at_none, 0, 0, set_version, 93 95 "Print version number and exit" } … … 424 426 read_cmdline(argc, argv); 425 427 426 return swaps_check_config() && memory_check_config() ;427 } 428 428 return swaps_check_config() && memory_check_config() && main_check_config(); 429 } 430 src/state.c
r85 r89 81 81 static void state_to(enum State s) 82 82 { 83 if (verbose) 84 { 85 sprintf(localbuf, "%s -> %s", Statenames[the_state], Statenames[s]); 86 log_msg(LOG_DEBUG, localbuf); 87 } 83 88 the_state = s; 84 89 timer_reset();
