From 060d3bde0412a787c9bf84a535d07d4fa9639f3f Mon Sep 17 00:00:00 2001 From: Fabien Thomas Date: Thu, 11 Mar 2010 07:36:45 +0000 Subject: [PATCH] MFC r204878: Change the way shutdown is handled for log file. pmc_flush_logfile is now non-blocking and just ask the kernel to shutdown the file. From that point, no more data is accepted by the log thread and when the last buffer is flushed the file is closed. This will remove a deadlock between pmcstat asking for flush while it cannot flush the pipe itself. --- usr.sbin/pmcstat/pmcstat_log.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/usr.sbin/pmcstat/pmcstat_log.c b/usr.sbin/pmcstat/pmcstat_log.c index 5811af3f1c6..fc26001a592 100644 --- a/usr.sbin/pmcstat/pmcstat_log.c +++ b/usr.sbin/pmcstat/pmcstat_log.c @@ -1670,10 +1670,8 @@ pmcstat_print_log(void) int pmcstat_close_log(void) { - if (pmc_flush_logfile() < 0 || - pmc_configure_logfile(-1) < 0) + if (pmc_flush_logfile() < 0) err(EX_OSERR, "ERROR: logging failed"); - args.pa_flags &= ~(FLAG_HAS_OUTPUT_LOGFILE | FLAG_HAS_PIPE); return (args.pa_flags & FLAG_HAS_PIPE ? PMCSTAT_EXITING : PMCSTAT_FINISHED); }