aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-02-17 22:23:36 -0500
committerIan Moffett <ian@osmora.org>2024-02-17 22:23:36 -0500
commit09bcb3675701460bfab084162537f107dcd3d9b3 (patch)
tree4788d0a7a096668effd086c252a7acb02c62d921 /sys
parent1d3ef9f7aed08dc76424ec0fb904d5aa87633102 (diff)
kernel: syslog: Add '%p'
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_syslog.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/sys/kern/kern_syslog.c b/sys/kern/kern_syslog.c
index 9c87537..52bdcca 100644
--- a/sys/kern/kern_syslog.c
+++ b/sys/kern/kern_syslog.c
@@ -65,6 +65,8 @@ syslog_handle_fmt(va_list *ap, char fmt_spec)
const char *tmp_str;
char tmp_buf[256] = { 0 };
+ size_t tmp_len;
+
switch (fmt_spec) {
case 'c':
tmp_ch = va_arg(*ap, int);
@@ -79,10 +81,26 @@ syslog_handle_fmt(va_list *ap, char fmt_spec)
itoa(tmp_int, tmp_buf, 10);
syslog_write(tmp_buf, strlen(tmp_buf));
break;
+ case 'p':
+ tmp_int = va_arg(*ap, uint64_t);
+ itoa(tmp_int, tmp_buf, 16);
+ tmp_len = strlen(tmp_buf);
+ /*
+ * Now we pad this.
+ *
+ * XXX TODO: This assumes 64-bits, should be
+ * cleaned up.
+ */
+ for (size_t i = 0; i < 18 - tmp_len; ++i) {
+ syslog_write("0", 1);
+ }
+ syslog_write(tmp_buf + 2, tmp_len - 2);
+ break;
case 'x':
tmp_int = va_arg(*ap, uint64_t);
itoa(tmp_int, tmp_buf, 16);
- syslog_write(tmp_buf + 2, strlen(tmp_buf) - 2);
+ tmp_len = strlen(tmp_buf);
+ syslog_write(tmp_buf + 2, tmp_len - 2);
break;
}
}