#include <unistd.h>
#include <linux/watchdog.h>
+#include "sd-messages.h"
+
#include "devnum-util.h"
#include "errno-util.h"
#include "fd-util.h"
}
if (watchdog_fd != -ENOENT)
- return log_warning_errno(watchdog_fd, "Failed to open watchdog device %s: %m", *wd);
+ return log_struct_errno(LOG_WARNING, watchdog_fd,
+ LOG_MESSAGE("Failed to open watchdog device %s: %m", *wd),
+ "MESSAGE_ID=" SD_MESSAGE_WATCHDOG_OPEN_FAILED_STR,
+ "WATCHDOG_DEVICE=%s", *wd);
}
if (watchdog_fd < 0)
r = RET_NERRNO(ioctl(watchdog_fd, WDIOC_GETSUPPORT, &ident));
if (r < 0)
- log_info_errno(r, "Using hardware watchdog %s, no support for WDIOC_GETSUPPORT ioctl: %m",
- watchdog_device);
+ log_struct_errno(LOG_INFO, r,
+ LOG_MESSAGE("Using hardware watchdog %s, no support for WDIOC_GETSUPPORT ioctl: %m",
+ watchdog_device),
+ "MESSAGE_ID=" SD_MESSAGE_WATCHDOG_OPENED_STR,
+ "WATCHDOG_DEVICE=%s", watchdog_device);
else
- log_info("Using hardware watchdog %s: '%s', version %x.",
- watchdog_device,
- ident.identity,
- ident.firmware_version),
+ log_struct(LOG_INFO,
+ LOG_MESSAGE("Using hardware watchdog %s: '%s', version %x.",
+ watchdog_device,
+ ident.identity,
+ ident.firmware_version),
+ "MESSAGE_ID=" SD_MESSAGE_WATCHDOG_OPENED_STR,
+ "WATCHDOG_DEVICE=%s", watchdog_device);
r = watchdog_update_timeout();
if (r < 0)
if (watchdog_open(/* ignore_ratelimit= */ true) >= 0)
return;
- log_full_errno(watchdog_device ? LOG_WARNING : LOG_NOTICE,
- watchdog_fd,
- "Failed to open %swatchdog device%s%s before the initial transaction completed: %m",
- watchdog_device ? "" : "any ",
- watchdog_device ? " " : "",
- strempty(watchdog_device));
+ if (watchdog_device)
+ log_struct_errno(LOG_WARNING, watchdog_fd,
+ LOG_MESSAGE("Failed to open watchdog device %s before the initial transaction completed: %m",
+ watchdog_device),
+ "MESSAGE_ID=" SD_MESSAGE_WATCHDOG_OPEN_FAILED_STR,
+ "WATCHDOG_DEVICE=%s", watchdog_device);
+ else
+ log_struct_errno(LOG_WARNING, watchdog_fd,
+ LOG_MESSAGE("Failed to open any watchdog device before the initial transaction completed: %m"),
+ "MESSAGE_ID=" SD_MESSAGE_WATCHDOG_OPEN_FAILED_STR);
}
void watchdog_close(bool disarm) {
#define SD_MESSAGE_TIME_BUMP SD_ID128_MAKE(7d,b7,3c,8a,f0,d9,4e,eb,82,2a,e0,43,23,fe,6a,b6)
#define SD_MESSAGE_TIME_BUMP_STR SD_ID128_MAKE_STR(7d,b7,3c,8a,f0,d9,4e,eb,82,2a,e0,43,23,fe,6a,b6)
+#define SD_MESSAGE_WATCHDOG_OPENED SD_ID128_MAKE(21,66,8d,bd,3d,7a,4a,32,a2,67,6d,53,da,da,b0,22)
+#define SD_MESSAGE_WATCHDOG_OPENED_STR SD_ID128_MAKE_STR(21,66,8d,bd,3d,7a,4a,32,a2,67,6d,53,da,da,b0,22)
+
+#define SD_MESSAGE_WATCHDOG_OPEN_FAILED SD_ID128_MAKE(37,5a,c1,51,ef,9d,4d,e3,90,68,b3,ef,bf,ed,0c,ee)
+#define SD_MESSAGE_WATCHDOG_OPEN_FAILED_STR SD_ID128_MAKE_STR(37,5a,c1,51,ef,9d,4d,e3,90,68,b3,ef,bf,ed,0c,ee)
+
#define SD_MESSAGE_SHUTDOWN_SCHEDULED SD_ID128_MAKE(9e,70,66,27,9d,c8,40,3d,a7,9c,e4,b1,a6,90,64,b2)
#define SD_MESSAGE_SHUTDOWN_SCHEDULED_STR SD_ID128_MAKE_STR(9e,70,66,27,9d,c8,40,3d,a7,9c,e4,b1,a6,90,64,b2)