unix +linux +x86_64

The unix module and its submodules provides support for functionality common to Unix-like systems.

Submodules

Index

Types

type pipe_flag;

Functions

fn getegid() uint;
fn geteuid() uint;
fn getgid() uint;
fn getgroups() []uint;
fn getuid() uint;
fn nice(int) (void | errors::error);
fn pipe(pipe_flag...) ((io::file, io::file) | errors::error);
fn setegid(uint) void;
fn seteuid(uint) void;
fn setgid(uint) void;
fn setgroups([]uint) void;
fn setuid(uint) void;
fn umask(fs::mode) fs::mode;

Types

type pipe_flag[link]

type pipe_flag = enum {
	NOCLOEXEC = rt::O_CLOEXEC,
	DIRECT = rt::O_DIRECT,
	NONBLOCK = rt::O_NONBLOCK,

};

Flags to use for the io::files returned by pipe. Only NOCLOEXEC and NONBLOCK are guaranteed to be available.

Functions

fn getegid[link]

fn getegid() uint;

Returns the current process effective group ID.

fn geteuid[link]

fn geteuid() uint;

Returns the current process effective user ID.

fn getgid[link]

fn getgid() uint;

Returns the current process group ID.

fn getgroups[link]

fn getgroups() []uint;

Returns a list of supplementary group IDs for the current process.

fn getuid[link]

fn getuid() uint;

Returns the current process user ID.

fn nice[link]

fn nice(inc: int) (void | errors::error);

Adds the argument to the niceness of the current process. The input should be between -20 and 19 (inclusive); lower numbers represent a higher priority. Generally, you must have elevated permissions to reduce your niceness, but not to increase it.

fn pipe[link]

fn pipe(flags: pipe_flag...) ((io::file, io::file) | errors::error);

Create a pair of two linked io::files, such that any data written to the second io::file may be read from the first. If you pass your own flags, it is recommended that you add it unless you know that you don't want it.

fn setegid[link]

fn setegid(gid: uint) void;

Sets the caller's effective group ID to the specified value. This generally requires elevated permissions from the calling process.

If the system returns an error, this function will abort the program. Failing to handle errors from setegid is a grave security issue in your program, and therefore we require this function to succeed. If you need to handle the error case gracefully, call the appropriate syscall wrapper in rt yourself, and take extreme care to handle errors correctly.

fn seteuid[link]

fn seteuid(uid: uint) void;

Sets the caller's effective user ID to the specified value. This generally requires elevated permissions from the calling process.

If the system returns an error, this function will abort the program. Failing to handle errors from seteuid is a grave security issue in your program, and therefore we require this function to succeed. If you need to handle the error case gracefully, call the appropriate syscall wrapper in rt yourself, and take extreme care to handle errors correctly.

fn setgid[link]

fn setgid(gid: uint) void;

Sets the caller's group ID to the specified value. This generally requires elevated permissions from the calling process.

If the system returns an error, this function will abort the program. Failing to handle errors from setuid is a grave security issue in your program, and therefore we require this function to succeed. If you need to handle the error case gracefully, call the appropriate syscall wrapper in rt yourself, and take extreme care to handle errors correctly.

fn setgroups[link]

fn setgroups(gids: []uint) void;

Sets the list of supplementary group IDs which apply to the current process. This generally requires elevated permissions.

If the system returns an error, this function will abort the program. Failing to handle errors from setgroups is a grave security issue in your program, and therefore we require this function to succeed. If you need to handle the error case gracefully, call the appropriate syscall wrapper in rt yourself, and take extreme care to handle errors correctly.

fn setuid[link]

fn setuid(uid: uint) void;

Sets the caller's user ID to the specified value. This generally requires elevated permissions from the calling process.

If the system returns an error, this function will abort the program. Failing to handle errors from setuid is a grave security issue in your program, and therefore we require this function to succeed. If you need to handle the error case gracefully, call the appropriate syscall wrapper in rt yourself, and take extreme care to handle errors correctly.

fn umask[link]

fn umask(mode: fs::mode) fs::mode;

Sets the file mode creation mask for the current process and return the previous value of the mask.