[PATCH 08/34] dmesg: use unlocked io, and avoid use of printf()

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

 



Signed-off-by: Sami Kerola <kerolasa@xxxxxx>
---
 sys-utils/dmesg.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/sys-utils/dmesg.c b/sys-utils/dmesg.c
index e681930..881e3ac 100644
--- a/sys-utils/dmesg.c
+++ b/sys-utils/dmesg.c
@@ -34,6 +34,7 @@
 #include "optutils.h"
 #include "mangle.h"
 #include "pager.h"
+#include "unlocked-io.h"
 
 /* Close the log.  Currently a NOP. */
 #define SYSLOG_ACTION_CLOSE          0
@@ -903,7 +904,9 @@ static void print_record(struct dmesg_control *ctl,
 	case DMESG_TIMEFTM_NONE:
 		break;
 	case DMESG_TIMEFTM_CTIME:
-		printf("[%s] ", record_ctime(ctl, rec, buf, sizeof(buf)));
+		fputs("[", stdout);
+		fputs(record_ctime(ctl, rec, buf, sizeof(buf)), stdout);
+		fputs("] ", stdout);
 		break;
 	case DMESG_TIMEFTM_CTIME_DELTA:
 		printf("[%s <%12.06f>] ",
@@ -919,7 +922,9 @@ static void print_record(struct dmesg_control *ctl,
 		if (cur.tm_min != ctl->lasttm.tm_min ||
 		    cur.tm_hour != ctl->lasttm.tm_hour ||
 		    cur.tm_yday != ctl->lasttm.tm_yday) {
-			printf("[%s] ", short_ctime(&cur, buf, sizeof(buf)));
+			fputs("[", stdout);
+			fputs(short_ctime(&cur, buf, sizeof(buf)), stdout);
+			fputs("] ", stdout);
 		} else {
 			if (delta < 10)
 				printf("[  %+8.06f] ", delta);
@@ -936,7 +941,8 @@ static void print_record(struct dmesg_control *ctl,
 		       (int)rec->tv.tv_usec, record_count_delta(ctl, rec));
 		break;
 	case DMESG_TIMEFTM_ISO8601:
-		printf("%s ", iso_8601_time(ctl, rec, buf, sizeof(buf)));
+		fputs(iso_8601_time(ctl, rec, buf, sizeof(buf)), stdout);
+		fputs(" ", stdout);
 		break;
 	default:
 		abort();
-- 
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux