1
2
3
4
5
6
7 package osinfo
8
9 import (
10 "syscall"
11 "unsafe"
12 )
13
14 type utsname struct {
15 Sysname [257]byte
16 Nodename [257]byte
17 Release [257]byte
18 Version [257]byte
19 Machine [257]byte
20 }
21
22
23
24
25 var procUname uintptr
26
27
28 func rawsysvicall6(fn, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err syscall.Errno)
29
30 func uname(buf *utsname) error {
31 _, _, errno := rawsysvicall6(uintptr(unsafe.Pointer(&procUname)), 1, uintptr(unsafe.Pointer(buf)), 0, 0, 0, 0, 0)
32 if errno != 0 {
33 return errno
34 }
35 return nil
36 }
37
View as plain text