Skip to content

Commit

Permalink
chore: improvement errno
Browse files Browse the repository at this point in the history
Signed-off-by: slowy07 <[email protected]>
  • Loading branch information
slowy07 committed May 17, 2024
1 parent 43eefcc commit 97bc481
Show file tree
Hide file tree
Showing 2 changed files with 158 additions and 28 deletions.
158 changes: 158 additions & 0 deletions std/sys/errno.jn
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
// Copyright (c) 2024 arfy slowy - DeRuneLabs
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BELIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

// error number
pub type errno: int

cpp let errno: errno

pub const EPERM = errno(1) // Operation not permitted
pub const ENOENT = errno(2) // No such file or directory
pub const ESRCH = errno(3) // No such process
pub const EINTR = errno(4) // Interrupted system call
pub const EIO = errno(5) // I/O error
pub const ENXIO = errno(6) // No such device or address
pub const E2BIG = errno(7) // Argument list too long
pub const ENOEXEC = errno(8) // Exec format error
pub const EBADF = errno(9) // Bad file number
pub const ECHILD = errno(10) // No child processes
pub const EAGAIN = errno(11) // Try again
pub const ENOMEM = errno(12) // Out of memory
pub const EACCESS = errno(13) // Permission denied
pub const EFAULT = errno(14) // Bad address
pub const ENOTBLK = errno(15) // Block device required
pub const EBUSY = errno(16) // Device or resource busy
pub const EEXIST = errno(17) // File exists
pub const EXDEV = errno(18) // Cross-device link
pub const ENODEV = errno(19) // No such device
pub const ENOTDIR = errno(20) // Not a directory
pub const EISDIR = errno(21) // Is a directory
pub const EINVAL = errno(22) // Invalid argument
pub const ENFILE = errno(23) // File table overflow
pub const EMFILE = errno(24) // Too many open files
pub const ENOTTY = errno(25) // Not a typewriter
pub const ETXTBSY = errno(26) // Text file busy
pub const EFBIG = errno(27) // File too large
pub const ENOSPC = errno(28) // No space left on device
pub const ESPIPE = errno(29) // Illegal seek
pub const EROFS = errno(30) // Read-only file system
pub const EEMLINK = errno(31) // Too many links
pub const EPIPE = errno(32) // Broken pipe
pub const EDOM = errno(33) // Math argument out of domain of func
pub const ERANGE = errno(34) // Math result not representable
pub const EDEADLK = errno(35) // Resource deadlock would occur
pub const ENAMETOOLONG = errno(36) // File name too long
pub const ENOLCK = errno(37) // No record locks available
pub const ENOSYS = errno(38) // Function not implemented
pub const ENOTEMPTY = errno(39) // Directory not empty
pub const ELOOP = errno(40) // Too many symbolic links encountered
pub const ENOMSG = errno(42) // No message of desired type
pub const EIDRM = errno(43) // Identifier removed
pub const ECHRNG = errno(44) // Channel number out of range
pub const EL2NSYNC = errno(45) // Level 2 not synchronized
pub const EL3HTL = errno(46) // Level 3 halted
pub const EL3RST = errno(47) // Level 3 reset
pub const ELNRNG = errno(48) // Link number out of range
pub const EUNATCH = errno(49) // Protocol driver not attached
pub const ENOCSI = errno(50) // No CSI structure available
pub const EL2HLT = errno(51) // Level 2 halted
pub const EBADE = errno(52) // Invalid exchange
pub const EBADR = errno(53) // Invalid request descriptor
pub const EXFULL = errno(54) // Exchange full
pub const ENOANO = errno(55) // No anode
pub const EBADRQC = errno(56) // Invalid request code
pub const EBADSLT = errno(57) // Invalid slot
pub const EBFONT = errno(59) // Bad font file format
pub const ENOSTR = errno(60) // Device not a stream
pub const ENODATA = errno(61) // No data available
pub const ETIME = errno(62) // Timer expired
pub const ENOSR = errno(63) // Out of streams resources
pub const ENONET = errno(64) // Machine is not on the network
pub const ENOPKG = errno(65) // Package not installed
pub const EREMOTE = errno(66) // Object is remote
pub const ENOLINK = errno(67) // Link has been severed
pub const EADV = errno(68) // Advertise error
pub const ESRMNT = errno(69) // Srmount error
pub const ECOMM = errno(70) // Communication error on send
pub const EPROTO = errno(71) // Protocol error
pub const EMULTIHOP = errno(72) // Multihop attempted
pub const EDOTDOT = errno(73) // RFS specific error
pub const EBADMSG = errno(74) // Not a data message
pub const EOVERFLOW = errno(75) // Value too large for defined data type
pub const ENOTUNIQ = errno(76) // Name not unique on network
pub const EBADFD = errno(77) // File descriptor in bad state
pub const EREMCHG = errno(78) // Remote address changed
pub const ELIBACC = errno(79) // Can not access a needed shared library
pub const ELIBBAD = errno(80) // Accessing a corrupted shared library
pub const ELIBSCN = errno(81) // .lib section in a.out corrupted
pub const ELIBMAX = errno(82) // Attempting to link in too many shared libraries
pub const ELIBEXEC = errno(83) // Cannot exec a shared library directly
pub const EILSEQ = errno(84) // Illegal byte sequence
pub const ERESTART = errno(85) // Interrupted system call should be restarted
pub const ESTRPIPE = errno(86) // Streams pipe error
pub const EUSERS = errno(87) // Too many users
pub const ENOTSOCK = errno(88) // Socket operation on non-socket
pub const EDESTADDRREQ = errno(89) // Destination address required
pub const EMSGSIZE = errno(90) // Message too long
pub const EPROTOTYPE = errno(91) // Protocol wrong type for socket
pub const ENOPROTOOPT = errno(92) // Protocol not available
pub const EPROTONOSUPPORT = errno(93) // Protocol not supported
pub const ESOCKTNOSUPPORT = errno(94) // Socket type not supported
pub const EOPNOTSUPP = errno(95) // Operation not supported on transport endpoint
pub const EPFNOSUPPORT = errno(96) // Protocol family not supported
pub const EAFNOSUPPORT = errno(97) // Address family not supported by protocol
pub const EADDRINUSE = errno(98) // Address already in use
pub const EADDRNOTAVAIL = errno(99) // Cannot assign requested address
pub const ENETDOWN = errno(100) // Network is down
pub const ENETUNREACH = errno(101) // Network is unreachable
pub const ENETRESET = errno(102) // Network dropped connection because of reset
pub const ECONNABORTED = errno(103) // Software caused connection abort
pub const ECONNRESET = errno(104) // Connection reset by peer
pub const ENOBUFS = errno(105) // No buffer space available
pub const EISCONN = errno(106) // Transport endpoint is already connected
pub const ENOTCONN = errno(107) // Transport endpoint is not connected
pub const ESHUTDOWN = errno(108) // Cannot send after transport endpoint shutdown
pub const ETOOMANYREFS = errno(109) // Too many references: cannot splice
pub const ETIMEDOUT = errno(110) // Connection timed out
pub const ECONNREFUSED = errno(111) // Connection refused
pub const EHOSTDOWN = errno(112) // Host is down
pub const EHOSTUNREACH = errno(113) // No route to host
pub const EALREADY = errno(114) // Operation already in progress
pub const EINPROGRESS = errno(115) // Operation now in progress
pub const ESTALE = errno(116) // Stale NFS file handle
pub const EUCLEAN = errno(117) // Structure needs cleaning
pub const ENOTNAM = errno(118) // Not a XENIX named type file
pub const ENAVAIL = errno(119) // No XENIX semaphores available
pub const EISNAM = errno(120) // Is a named type file
pub const EREMOTEIO = errno(121) // Remote I/O error
pub const EDQUOT = errno(122) // Quota exceeded
pub const ENOMEDIUM = errno(123) // No medium found
pub const EMEDIUMTYPE = errno(124) // Wrong medium type
pub const ECANCELED = errno(125) // Operation Canceled
pub const ENOKEY = errno(126) // Required key not available
pub const EKEYEXPIRED = errno(127) // Key has expired
pub const EKEYREVOKED = errno(128) // Key has been revoked
pub const EKEYREJECTED = errno(129) // Key was rejected by service
pub const EOWNERDEAD = errno(130) // Owner died
pub const ENOTRECOVERABLE = errno(131) // State not recoverable

pub fn get_last_errno(): errno {
ret cpp.errno
}
28 changes: 0 additions & 28 deletions std/sys/errors.jn

This file was deleted.

0 comments on commit 97bc481

Please sign in to comment.