Documentation ¶
Index ¶
- func Chmod(path string, mode os.FileMode) error
- func Chtimes(path string, atime, mtime time.Time) error
- func Create(path string) (*os.File, error)
- func Lchown(path string, uid, gid int) error
- func Lclearxattrs(path string, except map[string]struct{}) error
- func Lgetxattr(path, name string) ([]byte, error)
- func Link(linkname, path string) error
- func Llistxattr(path string) ([]string, error)
- func Lremovexattr(path, name string) error
- func Lsetxattr(path, name string, value []byte, flags int) error
- func Lstat(path string) (os.FileInfo, error)
- func Lstatx(path string) (unix.Stat_t, error)
- func Lutimes(path string, atime, mtime time.Time) error
- func Mkdir(path string, perm os.FileMode) error
- func MkdirAll(path string, perm os.FileMode) error
- func Mknod(path string, mode os.FileMode, dev uint64) error
- func Open(path string) (*os.File, error)
- func Readdir(path string) ([]os.FileInfo, error)
- func Readlink(path string) (string, error)
- func Remove(path string) error
- func RemoveAll(path string) error
- func Symlink(linkname, path string) error
- func Walk(root string, walkFn filepath.WalkFunc) error
- func Wrap(path string, fn WrapFunc) error
- type WrapFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Chmod ¶
Chmod is a wrapper around os.Chmod which has been wrapped with unpriv.Wrap to make it possible to change the permission bits of a path even if you do not currently have the required access bits to access the path.
func Chtimes ¶
Chtimes is a wrapper around os.Chtimes which has been wrapped with unpriv.Wrap to make it possible to change the modified times of a path even if you do not currently have the required access bits to access the path.
func Create ¶
Create is a wrapper around os.Create which has been wrapped with unpriv.Wrap to make it possible to create paths even if you do not currently have read permission. Note that the returned file handle references a path that you do not have read access to (since all changes are reverted when this function returns).
func Lchown ¶
Lchown is a wrapper around os.Lchown which has been wrapped with unpriv.Wrap to make it possible to change the owner of a path even if you do not currently have the required access bits to access the path. Note that this function is not particularly useful in most rootless scenarios.
FIXME: This probably should be removed because it's questionably useful.
func Lclearxattrs ¶
Lclearxattrs is similar to system.Lclearxattrs but in order to implement it properly all of the internal functions were wrapped with unpriv.Wrap to make it possible to create a path even if you do not currently have enough access bits.
func Lgetxattr ¶
Lgetxattr is a wrapper around system.Lgetxattr which has been wrapped with unpriv.Wrap to make it possible to get a path even if you do not currently have the required access bits to resolve the path.
func Link ¶
Link is a wrapper around os.Link which has been wrapped with unpriv.Wrap to make it possible to create a hard link even if you do not currently have the required access bits to create the hard link. Note that you may not have resolve access after this function returns because all of the trickery is reverted by unpriv.Wrap.
func Llistxattr ¶
Llistxattr is a wrapper around system.Llistxattr which has been wrapped with unpriv.Wrap to make it possible to remove a path even if you do not currently have the required access bits to resolve the path.
func Lremovexattr ¶
Lremovexattr is a wrapper around system.Lremovexattr which has been wrapped with unpriv.Wrap to make it possible to remove a path even if you do not currently have the required access bits to resolve the path.
func Lsetxattr ¶
Lsetxattr is a wrapper around system.Lsetxattr which has been wrapped with unpriv.Wrap to make it possible to set a path even if you do not currently have the required access bits to resolve the path.
func Lstat ¶
Lstat is a wrapper around os.Lstat which has been wrapped with unpriv.Wrap to make it possible to get os.FileInfo about a path even if you do not currently have the required mode bits set to resolve the path. Note that you may not have resolve access after this function returns because all of the trickery is reverted by unpriv.Wrap.
func Lstatx ¶ added in v0.3.0
Lstatx is like Lstat but uses unix.Lstat and returns unix.Stat_t instead
func Lutimes ¶
Lutimes is a wrapper around system.Lutimes which has been wrapped with unpriv.Wrap to make it possible to change the modified times of a path even if you do no currently have the required access bits to access the path.
func Mkdir ¶
Mkdir is a wrapper around os.Mkdir which has been wrapped with unpriv.Wrap to make it possible to remove a path even if you do not currently have the required access bits to modify or resolve the path.
func MkdirAll ¶
MkdirAll is similar to os.MkdirAll but in order to implement it properly all of the internal functions were wrapped with unpriv.Wrap to make it possible to create a path even if you do not currently have enough access bits.
func Mknod ¶
Mknod is a wrapper around unix.Mknod which has been wrapped with unpriv.Wrap to make it possible to remove a path even if you do not currently have the required access bits to modify or resolve the path.
func Open ¶
Open is a wrapper around os.Open which has been wrapped with unpriv.Wrap to make it possible to open paths even if you do not currently have read permission. Note that the returned file handle references a path that you do not have read access to (since all changes are reverted when this function returns), so attempts to do Readdir() or similar functions that require doing lstat(2) may fail.
func Readdir ¶
Readdir is a wrapper around (*os.File).Readdir which has been wrapper with unpriv.Wrap to make it possible to get []os.FileInfo for the set of children of the provided directory path. The interface for this is quite different to (*os.File).Readdir because we have to have a proper filesystem path in order to get the set of child FileInfos (because all of the child paths need to be resolveable).
func Readlink ¶
Readlink is a wrapper around os.Readlink which has been wrapped with unpriv.Wrap to make it possible to get the linkname of a symlink even if you do not currently have teh required mode bits set to resolve the path. Note that you may not have resolve access after this function returns because all of this trickery is reverted by unpriv.Wrap.
func Remove ¶
Remove is a wrapper around os.Remove which has been wrapped with unpriv.Wrap to make it possible to remove a path even if you do not currently have the required access bits to modify or resolve the path.
func RemoveAll ¶
RemoveAll is similar to os.RemoveAll but with all of the internal functions wrapped with unpriv.Wrap to make it possible to remove a path (even if it has child paths) even if you do not currently have enough access bits.
func Symlink ¶
Symlink is a wrapper around os.Symlink which has been wrapped with unpriv.Wrap to make it possible to create a symlink even if you do not currently have the required access bits to create the symlink. Note that you may not have resolve access after this function returns because all of the trickery is reverted by unpriv.Wrap.
func Walk ¶ added in v0.4.0
Walk is a reimplementation of filepath.Walk, wrapping all of the relevant function calls with Wrap, allowing you to walk over a tree even in the face of multiple nested cases where paths are not normally accessible. The os.FileInfo passed to walkFn is the "pristine" version (as opposed to the currently-on-disk version that may have been temporarily modified by Wrap).
func Wrap ¶
Wrap will wrap a given function, and call it in a context where all of the parent directories in the given path argument are such that the path can be resolved (you may need to make your own changes to the path to make it readable). Note that the provided function may be called several times, and if the error returned is such that !os.IsPermission(err), then no trickery will be performed. If fn returns an error, so will this function. All of the trickery is reverted when this function returns (which is when fn returns).