os

package
v0.9.8 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

View Source
const (
	/* get file status flags */
	F_GETFL = 3
	/* set file status flags */
	F_SETFL = 4

	/* open for reading only */
	O_RDONLY = 0x0000
	/* open for writing only */
	O_WRONLY = 0x0001
	/* open for reading and writing */
	O_RDWR = 0x0002
	/* mask for above modes */
	O_ACCMODE = 0x0003

	/* no delay */
	O_NONBLOCK = 0x00000004
	/* create if nonexistant */
	O_CREAT = 0x00000200
	/* truncate to zero length */
	O_TRUNC = 0x00000400
)
View Source
const (
	LLGoFiles   = "_os/os.c"
	LLGoPackage = "link"
)
View Source
const (
	EAGAIN = 35
)
View Source
const (
	PATH_MAX = C.PATH_MAX
)

Variables

View Source
var Environ **c.Char

Functions

func Chdir

func Chdir(path *c.Char) c.Int

func Chmod

func Chmod(path *c.Char, mode ModeT) c.Int

func Chown

func Chown(path *c.Char, owner UidT, group GidT) c.Int

func Chroot

func Chroot(path *c.Char) c.Int

func Clearenv

func Clearenv()

func Close

func Close(fd c.Int) c.Int

func Creat

func Creat(path *c.Char, mode ModeT) c.Int

func Dup

func Dup(fd c.Int) c.Int

func Dup2

func Dup2(oldfd c.Int, newfd c.Int) c.Int

func Errno

func Errno() c.Int

func Execl added in v0.9.1

func Execl(path *c.Char, arg0 *c.Char, __llgo_va_list ...any) c.Int

Execl(const char *path, const char *arg0, ..., /*, (char *)0, */)

Execl requires the full path of the program to be provided.

func Execle added in v0.9.1

func Execle(path *c.Char, arg0 *c.Char, __llgo_va_list ...any) c.Int

Execle(const char *path, const char *arg0, ..., /* (char *)0, char *const envp[] */)

func Execlp added in v0.9.1

func Execlp(file *c.Char, arg0 *c.Char, __llgo_va_list ...any) c.Int

Execlp(const char *file, const char *arg0, ..., /*, (char *)0, */)

Execlp only needs to provide the program name and it will search for the program in the paths specified in the PATH environment variable.

func Execv added in v0.9.1

func Execv(path *c.Char, argv **c.Char) c.Int

func Execve added in v0.9.1

func Execve(path *c.Char, argv **c.Char, envp **c.Char) c.Int

func Execvp added in v0.9.1

func Execvp(file *c.Char, argv **c.Char) c.Int

func Exit

func Exit(c.Int)

func Faccessat

func Faccessat(dirfd c.Int, path *c.Char, mode c.Int, flags c.Int) c.Int

func Fchdir

func Fchdir(dirfd c.Int) c.Int

func Fchmod

func Fchmod(fd c.Int, mode ModeT) c.Int

func Fchmodat

func Fchmodat(dirfd c.Int, path *c.Char, mode ModeT, flags c.Int) c.Int

func Fchown

func Fchown(fd c.Int, owner UidT, group GidT) c.Int

func Fchownat

func Fchownat(dirfd c.Int, path *c.Char, owner UidT, group GidT, flags c.Int) c.Int

func Fcntl added in v0.9.2

func Fcntl(a c.Int, b c.Int, __llgo_va_list ...any) c.Int

func Fstat

func Fstat(fd c.Int, buf *StatT) c.Int

func Fstatat

func Fstatat(dirfd c.Int, path *c.Char, buf *StatT, flags c.Int) c.Int

func Fsync

func Fsync(fd c.Int) c.Int

func Ftruncate

func Ftruncate(fd c.Int, length OffT) c.Int

func Getcwd

func Getcwd(buffer c.Pointer, size uintptr) *c.Char

func Getenv

func Getenv(name *c.Char) *c.Char

func Getrlimit added in v0.9.2

func Getrlimit(resource c.Int, rlp *syscall.Rlimit) c.Int

func Isatty

func Isatty(fd c.Int) c.Int

func Kill added in v0.8.10

func Kill(pid PidT, sig c.Int) c.Int

func Lchown

func Lchown(path *c.Char, owner UidT, group GidT) c.Int
func Link(oldpath *c.Char, newpath *c.Char) c.Int

func Lstat

func Lstat(path *c.Char, buf *StatT) c.Int

func Mkdir

func Mkdir(path *c.Char, mode ModeT) c.Int

func Mkfifo

func Mkfifo(path *c.Char, mode ModeT) c.Int

func Mknod

func Mknod(path *c.Char, mode ModeT, dev DevT) c.Int

func Open

func Open(path *c.Char, flags c.Int, __llgo_va_list ...any) c.Int

func Openat added in v0.8.10

func Openat(dirfd c.Int, path *c.Char, flags c.Int, mode ModeT) c.Int

func Pipe

func Pipe(fds *[2]c.Int) c.Int
TODO(xsw):

On Alpha, IA-64, MIPS, SuperH, and SPARC/SPARC64, pipe() has the following prototype:

struct fd_pair {
	long fd[2];
};

struct fd_pair pipe(void);

func Putenv

func Putenv(env *c.Char) c.Int

func Read

func Read(fd c.Int, buf c.Pointer, count uintptr) int
func Readlink(path *c.Char, buf c.Pointer, bufsize uintptr) int

func Remove

func Remove(path *c.Char) c.Int

func Rename

func Rename(oldpath *c.Char, newpath *c.Char) c.Int

func Rmdir

func Rmdir(path *c.Char) c.Int

func Setenv

func Setenv(name *c.Char, value *c.Char, overwrite c.Int) c.Int

func Setrlimit added in v0.9.2

func Setrlimit(resource c.Int, rlp *syscall.Rlimit) c.Int

func Stat

func Stat(path *c.Char, buf *StatT) c.Int
func Symlink(target *c.Char, linkpath *c.Char) c.Int

func Sysctl added in v0.9.2

func Sysctl(
	name *c.Int, namelen c.Uint,
	oldp c.Pointer, oldlenp *uintptr,
	newp c.Pointer, newlen uintptr) c.Int

Upon successful completion, the value 0 is returned; otherwise the value -1 is returned and the global variable errno is set to indicate the error.

func Sysctlbyname added in v0.9.2

func Sysctlbyname(
	name *c.Char, oldp c.Pointer, oldlenp *uintptr,
	newp c.Pointer, newlen uintptr) c.Int

func Sysctlnametomib added in v0.9.2

func Sysctlnametomib(name *c.Char, mibp *c.Int, sizep *uintptr) c.Int

The sysctlnametomib() function accepts an ASCII representation of the name, looks up the integer name vector, and returns the numeric repre- sentation in the mib array pointed to by mibp. The number of elements in the mib array is given by the location specified by sizep before the call, and that location gives the number of entries copied after a suc- cessful call. The resulting mib and size may be used in subsequent sysctl() calls to get the data associated with the requested ASCII name. This interface is intended for use by applications that want to repeatedly request the same variable (the sysctl() function runs in about a third the time as the same request made via the sysctlbyname() function). The sysctlnametomib() function is also useful for fetching mib prefixes and then adding a final component.

func Truncate

func Truncate(path *c.Char, length OffT) c.Int
func Unlink(path *c.Char) c.Int

func Unsetenv

func Unsetenv(name *c.Char) c.Int

func Write

func Write(fd c.Int, buf c.Pointer, count uintptr) int

Types

type DevT

type DevT C.dev_t

type GidT

type GidT C.gid_t

func Getegid

func Getegid() GidT

func Getgid

func Getgid() GidT

type ModeT

type ModeT C.mode_t

func Umask

func Umask(cmask ModeT) ModeT

type OffT

type OffT C.off_t

func Lseek

func Lseek(fd c.Int, offset OffT, whence c.Int) OffT

type PidT added in v0.9.2

type PidT c.Int

func Fork added in v0.9.1

func Fork() PidT

func Getpid

func Getpid() PidT

func Getppid

func Getppid() PidT

func Wait added in v0.9.2

func Wait(statLoc *c.Int) PidT

If wait() returns due to a stopped or terminated child process, the process ID of the child is returned to the calling process. Otherwise, a value of -1 is returned and errno is set to indicate the error.

func Wait3 added in v0.9.2

func Wait3(statLoc *c.Int, options c.Int, rusage *syscall.Rusage) PidT

If wait3(), wait4(), or waitpid() returns due to a stopped or terminated child process, the process ID of the child is returned to the calling process. If there are no children not previously awaited, -1 is returned with errno set to [ECHILD]. Otherwise, if WNOHANG is specified and there are no stopped or exited children, 0 is returned. If an error is detected or a caught signal aborts the call, a value of -1 is returned and errno is set to indicate the error.

func Wait4 added in v0.9.2

func Wait4(pid PidT, statLoc *c.Int, options c.Int, rusage *syscall.Rusage) PidT

func Waitpid added in v0.9.2

func Waitpid(pid PidT, statLoc *c.Int, options c.Int) PidT

type StatT

type StatT = syscall.Stat_t

type UidT

type UidT C.uid_t

func Geteuid

func Geteuid() UidT

func Getuid

func Getuid() UidT

Jump to

Keyboard shortcuts

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