xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/3] xentrace changes
@ 2023-05-26  7:29 Olaf Hering
  2023-05-26  7:29 ` [PATCH v1 1/3] xentrace: allow xentrace to write to stdout Olaf Hering
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Olaf Hering @ 2023-05-26  7:29 UTC (permalink / raw)
  To: xen-devel

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(-)



^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v1 1/3] xentrace: allow xentrace to write to stdout
  2023-05-26  7:29 [PATCH v1 0/3] xentrace changes Olaf Hering
@ 2023-05-26  7:29 ` Olaf Hering
  2023-05-26 10:04   ` George Dunlap
  2023-05-26  7:29 ` [PATCH v1 2/3] xentrace: remove return value from monitor_tbufs Olaf Hering
  2023-05-26  7:29 ` [PATCH v1 3/3] xentrace: close output file in the function which opened it Olaf Hering
  2 siblings, 1 reply; 8+ messages in thread
From: Olaf Hering @ 2023-05-26  7:29 UTC (permalink / raw)
  To: xen-devel; +Cc: George Dunlap, Wei Liu, Anthony PERARD

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 <olaf@aepfle.de>
---
 tools/xentrace/xentrace.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/tools/xentrace/xentrace.c b/tools/xentrace/xentrace.c
index 864e30d50c..b81abe8a51 100644
--- a/tools/xentrace/xentrace.c
+++ b/tools/xentrace/xentrace.c
@@ -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 */


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v1 2/3] xentrace: remove return value from monitor_tbufs
  2023-05-26  7:29 [PATCH v1 0/3] xentrace changes Olaf Hering
  2023-05-26  7:29 ` [PATCH v1 1/3] xentrace: allow xentrace to write to stdout Olaf Hering
@ 2023-05-26  7:29 ` Olaf Hering
  2023-05-26 10:11   ` George Dunlap
  2023-05-26  7:29 ` [PATCH v1 3/3] xentrace: close output file in the function which opened it Olaf Hering
  2 siblings, 1 reply; 8+ messages in thread
From: Olaf Hering @ 2023-05-26  7:29 UTC (permalink / raw)
  To: xen-devel; +Cc: George Dunlap, Wei Liu, Anthony PERARD

The function always returns zero.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
 tools/xentrace/xentrace.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/tools/xentrace/xentrace.c b/tools/xentrace/xentrace.c
index b81abe8a51..a073cab26d 100644
--- a/tools/xentrace/xentrace.c
+++ b/tools/xentrace/xentrace.c
@@ -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;
 }
 
 /*


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v1 3/3] xentrace: close output file in the function which opened it
  2023-05-26  7:29 [PATCH v1 0/3] xentrace changes Olaf Hering
  2023-05-26  7:29 ` [PATCH v1 1/3] xentrace: allow xentrace to write to stdout Olaf Hering
  2023-05-26  7:29 ` [PATCH v1 2/3] xentrace: remove return value from monitor_tbufs Olaf Hering
@ 2023-05-26  7:29 ` Olaf Hering
  2023-05-26 10:03   ` George Dunlap
  2 siblings, 1 reply; 8+ messages in thread
From: Olaf Hering @ 2023-05-26  7:29 UTC (permalink / raw)
  To: xen-devel; +Cc: George Dunlap, Wei Liu, Anthony PERARD

Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
 tools/xentrace/xentrace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/xentrace/xentrace.c b/tools/xentrace/xentrace.c
index a073cab26d..3548255123 100644
--- a/tools/xentrace/xentrace.c
+++ b/tools/xentrace/xentrace.c
@@ -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;
 }
 


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v1 3/3] xentrace: close output file in the function which opened it
  2023-05-26  7:29 ` [PATCH v1 3/3] xentrace: close output file in the function which opened it Olaf Hering
@ 2023-05-26 10:03   ` George Dunlap
  0 siblings, 0 replies; 8+ messages in thread
From: George Dunlap @ 2023-05-26 10:03 UTC (permalink / raw)
  To: Olaf Hering; +Cc: xen-devel, George Dunlap, Wei Liu, Anthony PERARD

[-- Attachment #1: Type: text/plain, Size: 206 bytes --]

On Fri, May 26, 2023 at 8:29 AM Olaf Hering <olaf@aepfle.de> wrote:

> Signed-off-by: Olaf Hering <olaf@aepfle.de>
>

Wow, this file is ugly.

Reviewed-by: George Dunlap <george.dunlap@cloud.com>

[-- Attachment #2: Type: text/html, Size: 668 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v1 1/3] xentrace: allow xentrace to write to stdout
  2023-05-26  7:29 ` [PATCH v1 1/3] xentrace: allow xentrace to write to stdout Olaf Hering
@ 2023-05-26 10:04   ` George Dunlap
  0 siblings, 0 replies; 8+ messages in thread
From: George Dunlap @ 2023-05-26 10:04 UTC (permalink / raw)
  To: Olaf Hering; +Cc: xen-devel, George Dunlap, Wei Liu, Anthony PERARD

[-- Attachment #1: Type: text/plain, Size: 332 bytes --]

On Fri, May 26, 2023 at 8:29 AM Olaf Hering <olaf@aepfle.de> wrote:

> 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 <olaf@aepfle.de>
>

Acked-by: George Dunlap <george.dunlap@cloud.com>

[-- Attachment #2: Type: text/html, Size: 766 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v1 2/3] xentrace: remove return value from monitor_tbufs
  2023-05-26  7:29 ` [PATCH v1 2/3] xentrace: remove return value from monitor_tbufs Olaf Hering
@ 2023-05-26 10:11   ` George Dunlap
  2023-05-26 11:12     ` Olaf Hering
  0 siblings, 1 reply; 8+ messages in thread
From: George Dunlap @ 2023-05-26 10:11 UTC (permalink / raw)
  To: Olaf Hering; +Cc: xen-devel, George Dunlap, Wei Liu, Anthony PERARD

[-- Attachment #1: Type: text/plain, Size: 586 bytes --]

On Fri, May 26, 2023 at 8:29 AM Olaf Hering <olaf@aepfle.de> wrote:

> 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:

Reviewed-by: George Dunlap <george.dunlap@cloud.com>

If that sounds OK to you I'll modify it on check-in.

 -George

[-- Attachment #2: Type: text/html, Size: 1104 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v1 2/3] xentrace: remove return value from monitor_tbufs
  2023-05-26 10:11   ` George Dunlap
@ 2023-05-26 11:12     ` Olaf Hering
  0 siblings, 0 replies; 8+ messages in thread
From: Olaf Hering @ 2023-05-26 11:12 UTC (permalink / raw)
  To: George Dunlap; +Cc: xen-devel, George Dunlap, Wei Liu, Anthony PERARD

[-- Attachment #1: Type: text/plain, Size: 251 bytes --]

Fri, 26 May 2023 11:11:58 +0100 George Dunlap <george.dunlap@cloud.com>:

> With that change:
> Reviewed-by: George Dunlap <george.dunlap@cloud.com>
> If that sounds OK to you I'll modify it on check-in.

Yes, sounds good. Thank you.


Olaf

[-- Attachment #2: Digitale Signatur von OpenPGP --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-05-26 11:13 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-26  7:29 [PATCH v1 0/3] xentrace changes Olaf Hering
2023-05-26  7:29 ` [PATCH v1 1/3] xentrace: allow xentrace to write to stdout Olaf Hering
2023-05-26 10:04   ` George Dunlap
2023-05-26  7:29 ` [PATCH v1 2/3] xentrace: remove return value from monitor_tbufs Olaf Hering
2023-05-26 10:11   ` George Dunlap
2023-05-26 11:12     ` Olaf Hering
2023-05-26  7:29 ` [PATCH v1 3/3] xentrace: close output file in the function which opened it Olaf Hering
2023-05-26 10:03   ` George Dunlap

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).