hostapd: Set stdout line-buffered
If hostapd will use stdout for debugging, set stdout to be line buffered in case its output is redirected to a file. This allows incremental output to be viewed immediately instead of at the file buffering interval. Signed-hostap: Paul Stewart <pstew@chromium.org>
This commit is contained in:
parent
a642a52b17
commit
de27bc7673
3 changed files with 12 additions and 0 deletions
|
@ -638,6 +638,8 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
if (log_file)
|
if (log_file)
|
||||||
wpa_debug_open_file(log_file);
|
wpa_debug_open_file(log_file);
|
||||||
|
else
|
||||||
|
wpa_debug_setup_stdout();
|
||||||
#ifdef CONFIG_DEBUG_LINUX_TRACING
|
#ifdef CONFIG_DEBUG_LINUX_TRACING
|
||||||
if (enable_trace_dbg) {
|
if (enable_trace_dbg) {
|
||||||
int tret = wpa_debug_open_linux_tracing();
|
int tret = wpa_debug_open_linux_tracing();
|
||||||
|
|
|
@ -574,6 +574,14 @@ void wpa_debug_close_file(void)
|
||||||
#endif /* CONFIG_DEBUG_FILE */
|
#endif /* CONFIG_DEBUG_FILE */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void wpa_debug_setup_stdout(void)
|
||||||
|
{
|
||||||
|
#ifndef _WIN32
|
||||||
|
setvbuf(stdout, NULL, _IOLBF, 0);
|
||||||
|
#endif /* _WIN32 */
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_NO_STDOUT_DEBUG */
|
#endif /* CONFIG_NO_STDOUT_DEBUG */
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@ enum {
|
||||||
#define wpa_hexdump_ascii_key(l,t,b,le) do { } while (0)
|
#define wpa_hexdump_ascii_key(l,t,b,le) do { } while (0)
|
||||||
#define wpa_debug_open_file(p) do { } while (0)
|
#define wpa_debug_open_file(p) do { } while (0)
|
||||||
#define wpa_debug_close_file() do { } while (0)
|
#define wpa_debug_close_file() do { } while (0)
|
||||||
|
#define wpa_debug_setup_stdout() do { } while (0)
|
||||||
#define wpa_dbg(args...) do { } while (0)
|
#define wpa_dbg(args...) do { } while (0)
|
||||||
|
|
||||||
static inline int wpa_debug_reopen_file(void)
|
static inline int wpa_debug_reopen_file(void)
|
||||||
|
@ -46,6 +47,7 @@ static inline int wpa_debug_reopen_file(void)
|
||||||
int wpa_debug_open_file(const char *path);
|
int wpa_debug_open_file(const char *path);
|
||||||
int wpa_debug_reopen_file(void);
|
int wpa_debug_reopen_file(void);
|
||||||
void wpa_debug_close_file(void);
|
void wpa_debug_close_file(void);
|
||||||
|
void wpa_debug_setup_stdout(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* wpa_debug_printf_timestamp - Print timestamp for debug output
|
* wpa_debug_printf_timestamp - Print timestamp for debug output
|
||||||
|
|
Loading…
Reference in a new issue