Exemple #1
0
func uname() (*unix.Utsname, error) {
	uts := &unix.Utsname{}

	if err := unix.Uname(uts); err != nil {
		return nil, err
	}
	return uts, nil
}
func genInfo() (info, error) {
	var name unix.Utsname
	err := unix.Uname(&name)
	return info{
		sysname:  intToString(name.Sysname),
		nodename: intToString(name.Nodename),
		release:  intToString(name.Release),
		version:  intToString(name.Version),
		machine:  intToString(name.Machine),
	}, err
}
Exemple #3
0
func (f *SystemFacts) getUname(wg *sync.WaitGroup) {
	defer wg.Done()

	var buf unix.Utsname
	err := unix.Uname(&buf)
	if err != nil {
		if c.Debug {
			log.Println(err.Error())
		}
		return
	}

	f.mu.Lock()
	defer f.mu.Unlock()

	f.Domainname = CharsToString(buf.Domainname)
	f.Architecture = CharsToString(buf.Machine)
	f.Hostname = CharsToString(buf.Nodename)
	f.Kernel.Name = CharsToString(buf.Sysname)
	f.Kernel.Release = CharsToString(buf.Release)
	f.Kernel.Version = CharsToString(buf.Version)
	return
}