Merge from mainline (167278:168000).
[official-gcc/graphite-test-results.git] / libgo / go / os / sys_bsd.go
blob188993b696120387b937d9c5a01697eb9a5f4c20
1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 // os code shared between *BSD systems including OS X (Darwin)
6 // and FreeBSD.
8 package os
10 import "syscall"
12 func Hostname() (name string, err Error) {
13 var errno int
14 name, errno = syscall.Sysctl("kern.hostname")
15 if errno != 0 {
16 return "", NewSyscallError("sysctl kern.hostname", errno)
18 return name, nil