Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 06 Jan 2017 21:28:49 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 215836] [PATCH] sbin/dmesg: support new flag for watching messages
Message-ID:  <bug-215836-8-zsP6MDxC07@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-215836-8@https.bugs.freebsd.org/bugzilla/>
References:  <bug-215836-8@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D215836

Mateusz Guzik <mjg@FreeBSD.org> changed:

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

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

I'm afraid this approach is a non-starter. Entries in dmesg show up extreme=
ly
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.

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-215836-8-zsP6MDxC07>