syscallcompat

package
v1.7.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 6, 2019 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// O_DIRECT means oncached I/O on Linux. No direct equivalent on MacOS and defined
	// to zero there.
	O_DIRECT = 0

	// O_PATH is only defined on Linux
	O_PATH = 0

	// KAUTH_UID_NONE and KAUTH_GID_NONE are special values to
	// revert permissions to the process credentials.
	KAUTH_UID_NONE = ^uint32(0) - 100
	KAUTH_GID_NONE = ^uint32(0) - 100
)
View Source
const PATH_MAX = 4096

PATH_MAX is the maximum allowed path length on Linux. It is not defined on Darwin, so we use the Linux value.

View Source
const XATTR_BUFSZ = XATTR_SIZE_MAX + 1024

Make the buffer 1kB bigger so we can detect overflows

View Source
const XATTR_SIZE_MAX = 65536

Variables

This section is empty.

Functions

func Dup3 added in v1.4.1

func Dup3(oldfd int, newfd int, flags int) (err error)

Dup3 is not available on Darwin, so we use Dup2 instead.

func EnospcPrealloc

func EnospcPrealloc(fd int, off int64, len int64) error

Sorry, fallocate is not available on OSX at all and fcntl F_PREALLOCATE is not accessible from Go. See https://github.com/rfjakob/gocryptfs/issues/18 if you want to help.

func Faccessat added in v1.4.3

func Faccessat(dirfd int, path string, mode uint32) error

Faccessat exists both in Linux and in MacOS 10.10+, but the Linux version DOES NOT support any flags. Emulate AT_SYMLINK_NOFOLLOW like glibc does.

func Fallocate

func Fallocate(fd int, mode uint32, off int64, len int64) error

See above.

func FchmodatNofollow added in v1.7.1

func FchmodatNofollow(dirfd int, path string, mode uint32) (err error)

func Fchownat added in v1.4.3

func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error)

Fchownat syscall.

func Fgetxattr added in v1.7.1

func Fgetxattr(fd int, attr string) (val []byte, err error)

Fgetxattr is a wrapper around unix.Fgetxattr that handles the buffer sizing.

func Flistxattr added in v1.7.1

func Flistxattr(fd int) (attrs []string, err error)

Flistxattr is a wrapper for unix.Flistxattr that handles buffer sizing and parsing the returned blob to a string slice.

func Fstatat added in v1.4.3

func Fstatat(dirfd int, path string, stat *unix.Stat_t, flags int) (err error)

Fstatat syscall.

func FutimesNano added in v1.7.1

func FutimesNano(fd int, a *time.Time, m *time.Time) (err error)

FutimesNano syscall.

func Getdents added in v1.4.1

func Getdents(fd int) ([]fuse.DirEntry, error)

func IsENOSPC added in v1.6.1

func IsENOSPC(err error) bool

IsENOSPC tries to find out if "err" is a (potentially wrapped) ENOSPC error.

func Lgetxattr added in v1.7.1

func Lgetxattr(path string, attr string) (val []byte, err error)

Lgetxattr is a wrapper around unix.Lgetxattr that handles the buffer sizing.

func Linkat added in v1.4.3

func Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (err error)

Linkat exists both in Linux and in MacOS 10.10+.

func Llistxattr added in v1.7.1

func Llistxattr(path string) (attrs []string, err error)

Llistxattr is a wrapper for unix.Llistxattr that handles buffer sizing and parsing the returned blob to a string slice.

func Mkdirat added in v1.4.3

func Mkdirat(dirfd int, path string, mode uint32) (err error)

Mkdirat syscall.

func MkdiratUser added in v1.7.1

func MkdiratUser(dirfd int, path string, mode uint32, context *fuse.Context) (err error)

func Mknodat

func Mknodat(dirfd int, path string, mode uint32, dev int) (err error)

func MknodatUser added in v1.7.1

func MknodatUser(dirfd int, path string, mode uint32, dev int, context *fuse.Context) (err error)

func OpenDirNofollow added in v1.7.1

func OpenDirNofollow(baseDir string, relPath string) (fd int, err error)

OpenDirNofollow opens the dir at "relPath" in a way that is secure against symlink attacks. Symlinks that are part of "relPath" are never followed. This function is implemented by walking the directory tree, starting at "baseDir", using the Openat syscall with the O_NOFOLLOW flag. Symlinks that are part of the "baseDir" path are followed.

func Openat

func Openat(dirfd int, path string, flags int, mode uint32) (fd int, err error)

Openat wraps the Openat syscall.

func OpenatUser added in v1.7.1

func OpenatUser(dirfd int, path string, flags int, mode uint32, context *fuse.Context) (fd int, err error)

func Readlinkat added in v1.4.3

func Readlinkat(dirfd int, path string) (string, error)

Readlinkat is a convenience wrapper around unix.Readlinkat() that takes care of buffer sizing. Implemented like os.Readlink().

func Renameat

func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)

Renameat wraps the Renameat syscall.

func Symlinkat added in v1.4.3

func Symlinkat(oldpath string, newdirfd int, newpath string) (err error)

Symlinkat syscall.

func SymlinkatUser added in v1.7.1

func SymlinkatUser(oldpath string, newdirfd int, newpath string, context *fuse.Context) (err error)

func Unix2syscall added in v1.4.3

func Unix2syscall(u unix.Stat_t) syscall.Stat_t

Unix2syscall converts a unix.Stat_t struct to a syscall.Stat_t struct.

func Unlinkat

func Unlinkat(dirfd int, path string, flags int) (err error)

Unlinkat syscall.

func UtimesNanoAtNofollow added in v1.7.1

func UtimesNanoAtNofollow(dirfd int, path string, a *time.Time, m *time.Time) (err error)

UtimesNanoAtNofollow is like UtimesNanoAt but never follows symlinks.

Unfortunately we cannot use unix.UtimesNanoAt since it is broken and just ignores the provided 'dirfd'. In addition, it also lacks handling of 'nil' pointers (used to preserve one of both timestamps).

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL