rosetta/internal/erl/kernel/r_file

Types

pub type DateTime =
  r_calendar.Datetime
pub type DeepList =
  Placeholder
pub type DeleteOption =
  Placeholder
pub type Fd =
  Placeholder
pub type FileInfo =
  Placeholder
pub type FileInfoOption =
  Placeholder
pub type Filename =
  Placeholder
pub type FilenameAll =
  Placeholder
pub type IoDevice =
  Placeholder
pub type Location =
  Placeholder
pub type Mode =
  Placeholder
pub type Name =
  Placeholder
pub type NameAll =
  Placeholder
pub type Placeholder =
  dynamic.Dynamic

Represents POSIX error codes (kernel:posix/0 in Erlang).

This type provides a direct mapping to POSIX error codes commonly used in UNIX systems and many C compiler runtime libraries. These codes are used to indicate various system-level errors that can occur during operations such as file I/O, network communication, and process management.

POSIX (Portable Operating System Interface) is a family of standards specified by the IEEE Computer Society for maintaining compatibility between operating systems. These error codes are part of that standard, ensuring consistent error reporting across different POSIX-compliant systems.

When working with system calls or libraries that interact closely with the operating system, functions may return these error codes to indicate specific failure conditions. Understanding these codes can help in diagnosing issues and handling errors appropriately in your application.

Note: While these codes originate from POSIX standards, their exact behavior or availability may vary slightly depending on the underlying system and the specific Gleam/Erlang libraries being used.

You may also encounter these atoms in other places, like for example inet. This is due to Gleam’s limitation: a type can not have fields i.e. from the other type (like in Go, for example)

pub type PosixError {
  Eagain
  Eacces
  Ebadf
  Ebadmsg
  Ebusy
  Edeadlk
  Edeadlock
  Edquot
  Eexist
  Efault
  Efbig
  Eftype
  Eintr
  Einval
  Eio
  Eisdir
  Emfile
  Emlink
  Emultihop
  Enametoolong
  Enfile
  Enobufs
  Enodev
  Enoent
  Enolink
  Enolck
  Enomem
  Enospc
  Enosr
  Enosys
  Enostr
  Enotblk
  Enotdir
  Enotsup
  Enxio
  Eopnotsup
  Eoverflow
  Eperm
  Epipe
  Erange
  Erofs
  Espipe
  Esrch
  Estale
  Exdev
}

Constructors

  • Eagain

    Resource temporarily unavailable

  • Eacces

    Permision denied - error code

  • Ebadf

    Bad file number

  • Ebadmsg

    Bad message. NOT DOCUMENTED IN ERLANG Indicates that the message structure is incorrect or the message is of an inappropriate type for the operation being performed.

    This error typically occurs in scenarios involving:

    • Interprocess communication (IPC)
    • Network operations with corrupted or malformed packets
    • Stream I/O operations
    • Parsing of structured data (e.g., XML, JSON)

    Common situations:

    • Reading a malformed message from a queue
    • Receiving a corrupted network packet
    • Attempting to process a stream with an invalid format

    Note: While this error code originates from POSIX systems, its exact behavior may vary slightly depending on the underlying system and the specific Gleam/Erlang libraries being used.

  • Ebusy

    File busy

  • Edeadlk

    Edeadlk

  • Edeadlock

    Edeadlock

  • Edquot

    Disk quota exceeded

  • Eexist

    File already exists

  • Efault

    Bad address in system call argument

  • Efbig

    File too large

  • Eftype

    Missing documentation

  • Eintr

    Interrupted system call

  • Einval

    Invalid argument

  • Eio

    I/O error

  • Eisdir

    Illegal operation on a driectory

  • Emfile

    Too many open files

  • Emlink

    Too many links

  • Emultihop

    Multihop attempted NOT DOCUMENTED IN ERLANG Indicates that an attempt was made to perform a multihop operation which is not supported. This error is typically encountered in distributed or network file systems.

    Common scenarios:

    • Accessing a resource in a distributed file system that requires traversing multiple network nodes
    • Operations on file systems that do not support or have limitations on multihop routing

    Note: This error is relatively rare and usually appears in the context of advanced network operations or specialized distributed systems.

  • Enametoolong

    Filename too long

  • Enfile

    File table overflow

  • Enobufs

    No buffer space available NOT DOCUMENTED IN ERLANG Indicates that the system lacks sufficient buffer space to perform the requested operation. This error is commonly encountered in network operations and inter-process communication (IPC).

    Common scenarios:

    • Attempting to send data through a socket when network buffers are full
    • Creating new sockets when the system has reached its resource limits
    • Operations on message queues when there’s insufficient memory for buffering

    Possible causes:

    • System overload
    • Exhaustion of system resources
    • Application errors leading to excessive buffer usage

    Handling: Applications should be prepared to handle this error, typically by retrying the operation after a short delay, implementing flow control mechanisms, or managing and releasing unused buffers.

  • Enodev

    No such device

  • Enoent

    No such file or directory

  • Enolink

    Link has been severed NOT DOCUMENTED IN ERLANG Indicates that a link has been severed. This error typically occurs in distributed file systems or network-related operations.

    Common scenarios:

    • Attempting to access a remote file system resource that is no longer available
    • Network connection interruptions in distributed systems

    Note: This error is closely related to operations in network file systems.

  • Enolck

    No locks available NOT DOCUMENTED IN ERLANG Indicates that no locks are available. This error occurs when a process cannot acquire a lock on a file due to system limits.

    Common scenarios:

    • Attempting to lock a file when the system’s maximum number of locks is reached
    • Issues with file locking mechanisms in the operating system

    Note: This error is often encountered in systems with heavy file I/O operations.

  • Enomem

    Not enough memory

  • Enospc

    No space left on the device

  • Enosr

    Out of streams resources NOT DOCUMENTED IN ERLANG Indicates that the system is out of STREAMS resources. This error is specific to systems that implement STREAMS I/O.

    Common scenarios:

    • Attempting to open a STREAMS device when all STREAMS resources are exhausted
    • Heavy usage of STREAMS-based communication in the system

    Note: This error is less common in modern systems and may not be relevant in all operating environments.

  • Enosys

    Function not implemented NOT DOCUMENTED IN ERLANG Indicates that the function is not implemented on the current system.

    Common scenarios:

    • Calling a system call or library function that is not supported by the OS
    • Attempting to use a feature that is not available in the current environment

    Note: This error is important for maintaining portability across different systems.

  • Enostr

    Not a STREAM NOT DOCUMENTED IN ERLANG Indicates that a STREAMS operation was attempted on a non-STREAMS device.

    Common scenarios:

    • Attempting STREAMS I/O operations on a file descriptor that doesn’t support them
    • Misuse of STREAMS-related system calls

    Note: Like ENosr, this error is specific to systems with STREAMS I/O support.

  • Enotblk

    Block device required

  • Enotdir

    Not a directory

  • Enotsup

    Operation not supported

  • Enxio

    No such device or addres

  • Eopnotsup

    Operation not supported

  • Eoverflow

    Value too large for defined data type NOT DOCUMENTED IN ERLANG Indicates that a value is too large to be stored in a specific data type.

    Common scenarios:

    • Attempting to store a value in a variable that exceeds its maximum size
    • File operations where a file size or offset exceeds the maximum allowed value

    Note: This error is important in systems programming and data processing tasks.

  • Eperm

    Not owner

  • Epipe

    Broken pipe

  • Erange

    Missing documentation

  • Erofs

    Read-only file system

  • Espipe

    Invalid seek

  • Esrch

    No such process

  • Estale

    Stale remote file handle

  • Exdev

    Cross-device link

pub type PosixFileAdvise =
  Placeholder
pub type ReadFileOption =
  Placeholder
pub type SendfileOption =
  Placeholder

Functions

pub fn r_advise_4(
  arg1: Dynamic,
  arg2: Dynamic,
  arg3: Dynamic,
  arg4: Dynamic,
) -> Dynamic

advise/4

pub fn r_allocate_3(
  arg1: Dynamic,
  arg2: Dynamic,
  arg3: Dynamic,
) -> Dynamic

allocate/3

pub fn r_change_group_2(arg1: Dynamic, arg2: Dynamic) -> Dynamic

change_group/2

pub fn r_change_mode_2(arg1: Dynamic, arg2: Dynamic) -> Dynamic

change_mode/2

pub fn r_change_owner_2(arg1: Dynamic, arg2: Dynamic) -> Dynamic

change_owner/2

pub fn r_change_owner_3(
  arg1: Dynamic,
  arg2: Dynamic,
  arg3: Dynamic,
) -> Dynamic

change_owner/3

pub fn r_change_time_2(arg1: Dynamic, arg2: Dynamic) -> Dynamic

change_time/2

pub fn r_change_time_3(
  arg1: Dynamic,
  arg2: Dynamic,
  arg3: Dynamic,
) -> Dynamic

change_time/3

pub fn r_close_1(arg1: Dynamic) -> Dynamic

close/1

pub fn r_consult_1(arg1: Dynamic) -> Dynamic

consult/1

pub fn r_copy_2(arg1: Dynamic, arg2: Dynamic) -> Dynamic

copy/2

pub fn r_copy_3(
  arg1: Dynamic,
  arg2: Dynamic,
  arg3: Dynamic,
) -> Dynamic

copy/3

pub fn r_datasync_1(arg1: Dynamic) -> Dynamic

datasync/1

pub fn r_del_dir_1(arg1: Dynamic) -> Dynamic

del_dir/1

pub fn r_del_dir_r_1(arg1: Dynamic) -> Dynamic

del_dir_r/1

pub fn r_delete_1(arg1: Dynamic) -> Dynamic

delete/1

pub fn r_delete_2(arg1: Dynamic, arg2: Dynamic) -> Dynamic

delete/2

pub fn r_eval_1(arg1: Dynamic) -> Dynamic

eval/1

pub fn r_eval_2(arg1: Dynamic, arg2: Dynamic) -> Dynamic

eval/2

pub fn r_format_error_1(arg1: Dynamic) -> Dynamic

format_error/1

pub fn r_get_cwd_0() -> Dynamic

get_cwd/0

pub fn r_get_cwd_1(arg1: Dynamic) -> Dynamic

get_cwd/1

pub fn r_list_dir_1(arg1: Dynamic) -> Dynamic

list_dir/1

pub fn r_list_dir_all_1(arg1: Dynamic) -> Dynamic

list_dir_all/1

pub fn r_make_dir_1(arg1: Dynamic) -> Dynamic

make_dir/1

pub fn r_make_link_2(arg1: Dynamic, arg2: Dynamic) -> Dynamic

make_link/2

pub fn r_make_symlink_2(arg1: Dynamic, arg2: Dynamic) -> Dynamic

make_symlink/2

pub fn r_native_name_encoding_0() -> Dynamic

native_name_encoding/0

pub fn r_open_2(arg1: Dynamic, arg2: Dynamic) -> Dynamic

open/2

pub fn r_path_consult_2(arg1: Dynamic, arg2: Dynamic) -> Dynamic

path_consult/2

pub fn r_path_eval_2(arg1: Dynamic, arg2: Dynamic) -> Dynamic

path_eval/2

pub fn r_path_open_3(
  arg1: Dynamic,
  arg2: Dynamic,
  arg3: Dynamic,
) -> Dynamic

path_open/3

pub fn r_path_script_2(arg1: Dynamic, arg2: Dynamic) -> Dynamic

path_script/2

pub fn r_path_script_3(
  arg1: Dynamic,
  arg2: Dynamic,
  arg3: Dynamic,
) -> Dynamic

path_script/3

pub fn r_position_2(arg1: Dynamic, arg2: Dynamic) -> Dynamic

position/2

pub fn r_pread_2(arg1: Dynamic, arg2: Dynamic) -> Dynamic

pread/2

pub fn r_pread_3(
  arg1: Dynamic,
  arg2: Dynamic,
  arg3: Dynamic,
) -> Dynamic

pread/3

pub fn r_pwrite_2(arg1: Dynamic, arg2: Dynamic) -> Dynamic

pwrite/2

pub fn r_pwrite_3(
  arg1: Dynamic,
  arg2: Dynamic,
  arg3: Dynamic,
) -> Dynamic

pwrite/3

pub fn r_read_2(arg1: Dynamic, arg2: Dynamic) -> Dynamic

read/2

pub fn r_read_file_1(arg1: Dynamic) -> Dynamic

read_file/1

pub fn r_read_file_2(arg1: Dynamic, arg2: Dynamic) -> Dynamic

read_file/2

pub fn r_read_file_info_1(arg1: Dynamic) -> Dynamic

read_file_info/1

pub fn r_read_file_info_2(
  arg1: Dynamic,
  arg2: Dynamic,
) -> Dynamic

read_file_info/2

pub fn r_read_line_1(arg1: Dynamic) -> Dynamic

read_line/1

pub fn r_read_link_1(arg1: Dynamic) -> Dynamic

read_link/1

pub fn r_read_link_all_1(arg1: Dynamic) -> Dynamic

read_link_all/1

pub fn r_read_link_info_1(arg1: Dynamic) -> Dynamic

read_link_info/1

pub fn r_read_link_info_2(
  arg1: Dynamic,
  arg2: Dynamic,
) -> Dynamic

read_link_info/2

pub fn r_rename_2(arg1: Dynamic, arg2: Dynamic) -> Dynamic

rename/2

pub fn r_script_1(arg1: Dynamic) -> Dynamic

script/1

pub fn r_script_2(arg1: Dynamic, arg2: Dynamic) -> Dynamic

script/2

pub fn r_sendfile_2(arg1: Dynamic, arg2: Dynamic) -> Dynamic

sendfile/2

pub fn r_sendfile_5(
  arg1: Dynamic,
  arg2: Dynamic,
  arg3: Dynamic,
  arg4: Dynamic,
  arg5: Dynamic,
) -> Dynamic

sendfile/5

pub fn r_set_cwd_1(arg1: Dynamic) -> Dynamic

set_cwd/1

pub fn r_sync_1(arg1: Dynamic) -> Dynamic

sync/1

pub fn r_truncate_1(arg1: Dynamic) -> Dynamic

truncate/1

pub fn r_write_2(arg1: Dynamic, arg2: Dynamic) -> Dynamic

write/2

pub fn r_write_file_2(arg1: Dynamic, arg2: Dynamic) -> Dynamic

write_file/2

pub fn r_write_file_3(
  arg1: Dynamic,
  arg2: Dynamic,
  arg3: Dynamic,
) -> Dynamic

write_file/3

pub fn r_write_file_info_2(
  arg1: Dynamic,
  arg2: Dynamic,
) -> Dynamic

write_file_info/2

pub fn r_write_file_info_3(
  arg1: Dynamic,
  arg2: Dynamic,
  arg3: Dynamic,
) -> Dynamic

write_file_info/3

Search Document