[][src]Module palaver::file

File and file descriptor-related functionality

Structs

FdIter

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

Functions

copy

Loops 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.

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/{randomfilename}")

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.