Page MenuHomeFreeBSD

D36953.diff
No OneTemporary

D36953.diff

diff --git a/usr.sbin/pmcstat/pmcstat.c b/usr.sbin/pmcstat/pmcstat.c
--- a/usr.sbin/pmcstat/pmcstat.c
+++ b/usr.sbin/pmcstat/pmcstat.c
@@ -452,6 +452,7 @@
int do_callchain, do_descendants, do_logproccsw, do_logprocexit;
int do_print, do_read, do_listcounters, do_descr, domains;
int do_userspace, i;
+ int exitcode;
size_t len;
int graphdepth;
int pipefd[2], rfd;
@@ -480,6 +481,7 @@
do_logprocexit = 0;
do_listcounters = 0;
domains = 0;
+ exitcode = EX_OK;
use_cumulative_counts = 0;
graphfilename = "-";
args.pa_required = 0;
@@ -1420,13 +1422,21 @@
* ourselves.
*/
(void) wait(&c);
+ exitcode = EX_IOERR;
runstate = PMCSTAT_FINISHED;
} else if (kev.ident == SIGIO) {
+ struct pmcstat_target *pt;
/*
* We get a SIGIO if a PMC loses all
* of its targets, or if logfile
* writes encounter an error.
*/
+ assert(args.pa_flags & FLAG_HAS_COMMANDLINE);
+ pt = SLIST_FIRST(&args.pa_targets);
+ if (wait4(pt->pt_pid, &c, 0, NULL) <= 0 ||
+ !WIFEXITED(c) || WEXITSTATUS(c) != 0) {
+ exitcode = EX_IOERR;
+ }
runstate = pmcstat_close_log(&args);
do_print = 1; /* print PMCs at exit */
} else if (kev.ident == SIGINT) {
@@ -1516,5 +1526,5 @@
);
}
- exit(EX_OK);
+ exit(exitcode);
}

File Metadata

Mime Type
text/plain
Expires
Wed, Apr 22, 5:48 PM (16 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31991871
Default Alt Text
D36953.diff (1 KB)

Event Timeline