Error Set CopyFileRangeError [src]
Errors
One of:
- One or more file descriptors are not valid.
- fd_in is not open for reading; or fd_out is not open for writing.
- The O_APPEND flag is set for the open file description referred to by the file descriptor fd_out.
One of:
- An attempt was made to write at a position past the maximum file offset the kernel supports.
- An attempt was made to write a range that exceeds the allowed maximum file size. The maximum file size differs between filesystem implementations and can be different from the maximum allowed file offset.
- An attempt was made to write beyond the process's file size resource limit. This may also result in the process receiving a SIGXFSZ signal.
A low-level I/O error occurred while copying.
One of:
- either fd_in or fd_out is not a regular file
- flags argument is not zero
- fd_in and fd_out refer to the same file and the source and target ranges overlap.
Either fd_in or fd_out refers to a directory.
There is not enough space on the target filesystem to complete the copy.
The files referred to by fd_in and fd_out are not on the same filesystem, and the source and target filesystems are not of the same type, or do not support cross-filesystem copy.
(since Linux 5.19) the filesystem does not support this operation.
The requested source or destination range is too large to represent in the specified data types.
fd_out refers to an immutable file.
Either fd_in or fd_out refers to an active swap file.
The Operating System returned an undocumented error code.
This error is in theory not possible, but it would be better to handle this error than to invoke undefined behavior.
When this error code is observed, it usually means the Zig Standard Library needs a small patch to add the error code to the error set for the respective function.
Source
pub const CopyFileRangeError = std.posix.UnexpectedError || error{
/// One of:
/// * One or more file descriptors are not valid.
/// * fd_in is not open for reading; or fd_out is not open for writing.
/// * The O_APPEND flag is set for the open file description referred
/// to by the file descriptor fd_out.
BadFileFlags,
/// One of:
/// * An attempt was made to write at a position past the maximum file
/// offset the kernel supports.
/// * An attempt was made to write a range that exceeds the allowed
/// maximum file size. The maximum file size differs between
/// filesystem implementations and can be different from the maximum
/// allowed file offset.
/// * An attempt was made to write beyond the process's file size
/// resource limit. This may also result in the process receiving a
/// SIGXFSZ signal.
FileTooBig,
/// One of:
/// * either fd_in or fd_out is not a regular file
/// * flags argument is not zero
/// * fd_in and fd_out refer to the same file and the source and target ranges overlap.
InvalidArguments,
/// A low-level I/O error occurred while copying.
InputOutput,
/// Either fd_in or fd_out refers to a directory.
IsDir,
OutOfMemory,
/// There is not enough space on the target filesystem to complete the copy.
NoSpaceLeft,
/// (since Linux 5.19) the filesystem does not support this operation.
OperationNotSupported,
/// The requested source or destination range is too large to represent
/// in the specified data types.
Overflow,
/// fd_out refers to an immutable file.
PermissionDenied,
/// Either fd_in or fd_out refers to an active swap file.
SwapFile,
/// The files referred to by fd_in and fd_out are not on the same
/// filesystem, and the source and target filesystems are not of the
/// same type, or do not support cross-filesystem copy.
NotSameFileSystem,
}