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.
This commit is contained in:
Fabien Thomas 2010-03-11 07:36:45 +00:00
parent 4e0c5d79a0
commit 060d3bde04

View file

@ -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);
}