#ifndef LIBTIO_ERROR_H # define LIBTIO_ERROR_H 20180710 # include "cdefs.h" TIO_BEGIN_NAMESPACE /* --- * Error codes. * --- */ typedef int tio_error_t; # define tio_ok 0x00 # define tio_error_none 0x00 # define tio_error_success 0x00 # define tio_error_ok 0x00 /* General errors. * `unknown`: an unknown error has occurred. * `alloc`: a memory allocation has failed. * `op`: unsupported operation. * `arg`: an argument was invalid. * `iter`: no more elements in the iterator. * `notfound`: error not found. * `access`: access denied. */ # define tio_error_unknown 0x01 # define tio_error_alloc 0x02 # define tio_error_op 0x03 # define tio_error_arg 0x04 # define tio_error_iter 0x05 # define tio_error_notfound 0x06 # define tio_error_access 0x07 /* Stream errors. * `stream`: invalid stream or stream in erroneous state (parent, …). * `read`: a read operation has failed. * `write`: a write operation has failed. * `seek`: a seek operation has failed. * `end`: an end of stream event has occured. * `timeout`: a timeout operation has failed. * `scsi`: an SCSI operation has failed. * `usb`: a USB operation has failed. */ # define tio_error_stream 0x10 # define tio_error_read 0x11 # define tio_error_write 0x12 # define tio_error_seek 0x13 # define tio_error_end 0x14 # define tio_error_timeout 0x15 # define tio_error_scsi 0x16 # define tio_error_usb 0x17 /* --- * Utilities. * --- */ /* Get the error name or description. */ TIO_EXTERN(char const *) tio_error_name OF((int tio__code)); TIO_EXTERN(char const *) tio_error_desc OF((int tio__code)); TIO_END_NAMESPACE #endif /* LIBTIO_ERROR_H */