[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen master] tools/xenstore: switch barf[_perror]() to use syslog()



commit cbc86340ac75c8ff50e51a16c8fdbdf3d2a7c55d
Author:     Juergen Gross <jgross@xxxxxxxx>
AuthorDate: Tue Dec 15 17:35:39 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Thu Dec 17 15:04:43 2020 +0000

    tools/xenstore: switch barf[_perror]() to use syslog()
    
    When xenstored crashes due to an unrecoverable condition it is calling
    either barf() or barf_perror() to issue a message and then exit().
    
    Make sure the message is visible somewhere by using syslog()
    additionally to xprintf(), as the latter will be visible only with
    tracing active.
    
    Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
    Reviewed-by: Paul Durrant <paul@xxxxxxx>
    Reviewed-by: Julien Grall <jgrall@xxxxxxxxxx>
---
 tools/xenstore/utils.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/xenstore/utils.c b/tools/xenstore/utils.c
index a1ac12584a..633ce3b4fc 100644
--- a/tools/xenstore/utils.c
+++ b/tools/xenstore/utils.c
@@ -3,6 +3,7 @@
 #include <stdarg.h>
 #include <stdlib.h>
 #include <string.h>
+#include <syslog.h>
 #include <errno.h>
 #include <unistd.h>
 #include <fcntl.h>
@@ -35,6 +36,7 @@ void barf(const char *fmt, ...)
        va_end(arglist);
 
        if (bytes >= 0) {
+               syslog(LOG_CRIT, "%s\n", str);
                xprintf("%s\n", str);
                free(str);
        }
@@ -54,6 +56,7 @@ void barf_perror(const char *fmt, ...)
        va_end(arglist);
 
        if (bytes >= 0) {
+               syslog(LOG_CRIT, "%s: %s\n", str, strerror(err));
                xprintf("%s: %s\n", str, strerror(err));
                free(str);
        }
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.