Posix_errnoPOSIX errno handling
type t = [ | `E2BIG| `EACCES| `EADDRINUSE| `EADDRNOTAVAIL| `EAFNOSUPPORT| `EAGAIN| `EALREADY| `EBADF| `EBADMSG| `EBUSY| `ECANCELED| `ECHILD| `ECONNABORTED| `ECONNREFUSED| `ECONNRESET| `EDEADLK| `EDESTADDRREQ| `EDOM| `EDQUOT| `EEXIST| `EFAULT| `EFBIG| `EHOSTDOWN| `EHOSTUNREACH| `EIDRM| `EILSEQ| `EINPROGRESS| `EINTR| `EINVAL| `EIO| `EISCONN| `EISDIR| `ELOOP| `EMFILE| `EMLINK| `EMSGSIZE| `EMULTIHOP| `ENAMETOOLONG| `ENETDOWN| `ENETRESET| `ENETUNREACH| `ENFILE| `ENOBUFS| `ENODATA| `ENODEV| `ENOENT| `ENOEXEC| `ENOLCK| `ENOLINK| `ENOMEM| `ENOMSG| `ENOPROTOOPT| `ENOSPC| `ENOSR| `ENOSTR| `ENOSYS| `ENOTCONN| `ENOTDIR| `ENOTEMPTY| `ENOTRECOVERABLE| `ENOTSOCK| `ENOTSUP| `ENOTTY| `ENXIO| `EOPNOTSUPP| `EOVERFLOW| `EOWNERDEAD| `EPERM| `EPFNOSUPPORT| `EPIPE| `EPROTO| `EPROTONOSUPPORT| `EPROTOTYPE| `ERANGE| `EREMOTE| `EROFS| `ESHUTDOWN| `ESOCKTNOSUPPORT| `ESPIPE| `ESRCH| `ESTALE| `ETIME| `ETIMEDOUT| `ETOOMANYREFS| `ETXTBSY| `EUSERS| `EWOULDBLOCK| `EXDEV| `EBADE| `EBADFD| `EBADR| `EBADRQC| `EBADSLT| `ECHRNG| `ECOMM| `EDEADLOCK| `EHWPOISON| `EISNAM| `EKEYEXPIRED| `EKEYREJECTED| `EKEYREVOKED| `EL2HLT| `EL2NSYNC| `EL3HLT| `EL3RST| `ELIBACC| `ELIBBAD| `ELIBEXEC| `ELIBMAX| `ELIBSCN| `ELNRNG| `EMEDIUMTYPE| `ENOANO| `ENOKEY| `ENOMEDIUM| `ENONET| `ENOPKG| `ENOTBLK| `ENOTUNIQ| `EREMCHG| `EREMOTEIO| `ERESTART| `ERFKILL| `ESTRPIPE| `ETOOBIG| `EUCLEAN| `EUNATCH| `EXFULL| `EAUTH| `EBADRPC| `EFTYPE| `ENEEDAUTH| `ENOCSI| `EPROCLIM| `EPROCUNAVAIL| `EPROGMISMATCH| `EPROGUNAVAIL| `ERPCMISMATCH| `EATTR| `EBADARCH| `EBADEXEC| `EBADMACHO| `EDEVERR| `ENOATTR| `ENOPOLICY| `EPWROFF| `ESHLIBVERS| `EOTHER| `EUNKNOWN of int ]Comprehensive errno type covering Linux, BSD, macOS, and Windows values
val of_int : int -> tConvert errno code to variant
val to_int : t -> intConvert variant to errno code
val get_errno : unit -> tGet current errno value
Generic error-raising function.
raise_on_error ?call f check calls f() and checks the result with check. If check returns true, raises a Unix_error based on the current errno.
Check for negative integer return (common for syscalls). Raises Unix_error if result < 0.
Check for null pointer return (for C functions). Raises Unix_error if result is null.
Check for zero return value (some functions return 0 on error). Raises Unix_error if result = 0.
Check for None return value. Raise Unix_error if result = None.
val to_unix_error : t -> Unix.errorConvert errno variant to Unix.error
val strerror : t -> stringGet error message string for an errno value using strerror. This function is cross-platform (works on both POSIX and Windows) but not thread-safe.
val strerror_r : ?buflen:int -> t -> stringGet error message string for an errno value using strerror_r. This function is thread-safe but only available on POSIX systems.
val is_native : t -> boolCheck if an errno value is natively defined on this platform. Returns true if the errno is natively defined by the system, false if it's using a placeholder fallback value.
This is useful to determine if an errno constant represents a real system error on the current platform, or if it's just a placeholder value (typically in the 10000+ range) that was assigned because the error doesn't exist on this system.