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.
12 // Getpagesize returns the underlying system's memory page size.
13 func Getpagesize() int { return syscall
.Getpagesize() }
15 // File represents an open file descriptor.
20 // A FileInfo describes a file and is returned by Stat and Lstat.
21 type FileInfo
= fs
.FileInfo
23 // A FileMode represents a file's mode and permission bits.
24 // The bits have the same definition on all systems, so that
25 // information about files can be moved from one system
26 // to another portably. Not all bits apply to all systems.
27 // The only required bit is ModeDir for directories.
28 type FileMode
= fs
.FileMode
30 // The defined file mode bits are the most significant bits of the FileMode.
31 // The nine least-significant bits are the standard Unix rwxrwxrwx permissions.
32 // The values of these bits should be considered part of the public API and
33 // may be used in wire protocols or disk representations: they must not be
34 // changed, although new bits might be added.
36 // The single letters are the abbreviations
37 // used by the String method's formatting.
38 ModeDir
= fs
.ModeDir
// d: is a directory
39 ModeAppend
= fs
.ModeAppend
// a: append-only
40 ModeExclusive
= fs
.ModeExclusive
// l: exclusive use
41 ModeTemporary
= fs
.ModeTemporary
// T: temporary file; Plan 9 only
42 ModeSymlink
= fs
.ModeSymlink
// L: symbolic link
43 ModeDevice
= fs
.ModeDevice
// D: device file
44 ModeNamedPipe
= fs
.ModeNamedPipe
// p: named pipe (FIFO)
45 ModeSocket
= fs
.ModeSocket
// S: Unix domain socket
46 ModeSetuid
= fs
.ModeSetuid
// u: setuid
47 ModeSetgid
= fs
.ModeSetgid
// g: setgid
48 ModeCharDevice
= fs
.ModeCharDevice
// c: Unix character device, when ModeDevice is set
49 ModeSticky
= fs
.ModeSticky
// t: sticky
50 ModeIrregular
= fs
.ModeIrregular
// ?: non-regular file; nothing else is known about this file
52 // Mask for the type bits. For regular files, none will be set.
53 ModeType
= fs
.ModeType
55 ModePerm
= fs
.ModePerm
// Unix permission bits, 0o777
58 func (fs
*fileStat
) Name() string { return fs
.name
}
59 func (fs
*fileStat
) IsDir() bool { return fs
.Mode().IsDir() }
61 // SameFile reports whether fi1 and fi2 describe the same file.
62 // For example, on Unix this means that the device and inode fields
63 // of the two underlying structures are identical; on other systems
64 // the decision may be based on the path names.
65 // SameFile only applies to results returned by this package's Stat.
66 // It returns false in other cases.
67 func SameFile(fi1
, fi2 FileInfo
) bool {
68 fs1
, ok1
:= fi1
.(*fileStat
)
69 fs2
, ok2
:= fi2
.(*fileStat
)
73 return sameFile(fs1
, fs2
)