More errors #4

Closed
opened 2022-10-08 10:23:37 +00:00 by apio · 3 comments
Owner

Currently, errno can only have two values (EINVAL and ENOMEM), and only three are defined in errno.h (EINVAL, ENOMEM and EPERM). There should be more.

Currently, errno can only have two values (EINVAL and ENOMEM), and only three are defined in errno.h (EINVAL, ENOMEM and EPERM). There should be more.
apio added this to the (deleted) milestone 2022-10-08 10:23:37 +00:00
apio added the
enhancement
label 2022-10-08 10:23:37 +00:00
apio self-assigned this 2022-10-08 10:23:37 +00:00
Author
Owner

libs/libc/include/errno.h

#ifndef _ERRNO_H
#define _ERRNO_H

/* The last error encountered during a call to a library or system function. */
extern int errno;

#define EPERM 1   // Operation not permitted
#define ENOENT 2  // No such file or directory
#define ENOEXEC 8 // Exec format error
#define EBADF 9   // Bad file descriptor
#define ENOMEM 12 // Cannot allocate memory
#define EFAULT 14 // Bad address
#define EISDIR 21 // Is a directory
#define EINVAL 22 // Invalid argument
#define EMFILE 24 // Too many open files
#define ENOSYS 38 // Function not implemented

#endif

This can probably be closed now.

[libs/libc/include/errno.h](https://git.cloudapio.eu/apio/Luna/src/commit/50d52c9a6b362548984608cbd0e42a210257b0c7/libs/libc/include/errno.h) ``` #ifndef _ERRNO_H #define _ERRNO_H /* The last error encountered during a call to a library or system function. */ extern int errno; #define EPERM 1 // Operation not permitted #define ENOENT 2 // No such file or directory #define ENOEXEC 8 // Exec format error #define EBADF 9 // Bad file descriptor #define ENOMEM 12 // Cannot allocate memory #define EFAULT 14 // Bad address #define EISDIR 21 // Is a directory #define EINVAL 22 // Invalid argument #define EMFILE 24 // Too many open files #define ENOSYS 38 // Function not implemented #endif ``` This can probably be closed now.
apio closed this issue 2022-10-14 14:58:33 +00:00
Author
Owner

libs/libc/include/errno.h

#ifndef _ERRNO_H
#define _ERRNO_H

/* The last error encountered during a call to a library or system function. */
extern int errno;

#define EPERM 1         // Operation not permitted
#define ENOENT 2        // No such file or directory
#define ESRCH 3         // No such process
#define EINTR 4         // Interrupted system call. Not implemented.
#define EIO 5           // Input/output error. Not implemented.
#define ENXIO 6         // No such device or address. Not implemented.
#define E2BIG 7         // Argument list too long
#define ENOEXEC 8       // Exec format error
#define EBADF 9         // Bad file descriptor
#define ECHILD 10       // No child processes
#define EAGAIN 11       // Resource temporarily unavailable
#define EWOULDBLOCK 11  // Resource temporarily unavailable
#define ENOMEM 12       // Cannot allocate memory
#define EACCES 13       // Permission denied
#define EFAULT 14       // Bad address
#define EBUSY 16        // Device or resource busy. Not implemented.
#define EEXIST 17       // File exists
#define EXDEV 18        // Invalid cross-device link. Not implemented.
#define ENODEV 19       // No such device. Not implemented.
#define ENOTDIR 20      // Not a directory
#define EISDIR 21       // Is a directory
#define EINVAL 22       // Invalid argument
#define ENFILE 23       // Too many open files in system. Not implemented.
#define EMFILE 24       // Too many open files
#define ENOTTY 25       // Inappropriate ioctl for device
#define EFBIG 27        // File too large. Not implemented.
#define ENOSPC 28       // No space left on device
#define ESPIPE 29       // Illegal seek. Not implemented.
#define EROFS 30        // Read-only file system. Not implemented.
#define EMLINK 31       // Too many links. Not implemented.
#define EPIPE 32        // Broken pipe. Not implemented.
#define EDOM 33         // Numerical argument out of domain. Not implemented.
#define ERANGE 34       // Numerical result out of range
#define EDEADLK 35      // Resource deadlock avoided. Not implemented.
#define ENAMETOOLONG 36 // File name too long. Not implemented.
#define ENOLCK 37       // No locks available. Not implemented.
#define ENOSYS 38       // Function not implemented
#define ENOTEMPTY 39    // Directory not empty. Not implemented.
#define ELOOP 40        // Too many levels of symbolic links. Not implemented.
#define ENOMSG 42       // No message of desired type. Not implemented.
#define EOVERFLOW 75    // Value too large for defined data type. Not implemented.
#define EILSEQ 84       // Invalid or incomplete multibyte or wide character. Not implemented.
#define ENOTSOCK 88     // Socket operation on non-socket. Not implemented.
#define ENOTSUP 95      // Operation not supported
#define EOPNOTSUPP 95   // Operation not supported
#define EADDRINUSE 98   // Address already in use. Not implemented.
#define ENETRESET 102   // Network dropped connection on reset. Not implemented.
#define ECONNRESET 104  // Connection reset by peer. Not implemented.
#define EISCONN 106     // Transport endpoint is already connected. Not implemented.
#define ETIMEDOUT 110   // Connection timed out. Not implemented.
#define EALREADY 114    // Operation already in progress. Not implemented.

// FIXME: Right now I don't want to have to order and label these, since we have no net support anyways.
#define EADDRNOTAVAIL -1
#define EAFNOSUPPORT -2
#define ECONNABORTED -3
#define ECONNREFUSED -4
#define EDESTADDRREQ -5
#define EHOSTUNREACH -6
#define EINPROGRESS -7
#define EMSGSIZE -8
#define ENETDOWN -9
#define ENETRESET -10
#define ENETUNREACH -11
#define ENOBUFS -12
#define ENOMSG -13
#define ENOPROTOOPT -14
#define ENOTCONN -15
#define ENOTSOCK -16
#define EPROTONOSUPPORT -17
#define EPROTOTYPE -18

#ifdef _GNU_SOURCE // Give it only to programs that ask for it.
/* Name used to invoke calling program. Same value as argv[0] in main(), but can be used globally. */
extern char* program_invocation_name;
#endif

#endif

Just saying...

[libs/libc/include/errno.h](https://git.cloudapio.eu/apio/Luna/src/commit/37fe95b128b1d12a19811620d4dd5f11f2f90894/libs/libc/include/errno.h) ``` #ifndef _ERRNO_H #define _ERRNO_H /* The last error encountered during a call to a library or system function. */ extern int errno; #define EPERM 1 // Operation not permitted #define ENOENT 2 // No such file or directory #define ESRCH 3 // No such process #define EINTR 4 // Interrupted system call. Not implemented. #define EIO 5 // Input/output error. Not implemented. #define ENXIO 6 // No such device or address. Not implemented. #define E2BIG 7 // Argument list too long #define ENOEXEC 8 // Exec format error #define EBADF 9 // Bad file descriptor #define ECHILD 10 // No child processes #define EAGAIN 11 // Resource temporarily unavailable #define EWOULDBLOCK 11 // Resource temporarily unavailable #define ENOMEM 12 // Cannot allocate memory #define EACCES 13 // Permission denied #define EFAULT 14 // Bad address #define EBUSY 16 // Device or resource busy. Not implemented. #define EEXIST 17 // File exists #define EXDEV 18 // Invalid cross-device link. Not implemented. #define ENODEV 19 // No such device. Not implemented. #define ENOTDIR 20 // Not a directory #define EISDIR 21 // Is a directory #define EINVAL 22 // Invalid argument #define ENFILE 23 // Too many open files in system. Not implemented. #define EMFILE 24 // Too many open files #define ENOTTY 25 // Inappropriate ioctl for device #define EFBIG 27 // File too large. Not implemented. #define ENOSPC 28 // No space left on device #define ESPIPE 29 // Illegal seek. Not implemented. #define EROFS 30 // Read-only file system. Not implemented. #define EMLINK 31 // Too many links. Not implemented. #define EPIPE 32 // Broken pipe. Not implemented. #define EDOM 33 // Numerical argument out of domain. Not implemented. #define ERANGE 34 // Numerical result out of range #define EDEADLK 35 // Resource deadlock avoided. Not implemented. #define ENAMETOOLONG 36 // File name too long. Not implemented. #define ENOLCK 37 // No locks available. Not implemented. #define ENOSYS 38 // Function not implemented #define ENOTEMPTY 39 // Directory not empty. Not implemented. #define ELOOP 40 // Too many levels of symbolic links. Not implemented. #define ENOMSG 42 // No message of desired type. Not implemented. #define EOVERFLOW 75 // Value too large for defined data type. Not implemented. #define EILSEQ 84 // Invalid or incomplete multibyte or wide character. Not implemented. #define ENOTSOCK 88 // Socket operation on non-socket. Not implemented. #define ENOTSUP 95 // Operation not supported #define EOPNOTSUPP 95 // Operation not supported #define EADDRINUSE 98 // Address already in use. Not implemented. #define ENETRESET 102 // Network dropped connection on reset. Not implemented. #define ECONNRESET 104 // Connection reset by peer. Not implemented. #define EISCONN 106 // Transport endpoint is already connected. Not implemented. #define ETIMEDOUT 110 // Connection timed out. Not implemented. #define EALREADY 114 // Operation already in progress. Not implemented. // FIXME: Right now I don't want to have to order and label these, since we have no net support anyways. #define EADDRNOTAVAIL -1 #define EAFNOSUPPORT -2 #define ECONNABORTED -3 #define ECONNREFUSED -4 #define EDESTADDRREQ -5 #define EHOSTUNREACH -6 #define EINPROGRESS -7 #define EMSGSIZE -8 #define ENETDOWN -9 #define ENETRESET -10 #define ENETUNREACH -11 #define ENOBUFS -12 #define ENOMSG -13 #define ENOPROTOOPT -14 #define ENOTCONN -15 #define ENOTSOCK -16 #define EPROTONOSUPPORT -17 #define EPROTOTYPE -18 #ifdef _GNU_SOURCE // Give it only to programs that ask for it. /* Name used to invoke calling program. Same value as argv[0] in main(), but can be used globally. */ extern char* program_invocation_name; #endif #endif ``` Just saying...
Author
Owner

libluna/include/luna/SystemError.h

#pragma once

#define EPERM 1         // Operation not permitted
#define ENOENT 2        // No such file or directory
#define ESRCH 3         // No such process
#define EINTR 4         // Interrupted system call
#define EIO 5           // Input/output error
#define ENXIO 6         // No such device or address
#define E2BIG 7         // Argument list too long
#define ENOEXEC 8       // Exec format error
#define EBADF 9         // Bad file descriptor
#define ECHILD 10       // No child processes
#define EAGAIN 11       // Resource temporarily unavailable
#define EWOULDBLOCK 11  // Resource temporarily unavailable
#define ENOMEM 12       // Cannot allocate memory
#define EACCES 13       // Permission denied
#define EFAULT 14       // Bad address
#define ENOTBLK 15      // Block device required
#define EBUSY 16        // Device or resource busy
#define EEXIST 17       // File exists
#define EXDEV 18        // Invalid cross-device link
#define ENODEV 19       // No such device
#define ENOTDIR 20      // Not a directory
#define EISDIR 21       // Is a directory
#define EINVAL 22       // Invalid argument
#define ENFILE 23       // Too many open files in system
#define EMFILE 24       // Too many open files
#define ENOTTY 25       // Inappropriate ioctl for device
#define ETXTBSY 26      // Text file busy
#define EFBIG 27        // File too large
#define ENOSPC 28       // No space left on device
#define ESPIPE 29       // Illegal seek
#define EROFS 30        // Read-only file system
#define EMLINK 31       // Too many links
#define EPIPE 32        // Broken pipe
#define EDOM 33         // Numerical argument out of domain
#define ERANGE 34       // Numerical result out of range
#define EDEADLK 35      // Resource deadlock avoided
#define ENAMETOOLONG 36 // File name too long
#define ENOLCK 37       // No locks available
#define ENOSYS 38       // Function not implemented
#define ENOTEMPTY 39    // Directory not empty
#define ELOOP 40        // Too many levels of symbolic links
#define ENOMSG 42       // No message of desired type
#define EOVERFLOW 75    // Value too large for defined data type
#define EILSEQ 84       // Invalid or incomplete multibyte or wide character
#define ENOTSOCK 88     // Socket operation on non-socket
#define ENOTSUP 95      // Operation not supported
#define EOPNOTSUPP 95   // Operation not supported
#define EADDRINUSE 98   // Address already in use
#define ENETRESET 102   // Network dropped connection on reset
#define ECONNRESET 104  // Connection reset by peer
#define EISCONN 106     // Transport endpoint is already connected
#define ETIMEDOUT 110   // Connection timed out
#define EALREADY 114    // Operation already in progress

#if defined(IN_MOON) || defined(USE_FREESTANDING) || defined(_LUNA_SYSTEM_ERROR_EXTENSIONS) || defined(_LUNA_SOURCE)
// This one is Luna-specific.
#define EFIXME 342 // Functionality not yet implemented

#ifndef _LUNA_SOURCE
const char* error_string(int error);
const char* error_name(int error);
#endif

#endif
[libluna/include/luna/SystemError.h](https://git.cloudapio.eu/apio/Luna/src/commit/e6c4ceb18fbd6ae1d3181b90d384882683b16da4/libluna/include/luna/SystemError.h) ``` #pragma once #define EPERM 1 // Operation not permitted #define ENOENT 2 // No such file or directory #define ESRCH 3 // No such process #define EINTR 4 // Interrupted system call #define EIO 5 // Input/output error #define ENXIO 6 // No such device or address #define E2BIG 7 // Argument list too long #define ENOEXEC 8 // Exec format error #define EBADF 9 // Bad file descriptor #define ECHILD 10 // No child processes #define EAGAIN 11 // Resource temporarily unavailable #define EWOULDBLOCK 11 // Resource temporarily unavailable #define ENOMEM 12 // Cannot allocate memory #define EACCES 13 // Permission denied #define EFAULT 14 // Bad address #define ENOTBLK 15 // Block device required #define EBUSY 16 // Device or resource busy #define EEXIST 17 // File exists #define EXDEV 18 // Invalid cross-device link #define ENODEV 19 // No such device #define ENOTDIR 20 // Not a directory #define EISDIR 21 // Is a directory #define EINVAL 22 // Invalid argument #define ENFILE 23 // Too many open files in system #define EMFILE 24 // Too many open files #define ENOTTY 25 // Inappropriate ioctl for device #define ETXTBSY 26 // Text file busy #define EFBIG 27 // File too large #define ENOSPC 28 // No space left on device #define ESPIPE 29 // Illegal seek #define EROFS 30 // Read-only file system #define EMLINK 31 // Too many links #define EPIPE 32 // Broken pipe #define EDOM 33 // Numerical argument out of domain #define ERANGE 34 // Numerical result out of range #define EDEADLK 35 // Resource deadlock avoided #define ENAMETOOLONG 36 // File name too long #define ENOLCK 37 // No locks available #define ENOSYS 38 // Function not implemented #define ENOTEMPTY 39 // Directory not empty #define ELOOP 40 // Too many levels of symbolic links #define ENOMSG 42 // No message of desired type #define EOVERFLOW 75 // Value too large for defined data type #define EILSEQ 84 // Invalid or incomplete multibyte or wide character #define ENOTSOCK 88 // Socket operation on non-socket #define ENOTSUP 95 // Operation not supported #define EOPNOTSUPP 95 // Operation not supported #define EADDRINUSE 98 // Address already in use #define ENETRESET 102 // Network dropped connection on reset #define ECONNRESET 104 // Connection reset by peer #define EISCONN 106 // Transport endpoint is already connected #define ETIMEDOUT 110 // Connection timed out #define EALREADY 114 // Operation already in progress #if defined(IN_MOON) || defined(USE_FREESTANDING) || defined(_LUNA_SYSTEM_ERROR_EXTENSIONS) || defined(_LUNA_SOURCE) // This one is Luna-specific. #define EFIXME 342 // Functionality not yet implemented #ifndef _LUNA_SOURCE const char* error_string(int error); const char* error_name(int error); #endif #endif ```
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: apio/Luna#4
No description provided.