[][src]Module palaver::file

File and file descriptor-related functionality

Structs

FdFlag

Additional configuration flags for fcntl's F_SETFD.

FdIter

Iterator for all open file descriptors. Doesn't work on Windows.

OFlag

Configuration options for opened files.

Functions

copy

io::copy till len elapsed or error

copy_fd

Copy a file descriptor. Flags are passed atomically. flags being None copies the flags from oldfd. Panics if newfd doesn't exist and allow_nonexistent isn't set; this can help debug the race of another thread creating newfd and having it deleted from under it by us.

copy_sendfile

Loops sendfile till len elapsed or error

copy_splice

Loops splice till len elapsed or error

dup_fd

Duplicate a file descriptor. Flags are passed atomically. flags being None copies the flags from oldfd.

execve

execve, not requiring memory allocation unlike nix's, but panics on >255 args or vars.

fd_dir

Returns the path of the directory that contains entries for each open file descriptor. On Linux this is /proc/self/fd. Doesn't work on Windows.

fd_path

Returns the path of the entry for a particular open file descriptor. On Linux this is /proc/self/fd/{fd}. Doesn't work on Windows.

fexecve

Falls back to execve("/proc/self/fd/{fd}",...), falls back to execve("/tmp/{hash}")

memfd_create

Falls back to shm_open, falls back to creating+unlinking /tmp/{random_filename}

move_fd

Move a file descriptor. Flags are passed atomically. flags being None copies the flags from oldfd. Panics if newfd doesn't exist and allow_nonexistent isn't set; this can help debug the race of another thread creating newfd and having it deleted from under it by us.

move_fds

Maps file descriptors [(from,to)]

pipe

Like pipe2; not atomic on platforms that lack it

seal_fd

Makes a file descriptor read-only, which seems neccessary on some platforms to pass to fexecve and is good practise anyway.