LEFT | RIGHT |
(no file at all) | |
| 1 // Copyright 2012 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. |
| 4 |
| 5 package os |
| 6 |
| 7 // FindProcess looks for a running process by its pid. |
| 8 // The Process it returns can be used to obtain information |
| 9 // about the underlying operating system process. |
| 10 func FindProcess(pid int) (p *Process, err error) { |
| 11 return findProcess(pid) |
| 12 } |
| 13 |
| 14 // Hostname returns the host name reported by the kernel. |
| 15 func Hostname() (name string, err error) { |
| 16 return hostname() |
| 17 } |
| 18 |
| 19 // Readdir reads the contents of the directory associated with file and |
| 20 // returns an array of up to n FileInfo values, as would be returned |
| 21 // by Lstat, in directory order. Subsequent calls on the same file will yield |
| 22 // further FileInfos. |
| 23 // |
| 24 // If n > 0, Readdir returns at most n FileInfo structures. In this case, if |
| 25 // Readdir returns an empty slice, it will return a non-nil error |
| 26 // explaining why. At the end of a directory, the error is io.EOF. |
| 27 // |
| 28 // If n <= 0, Readdir returns all the FileInfo from the directory in |
| 29 // a single slice. In this case, if Readdir succeeds (reads all |
| 30 // the way to the end of the directory), it returns the slice and a |
| 31 // nil error. If it encounters an error before the end of the |
| 32 // directory, Readdir returns the FileInfo read until that point |
| 33 // and a non-nil error. |
| 34 func (f *File) Readdir(n int) (fi []FileInfo, err error) { |
| 35 return f.readdir(n) |
| 36 } |
| 37 |
| 38 // Readdirnames reads and returns a slice of names from the directory f. |
| 39 // |
| 40 // If n > 0, Readdirnames returns at most n names. In this case, if |
| 41 // Readdirnames returns an empty slice, it will return a non-nil error |
| 42 // explaining why. At the end of a directory, the error is io.EOF. |
| 43 // |
| 44 // If n <= 0, Readdirnames returns all the names from the directory in |
| 45 // a single slice. In this case, if Readdirnames succeeds (reads all |
| 46 // the way to the end of the directory), it returns the slice and a |
| 47 // nil error. If it encounters an error before the end of the |
| 48 // directory, Readdirnames returns the names read until that point and |
| 49 // a non-nil error. |
| 50 func (f *File) Readdirnames(n int) (names []string, err error) { |
| 51 return f.readdirnames(n) |
| 52 } |
LEFT | RIGHT |