Skip to content

Commit

Permalink
sysinfo: kernel release only
Browse files Browse the repository at this point in the history
  • Loading branch information
apprehensions committed Oct 29, 2023
1 parent accbc73 commit cdc478e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 19 deletions.
20 changes: 2 additions & 18 deletions sysinfo/kernel.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,12 @@ import (
"syscall"
)

type kernel struct {
Release string
Version string
}

func getKernel() kernel {
func getKernel() string {
var un syscall.Utsname
_ = syscall.Uname(&un)

return kernel{
Release: unameString(un.Release),
Version: unameString(un.Version),
}
}

func (k kernel) String() string {
return k.Release + " " + k.Version
}

func unameString(unarr [65]int8) string {
var sb strings.Builder
for _, b := range unarr[:] {
for _, b := range un.Release[:] {
if b == 0 {
break
}
Expand Down
2 changes: 1 addition & 1 deletion sysinfo/sysinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

var (
Kernel kernel
Kernel string
CPU string
Cards []card
Distro distro
Expand Down

0 comments on commit cdc478e

Please sign in to comment.