Commit 994e0646 authored by Alex Brainman's avatar Alex Brainman

pkg: add missing godoc comments to windows versions

Mostly copied comments from unix files.

R=rsc
CC=golang-dev
https://golang.org/cl/5533057
parent f320eb94
...@@ -253,7 +253,7 @@ cp "$WORK"/time.a "$GOROOT"/pkg/darwin_386/time.a ...@@ -253,7 +253,7 @@ cp "$WORK"/time.a "$GOROOT"/pkg/darwin_386/time.a
mkdir -p "$WORK"/os/_obj/ mkdir -p "$WORK"/os/_obj/
cd "$GOROOT"/src/pkg/os cd "$GOROOT"/src/pkg/os
8g -o "$WORK"/os/_obj/_go_.8 -p os -I "$WORK" ./dir_unix.go ./env.go ./error.go ./error_posix.go ./exec.go ./exec_posix.go ./exec_unix.go ./file.go ./file_posix.go ./file_unix.go ./getwd.go ./path.go ./path_unix.go ./proc.go ./stat_darwin.go ./sys_bsd.go ./time.go ./types.go ./zsignal_darwin_386.go 8g -o "$WORK"/os/_obj/_go_.8 -p os -I "$WORK" ./dir_unix.go ./doc.go ./env.go ./error.go ./error_posix.go ./exec.go ./exec_posix.go ./exec_unix.go ./file.go ./file_posix.go ./file_unix.go ./getwd.go ./path.go ./path_unix.go ./proc.go ./stat_darwin.go ./sys_bsd.go ./time.go ./types.go ./zsignal_darwin_386.go
gopack grc "$WORK"/os.a "$WORK"/os/_obj/_go_.8 gopack grc "$WORK"/os.a "$WORK"/os/_obj/_go_.8
cp "$WORK"/os.a "$GOROOT"/pkg/darwin_386/os.a cp "$WORK"/os.a "$GOROOT"/pkg/darwin_386/os.a
......
...@@ -252,7 +252,7 @@ cp "$WORK"/time.a "$GOROOT"/pkg/darwin_amd64/time.a ...@@ -252,7 +252,7 @@ cp "$WORK"/time.a "$GOROOT"/pkg/darwin_amd64/time.a
mkdir -p "$WORK"/os/_obj/ mkdir -p "$WORK"/os/_obj/
cd "$GOROOT"/src/pkg/os cd "$GOROOT"/src/pkg/os
6g -o "$WORK"/os/_obj/_go_.6 -p os -I "$WORK" ./dir_unix.go ./env.go ./error.go ./error_posix.go ./exec.go ./exec_posix.go ./exec_unix.go ./file.go ./file_posix.go ./file_unix.go ./getwd.go ./path.go ./path_unix.go ./proc.go ./stat_darwin.go ./sys_bsd.go ./time.go ./types.go ./zsignal_darwin_amd64.go 6g -o "$WORK"/os/_obj/_go_.6 -p os -I "$WORK" ./dir_unix.go ./doc.go ./env.go ./error.go ./error_posix.go ./exec.go ./exec_posix.go ./exec_unix.go ./file.go ./file_posix.go ./file_unix.go ./getwd.go ./path.go ./path_unix.go ./proc.go ./stat_darwin.go ./sys_bsd.go ./time.go ./types.go ./zsignal_darwin_amd64.go
gopack grc "$WORK"/os.a "$WORK"/os/_obj/_go_.6 gopack grc "$WORK"/os.a "$WORK"/os/_obj/_go_.6
cp "$WORK"/os.a "$GOROOT"/pkg/darwin_amd64/os.a cp "$WORK"/os.a "$GOROOT"/pkg/darwin_amd64/os.a
......
...@@ -253,7 +253,7 @@ cp "$WORK"/time.a "$GOROOT"/pkg/freebsd_386/time.a ...@@ -253,7 +253,7 @@ cp "$WORK"/time.a "$GOROOT"/pkg/freebsd_386/time.a
mkdir -p "$WORK"/os/_obj/ mkdir -p "$WORK"/os/_obj/
cd "$GOROOT"/src/pkg/os cd "$GOROOT"/src/pkg/os
8g -o "$WORK"/os/_obj/_go_.8 -p os -I "$WORK" ./dir_unix.go ./env.go ./error.go ./error_posix.go ./exec.go ./exec_posix.go ./exec_unix.go ./file.go ./file_posix.go ./file_unix.go ./getwd.go ./path.go ./path_unix.go ./proc.go ./stat_freebsd.go ./sys_bsd.go ./time.go ./types.go ./zsignal_freebsd_386.go 8g -o "$WORK"/os/_obj/_go_.8 -p os -I "$WORK" ./dir_unix.go ./doc.go ./env.go ./error.go ./error_posix.go ./exec.go ./exec_posix.go ./exec_unix.go ./file.go ./file_posix.go ./file_unix.go ./getwd.go ./path.go ./path_unix.go ./proc.go ./stat_freebsd.go ./sys_bsd.go ./time.go ./types.go ./zsignal_freebsd_386.go
gopack grc "$WORK"/os.a "$WORK"/os/_obj/_go_.8 gopack grc "$WORK"/os.a "$WORK"/os/_obj/_go_.8
cp "$WORK"/os.a "$GOROOT"/pkg/freebsd_386/os.a cp "$WORK"/os.a "$GOROOT"/pkg/freebsd_386/os.a
......
...@@ -252,7 +252,7 @@ cp "$WORK"/time.a "$GOROOT"/pkg/freebsd_amd64/time.a ...@@ -252,7 +252,7 @@ cp "$WORK"/time.a "$GOROOT"/pkg/freebsd_amd64/time.a
mkdir -p "$WORK"/os/_obj/ mkdir -p "$WORK"/os/_obj/
cd "$GOROOT"/src/pkg/os cd "$GOROOT"/src/pkg/os
6g -o "$WORK"/os/_obj/_go_.6 -p os -I "$WORK" ./dir_unix.go ./env.go ./error.go ./error_posix.go ./exec.go ./exec_posix.go ./exec_unix.go ./file.go ./file_posix.go ./file_unix.go ./getwd.go ./path.go ./path_unix.go ./proc.go ./stat_freebsd.go ./sys_bsd.go ./time.go ./types.go ./zsignal_freebsd_amd64.go 6g -o "$WORK"/os/_obj/_go_.6 -p os -I "$WORK" ./dir_unix.go ./doc.go ./env.go ./error.go ./error_posix.go ./exec.go ./exec_posix.go ./exec_unix.go ./file.go ./file_posix.go ./file_unix.go ./getwd.go ./path.go ./path_unix.go ./proc.go ./stat_freebsd.go ./sys_bsd.go ./time.go ./types.go ./zsignal_freebsd_amd64.go
gopack grc "$WORK"/os.a "$WORK"/os/_obj/_go_.6 gopack grc "$WORK"/os.a "$WORK"/os/_obj/_go_.6
cp "$WORK"/os.a "$GOROOT"/pkg/freebsd_amd64/os.a cp "$WORK"/os.a "$GOROOT"/pkg/freebsd_amd64/os.a
......
...@@ -253,7 +253,7 @@ cp "$WORK"/time.a "$GOROOT"/pkg/linux_386/time.a ...@@ -253,7 +253,7 @@ cp "$WORK"/time.a "$GOROOT"/pkg/linux_386/time.a
mkdir -p "$WORK"/os/_obj/ mkdir -p "$WORK"/os/_obj/
cd "$GOROOT"/src/pkg/os cd "$GOROOT"/src/pkg/os
8g -o "$WORK"/os/_obj/_go_.8 -p os -I "$WORK" ./dir_unix.go ./env.go ./error.go ./error_posix.go ./exec.go ./exec_posix.go ./exec_unix.go ./file.go ./file_posix.go ./file_unix.go ./getwd.go ./path.go ./path_unix.go ./proc.go ./stat_linux.go ./sys_linux.go ./time.go ./types.go ./zsignal_linux_386.go 8g -o "$WORK"/os/_obj/_go_.8 -p os -I "$WORK" ./dir_unix.go ./doc.go ./env.go ./error.go ./error_posix.go ./exec.go ./exec_posix.go ./exec_unix.go ./file.go ./file_posix.go ./file_unix.go ./getwd.go ./path.go ./path_unix.go ./proc.go ./stat_linux.go ./sys_linux.go ./time.go ./types.go ./zsignal_linux_386.go
gopack grc "$WORK"/os.a "$WORK"/os/_obj/_go_.8 gopack grc "$WORK"/os.a "$WORK"/os/_obj/_go_.8
cp "$WORK"/os.a "$GOROOT"/pkg/linux_386/os.a cp "$WORK"/os.a "$GOROOT"/pkg/linux_386/os.a
......
...@@ -252,7 +252,7 @@ cp "$WORK"/time.a "$GOROOT"/pkg/linux_amd64/time.a ...@@ -252,7 +252,7 @@ cp "$WORK"/time.a "$GOROOT"/pkg/linux_amd64/time.a
mkdir -p "$WORK"/os/_obj/ mkdir -p "$WORK"/os/_obj/
cd "$GOROOT"/src/pkg/os cd "$GOROOT"/src/pkg/os
6g -o "$WORK"/os/_obj/_go_.6 -p os -I "$WORK" ./dir_unix.go ./env.go ./error.go ./error_posix.go ./exec.go ./exec_posix.go ./exec_unix.go ./file.go ./file_posix.go ./file_unix.go ./getwd.go ./path.go ./path_unix.go ./proc.go ./stat_linux.go ./sys_linux.go ./time.go ./types.go ./zsignal_linux_amd64.go 6g -o "$WORK"/os/_obj/_go_.6 -p os -I "$WORK" ./dir_unix.go ./doc.go ./env.go ./error.go ./error_posix.go ./exec.go ./exec_posix.go ./exec_unix.go ./file.go ./file_posix.go ./file_unix.go ./getwd.go ./path.go ./path_unix.go ./proc.go ./stat_linux.go ./sys_linux.go ./time.go ./types.go ./zsignal_linux_amd64.go
gopack grc "$WORK"/os.a "$WORK"/os/_obj/_go_.6 gopack grc "$WORK"/os.a "$WORK"/os/_obj/_go_.6
cp "$WORK"/os.a "$GOROOT"/pkg/linux_amd64/os.a cp "$WORK"/os.a "$GOROOT"/pkg/linux_amd64/os.a
......
...@@ -256,7 +256,7 @@ cp "$WORK"/time.a "$GOROOT"/pkg/linux_arm/time.a ...@@ -256,7 +256,7 @@ cp "$WORK"/time.a "$GOROOT"/pkg/linux_arm/time.a
mkdir -p "$WORK"/os/_obj/ mkdir -p "$WORK"/os/_obj/
cd "$GOROOT"/src/pkg/os cd "$GOROOT"/src/pkg/os
5g -o "$WORK"/os/_obj/_go_.5 -p os -I "$WORK" ./dir_unix.go ./env.go ./error.go ./error_posix.go ./exec.go ./exec_posix.go ./exec_unix.go ./file.go ./file_posix.go ./file_unix.go ./getwd.go ./path.go ./path_unix.go ./proc.go ./stat_linux.go ./sys_linux.go ./time.go ./types.go ./zsignal_linux_arm.go 5g -o "$WORK"/os/_obj/_go_.5 -p os -I "$WORK" ./dir_unix.go ./doc.go ./env.go ./error.go ./error_posix.go ./exec.go ./exec_posix.go ./exec_unix.go ./file.go ./file_posix.go ./file_unix.go ./getwd.go ./path.go ./path_unix.go ./proc.go ./stat_linux.go ./sys_linux.go ./time.go ./types.go ./zsignal_linux_arm.go
gopack grc "$WORK"/os.a "$WORK"/os/_obj/_go_.5 gopack grc "$WORK"/os.a "$WORK"/os/_obj/_go_.5
cp "$WORK"/os.a "$GOROOT"/pkg/linux_arm/os.a cp "$WORK"/os.a "$GOROOT"/pkg/linux_arm/os.a
......
...@@ -253,7 +253,7 @@ cp "$WORK"/time.a "$GOROOT"/pkg/netbsd_386/time.a ...@@ -253,7 +253,7 @@ cp "$WORK"/time.a "$GOROOT"/pkg/netbsd_386/time.a
mkdir -p "$WORK"/os/_obj/ mkdir -p "$WORK"/os/_obj/
cd "$GOROOT"/src/pkg/os cd "$GOROOT"/src/pkg/os
8g -o "$WORK"/os/_obj/_go_.8 -p os -I "$WORK" ./dir_unix.go ./env.go ./error.go ./error_posix.go ./exec.go ./exec_posix.go ./exec_unix.go ./file.go ./file_posix.go ./file_unix.go ./getwd.go ./path.go ./path_unix.go ./proc.go ./stat_netbsd.go ./sys_bsd.go ./time.go ./types.go ./zsignal_netbsd_386.go 8g -o "$WORK"/os/_obj/_go_.8 -p os -I "$WORK" ./dir_unix.go ./doc.go ./env.go ./error.go ./error_posix.go ./exec.go ./exec_posix.go ./exec_unix.go ./file.go ./file_posix.go ./file_unix.go ./getwd.go ./path.go ./path_unix.go ./proc.go ./stat_netbsd.go ./sys_bsd.go ./time.go ./types.go ./zsignal_netbsd_386.go
gopack grc "$WORK"/os.a "$WORK"/os/_obj/_go_.8 gopack grc "$WORK"/os.a "$WORK"/os/_obj/_go_.8
cp "$WORK"/os.a "$GOROOT"/pkg/netbsd_386/os.a cp "$WORK"/os.a "$GOROOT"/pkg/netbsd_386/os.a
......
...@@ -252,7 +252,7 @@ cp "$WORK"/time.a "$GOROOT"/pkg/netbsd_amd64/time.a ...@@ -252,7 +252,7 @@ cp "$WORK"/time.a "$GOROOT"/pkg/netbsd_amd64/time.a
mkdir -p "$WORK"/os/_obj/ mkdir -p "$WORK"/os/_obj/
cd "$GOROOT"/src/pkg/os cd "$GOROOT"/src/pkg/os
6g -o "$WORK"/os/_obj/_go_.6 -p os -I "$WORK" ./dir_unix.go ./env.go ./error.go ./error_posix.go ./exec.go ./exec_posix.go ./exec_unix.go ./file.go ./file_posix.go ./file_unix.go ./getwd.go ./path.go ./path_unix.go ./proc.go ./stat_netbsd.go ./sys_bsd.go ./time.go ./types.go ./zsignal_netbsd_amd64.go 6g -o "$WORK"/os/_obj/_go_.6 -p os -I "$WORK" ./dir_unix.go ./doc.go ./env.go ./error.go ./error_posix.go ./exec.go ./exec_posix.go ./exec_unix.go ./file.go ./file_posix.go ./file_unix.go ./getwd.go ./path.go ./path_unix.go ./proc.go ./stat_netbsd.go ./sys_bsd.go ./time.go ./types.go ./zsignal_netbsd_amd64.go
gopack grc "$WORK"/os.a "$WORK"/os/_obj/_go_.6 gopack grc "$WORK"/os.a "$WORK"/os/_obj/_go_.6
cp "$WORK"/os.a "$GOROOT"/pkg/netbsd_amd64/os.a cp "$WORK"/os.a "$GOROOT"/pkg/netbsd_amd64/os.a
......
...@@ -253,7 +253,7 @@ cp "$WORK"/time.a "$GOROOT"/pkg/openbsd_386/time.a ...@@ -253,7 +253,7 @@ cp "$WORK"/time.a "$GOROOT"/pkg/openbsd_386/time.a
mkdir -p "$WORK"/os/_obj/ mkdir -p "$WORK"/os/_obj/
cd "$GOROOT"/src/pkg/os cd "$GOROOT"/src/pkg/os
8g -o "$WORK"/os/_obj/_go_.8 -p os -I "$WORK" ./dir_unix.go ./env.go ./error.go ./error_posix.go ./exec.go ./exec_posix.go ./exec_unix.go ./file.go ./file_posix.go ./file_unix.go ./getwd.go ./path.go ./path_unix.go ./proc.go ./stat_openbsd.go ./sys_bsd.go ./time.go ./types.go ./zsignal_openbsd_386.go 8g -o "$WORK"/os/_obj/_go_.8 -p os -I "$WORK" ./dir_unix.go ./doc.go ./env.go ./error.go ./error_posix.go ./exec.go ./exec_posix.go ./exec_unix.go ./file.go ./file_posix.go ./file_unix.go ./getwd.go ./path.go ./path_unix.go ./proc.go ./stat_openbsd.go ./sys_bsd.go ./time.go ./types.go ./zsignal_openbsd_386.go
gopack grc "$WORK"/os.a "$WORK"/os/_obj/_go_.8 gopack grc "$WORK"/os.a "$WORK"/os/_obj/_go_.8
cp "$WORK"/os.a "$GOROOT"/pkg/openbsd_386/os.a cp "$WORK"/os.a "$GOROOT"/pkg/openbsd_386/os.a
......
...@@ -252,7 +252,7 @@ cp "$WORK"/time.a "$GOROOT"/pkg/openbsd_amd64/time.a ...@@ -252,7 +252,7 @@ cp "$WORK"/time.a "$GOROOT"/pkg/openbsd_amd64/time.a
mkdir -p "$WORK"/os/_obj/ mkdir -p "$WORK"/os/_obj/
cd "$GOROOT"/src/pkg/os cd "$GOROOT"/src/pkg/os
6g -o "$WORK"/os/_obj/_go_.6 -p os -I "$WORK" ./dir_unix.go ./env.go ./error.go ./error_posix.go ./exec.go ./exec_posix.go ./exec_unix.go ./file.go ./file_posix.go ./file_unix.go ./getwd.go ./path.go ./path_unix.go ./proc.go ./stat_openbsd.go ./sys_bsd.go ./time.go ./types.go ./zsignal_openbsd_amd64.go 6g -o "$WORK"/os/_obj/_go_.6 -p os -I "$WORK" ./dir_unix.go ./doc.go ./env.go ./error.go ./error_posix.go ./exec.go ./exec_posix.go ./exec_unix.go ./file.go ./file_posix.go ./file_unix.go ./getwd.go ./path.go ./path_unix.go ./proc.go ./stat_openbsd.go ./sys_bsd.go ./time.go ./types.go ./zsignal_openbsd_amd64.go
gopack grc "$WORK"/os.a "$WORK"/os/_obj/_go_.6 gopack grc "$WORK"/os.a "$WORK"/os/_obj/_go_.6
cp "$WORK"/os.a "$GOROOT"/pkg/openbsd_amd64/os.a cp "$WORK"/os.a "$GOROOT"/pkg/openbsd_amd64/os.a
......
...@@ -253,7 +253,7 @@ cp "$WORK"/time.a "$GOROOT"/pkg/plan9_386/time.a ...@@ -253,7 +253,7 @@ cp "$WORK"/time.a "$GOROOT"/pkg/plan9_386/time.a
mkdir -p "$WORK"/os/_obj/ mkdir -p "$WORK"/os/_obj/
cd "$GOROOT"/src/pkg/os cd "$GOROOT"/src/pkg/os
8g -o "$WORK"/os/_obj/_go_.8 -p os -I "$WORK" ./dir_plan9.go ./env.go ./error.go ./error_plan9.go ./exec.go ./exec_plan9.go ./file.go ./file_plan9.go ./getwd.go ./path.go ./path_plan9.go ./proc.go ./stat_plan9.go ./str.go ./sys_plan9.go ./time.go ./types.go 8g -o "$WORK"/os/_obj/_go_.8 -p os -I "$WORK" ./dir_plan9.go ./doc.go ./env.go ./error.go ./error_plan9.go ./exec.go ./exec_plan9.go ./file.go ./file_plan9.go ./getwd.go ./path.go ./path_plan9.go ./proc.go ./stat_plan9.go ./str.go ./sys_plan9.go ./time.go ./types.go
gopack grc "$WORK"/os.a "$WORK"/os/_obj/_go_.8 gopack grc "$WORK"/os.a "$WORK"/os/_obj/_go_.8
cp "$WORK"/os.a "$GOROOT"/pkg/plan9_386/os.a cp "$WORK"/os.a "$GOROOT"/pkg/plan9_386/os.a
......
...@@ -265,7 +265,7 @@ cp "$WORK"/time.a "$GOROOT"/pkg/windows_386/time.a ...@@ -265,7 +265,7 @@ cp "$WORK"/time.a "$GOROOT"/pkg/windows_386/time.a
mkdir -p "$WORK"/os/_obj/ mkdir -p "$WORK"/os/_obj/
cd "$GOROOT"/src/pkg/os cd "$GOROOT"/src/pkg/os
8g -o "$WORK"/os/_obj/_go_.8 -p os -I "$WORK" ./dir_windows.go ./env.go ./error.go ./error_posix.go ./exec.go ./exec_posix.go ./exec_windows.go ./file.go ./file_posix.go ./file_windows.go ./getwd.go ./path.go ./path_windows.go ./proc.go ./stat_windows.go ./sys_windows.go ./time.go ./types.go ./zsignal_windows_386.go 8g -o "$WORK"/os/_obj/_go_.8 -p os -I "$WORK" ./dir_windows.go ./doc.go ./env.go ./error.go ./error_posix.go ./exec.go ./exec_posix.go ./exec_windows.go ./file.go ./file_posix.go ./file_windows.go ./getwd.go ./path.go ./path_windows.go ./proc.go ./stat_windows.go ./sys_windows.go ./time.go ./types.go ./zsignal_windows_386.go
gopack grc "$WORK"/os.a "$WORK"/os/_obj/_go_.8 gopack grc "$WORK"/os.a "$WORK"/os/_obj/_go_.8
cp "$WORK"/os.a "$GOROOT"/pkg/windows_386/os.a cp "$WORK"/os.a "$GOROOT"/pkg/windows_386/os.a
......
...@@ -264,7 +264,7 @@ cp "$WORK"/time.a "$GOROOT"/pkg/windows_amd64/time.a ...@@ -264,7 +264,7 @@ cp "$WORK"/time.a "$GOROOT"/pkg/windows_amd64/time.a
mkdir -p "$WORK"/os/_obj/ mkdir -p "$WORK"/os/_obj/
cd "$GOROOT"/src/pkg/os cd "$GOROOT"/src/pkg/os
6g -o "$WORK"/os/_obj/_go_.6 -p os -I "$WORK" ./dir_windows.go ./env.go ./error.go ./error_posix.go ./exec.go ./exec_posix.go ./exec_windows.go ./file.go ./file_posix.go ./file_windows.go ./getwd.go ./path.go ./path_windows.go ./proc.go ./stat_windows.go ./sys_windows.go ./time.go ./types.go ./zsignal_windows_amd64.go 6g -o "$WORK"/os/_obj/_go_.6 -p os -I "$WORK" ./dir_windows.go ./doc.go ./env.go ./error.go ./error_posix.go ./exec.go ./exec_posix.go ./exec_windows.go ./file.go ./file_posix.go ./file_windows.go ./getwd.go ./path.go ./path_windows.go ./proc.go ./stat_windows.go ./sys_windows.go ./time.go ./types.go ./zsignal_windows_amd64.go
gopack grc "$WORK"/os.a "$WORK"/os/_obj/_go_.6 gopack grc "$WORK"/os.a "$WORK"/os/_obj/_go_.6
cp "$WORK"/os.a "$GOROOT"/pkg/windows_amd64/os.a cp "$WORK"/os.a "$GOROOT"/pkg/windows_amd64/os.a
......
...@@ -9,6 +9,7 @@ GOFILES=\ ...@@ -9,6 +9,7 @@ GOFILES=\
dial.go\ dial.go\
dnsclient.go\ dnsclient.go\
dnsmsg.go\ dnsmsg.go\
doc.go\
hosts.go\ hosts.go\
interface.go\ interface.go\
ip.go\ ip.go\
......
// Copyright 2012 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.
package net
// LookupHost looks up the given host using the local resolver.
// It returns an array of that host's addresses.
func LookupHost(host string) (addrs []string, err error) {
return lookupHost(host)
}
// LookupIP looks up host using the local resolver.
// It returns an array of that host's IPv4 and IPv6 addresses.
func LookupIP(host string) (addrs []IP, err error) {
return lookupIP(host)
}
// LookupPort looks up the port for the given network and service.
func LookupPort(network, service string) (port int, err error) {
return lookupPort(network, service)
}
// LookupCNAME returns the canonical DNS host for the given name.
// Callers that do not care about the canonical name can call
// LookupHost or LookupIP directly; both take care of resolving
// the canonical name as part of the lookup.
func LookupCNAME(name string) (cname string, err error) {
return lookupCNAME(name)
}
// LookupSRV tries to resolve an SRV query of the given service,
// protocol, and domain name. The proto is "tcp" or "udp".
// The returned records are sorted by priority and randomized
// by weight within a priority.
//
// LookupSRV constructs the DNS name to look up following RFC 2782.
// That is, it looks up _service._proto.name. To accommodate services
// publishing SRV records under non-standard names, if both service
// and proto are empty strings, LookupSRV looks up name directly.
func LookupSRV(service, proto, name string) (cname string, addrs []*SRV, err error) {
return lookupSRV(service, proto, name)
}
// LookupMX returns the DNS MX records for the given domain name sorted by preference.
func LookupMX(name string) (mx []*MX, err error) {
return lookupMX(name)
}
// LookupTXT returns the DNS TXT records for the given domain name.
func LookupTXT(name string) (txt []string, err error) {
return lookupTXT(name)
}
// LookupAddr performs a reverse lookup for the given address, returning a list
// of names mapping to that address.
func LookupAddr(addr string) (name []string, err error) {
return lookupAddr(addr)
}
...@@ -69,9 +69,7 @@ func queryDNS(addr string, typ string) (res []string, err error) { ...@@ -69,9 +69,7 @@ func queryDNS(addr string, typ string) (res []string, err error) {
return query("/net/dns", addr+" "+typ, 1024) return query("/net/dns", addr+" "+typ, 1024)
} }
// LookupHost looks up the given host using the local resolver. func lookupHost(host string) (addrs []string, err error) {
// It returns an array of that host's addresses.
func LookupHost(host string) (addrs []string, err error) {
// Use /net/cs insead of /net/dns because cs knows about // Use /net/cs insead of /net/dns because cs knows about
// host names in local network (e.g. from /lib/ndb/local) // host names in local network (e.g. from /lib/ndb/local)
lines, err := queryCS("tcp", host, "1") lines, err := queryCS("tcp", host, "1")
...@@ -95,9 +93,7 @@ func LookupHost(host string) (addrs []string, err error) { ...@@ -95,9 +93,7 @@ func LookupHost(host string) (addrs []string, err error) {
return return
} }
// LookupIP looks up host using the local resolver. func lookupIP(host string) (ips []IP, err error) {
// It returns an array of that host's IPv4 and IPv6 addresses.
func LookupIP(host string) (ips []IP, err error) {
addrs, err := LookupHost(host) addrs, err := LookupHost(host)
if err != nil { if err != nil {
return return
...@@ -110,8 +106,7 @@ func LookupIP(host string) (ips []IP, err error) { ...@@ -110,8 +106,7 @@ func LookupIP(host string) (ips []IP, err error) {
return return
} }
// LookupPort looks up the port for the given network and service. func lookupPort(network, service string) (port int, err error) {
func LookupPort(network, service string) (port int, err error) {
switch network { switch network {
case "tcp4", "tcp6": case "tcp4", "tcp6":
network = "tcp" network = "tcp"
...@@ -140,11 +135,7 @@ func LookupPort(network, service string) (port int, err error) { ...@@ -140,11 +135,7 @@ func LookupPort(network, service string) (port int, err error) {
return 0, unknownPortError return 0, unknownPortError
} }
// LookupCNAME returns the canonical DNS host for the given name. func lookupCNAME(name string) (cname string, err error) {
// Callers that do not care about the canonical name can call
// LookupHost or LookupIP directly; both take care of resolving
// the canonical name as part of the lookup.
func LookupCNAME(name string) (cname string, err error) {
lines, err := queryDNS(name, "cname") lines, err := queryDNS(name, "cname")
if err != nil { if err != nil {
return return
...@@ -157,16 +148,7 @@ func LookupCNAME(name string) (cname string, err error) { ...@@ -157,16 +148,7 @@ func LookupCNAME(name string) (cname string, err error) {
return "", errors.New("net: bad response from ndb/dns") return "", errors.New("net: bad response from ndb/dns")
} }
// LookupSRV tries to resolve an SRV query of the given service, func lookupSRV(service, proto, name string) (cname string, addrs []*SRV, err error) {
// protocol, and domain name. The proto is "tcp" or "udp".
// The returned records are sorted by priority and randomized
// by weight within a priority.
//
// LookupSRV constructs the DNS name to look up following RFC 2782.
// That is, it looks up _service._proto.name. To accommodate services
// publishing SRV records under non-standard names, if both service
// and proto are empty strings, LookupSRV looks up name directly.
func LookupSRV(service, proto, name string) (cname string, addrs []*SRV, err error) {
var target string var target string
if service == "" && proto == "" { if service == "" && proto == "" {
target = name target = name
...@@ -195,8 +177,7 @@ func LookupSRV(service, proto, name string) (cname string, addrs []*SRV, err err ...@@ -195,8 +177,7 @@ func LookupSRV(service, proto, name string) (cname string, addrs []*SRV, err err
return return
} }
// LookupMX returns the DNS MX records for the given domain name sorted by preference. func lookupMX(name string) (mx []*MX, err error) {
func LookupMX(name string) (mx []*MX, err error) {
lines, err := queryDNS(name, "mx") lines, err := queryDNS(name, "mx")
if err != nil { if err != nil {
return return
...@@ -214,8 +195,7 @@ func LookupMX(name string) (mx []*MX, err error) { ...@@ -214,8 +195,7 @@ func LookupMX(name string) (mx []*MX, err error) {
return return
} }
// LookupTXT returns the DNS TXT records for the given domain name. func lookupTXT(name string) (txt []string, err error) {
func LookupTXT(name string) (txt []string, err error) {
lines, err := queryDNS(name, "txt") lines, err := queryDNS(name, "txt")
if err != nil { if err != nil {
return return
...@@ -228,9 +208,7 @@ func LookupTXT(name string) (txt []string, err error) { ...@@ -228,9 +208,7 @@ func LookupTXT(name string) (txt []string, err error) {
return return
} }
// LookupAddr performs a reverse lookup for the given address, returning a list func lookupAddr(addr string) (name []string, err error) {
// of names mapping to that address.
func LookupAddr(addr string) (name []string, err error) {
arpa, err := reverseaddr(addr) arpa, err := reverseaddr(addr)
if err != nil { if err != nil {
return return
......
...@@ -52,9 +52,7 @@ func lookupProtocol(name string) (proto int, err error) { ...@@ -52,9 +52,7 @@ func lookupProtocol(name string) (proto int, err error) {
return return
} }
// LookupHost looks up the given host using the local resolver. func lookupHost(host string) (addrs []string, err error) {
// It returns an array of that host's addresses.
func LookupHost(host string) (addrs []string, err error) {
addrs, err, ok := cgoLookupHost(host) addrs, err, ok := cgoLookupHost(host)
if !ok { if !ok {
addrs, err = goLookupHost(host) addrs, err = goLookupHost(host)
...@@ -62,9 +60,7 @@ func LookupHost(host string) (addrs []string, err error) { ...@@ -62,9 +60,7 @@ func LookupHost(host string) (addrs []string, err error) {
return return
} }
// LookupIP looks up host using the local resolver. func lookupIP(host string) (addrs []IP, err error) {
// It returns an array of that host's IPv4 and IPv6 addresses.
func LookupIP(host string) (addrs []IP, err error) {
addrs, err, ok := cgoLookupIP(host) addrs, err, ok := cgoLookupIP(host)
if !ok { if !ok {
addrs, err = goLookupIP(host) addrs, err = goLookupIP(host)
...@@ -72,8 +68,7 @@ func LookupIP(host string) (addrs []IP, err error) { ...@@ -72,8 +68,7 @@ func LookupIP(host string) (addrs []IP, err error) {
return return
} }
// LookupPort looks up the port for the given network and service. func lookupPort(network, service string) (port int, err error) {
func LookupPort(network, service string) (port int, err error) {
port, err, ok := cgoLookupPort(network, service) port, err, ok := cgoLookupPort(network, service)
if !ok { if !ok {
port, err = goLookupPort(network, service) port, err = goLookupPort(network, service)
...@@ -81,11 +76,7 @@ func LookupPort(network, service string) (port int, err error) { ...@@ -81,11 +76,7 @@ func LookupPort(network, service string) (port int, err error) {
return return
} }
// LookupCNAME returns the canonical DNS host for the given name. func lookupCNAME(name string) (cname string, err error) {
// Callers that do not care about the canonical name can call
// LookupHost or LookupIP directly; both take care of resolving
// the canonical name as part of the lookup.
func LookupCNAME(name string) (cname string, err error) {
cname, err, ok := cgoLookupCNAME(name) cname, err, ok := cgoLookupCNAME(name)
if !ok { if !ok {
cname, err = goLookupCNAME(name) cname, err = goLookupCNAME(name)
...@@ -93,16 +84,7 @@ func LookupCNAME(name string) (cname string, err error) { ...@@ -93,16 +84,7 @@ func LookupCNAME(name string) (cname string, err error) {
return return
} }
// LookupSRV tries to resolve an SRV query of the given service, func lookupSRV(service, proto, name string) (cname string, addrs []*SRV, err error) {
// protocol, and domain name. The proto is "tcp" or "udp".
// The returned records are sorted by priority and randomized
// by weight within a priority.
//
// LookupSRV constructs the DNS name to look up following RFC 2782.
// That is, it looks up _service._proto.name. To accommodate services
// publishing SRV records under non-standard names, if both service
// and proto are empty strings, LookupSRV looks up name directly.
func LookupSRV(service, proto, name string) (cname string, addrs []*SRV, err error) {
var target string var target string
if service == "" && proto == "" { if service == "" && proto == "" {
target = name target = name
...@@ -123,8 +105,7 @@ func LookupSRV(service, proto, name string) (cname string, addrs []*SRV, err err ...@@ -123,8 +105,7 @@ func LookupSRV(service, proto, name string) (cname string, addrs []*SRV, err err
return return
} }
// LookupMX returns the DNS MX records for the given domain name sorted by preference. func lookupMX(name string) (mx []*MX, err error) {
func LookupMX(name string) (mx []*MX, err error) {
_, records, err := lookup(name, dnsTypeMX) _, records, err := lookup(name, dnsTypeMX)
if err != nil { if err != nil {
return return
...@@ -138,8 +119,7 @@ func LookupMX(name string) (mx []*MX, err error) { ...@@ -138,8 +119,7 @@ func LookupMX(name string) (mx []*MX, err error) {
return return
} }
// LookupTXT returns the DNS TXT records for the given domain name. func lookupTXT(name string) (txt []string, err error) {
func LookupTXT(name string) (txt []string, err error) {
_, records, err := lookup(name, dnsTypeTXT) _, records, err := lookup(name, dnsTypeTXT)
if err != nil { if err != nil {
return return
...@@ -151,9 +131,7 @@ func LookupTXT(name string) (txt []string, err error) { ...@@ -151,9 +131,7 @@ func LookupTXT(name string) (txt []string, err error) {
return return
} }
// LookupAddr performs a reverse lookup for the given address, returning a list func lookupAddr(addr string) (name []string, err error) {
// of names mapping to that address.
func LookupAddr(addr string) (name []string, err error) {
name = lookupStaticAddr(addr) name = lookupStaticAddr(addr)
if len(name) > 0 { if len(name) > 0 {
return return
......
...@@ -28,7 +28,7 @@ func lookupProtocol(name string) (proto int, err error) { ...@@ -28,7 +28,7 @@ func lookupProtocol(name string) (proto int, err error) {
return int(p.Proto), nil return int(p.Proto), nil
} }
func LookupHost(name string) (addrs []string, err error) { func lookupHost(name string) (addrs []string, err error) {
ips, err := LookupIP(name) ips, err := LookupIP(name)
if err != nil { if err != nil {
return return
...@@ -40,7 +40,7 @@ func LookupHost(name string) (addrs []string, err error) { ...@@ -40,7 +40,7 @@ func LookupHost(name string) (addrs []string, err error) {
return return
} }
func LookupIP(name string) (addrs []IP, err error) { func lookupIP(name string) (addrs []IP, err error) {
hostentLock.Lock() hostentLock.Lock()
defer hostentLock.Unlock() defer hostentLock.Unlock()
h, e := syscall.GetHostByName(name) h, e := syscall.GetHostByName(name)
...@@ -61,7 +61,7 @@ func LookupIP(name string) (addrs []IP, err error) { ...@@ -61,7 +61,7 @@ func LookupIP(name string) (addrs []IP, err error) {
return addrs, nil return addrs, nil
} }
func LookupPort(network, service string) (port int, err error) { func lookupPort(network, service string) (port int, err error) {
switch network { switch network {
case "tcp4", "tcp6": case "tcp4", "tcp6":
network = "tcp" network = "tcp"
...@@ -77,7 +77,7 @@ func LookupPort(network, service string) (port int, err error) { ...@@ -77,7 +77,7 @@ func LookupPort(network, service string) (port int, err error) {
return int(syscall.Ntohs(s.Port)), nil return int(syscall.Ntohs(s.Port)), nil
} }
func LookupCNAME(name string) (cname string, err error) { func lookupCNAME(name string) (cname string, err error) {
var r *syscall.DNSRecord var r *syscall.DNSRecord
e := syscall.DnsQuery(name, syscall.DNS_TYPE_CNAME, 0, nil, &r, nil) e := syscall.DnsQuery(name, syscall.DNS_TYPE_CNAME, 0, nil, &r, nil)
if e != nil { if e != nil {
...@@ -91,16 +91,7 @@ func LookupCNAME(name string) (cname string, err error) { ...@@ -91,16 +91,7 @@ func LookupCNAME(name string) (cname string, err error) {
return return
} }
// LookupSRV tries to resolve an SRV query of the given service, func lookupSRV(service, proto, name string) (cname string, addrs []*SRV, err error) {
// protocol, and domain name. The proto is "tcp" or "udp".
// The returned records are sorted by priority and randomized
// by weight within a priority.
//
// LookupSRV constructs the DNS name to look up following RFC 2782.
// That is, it looks up _service._proto.name. To accommodate services
// publishing SRV records under non-standard names, if both service
// and proto are empty strings, LookupSRV looks up name directly.
func LookupSRV(service, proto, name string) (cname string, addrs []*SRV, err error) {
var target string var target string
if service == "" && proto == "" { if service == "" && proto == "" {
target = name target = name
...@@ -122,7 +113,7 @@ func LookupSRV(service, proto, name string) (cname string, addrs []*SRV, err err ...@@ -122,7 +113,7 @@ func LookupSRV(service, proto, name string) (cname string, addrs []*SRV, err err
return name, addrs, nil return name, addrs, nil
} }
func LookupMX(name string) (mx []*MX, err error) { func lookupMX(name string) (mx []*MX, err error) {
var r *syscall.DNSRecord var r *syscall.DNSRecord
e := syscall.DnsQuery(name, syscall.DNS_TYPE_MX, 0, nil, &r, nil) e := syscall.DnsQuery(name, syscall.DNS_TYPE_MX, 0, nil, &r, nil)
if e != nil { if e != nil {
...@@ -138,7 +129,7 @@ func LookupMX(name string) (mx []*MX, err error) { ...@@ -138,7 +129,7 @@ func LookupMX(name string) (mx []*MX, err error) {
return mx, nil return mx, nil
} }
func LookupTXT(name string) (txt []string, err error) { func lookupTXT(name string) (txt []string, err error) {
var r *syscall.DNSRecord var r *syscall.DNSRecord
e := syscall.DnsQuery(name, syscall.DNS_TYPE_TEXT, 0, nil, &r, nil) e := syscall.DnsQuery(name, syscall.DNS_TYPE_TEXT, 0, nil, &r, nil)
if e != nil { if e != nil {
...@@ -156,7 +147,7 @@ func LookupTXT(name string) (txt []string, err error) { ...@@ -156,7 +147,7 @@ func LookupTXT(name string) (txt []string, err error) {
return return
} }
func LookupAddr(addr string) (name []string, err error) { func lookupAddr(addr string) (name []string, err error) {
arpa, err := reverseaddr(addr) arpa, err := reverseaddr(addr)
if err != nil { if err != nil {
return nil, err return nil, err
......
...@@ -6,6 +6,7 @@ include ../../Make.inc ...@@ -6,6 +6,7 @@ include ../../Make.inc
TARG=os TARG=os
GOFILES=\ GOFILES=\
doc.go\
error.go\ error.go\
env.go\ env.go\
exec.go\ exec.go\
......
...@@ -10,22 +10,7 @@ import ( ...@@ -10,22 +10,7 @@ import (
"syscall" "syscall"
) )
// Readdir reads the contents of the directory associated with file and func (file *File) readdir(n int) (fi []FileInfo, err error) {
// returns an array of up to n FileInfo structures, as would be returned
// by Lstat, in directory order. Subsequent calls on the same file will yield
// further FileInfos.
//
// If n > 0, Readdir returns at most n FileInfo structures. In this case, if
// Readdirnames returns an empty slice, it will return a non-nil error
// explaining why. At the end of a directory, the error is io.EOF.
//
// If n <= 0, Readdir returns all the FileInfo from the directory in
// a single slice. In this case, if Readdir succeeds (reads all
// the way to the end of the directory), it returns the slice and a
// nil error. If it encounters an error before the end of the
// directory, Readdir returns the FileInfo read until that point
// and a non-nil error.
func (file *File) Readdir(n int) (fi []FileInfo, err error) {
// If this file has no dirinfo, create one. // If this file has no dirinfo, create one.
if file.dirinfo == nil { if file.dirinfo == nil {
file.dirinfo = new(dirInfo) file.dirinfo = new(dirInfo)
...@@ -76,19 +61,7 @@ func (file *File) Readdir(n int) (fi []FileInfo, err error) { ...@@ -76,19 +61,7 @@ func (file *File) Readdir(n int) (fi []FileInfo, err error) {
return result, nil return result, nil
} }
// Readdirnames reads and returns a slice of names from the directory f. func (file *File) readdirnames(n int) (names []string, err error) {
//
// If n > 0, Readdirnames returns at most n names. In this case, if
// Readdirnames returns an empty slice, it will return a non-nil error
// explaining why. At the end of a directory, the error is io.EOF.
//
// If n <= 0, Readdirnames returns all the names from the directory in
// a single slice. In this case, if Readdirnames succeeds (reads all
// the way to the end of the directory), it returns the slice and a
// nil error. If it encounters an error before the end of the
// directory, Readdirnames returns the names read until that point and
// a non-nil error.
func (file *File) Readdirnames(n int) (names []string, err error) {
fi, err := file.Readdir(n) fi, err := file.Readdir(n)
names = make([]string, len(fi)) names = make([]string, len(fi))
for i := range fi { for i := range fi {
......
...@@ -15,19 +15,7 @@ const ( ...@@ -15,19 +15,7 @@ const (
blockSize = 4096 blockSize = 4096
) )
// Readdirnames reads and returns a slice of names from the directory f. func (f *File) readdirnames(n int) (names []string, err error) {
//
// If n > 0, Readdirnames returns at most n names. In this case, if
// Readdirnames returns an empty slice, it will return a non-nil error
// explaining why. At the end of a directory, the error is io.EOF.
//
// If n <= 0, Readdirnames returns all the names from the directory in
// a single slice. In this case, if Readdirnames succeeds (reads all
// the way to the end of the directory), it returns the slice and a
// nil error. If it encounters an error before the end of the
// directory, Readdirnames returns the names read until that point and
// a non-nil error.
func (f *File) Readdirnames(n int) (names []string, err error) {
// If this file has no dirinfo, create one. // If this file has no dirinfo, create one.
if f.dirinfo == nil { if f.dirinfo == nil {
f.dirinfo = new(dirInfo) f.dirinfo = new(dirInfo)
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
package os package os
func (file *File) Readdirnames(n int) (names []string, err error) { func (file *File) readdirnames(n int) (names []string, err error) {
fis, err := file.Readdir(n) fis, err := file.Readdir(n)
names = make([]string, len(fis)) names = make([]string, len(fis))
for i, fi := range fis { for i, fi := range fis {
......
// Copyright 2012 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.
package os
// FindProcess looks for a running process by its pid.
// The Process it returns can be used to obtain information
// about the underlying operating system process.
func FindProcess(pid int) (p *Process, err error) {
return findProcess(pid)
}
// Hostname returns the host name reported by the kernel.
func Hostname() (name string, err error) {
return hostname()
}
// Readdir reads the contents of the directory associated with file and
// returns an array of up to n FileInfo values, as would be returned
// by Lstat, in directory order. Subsequent calls on the same file will yield
// further FileInfos.
//
// If n > 0, Readdir returns at most n FileInfo structures. In this case, if
// Readdir returns an empty slice, it will return a non-nil error
// explaining why. At the end of a directory, the error is io.EOF.
//
// If n <= 0, Readdir returns all the FileInfo from the directory in
// a single slice. In this case, if Readdir succeeds (reads all
// the way to the end of the directory), it returns the slice and a
// nil error. If it encounters an error before the end of the
// directory, Readdir returns the FileInfo read until that point
// and a non-nil error.
func (f *File) Readdir(n int) (fi []FileInfo, err error) {
return f.readdir(n)
}
// Readdirnames reads and returns a slice of names from the directory f.
//
// If n > 0, Readdirnames returns at most n names. In this case, if
// Readdirnames returns an empty slice, it will return a non-nil error
// explaining why. At the end of a directory, the error is io.EOF.
//
// If n <= 0, Readdirnames returns all the names from the directory in
// a single slice. In this case, if Readdirnames succeeds (reads all
// the way to the end of the directory), it returns the slice and a
// nil error. If it encounters an error before the end of the
// directory, Readdirnames returns the names read until that point and
// a non-nil error.
func (f *File) Readdirnames(n int) (names []string, err error) {
return f.readdirnames(n)
}
...@@ -42,6 +42,11 @@ func findExecutable(file string, exts []string) (string, error) { ...@@ -42,6 +42,11 @@ func findExecutable(file string, exts []string) (string, error) {
return ``, os.ENOENT return ``, os.ENOENT
} }
// LookPath searches for an executable binary named file
// in the directories named by the PATH environment variable.
// If file contains a slash, it is tried directly and the PATH is not consulted.
// LookPath also uses PATHEXT environment variable to match
// a suitable candidate.
func LookPath(file string) (f string, err error) { func LookPath(file string) (f string, err error) {
x := os.Getenv(`PATHEXT`) x := os.Getenv(`PATHEXT`)
if x == `` { if x == `` {
......
...@@ -138,10 +138,7 @@ func (p *Process) Release() error { ...@@ -138,10 +138,7 @@ func (p *Process) Release() error {
return nil return nil
} }
// FindProcess looks for a running process by its pid. func findProcess(pid int) (p *Process, err error) {
// The Process it returns can be used to obtain information
// about the underlying operating system process.
func FindProcess(pid int) (p *Process, err error) {
// NOOP for Plan 9. // NOOP for Plan 9.
return newProcess(pid, 0), nil return newProcess(pid, 0), nil
} }
......
...@@ -72,10 +72,7 @@ func (p *Process) Release() error { ...@@ -72,10 +72,7 @@ func (p *Process) Release() error {
return nil return nil
} }
// FindProcess looks for a running process by its pid. func findProcess(pid int) (p *Process, err error) {
// The Process it returns can be used to obtain information
// about the underlying operating system process.
func FindProcess(pid int) (p *Process, err error) {
// NOOP for unix. // NOOP for unix.
return newProcess(pid, 0), nil return newProcess(pid, 0), nil
} }
...@@ -11,6 +11,8 @@ import ( ...@@ -11,6 +11,8 @@ import (
"unsafe" "unsafe"
) )
// Wait waits for the Process to exit or stop, and then returns a
// Waitmsg describing its status and an error, if any.
func (p *Process) Wait(options int) (w *Waitmsg, err error) { func (p *Process) Wait(options int) (w *Waitmsg, err error) {
s, e := syscall.WaitForSingleObject(syscall.Handle(p.handle), syscall.INFINITE) s, e := syscall.WaitForSingleObject(syscall.Handle(p.handle), syscall.INFINITE)
switch s { switch s {
...@@ -43,6 +45,7 @@ func (p *Process) Signal(sig Signal) error { ...@@ -43,6 +45,7 @@ func (p *Process) Signal(sig Signal) error {
return syscall.Errno(syscall.EWINDOWS) return syscall.Errno(syscall.EWINDOWS)
} }
// Release releases any resources associated with the Process.
func (p *Process) Release() error { func (p *Process) Release() error {
if p.handle == -1 { if p.handle == -1 {
return EINVAL return EINVAL
...@@ -57,7 +60,7 @@ func (p *Process) Release() error { ...@@ -57,7 +60,7 @@ func (p *Process) Release() error {
return nil return nil
} }
func FindProcess(pid int) (p *Process, err error) { func findProcess(pid int) (p *Process, err error) {
const da = syscall.STANDARD_RIGHTS_READ | const da = syscall.STANDARD_RIGHTS_READ |
syscall.PROCESS_QUERY_INFORMATION | syscall.SYNCHRONIZE syscall.PROCESS_QUERY_INFORMATION | syscall.SYNCHRONIZE
h, e := syscall.OpenProcess(da, false, uint32(pid)) h, e := syscall.OpenProcess(da, false, uint32(pid))
......
...@@ -139,22 +139,7 @@ func Lstat(name string) (fi FileInfo, err error) { ...@@ -139,22 +139,7 @@ func Lstat(name string) (fi FileInfo, err error) {
return fileInfoFromStat(&stat, name), nil return fileInfoFromStat(&stat, name), nil
} }
// Readdir reads the contents of the directory associated with file and func (f *File) readdir(n int) (fi []FileInfo, err error) {
// returns an array of up to n FileInfo values, as would be returned
// by Lstat, in directory order. Subsequent calls on the same file will yield
// further FileInfos.
//
// If n > 0, Readdir returns at most n FileInfo structures. In this case, if
// Readdir returns an empty slice, it will return a non-nil error
// explaining why. At the end of a directory, the error is io.EOF.
//
// If n <= 0, Readdir returns all the FileInfo from the directory in
// a single slice. In this case, if Readdir succeeds (reads all
// the way to the end of the directory), it returns the slice and a
// nil error. If it encounters an error before the end of the
// directory, Readdir returns the FileInfo read until that point
// and a non-nil error.
func (f *File) Readdir(n int) (fi []FileInfo, err error) {
dirname := f.name dirname := f.name
if dirname == "" { if dirname == "" {
dirname = "." dirname = "."
......
...@@ -135,22 +135,7 @@ func (file *file) close() error { ...@@ -135,22 +135,7 @@ func (file *file) close() error {
return err return err
} }
// Readdir reads the contents of the directory associated with file and func (file *File) readdir(n int) (fi []FileInfo, err error) {
// returns an array of up to n FileInfo structures, as would be returned
// by Lstat, in directory order. Subsequent calls on the same file will yield
// further FileInfos.
//
// If n > 0, Readdir returns at most n FileInfo structures. In this case, if
// Readdir returns an empty slice, it will return a non-nil error
// explaining why. At the end of a directory, the error is io.EOF.
//
// If n <= 0, Readdir returns all the FileInfo from the directory in
// a single slice. In this case, if Readdir succeeds (reads all
// the way to the end of the directory), it returns the slice and a
// nil error. If it encounters an error before the end of the
// directory, Readdir returns the FileInfo read until that point
// and a non-nil error.
func (file *File) Readdir(n int) (fi []FileInfo, err error) {
if file == nil || file.fd < 0 { if file == nil || file.fd < 0 {
return nil, EINVAL return nil, EINVAL
} }
......
...@@ -11,7 +11,7 @@ package os ...@@ -11,7 +11,7 @@ package os
import "syscall" import "syscall"
func Hostname() (name string, err error) { func hostname() (name string, err error) {
name, err = syscall.Sysctl("kern.hostname") name, err = syscall.Sysctl("kern.hostname")
if err != nil { if err != nil {
return "", NewSyscallError("sysctl kern.hostname", err) return "", NewSyscallError("sysctl kern.hostname", err)
......
...@@ -6,8 +6,7 @@ ...@@ -6,8 +6,7 @@
package os package os
// Hostname returns the host name reported by the kernel. func hostname() (name string, err error) {
func Hostname() (name string, err error) {
f, err := Open("/proc/sys/kernel/hostname") f, err := Open("/proc/sys/kernel/hostname")
if err != nil { if err != nil {
return "", err return "", err
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
package os package os
func Hostname() (name string, err error) { func hostname() (name string, err error) {
f, err := Open("#c/sysname") f, err := Open("#c/sysname")
if err != nil { if err != nil {
return "", err return "", err
......
...@@ -6,7 +6,7 @@ package os ...@@ -6,7 +6,7 @@ package os
import "syscall" import "syscall"
func Hostname() (name string, err error) { func hostname() (name string, err error) {
s, e := syscall.ComputerName() s, e := syscall.ComputerName()
if e != nil { if e != nil {
return "", NewSyscallError("ComputerName", e) return "", NewSyscallError("ComputerName", e)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment