From patchwork Thu Dec 4 22:23:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Stewart X-Patchwork-Id: 417952 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from maxx.maxx.shmoo.com (maxx.shmoo.com [205.134.188.171]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 989471400D5 for ; Fri, 5 Dec 2014 09:29:54 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 666BB9D0C8; Thu, 4 Dec 2014 17:29:49 -0500 (EST) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id h6KfGKVXU8BV; Thu, 4 Dec 2014 17:29:49 -0500 (EST) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 9D34F9D39F; Thu, 4 Dec 2014 17:29:26 -0500 (EST) X-Original-To: mailman-post+hostap@maxx.shmoo.com Delivered-To: mailman-post+hostap@maxx.shmoo.com Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 982FE9D34C for ; Thu, 4 Dec 2014 17:29:19 -0500 (EST) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id A+9v6MHTvkzC for ; Thu, 4 Dec 2014 17:29:12 -0500 (EST) Received: from mail-vc0-f201.google.com (mail-vc0-f201.google.com [209.85.220.201]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (not verified)) by maxx.maxx.shmoo.com (Postfix) with ESMTPS id 54CEF9D395 for ; Thu, 4 Dec 2014 17:28:45 -0500 (EST) Received: by mail-vc0-f201.google.com with SMTP id hq11so1036545vcb.0 for ; Thu, 04 Dec 2014 14:28:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:date:subject:to:message-id; bh=0hOj6CRnQQdHiMQ1LD2tYqgDlbZ2a3k/XhgczOWUhMY=; b=PlKvd5VMItQFvjMsBzT7qJKpyUzrTJ4ppiheTH0OxEwL37j6XD7b76MT2QwfjQgcUO D6YqDW64by25KUo8xudIxfWSl7h4rpfhgNhJaVYzdqjMSMENu/Nne2ZIFSjqaWmFGSct 5RbhrCvgeSehBCZKJRqssITcItlgO41ISRSOFIziU96jbpo+IWi0EonTaq5EkckOjBvC kpAUkHXzKYIaaKHU3eKcBER7KsIKgvboh3CC44RC77rmNAciUl+/7rloZsz0BA03CKGj F1NhSt91yySkXdRQTNrrH+28WlTkuVZuw6bV4pQUIBAaB2/GTuS53UmpMhqcLj5NknTh lI+g== X-Gm-Message-State: ALoCoQmNRLYtNLfLrSTFvBPFL/hlOUVHP1v5yYoEFcUYkZMOlzH/OAdugbW1dlqqDAGwG2jKYSQ+hthZnNhIE4u9ypfTHqtvmwLDjL9SuXrxjvfqsCkPLcpVnCKE5SUwjvbzq5aCg9G1qauwE1nA0dzqkUukmlDawLbI97fFucgjp6T+Z/+paKs= X-Received: by 10.52.1.103 with SMTP id 7mr11874183vdl.6.1417732123696; Thu, 04 Dec 2014 14:28:43 -0800 (PST) Received: from corpmail-nozzle1-2.hot.corp.google.com ([100.108.1.103]) by gmr-mx.google.com with ESMTPS id s23si1193910yhf.0.2014.12.04.14.28.43 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Dec 2014 14:28:43 -0800 (PST) Received: from pstew.mtv.corp.google.com ([172.22.65.44]) by corpmail-nozzle1-2.hot.corp.google.com with ESMTP id d5HcJyhH.1; Thu, 04 Dec 2014 14:28:43 -0800 Received: by pstew.mtv.corp.google.com (Postfix, from userid 110058) id CCE36E01E1; Thu, 4 Dec 2014 14:28:42 -0800 (PST) From: Paul Stewart Date: Thu, 4 Dec 2014 14:23:35 -0800 Subject: [PATCH] hostapd: Set stdout line-buffered To: hostap@lists.shmoo.com Message-Id: <20141204222842.CCE36E01E1@pstew.mtv.corp.google.com> X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.11 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com 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 --- hostapd/main.c | 2 ++ src/utils/wpa_debug.c | 7 +++++++ src/utils/wpa_debug.h | 2 ++ 3 files changed, 11 insertions(+) diff --git a/hostapd/main.c b/hostapd/main.c index 900bba9..6a90d58 100644 --- a/hostapd/main.c +++ b/hostapd/main.c @@ -638,6 +638,8 @@ int main(int argc, char *argv[]) if (log_file) wpa_debug_open_file(log_file); + else + wpa_debug_setup_stdout(); #ifdef CONFIG_DEBUG_LINUX_TRACING if (enable_trace_dbg) { int tret = wpa_debug_open_linux_tracing(); diff --git a/src/utils/wpa_debug.c b/src/utils/wpa_debug.c index bf0833a..8ba82b1 100644 --- a/src/utils/wpa_debug.c +++ b/src/utils/wpa_debug.c @@ -574,6 +574,13 @@ void wpa_debug_close_file(void) #endif /* CONFIG_DEBUG_FILE */ } +void wpa_debug_setup_stdout(void) +{ +#ifndef _WIN32 + setvbuf(stdout, NULL, _IOLBF, 0); +#endif /* _WIN32 */ +} + #endif /* CONFIG_NO_STDOUT_DEBUG */ diff --git a/src/utils/wpa_debug.h b/src/utils/wpa_debug.h index 391f197..400bea9 100644 --- a/src/utils/wpa_debug.h +++ b/src/utils/wpa_debug.h @@ -34,6 +34,7 @@ enum { #define wpa_hexdump_ascii_key(l,t,b,le) do { } while (0) #define wpa_debug_open_file(p) 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) 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_reopen_file(void); void wpa_debug_close_file(void); +void wpa_debug_setup_stdout(void); /** * wpa_debug_printf_timestamp - Print timestamp for debug output