[Bug 215836] [PATCH] sbin/dmesg: support new flag for watching messages

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Fri Jan 6 21:28:49 UTC 2017


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=215836

Mateusz Guzik <mjg at FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mjg at FreeBSD.org

--- Comment #1 from Mateusz Guzik <mjg at FreeBSD.org> ---
>@@ -109,6 +112,8 @@ main(int argc, char *argv[])
> 	if (argc != 0)
> 		usage();
> 
>+again:
>+
> 	if (memf == NULL) {
> 		/*
> 		 * Running kernel.  Use sysctl.  This gives an unwrapped buffer
>@@ -203,15 +208,26 @@ main(int argc, char *argv[])
> 			}
> 		}
> 
>+		if (*p == '\0') continue;
>+
> 		(void)strvisx(visbp, p, nextp - p, 0);
>-		(void)printf("%s", visbp);
>+		if (*visbp != '\n') (void)printf("%s", visbp);
> 	}
>+
>+	free (bp);
>+	free (visbp);
>+
>+	if (loop) {
>+		usleep(100000);
>+		goto again;
>+	}
>+
> 	exit(0);
> }
> 

I'm afraid this approach is a non-starter. Entries in dmesg show up extremely
rarely and waking up periodically to check it quite wasteful, especially so
with this frequency.

Luckily, /dev/klog supports kqueue so you can use that to get notified.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list