Compare commits

...

2 Commits

Author SHA1 Message Date
a3362429d3 libc: Update strerror() 2022-10-12 12:01:18 +02:00
0d3e7d4463 libc: Document errno.h 2022-10-12 12:01:07 +02:00
2 changed files with 10 additions and 9 deletions

View File

@ -1,15 +1,16 @@
#ifndef _ERRNO_H #ifndef _ERRNO_H
#define _ERRNO_H #define _ERRNO_H
/* The last error encountered during a call to a library or system function. */
extern int errno; extern int errno;
#define EPERM 1 #define EPERM 1 // Operation not permitted
#define ENOENT 2 #define ENOENT 2 // No such file or directory
#define EBADF 9 #define EBADF 9 // Bad file descriptor
#define ENOMEM 12 #define ENOMEM 12 // Cannot allocate memory
#define EISDIR 21 #define EISDIR 21 // Is a directory
#define EINVAL 22 #define EINVAL 22 // Invalid argument
#define EMFILE 24 #define EMFILE 24 // Too many open files
#define ENOSYS 38 #define ENOSYS 38 // Function not implemented
#endif #endif

View File

@ -121,7 +121,7 @@ extern "C"
{ {
case EPERM: return "Operation not permitted"; case EPERM: return "Operation not permitted";
case EINVAL: return "Invalid argument"; case EINVAL: return "Invalid argument";
case ENOMEM: return "Out of memory"; case ENOMEM: return "Cannot allocate memory";
case ENOSYS: return "Function not implemented"; case ENOSYS: return "Function not implemented";
case ENOENT: return "No such file or directory"; case ENOENT: return "No such file or directory";
case EBADF: return "Bad file descriptor"; case EBADF: return "Bad file descriptor";