| // Copyright 2022 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| library zx; |
| |
| // TODO(https://fxbug.dev/42065140): `status` should be defined here and this should all |
| // be a single enum definition. |
| |
| /// Indicates an operation was successful. |
| const OK Status = 0; |
| |
| // ======= Internal failures ======= |
| |
| /// The system encountered an otherwise unspecified error while performing the |
| /// operation. |
| const ERR_INTERNAL Status = -1; |
| |
| /// The operation is not implemented, supported, or enabled. |
| const ERR_NOT_SUPPORTED Status = -2; |
| |
| /// The system was not able to allocate some resource needed for the operation. |
| const ERR_NO_RESOURCES Status = -3; |
| |
| /// The system was not able to allocate memory needed for the operation. |
| const ERR_NO_MEMORY Status = -4; |
| |
| // -5 used to be ZX_ERR_CALL_FAILED. |
| |
| /// The system call was interrupted, but should be retried. This should not be |
| /// seen outside of the VDSO. |
| const ERR_INTERNAL_INTR_RETRY Status = -6; |
| |
| // ======= Parameter errors ======= |
| |
| /// An argument is invalid. For example, a null pointer when a null pointer is |
| /// not permitted. |
| const ERR_INVALID_ARGS Status = -10; |
| |
| /// A specified handle value does not refer to a handle. |
| const ERR_BAD_HANDLE Status = -11; |
| |
| /// The subject of the operation is the wrong type to perform the operation. |
| /// |
| /// For example: Attempting a message_read on a thread handle. |
| const ERR_WRONG_TYPE Status = -12; |
| |
| /// The specified syscall number is invalid. |
| const ERR_BAD_SYSCALL Status = -13; |
| |
| /// An argument is outside the valid range for this operation. |
| const ERR_OUT_OF_RANGE Status = -14; |
| |
| /// The caller-provided buffer is too small for this operation. |
| const ERR_BUFFER_TOO_SMALL Status = -15; |
| |
| // ======= Precondition or state errors ======= |
| |
| /// The operation failed because the current state of the object does not allow |
| /// it, or a precondition of the operation is not satisfied. |
| const ERR_BAD_STATE Status = -20; |
| |
| /// The time limit for the operation elapsed before the operation completed. |
| const ERR_TIMED_OUT Status = -21; |
| |
| /// The operation cannot be performed currently but potentially could succeed if |
| /// the caller waits for a prerequisite to be satisfied, like waiting for a |
| /// handle to be readable or writable. |
| /// |
| /// Example: Attempting to read from a channel that has no messages waiting but |
| /// has an open remote will return `ZX_ERR_SHOULD_WAIT`. In contrast, attempting |
| /// to read from a channel that has no messages waiting and has a closed remote |
| /// end will return `ZX_ERR_PEER_CLOSED`. |
| const ERR_SHOULD_WAIT Status = -22; |
| |
| /// The in-progress operation, for example, a wait, has been canceled. |
| const ERR_CANCELED Status = -23; |
| |
| /// The operation failed because the remote end of the subject of the operation |
| /// was closed. |
| const ERR_PEER_CLOSED Status = -24; |
| |
| /// The requested entity is not found. |
| const ERR_NOT_FOUND Status = -25; |
| |
| /// An object with the specified identifier already exists. |
| /// |
| /// Example: Attempting to create a file when a file already exists with that |
| /// name. |
| const ERR_ALREADY_EXISTS Status = -26; |
| |
| /// The operation failed because the named entity is already owned or controlled |
| /// by another entity. The operation could succeed later if the current owner |
| /// releases the entity. |
| const ERR_ALREADY_BOUND Status = -27; |
| |
| /// The subject of the operation is currently unable to perform the operation. |
| /// |
| /// This is used when there's no direct way for the caller to observe when the |
| /// subject will be able to perform the operation and should thus retry. |
| const ERR_UNAVAILABLE Status = -28; |
| |
| // ======= Permission check errors ======= |
| |
| /// The caller did not have permission to perform the specified operation. |
| const ERR_ACCESS_DENIED Status = -30; |
| |
| /// Otherwise-unspecified error occurred during I/O. |
| const ERR_IO Status = -40; |
| |
| /// The entity the I/O operation is being performed on rejected the operation. |
| /// |
| /// Example: an I2C device NAK'ing a transaction or a disk controller rejecting |
| /// an invalid command, or a stalled USB endpoint. |
| const ERR_IO_REFUSED Status = -41; |
| |
| /// The data in the operation failed an integrity check and is possibly |
| /// corrupted. |
| /// |
| /// Example: CRC or Parity error. |
| const ERR_IO_DATA_INTEGRITY Status = -42; |
| |
| /// The data in the operation is currently unavailable and may be permanently |
| /// lost. |
| /// |
| /// Example: A disk block is irrecoverably damaged. |
| const ERR_IO_DATA_LOSS Status = -43; |
| |
| /// The device is no longer available (has been unplugged from the system, |
| /// powered down, or the driver has been unloaded). |
| const ERR_IO_NOT_PRESENT Status = -44; |
| |
| /// More data was received from the device than expected. |
| /// |
| /// Example: a USB "babble" error due to a device sending more data than the |
| /// host queued to receive. |
| const ERR_IO_OVERRUN Status = -45; |
| |
| /// An operation did not complete within the required timeframe. |
| /// |
| /// Example: A USB isochronous transfer that failed to complete due to an |
| /// overrun or underrun. |
| const ERR_IO_MISSED_DEADLINE Status = -46; |
| |
| /// The data in the operation is invalid parameter or is out of range. |
| /// |
| /// Example: A USB transfer that failed to complete with TRB Error |
| const ERR_IO_INVALID Status = -47; |
| |
| // ======== Filesystem Errors ======== |
| |
| /// Path name is too long. |
| const ERR_BAD_PATH Status = -50; |
| |
| /// The object is not a directory or does not support directory operations. |
| /// |
| /// Example: Attempted to open a file as a directory or attempted to do |
| /// directory operations on a file. |
| const ERR_NOT_DIR Status = -51; |
| |
| /// Object is not a regular file. |
| const ERR_NOT_FILE Status = -52; |
| |
| /// This operation would cause a file to exceed a filesystem-specific size |
| /// limit. |
| const ERR_FILE_BIG Status = -53; |
| |
| /// The filesystem or device space is exhausted. |
| const ERR_NO_SPACE Status = -54; |
| |
| /// The directory is not empty for an operation that requires it to be empty. |
| /// |
| /// For example, non-recursively deleting a directory with files still in it. |
| const ERR_NOT_EMPTY Status = -55; |
| |
| // ======== Flow Control ======== |
| |
| /// An indicate to not call again. |
| /// |
| /// The flow control values `ZX_ERR_STOP`, `ZX_ERR_NEXT`, and `ZX_ERR_ASYNC` are |
| /// not errors and will never be returned by a system call or public API. They |
| /// allow callbacks to request their caller perform some other operation. |
| /// |
| /// For example, a callback might be called on every event until it returns |
| /// something other than `ZX_OK`. This status allows differentiation between |
| /// "stop due to an error" and "stop because work is done." |
| const ERR_STOP Status = -60; |
| |
| /// Advance to the next item. |
| /// |
| /// The flow control values `ZX_ERR_STOP`, `ZX_ERR_NEXT`, and `ZX_ERR_ASYNC` are |
| /// not errors and will never be returned by a system call or public API. They |
| /// allow callbacks to request their caller perform some other operation. |
| /// |
| /// For example, a callback could use this value to indicate it did not consume |
| /// an item passed to it, but by choice, not due to an error condition. |
| const ERR_NEXT Status = -61; |
| |
| /// Ownership of the item has moved to an asynchronous worker. |
| /// |
| /// The flow control values `ZX_ERR_STOP`, `ZX_ERR_NEXT`, and `ZX_ERR_ASYNC` are |
| /// not errors and will never be returned by a system call or public API. They |
| /// allow callbacks to request their caller perform some other operation. |
| /// |
| /// Unlike `ZX_ERR_STOP`, which implies that iteration on an object |
| /// should stop, and `ZX_ERR_NEXT`, which implies that iteration |
| /// should continue to the next item, `ZX_ERR_ASYNC` implies |
| /// that an asynchronous worker is responsible for continuing iteration. |
| /// |
| /// For example, a callback will be called on every event, but one event needs |
| /// to handle some work asynchronously before it can continue. `ZX_ERR_ASYNC` |
| /// implies the worker is responsible for resuming iteration once its work has |
| /// completed. |
| const ERR_ASYNC Status = -62; |
| |
| // ======== Network-related errors ======== |
| |
| /// The specified protocol is not supported. |
| const ERR_PROTOCOL_NOT_SUPPORTED Status = -70; |
| |
| /// The host is unreachable. |
| const ERR_ADDRESS_UNREACHABLE Status = -71; |
| |
| /// Address is being used by someone else. |
| const ERR_ADDRESS_IN_USE Status = -72; |
| |
| /// The socket is not connected. |
| const ERR_NOT_CONNECTED Status = -73; |
| |
| /// The remote peer rejected the connection. |
| const ERR_CONNECTION_REFUSED Status = -74; |
| |
| /// The connection was reset. |
| const ERR_CONNECTION_RESET Status = -75; |
| |
| /// The connection was aborted. |
| const ERR_CONNECTION_ABORTED Status = -76; |
| |
| // ======= VDSO-private errors ======= |
| |
| /// A task was killed during an operation. This is a private error that should |
| /// not be seen outside of the VDSO. |
| const ERR_INTERNAL_INTR_KILLED Status = -502; |