xentrace changes
cover xentrace changes
Olaf Hering (3):
xentrace: allow xentrace to write to stdout
xentrace: remove return value from monitor_tbufs
xentrace: close output file in the function which opened it
tools/xentrace/xentrace.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-)
PATCH 1/3 xentrace: allow xentrace to write to stdout
The output file is optional. In case it is missing, xentrace is supposed to write to stdout - unless it is a tty, which is checked prior using it.
--- tools/xentrace/xentrace.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
tools/xentrace/xentrace.c +3 -5
@@ -1152,11 +1152,9 @@ static void parse_args(int argc, char **argv) } } -/* get outfile (required last argument) */ -if (optind != (argc-1 )) -usage (); - - opts.outfile = argv[optind]; +/* get outfile (optional last argument) */ +if (argc > optind) + opts.outfile = argv[optind]; }/* *BSD has no O_LARGEFILE */
Re: [PATCH v1 1/3] xentrace: allow xentrace to write to stdout
Quoted 5 lines · Olaf Hering
The output file is optional. In case it is missing, xentrace is supposed to write to stdout - unless it is a tty, which is checked prior using it.
Signed-off-by Olaf Hering <[email protected]>
PATCH 2/3 xentrace: remove return value from monitor_tbufs
In reply to Olaf HeringThe function always returns zero.
--- tools/xentrace/xentrace.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
tools/xentrace/xentrace.c +3 -6
@@ -668,7 +668,7 @@ static void wait_for_event_or_timeout(unsigned long milliseconds)* monitor_tbufs - monitor the contents of tbufs and output to a file * @logfile: the FILE * representing the file to log to */ -static int monitor_tbufs (void ) +static void monitor_tbufs (void ) {int i;
@@ -795,8 +795,6 @@ static int monitor_tbufs(void)free (data);/* don't need to munmap - cleanup is automatic */ close (outfd); - -return 0 ; }
@@ -1164,7 +1162,6 @@ static void parse_args(int argc, char **argv)int main (int argc,char **argv) { -int ret;struct sigaction act; opts.outfile =0 ;
@@ -1226,9 +1223,9 @@ int main(int argc, char **argv)sigaction (SIGINT , &act,NULL );sigaction (SIGALRM , &act,NULL ); - ret =monitor_tbufs (); +monitor_tbufs (); -return ret; +return 0 ; }/*
Re: [PATCH v1 2/3] xentrace: remove return value from monitor_tbufs
Quoted 2 lines · Olaf Hering
The function always returns zero.
I think a better argument (which I propose to replace the content of the commit message) would be something like this:
---
The program is structured so that fatal errors cause exit() to be called directly, rather than being passed up the stack; returning a value here may mislead people into believing otherwise.
---
With that change:
If that sounds OK to you I'll modify it on check-in.
-George
Re: [PATCH v1 2/3] xentrace: remove return value from monitor_tbufs
Fri, 26 May 2023 11:11:58 +0100 George Dunlap <[email protected]>:
Quoted 3 lines
With that change:
Reviewed-by George Dunlap <[email protected]>If that sounds OK to you I'll modify it on check-in.
Yes, sounds good. Thank you.
Olaf
PATCH 3/3 xentrace: close output file in the function which opened it
In reply to Olaf Hering--- tools/xentrace/xentrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/xentrace/xentrace.c +1 -1
@@ -794,7 +794,6 @@ static void monitor_tbufs(void)free (meta);free (data);/* don't need to munmap - cleanup is automatic */ -close (outfd); }
@@ -1225,6 +1224,7 @@ int main(int argc, char **argv)monitor_tbufs (); +close (outfd);return 0 ; }
Re: [PATCH v1 3/3] xentrace: close output file in the function which opened it
Quoted 2 lines · Olaf Hering
Signed-off-by Olaf Hering <[email protected]>
Wow, this file is ugly.