2009-06-29 14:44:46 -06:00
|
|
|
// Copyright 2009 The Go Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
// Darwin-specific
|
|
|
|
|
|
|
|
package os
|
|
|
|
|
2009-08-12 14:18:37 -06:00
|
|
|
import "syscall"
|
2009-06-29 14:44:46 -06:00
|
|
|
|
2009-08-10 23:02:51 -06:00
|
|
|
func Hostname() (name string, err Error) {
|
2009-06-29 14:44:46 -06:00
|
|
|
var errno int;
|
|
|
|
name, errno = syscall.Sysctl("kern.hostname");
|
|
|
|
if errno != 0 {
|
|
|
|
return "", NewSyscallError("sysctl kern.hostname", errno);
|
|
|
|
}
|
|
|
|
return name, nil;
|
|
|
|
}
|