pkg/dmesg: use unix.SYSLOG_ACTION_READ_ALL instead of local variable

This value was originally added in 46833ee1c3,
at which time golang.org/x/sys/unix didn't have utilities for this syscall.
A later patch switched the implementation to use the golang/x/sys/unix
implementation in 2841b05b71, but kept the
local variable.

golang.org/x/sys now has a const for this, so let's use it.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2024-06-16 12:24:16 +02:00
parent d1273b2b4a
commit c7f4abc14a

View File

@@ -6,9 +6,8 @@ import (
// Dmesg returns last messages from the kernel log, up to size bytes
func Dmesg(size int) []byte {
t := 3 // SYSLOG_ACTION_READ_ALL
b := make([]byte, size)
amt, err := unix.Klogctl(t, b)
amt, err := unix.Klogctl(unix.SYSLOG_ACTION_READ_ALL, b)
if err != nil {
return []byte{}
}