Below is a partial list of more common Linux and Windows operating system error codes.
The perror tool can be used to find the error message which is associated with a given error code.
Number | Error Code | Description |
---|---|---|
1 | EPERM | Operation not permitted |
2 | ENOENT | No such file or directory |
3 | ESRCH | No such process |
4 | EINTR | Interrupted system call |
5 | EIO | I/O error |
6 | ENXIO | No such device or address |
7 | E2BIG | Argument list too long |
8 | ENOEXEC | Exec format error |
9 | EBADF | Bad file number |
10 | ECHILD | No child processes |
11 | EAGAIN | Try again |
12 | ENOMEM | Out of memory |
13 | EACCES | Permission denied |
14 | EFAULT | Bad address |
15 | ENOTBLK | Block device required |
16 | EBUSY | Device or resource busy |
17 | EEXIST | File exists |
18 | EXDEV | Cross-device link |
19 | ENODEV | No such device |
20 | ENOTDIR | Not a directory |
21 | EISDIR | Is a directory |
22 | EINVAL | Invalid argument |
23 | ENFILE | File table overflow |
24 | EMFILE | Too many open files |
25 | ENOTTY | Not a typewriter |
26 | ETXTBSY | Text file busy |
27 | EFBIG | File too large |
28 | ENOSPC | No space left on device |
29 | ESPIPE | Illegal seek |
30 | EROFS | Read-only file system |
31 | EMLINK | Too many links |
32 | EPIPE | Broken pipe |
33 | EDOM | Math argument out of domain of func |
34 | ERANGE | Math result not representable |
35 | EDEADLK | Resource deadlock would occur |
36 | ENAMETOOLONG | File name too long |
37 | ENOLCK | No record locks available |
38 | ENOSYS | Function not implemented |
39 | ENOTEMPTY | Directory not empty |
40 | ELOOP | Too many symbolic links encountered |
42 | ENOMSG | No message of desired type |
43 | EIDRM | Identifier removed |
44 | ECHRNG | Channel number out of range |
45 | EL2NSYNC | Level 2 not synchronized |
46 | EL3HLT | Level 3 halted |
47 | EL3RST | Level 3 reset |
48 | ELNRNG | Link number out of range |
49 | EUNATCH | Protocol driver not attached |
50 | ENOCSI | No CSI structure available |
51 | EL2HLT | Level 2 halted |
52 | EBADE | Invalid exchange |
53 | EBADR | Invalid request descriptor |
54 | EXFULL | Exchange full |
55 | ENOANO | No anode |
56 | EBADRQC | Invalid request code |
57 | EBADSLT | Invalid slot |
59 | EBFONT | Bad font file format |
60 | ENOSTR | Device not a stream |
61 | ENODATA | No data available |
62 | ETIME | Timer expired |
63 | ENOSR | Out of streams resources |
64 | ENONET | Machine is not on the network |
65 | ENOPKG | Package not installed |
66 | EREMOTE | Object is remote |
67 | ENOLINK | Link has been severed |
68 | EADV | Advertise error |
69 | ESRMNT | Srmount error |
70 | ECOMM | Communication error on send |
71 | EPROTO | Protocol error |
72 | EMULTIHOP | Multihop attempted |
73 | EDOTDOT | RFS specific error |
74 | EBADMSG | Not a data message |
75 | EOVERFLOW | Value too large for defined data type |
76 | ENOTUNIQ | Name not unique on network |
77 | EBADFD | File descriptor in bad state |
78 | EREMCHG | Remote address changed |
79 | ELIBACC | Can not access a needed shared library |
80 | ELIBBAD | Accessing a corrupted shared library |
81 | ELIBSCN | .lib section in a.out corrupted |
82 | ELIBMAX | Attempting to link in too many shared libraries |
83 | ELIBEXEC | Cannot exec a shared library directly |
84 | EILSEQ | Illegal byte sequence |
85 | ERESTART | Interrupted system call should be restarted |
86 | ESTRPIPE | Streams pipe error |
87 | EUSERS | Too many users |
88 | ENOTSOCK | Socket operation on non-socket |
89 | EDESTADDRREQ | Destination address required |
90 | EMSGSIZE | Message too long |
91 | EPROTOTYPE | Protocol wrong type for socket |
92 | ENOPROTOOPT | Protocol not available |
93 | EPROTONOSUPPORT | Protocol not supported |
94 | ESOCKTNOSUPPORT | Socket type not supported |
95 | EOPNOTSUPP | Operation not supported on transport endpoint |
96 | EPFNOSUPPORT | Protocol family not supported |
97 | EAFNOSUPPORT | Address family not supported by protocol |
98 | EADDRINUSE | Address already in use |
99 | EADDRNOTAVAIL | Cannot assign requested address |
100 | ENETDOWN | Network is down |
101 | ENETUNREACH | Network is unreachable |
102 | ENETRESET | Network dropped connection because of reset |
103 | ECONNABORTED | Software caused connection abort |
104 | ECONNRESET | Connection reset by peer |
105 | ENOBUFS | No buffer space available |
106 | EISCONN | Transport endpoint is already connected |
107 | ENOTCONN | Transport endpoint is not connected |
108 | ESHUTDOWN | Cannot send after transport endpoint shutdown |
109 | ETOOMANYREFS | Too many references: cannot splice |
110 | ETIMEDOUT | Connection timed out |
111 | ECONNREFUSED | Connection refused |
112 | EHOSTDOWN | Host is down |
113 | EHOSTUNREACH | No route to host |
114 | EALREADY | Operation already in progress |
115 | EINPROGRESS | Operation now in progress |
116 | ESTALE | Stale NFS file handle |
117 | EUCLEAN | Structure needs cleaning |
118 | ENOTNAM | Not a XENIX named type file |
119 | ENAVAIL | No XENIX semaphores available |
120 | EISNAM | Is a named type file |
121 | EREMOTEIO | Remote I/O error |
122 | EDQUOT | Quota exceeded |
123 | ENOMEDIUM | No medium found |
124 | EMEDIUMTYPE | Wrong medium type |
125 | ECANCELED | Operation Canceled |
126 | ENOKEY | Required key not available |
127 | EKEYEXPIRED | Key has expired |
128 | EKEYREVOKED | Key has been revoked |
129 | EKEYREJECTED | Key was rejected by service |
130 | EOWNERDEAD | Owner died |
131 | ENOTRECOVERABLE | State not recoverable |
Number | Error Code | Description |
---|---|---|
1 | ERROR_INVALID_FUNCTION | Incorrect function. |
2 | ERROR_FILE_NOT_FOUND | The system cannot find the file specified. |
3 | ERROR_PATH_NOT_FOUND | The system cannot find the path specified. |
4 | ERROR_TOO_MANY_OPEN_FILES | The system cannot open the file. |
5 | ERROR_ACCESS_DENIED | Access is denied. |
6 | ERROR_INVALID_HANDLE | The handle is invalid. |
7 | ERROR_ARENA_TRASHED | The storage control blocks were destroyed. |
8 | ERROR_NOT_ENOUGH_MEMORY | Not enough storage is available to process this command. |
9 | ERROR_INVALID_BLOCK | The storage control block address is invalid. |
10 | ERROR_BAD_ENVIRONMENT | The environment is incorrect. |
11 | ERROR_BAD_FORMAT | An attempt was made to load a program with an incorrect format. |
12 | ERROR_INVALID_ACCESS | The access code is invalid. |
13 | ERROR_INVALID_DATA | The data is invalid. |
14 | ERROR_OUTOFMEMORY | Not enough storage is available to complete this operation. |
15 | ERROR_INVALID_DRIVE | The system cannot find the drive specified. |
16 | ERROR_CURRENT_DIRECTORY | The directory cannot be removed. |
17 | ERROR_NOT_SAME_DEVICE | The system cannot move the file to a different disk drive. |
18 | ERROR_NO_MORE_FILES | There are no more files. |
19 | ERROR_WRITE_PROTECT | The media is write protected. |
20 | ERROR_BAD_UNIT | The system cannot find the device specified. |
21 | ERROR_NOT_READY | The device is not ready. |
22 | ERROR_BAD_COMMAND | The device does not recognize the command. |
23 | ERROR_CRC | Data error (cyclic redundancy check). |
24 | ERROR_BAD_LENGTH | The program issued a command but the command length is incorrect. |
25 | ERROR_SEEK | The drive cannot locate a specific area or track on the disk. |
26 | ERROR_NOT_DOS_DISK | The specified disk or diskette cannot be accessed. |
27 | ERROR_SECTOR_NOT_FOUND | The drive cannot find the sector requested. |
28 | ERROR_OUT_OF_PAPER | The printer is out of paper. |
29 | ERROR_WRITE_FAULT | The system cannot write to the specified device. |
30 | ERROR_READ_FAULT | The system cannot read from the specified device. |
31 | ERROR_GEN_FAILURE | A device attached to the system is not functioning. |
32 | ERROR_SHARING_VIOLATION | The process cannot access the file because it is being used by another process. |
33 | ERROR_LOCK_VIOLATION | The process cannot access the file because another process has locked a portion of the file. |
34 | ERROR_WRONG_DISK | The wrong diskette is in the drive. Insert %2 (Volume Serial Number: %3) into drive %1. |
36 | ERROR_SHARING_BUFFER_EXCEEDED | Too many files opened for sharing. |
38 | ERROR_HANDLE_EOF | Reached the end of the file. |
39 | ERROR_HANDLE_DISK_FULL | The disk is full. |
87 | ERROR_INVALID_PARAMETER | The parameter is incorrect. |
112 | ERROR_DISK_FULL | The disk is full. |
123 | ERROR_INVALID_NAME | The file name, directory name, or volume label syntax is incorrect. |
1450 | ERROR_NO_SYSTEM_RESOURCES | Insufficient system resources exist to complete the requested service. |
Содержание
- Коды системных ошибок OS LINUX
- ВСЕ КОДЫ ОШИБОК ОПЕРАЦИОННОЙ СИСТЕМЫ LINUX
- ВТОРИЧНЫЙ ФАЙЛ ОТВЕТОВ КОДЫ ОШИБОК ПРИ УСТАНОВКЕ — КОД ОШИБКИ ЗНАЧЕНИЕ — ОПИСАНИЕ
- 131 Linux Error Codes for C Programming Language using errno
- System error codes linux
Коды системных ошибок OS LINUX
ВСЕ КОДЫ ОШИБОК ОПЕРАЦИОННОЙ СИСТЕМЫ LINUX
EPERM 1 / * Операция не допускается * /
ENOENT 2 / * Нет такого файла или каталога * /
ESRCH 3 / * Нет такого процесса * /
EINTR 4 / * * Прерванный системный вызов /
EIO 5 / * I / O * ошибка /
ENXIO 6 / * Нет такого устройства или адреса * /
E2BIG 7 / * список аргументов слишком долго * /
ENOEXEC 8 / * Exec формате ошибки * /
EBADF 9 / * Плохо * номер файла /
ECHILD 10 / * Ни один ребенок процессов * /
EAGAIN 11 / * Попробуйте еще раз * /
ENOMEM 12 / * Из памяти * /
EACCES 13 / * Доступ запрещен * /
EFAULT 14 / * Плохой адрес * /
ENOTBLK 15 / * Блок устройства требуется * /
EBUSY 16 / * Устройство или ресурс занято * /
EEXIST 17 / * Файл существует * /
EXDEV 18 / * кросс-устройства ссылка * /
ENODEV 19 / * Нет такого устройства * /
ENOTDIR 20 / * Не каталога * /
EISDIR 21 / * Есть каталог * /
EINVAL 22 / * Неправильный аргумент * /
ENFILE 23 / * файл * Переполнение таблицы /
EMFILE 24 / * Слишком много открытых файлов * /
ENOTTY 25 / * Не пишущую машинку * /
ETXTBSY 26 / * Текстовый файл занят * /
EFBIG 27 / * Файл слишком большой * /
ENOSPC 28 / * Нет места на устройстве * /
ESPIPE 29 / * Незаконное искать * /
EROFS 30 / * только для чтения * файловой системы /
EMLINK 31 / * Слишком много ссылок * /
EPIPE 32 / * * Broken трубы /
EDOM 33 / * мат аргумента из области функции * /
ERANGE 34 / * мат результат не представляется * /
Код ошибки значение Описание
0 Действие завершено успешно.
1 Действие возвращается предупреждения.
67 Произошла фатальная ошибка во время установки.
ВТОРИЧНЫЙ ФАЙЛ ОТВЕТОВ КОДЫ ОШИБОК ПРИ УСТАНОВКЕ — КОД ОШИБКИ ЗНАЧЕНИЕ — ОПИСАНИЕ
3 Путь не был найден.
5 Отказано в доступе.
10 Среду произошла ошибка.
13 Недопустимые данные.
16 Создание DAS не удалось.
17 Создания экземпляра не удалось.
18 Создание базы данных не удалось.
19 Исправить изображение пакет находится на более низком уровне, чем установленного продукта.
20 Исправить изображение пакет на том же уровне, как установленного продукта. Существует ничего, чтобы обновить.
21 Есть не DB2 (R) продуктов, установленных на выбранное место. Существует ничего, чтобы обновить.
22 Для обновления уже установлен продукт DB2, используйте installFixPack команду вместо команды db2setup.
87 Один из параметров является ошибочным.
66 Установка была отменена пользователем.
74 Данные конфигурации повреждены. Обратитесь в службу поддержки.
76 Установочными файлами для этого продукта недоступен. Убедитесь, что источник существует и доступен.
82 Другая установка уже идет. Полное, что установка, прежде чем приступить к этой установки.
86 Существовал ошибка при открытии файла журнала установки. Убедитесь, что указанное место файла журнала и, что она доступна для записи.
96 Папка Temp переполнена или недоступны. Убедитесь, что папка Temp существует и что вы можете писать на нем.
97 Этот установочный пакет не поддерживается на этой платформе.
102 Другая версия этого продукта уже установлена. Установка этой версии не может продолжаться.
103 Неверный аргумент командной строки.
143 Система не имеет достаточно свободного места, чтобы продолжить установку.
Источник
131 Linux Error Codes for C Programming Language using errno
Programmers should handle all kinds of errors to protect the program from failure.
In C programming language, there is no direct support for error handling. You have to detect the failure and handle the error. In C programming language, return values represents success or failure. Inside a C program, when a function fails, you should handle the errors accordingly, or at least record the errors in a log file.
When you are running some program on Linux environment, you might notice that it gives some error number. For example, “Error no is : 17”, which doesn’t really say much. You really need to know what error number 17 means.
This article shows all available error numbers along with it descriptions. This article might be a handy reference for you, when you encounter an error number and you would like to know what it means.
- In C programming language, there is an external variable called “errno”.
- From this errno variable you can use some error handling functions to find out the error description and handle it appropriately.
- You have to include errno.h header file to use external variable errno.
- perror function prints error description in standard error.
- The strerror function returns a string describing the error code passed in the argument errnum.
The following C code snippet tries to open a file through open system call. There are two flags in the open call. O_CREAT flag is to create a file, if the file does not exist. O_EXCL flag is used with O_CREAT, if the file is already exist open call will fail with the proper error number.
At first execution, open got executed successfully, and it created the file since the file was not available. In next execution, it throws an error number 17, which is “File already exist”.
The following table shows list of error numbers and its descriptions in Linux operation system
ERROR CODE TABLE | ||
---|---|---|
Error number | Error Code | Error Description |
1 | EPERM | Operation not permitted |
2 | ENOENT | No such file or directory |
3 | ESRCH | No such process |
4 | EINTR | Interrupted system call |
5 | EIO | I/O error |
6 | ENXIO | No such device or address |
7 | E2BIG | Argument list too long |
8 | ENOEXEC | Exec format error |
9 | EBADF | Bad file number |
10 | ECHILD | No child processes |
11 | EAGAIN | Try again |
12 | ENOMEM | Out of memory |
13 | EACCES | Permission denied |
14 | EFAULT | Bad address |
15 | ENOTBLK | Block device required |
16 | EBUSY | Device or resource busy |
17 | EEXIST | File exists |
18 | EXDEV | Cross-device link |
19 | ENODEV | No such device |
20 | ENOTDIR | Not a directory |
21 | EISDIR | Is a directory |
22 | EINVAL | Invalid argument |
23 | ENFILE | File table overflow |
24 | EMFILE | Too many open files |
25 | ENOTTY | Not a typewriter |
26 | ETXTBSY | Text file busy |
27 | EFBIG | File too large |
28 | ENOSPC | No space left on device |
29 | ESPIPE | Illegal seek |
30 | EROFS | Read-only file system |
31 | EMLINK | Too many links |
32 | EPIPE | Broken pipe |
33 | EDOM | Math argument out of domain of func |
34 | ERANGE | Math result not representable |
35 | EDEADLK | Resource deadlock would occur |
36 | ENAMETOOLONG | File name too long |
37 | ENOLCK | No record locks available |
38 | ENOSYS | Function not implemented |
39 | ENOTEMPTY | Directory not empty |
40 | ELOOP | Too many symbolic links encountered |
42 | ENOMSG | No message of desired type |
43 | EIDRM | Identifier removed |
44 | ECHRNG | Channel number out of range |
45 | EL2NSYNC | Level 2 not synchronized |
46 | EL3HLT | Level 3 halted |
47 | EL3RST | Level 3 reset |
48 | ELNRNG | Link number out of range |
49 | EUNATCH | Protocol driver not attached |
50 | ENOCSI | No CSI structure available |
51 | EL2HLT | Level 2 halted |
52 | EBADE | Invalid exchange |
53 | EBADR | Invalid request descriptor |
54 | EXFULL | Exchange full |
55 | ENOANO | No anode |
56 | EBADRQC | Invalid request code |
57 | EBADSLT | Invalid slot |
59 | EBFONT | Bad font file format |
60 | ENOSTR | Device not a stream |
61 | ENODATA | No data available |
62 | ETIME | Timer expired |
63 | ENOSR | Out of streams resources |
64 | ENONET | Machine is not on the network |
65 | ENOPKG | Package not installed |
66 | EREMOTE | Object is remote |
67 | ENOLINK | Link has been severed |
68 | EADV | Advertise error |
69 | ESRMNT | Srmount error |
70 | ECOMM | Communication error on send |
71 | EPROTO | Protocol error |
72 | EMULTIHOP | Multihop attempted |
73 | EDOTDOT | RFS specific error |
74 | EBADMSG | Not a data message |
75 | EOVERFLOW | Value too large for defined data type |
76 | ENOTUNIQ | Name not unique on network |
77 | EBADFD | File descriptor in bad state |
78 | EREMCHG | Remote address changed |
79 | ELIBACC | Can not access a needed shared library |
80 | ELIBBAD | Accessing a corrupted shared library |
81 | ELIBSCN | .lib section in a.out corrupted |
82 | ELIBMAX | Attempting to link in too many shared libraries |
83 | ELIBEXEC | Cannot exec a shared library directly |
84 | EILSEQ | Illegal byte sequence |
85 | ERESTART | Interrupted system call should be restarted |
86 | ESTRPIPE | Streams pipe error |
87 | EUSERS | Too many users |
88 | ENOTSOCK | Socket operation on non-socket |
89 | EDESTADDRREQ | Destination address required |
90 | EMSGSIZE | Message too long |
91 | EPROTOTYPE | Protocol wrong type for socket |
92 | ENOPROTOOPT | Protocol not available |
93 | EPROTONOSUPPORT | Protocol not supported |
94 | ESOCKTNOSUPPORT | Socket type not supported |
95 | EOPNOTSUPP | Operation not supported on transport endpoint |
96 | EPFNOSUPPORT | Protocol family not supported |
97 | EAFNOSUPPORT | Address family not supported by protocol |
98 | EADDRINUSE | Address already in use |
99 | EADDRNOTAVAIL | Cannot assign requested address |
100 | ENETDOWN | Network is down |
101 | ENETUNREACH | Network is unreachable |
102 | ENETRESET | Network dropped connection because of reset |
103 | ECONNABORTED | Software caused connection abort |
104 | ECONNRESET | Connection reset by peer |
105 | ENOBUFS | No buffer space available |
106 | EISCONN | Transport endpoint is already connected |
107 | ENOTCONN | Transport endpoint is not connected |
108 | ESHUTDOWN | Cannot send after transport endpoint shutdown |
109 | ETOOMANYREFS | Too many references: cannot splice |
110 | ETIMEDOUT | Connection timed out |
111 | ECONNREFUSED | Connection refused |
112 | EHOSTDOWN | Host is down |
113 | EHOSTUNREACH | No route to host |
114 | EALREADY | Operation already in progress |
115 | EINPROGRESS | Operation now in progress |
116 | ESTALE | Stale NFS file handle |
117 | EUCLEAN | Structure needs cleaning |
118 | ENOTNAM | Not a XENIX named type file |
119 | ENAVAIL | No XENIX semaphores available |
120 | EISNAM | Is a named type file |
121 | EREMOTEIO | Remote I/O error |
122 | EDQUOT | Quota exceeded |
123 | ENOMEDIUM | No medium found |
124 | EMEDIUMTYPE | Wrong medium type |
125 | ECANCELED | Operation Canceled |
126 | ENOKEY | Required key not available |
127 | EKEYEXPIRED | Key has expired |
128 | EKEYREVOKED | Key has been revoked |
129 | EKEYREJECTED | Key was rejected by service |
130 | EOWNERDEAD | Owner died |
131 | ENOTRECOVERABLE | State not recoverable |
When you see an error number thrown by a C program on a Linux environment, you might find the above table handy to identify what those error number means. Make sure to bookmark this article for future reference.
Источник
System error codes linux
The error code macros are defined in the header file errno.h . All of them expand into integer constant values. Some of these error codes can’t occur on GNU systems, but they can occur using the GNU C Library on other systems.
Macro: int EPERM ¶
“Operation not permitted.” Only the owner of the file (or other resource) or processes with special privileges can perform the operation.
Macro: int ENOENT ¶
“No such file or directory.” This is a “file doesn’t exist” error for ordinary files that are referenced in contexts where they are expected to already exist.
Macro: int ESRCH ¶
“No such process.” No process matches the specified process ID.
Macro: int EINTR ¶
“Interrupted system call.” An asynchronous signal occurred and prevented completion of the call. When this happens, you should try the call again.
You can choose to have functions resume after a signal that is handled, rather than failing with EINTR ; see Primitives Interrupted by Signals.
Macro: int EIO ¶
“Input/output error.” Usually used for physical read or write errors.
Macro: int ENXIO ¶
“No such device or address.” The system tried to use the device represented by a file you specified, and it couldn’t find the device. This can mean that the device file was installed incorrectly, or that the physical device is missing or not correctly attached to the computer.
Macro: int E2BIG ¶
“Argument list too long.” Used when the arguments passed to a new program being executed with one of the exec functions (see Executing a File) occupy too much memory space. This condition never arises on GNU/Hurd systems.
Macro: int ENOEXEC ¶
“Exec format error.” Invalid executable file format. This condition is detected by the exec functions; see Executing a File.
Macro: int EBADF ¶
“Bad file descriptor.” For example, I/O on a descriptor that has been closed or reading from a descriptor open only for writing (or vice versa).
Macro: int ECHILD ¶
“No child processes.” This error happens on operations that are supposed to manipulate child processes, when there aren’t any processes to manipulate.
Macro: int EDEADLK ¶
“Resource deadlock avoided.” Allocating a system resource would have resulted in a deadlock situation. The system does not guarantee that it will notice all such situations. This error means you got lucky and the system noticed; it might just hang. See File Locks, for an example.
Macro: int ENOMEM ¶
“Cannot allocate memory.” The system cannot allocate more virtual memory because its capacity is full.
Macro: int EACCES ¶
“Permission denied.” The file permissions do not allow the attempted operation.
Macro: int EFAULT ¶
“Bad address.” An invalid pointer was detected. On GNU/Hurd systems, this error never happens; you get a signal instead.
Macro: int ENOTBLK ¶
“Block device required.” A file that isn’t a block special file was given in a situation that requires one. For example, trying to mount an ordinary file as a file system in Unix gives this error.
Macro: int EBUSY ¶
“Device or resource busy.” A system resource that can’t be shared is already in use. For example, if you try to delete a file that is the root of a currently mounted filesystem, you get this error.
Macro: int EEXIST ¶
“File exists.” An existing file was specified in a context where it only makes sense to specify a new file.
Macro: int EXDEV ¶
“Invalid cross-device link.” An attempt to make an improper link across file systems was detected. This happens not only when you use link (see Hard Links) but also when you rename a file with rename (see Renaming Files).
Macro: int ENODEV ¶
“No such device.” The wrong type of device was given to a function that expects a particular sort of device.
Macro: int ENOTDIR ¶
“Not a directory.” A file that isn’t a directory was specified when a directory is required.
Macro: int EISDIR ¶
“Is a directory.” You cannot open a directory for writing, or create or remove hard links to it.
Macro: int EINVAL ¶
“Invalid argument.” This is used to indicate various kinds of problems with passing the wrong argument to a library function.
Macro: int EMFILE ¶
“Too many open files.” The current process has too many files open and can’t open any more. Duplicate descriptors do count toward this limit.
In BSD and GNU, the number of open files is controlled by a resource limit that can usually be increased. If you get this error, you might want to increase the RLIMIT_NOFILE limit or make it unlimited; see Limiting Resource Usage.
Macro: int ENFILE ¶
“Too many open files in system.” There are too many distinct file openings in the entire system. Note that any number of linked channels count as just one file opening; see Linked Channels. This error never occurs on GNU/Hurd systems.
Macro: int ENOTTY ¶
“Inappropriate ioctl for device.” Inappropriate I/O control operation, such as trying to set terminal modes on an ordinary file.
Macro: int ETXTBSY ¶
“Text file busy.” An attempt to execute a file that is currently open for writing, or write to a file that is currently being executed. Often using a debugger to run a program is considered having it open for writing and will cause this error. (The name stands for “text file busy”.) This is not an error on GNU/Hurd systems; the text is copied as necessary.
Macro: int EFBIG ¶
“File too large.” The size of a file would be larger than allowed by the system.
Macro: int ENOSPC ¶
“No space left on device.” Write operation on a file failed because the disk is full.
Macro: int ESPIPE ¶
“Illegal seek.” Invalid seek operation (such as on a pipe).
Macro: int EROFS ¶
“Read-only file system.” An attempt was made to modify something on a read-only file system.
Macro: int EMLINK ¶
“Too many links.” The link count of a single file would become too large. rename can cause this error if the file being renamed already has as many links as it can take (see Renaming Files).
Macro: int EPIPE ¶
“Broken pipe.” There is no process reading from the other end of a pipe. Every library function that returns this error code also generates a SIGPIPE signal; this signal terminates the program if not handled or blocked. Thus, your program will never actually see EPIPE unless it has handled or blocked SIGPIPE .
Macro: int EDOM ¶
“Numerical argument out of domain.” Used by mathematical functions when an argument value does not fall into the domain over which the function is defined.
Macro: int ERANGE ¶
“Numerical result out of range.” Used by mathematical functions when the result value is not representable because of overflow or underflow.
Macro: int EAGAIN ¶
“Resource temporarily unavailable.” The call might work if you try again later. The macro EWOULDBLOCK is another name for EAGAIN ; they are always the same in the GNU C Library.
This error can happen in a few different situations:
- An operation that would block was attempted on an object that has non-blocking mode selected. Trying the same operation again will block until some external condition makes it possible to read, write, or connect (whatever the operation). You can use select to find out when the operation will be possible; see Waiting for Input or Output.
Portability Note: In many older Unix systems, this condition was indicated by EWOULDBLOCK , which was a distinct error code different from EAGAIN . To make your program portable, you should check for both codes and treat them the same.
Macro: intEWOULDBLOCK¶
“Operation would block.” In the GNU C Library, this is another name for EAGAIN (above). The values are always the same, on every operating system.
C libraries in many older Unix systems have EWOULDBLOCK as a separate error code.
Macro: int EINPROGRESS ¶
“Operation now in progress.” An operation that cannot complete immediately was initiated on an object that has non-blocking mode selected. Some functions that must always block (such as connect ; see Making a Connection) never return EAGAIN . Instead, they return EINPROGRESS to indicate that the operation has begun and will take some time. Attempts to manipulate the object before the call completes return EALREADY . You can use the select function to find out when the pending operation has completed; see Waiting for Input or Output.
Macro: int EALREADY ¶
“Operation already in progress.” An operation is already in progress on an object that has non-blocking mode selected.
Macro: int ENOTSOCK ¶
“Socket operation on non-socket.” A file that isn’t a socket was specified when a socket is required.
Macro: int EMSGSIZE ¶
“Message too long.” The size of a message sent on a socket was larger than the supported maximum size.
Macro: int EPROTOTYPE ¶
“Protocol wrong type for socket.” The socket type does not support the requested communications protocol.
Macro: int ENOPROTOOPT ¶
“Protocol not available.” You specified a socket option that doesn’t make sense for the particular protocol being used by the socket. See Socket Options.
Macro: int EPROTONOSUPPORT ¶
“Protocol not supported.” The socket domain does not support the requested communications protocol (perhaps because the requested protocol is completely invalid). See Creating a Socket.
Macro: int ESOCKTNOSUPPORT ¶
“Socket type not supported.” The socket type is not supported.
Macro: int EOPNOTSUPP ¶
“Operation not supported.” The operation you requested is not supported. Some socket functions don’t make sense for all types of sockets, and others may not be implemented for all communications protocols. On GNU/Hurd systems, this error can happen for many calls when the object does not support the particular operation; it is a generic indication that the server knows nothing to do for that call.
Macro: int EPFNOSUPPORT ¶
“Protocol family not supported.” The socket communications protocol family you requested is not supported.
Macro: int EAFNOSUPPORT ¶
“Address family not supported by protocol.” The address family specified for a socket is not supported; it is inconsistent with the protocol being used on the socket. See Sockets.
Macro: int EADDRINUSE ¶
“Address already in use.” The requested socket address is already in use. See Socket Addresses.
Macro: int EADDRNOTAVAIL ¶
“Cannot assign requested address.” The requested socket address is not available; for example, you tried to give a socket a name that doesn’t match the local host name. See Socket Addresses.
Macro: int ENETDOWN ¶
“Network is down.” A socket operation failed because the network was down.
Macro: int ENETUNREACH ¶
“Network is unreachable.” A socket operation failed because the subnet containing the remote host was unreachable.
Macro: int ENETRESET ¶
“Network dropped connection on reset.” A network connection was reset because the remote host crashed.
Macro: int ECONNABORTED ¶
“Software caused connection abort.” A network connection was aborted locally.
Macro: int ECONNRESET ¶
“Connection reset by peer.” A network connection was closed for reasons outside the control of the local host, such as by the remote machine rebooting or an unrecoverable protocol violation.
Macro: int ENOBUFS ¶
“No buffer space available.” The kernel’s buffers for I/O operations are all in use. In GNU, this error is always synonymous with ENOMEM ; you may get one or the other from network operations.
Macro: int EISCONN ¶
“Transport endpoint is already connected.” You tried to connect a socket that is already connected. See Making a Connection.
Macro: int ENOTCONN ¶
“Transport endpoint is not connected.” The socket is not connected to anything. You get this error when you try to transmit data over a socket, without first specifying a destination for the data. For a connectionless socket (for datagram protocols, such as UDP), you get EDESTADDRREQ instead.
Macro: int EDESTADDRREQ ¶
“Destination address required.” No default destination address was set for the socket. You get this error when you try to transmit data over a connectionless socket, without first specifying a destination for the data with connect .
Macro: int ESHUTDOWN ¶
“Cannot send after transport endpoint shutdown.” The socket has already been shut down.
Macro: int ETOOMANYREFS ¶
“Too many references: cannot splice.”
Macro: int ETIMEDOUT ¶
“Connection timed out.” A socket operation with a specified timeout received no response during the timeout period.
Macro: int ECONNREFUSED ¶
“Connection refused.” A remote host refused to allow the network connection (typically because it is not running the requested service).
Macro: int ELOOP ¶
“Too many levels of symbolic links.” Too many levels of symbolic links were encountered in looking up a file name. This often indicates a cycle of symbolic links.
Macro: int ENAMETOOLONG ¶
“File name too long.” Filename too long (longer than PATH_MAX ; see Limits on File System Capacity) or host name too long (in gethostname or sethostname ; see Host Identification).
Macro: int EHOSTDOWN ¶
“Host is down.” The remote host for a requested network connection is down.
Macro: int EHOSTUNREACH ¶
“No route to host.” The remote host for a requested network connection is not reachable.
Macro: int ENOTEMPTY ¶
“Directory not empty.” Directory not empty, where an empty directory was expected. Typically, this error occurs when you are trying to delete a directory.
Macro: int EPROCLIM ¶
“Too many processes.” This means that the per-user limit on new process would be exceeded by an attempted fork . See Limiting Resource Usage, for details on the RLIMIT_NPROC limit.
Macro: int EUSERS ¶
“Too many users.” The file quota system is confused because there are too many users.
Macro: int EDQUOT ¶
“Disk quota exceeded.” The user’s disk quota was exceeded.
Macro: int ESTALE ¶
“Stale file handle.” This indicates an internal confusion in the file system which is due to file system rearrangements on the server host for NFS file systems or corruption in other file systems. Repairing this condition usually requires unmounting, possibly repairing and remounting the file system.
Macro: int EREMOTE ¶
“Object is remote.” An attempt was made to NFS-mount a remote file system with a file name that already specifies an NFS-mounted file. (This is an error on some operating systems, but we expect it to work properly on GNU/Hurd systems, making this error code impossible.)
Macro: int EBADRPC ¶
“RPC struct is bad.”
Macro: int ERPCMISMATCH ¶
“RPC version wrong.”
Macro: int EPROGUNAVAIL ¶
“RPC program not available.”
Macro: int EPROGMISMATCH ¶
“RPC program version wrong.”
Macro: int EPROCUNAVAIL ¶
“RPC bad procedure for program.”
Macro: int ENOLCK ¶
“No locks available.” This is used by the file locking facilities; see File Locks. This error is never generated by GNU/Hurd systems, but it can result from an operation to an NFS server running another operating system.
Macro: int EFTYPE ¶
“Inappropriate file type or format.” The file was the wrong type for the operation, or a data file had the wrong format.
On some systems chmod returns this error if you try to set the sticky bit on a non-directory file; see Assigning File Permissions.
Macro: int EAUTH ¶
Macro: int ENEEDAUTH ¶
Macro: int ENOSYS ¶
“Function not implemented.” This indicates that the function called is not implemented at all, either in the C library itself or in the operating system. When you get this error, you can be sure that this particular function will always fail with ENOSYS unless you install a new version of the C library or the operating system.
Macro: int ELIBEXEC ¶
“Cannot exec a shared library directly.”
Macro: int ENOTSUP ¶
“Not supported.” A function returns this error when certain parameter values are valid, but the functionality they request is not available. This can mean that the function does not implement a particular command or option value or flag bit at all. For functions that operate on some object given in a parameter, such as a file descriptor or a port, it might instead mean that only that specific object (file descriptor, port, etc.) is unable to support the other parameters given; different file descriptors might support different ranges of parameter values.
If the entire function is not available at all in the implementation, it returns ENOSYS instead.
Macro: int EILSEQ ¶
“Invalid or incomplete multibyte or wide character.” While decoding a multibyte character the function came along an invalid or an incomplete sequence of bytes or the given wide character is invalid.
Macro: int EBACKGROUND ¶
“Inappropriate operation for background process.” On GNU/Hurd systems, servers supporting the term protocol return this error for certain operations when the caller is not in the foreground process group of the terminal. Users do not usually see this error because functions such as read and write translate it into a SIGTTIN or SIGTTOU signal. See Job Control, for information on process groups and these signals.
Macro: int EDIED ¶
“Translator died.” On GNU/Hurd systems, opening a file returns this error when the file is translated by a program and the translator program dies while starting up, before it has connected to the file.
Macro: int ED ¶
“?.” The experienced user will know what is wrong.
Macro: int EGREGIOUS ¶
“You really blew it this time.” You did what?
Macro: int EIEIO ¶
“Computer bought the farm.” Go home and have a glass of warm, dairy-fresh milk.
Macro: int EGRATUITOUS ¶
“Gratuitous error.” This error code has no purpose.
Macro: int EBADMSG ¶
Macro: int EIDRM ¶
Macro: int EMULTIHOP ¶
Macro: int ENODATA ¶
“No data available.”
Macro: int ENOLINK ¶
“Link has been severed.”
Macro: int ENOMSG ¶
“No message of desired type.”
Macro: int ENOSR ¶
“Out of streams resources.”
Macro: int ENOSTR ¶
“Device not a stream.”
Macro: int EOVERFLOW ¶
“Value too large for defined data type.”
Macro: int EPROTO ¶
Macro: int ETIME ¶
Macro: int ECANCELED ¶
“Operation canceled.” An asynchronous operation was canceled before it completed. See Perform I/O Operations in Parallel. When you call aio_cancel , the normal result is for the operations affected to complete with this error; see Cancellation of AIO Operations.
Macro: int EOWNERDEAD ¶
Macro: int ENOTRECOVERABLE ¶
“State not recoverable.”
The following error codes are defined by the Linux/i386 kernel. They are not yet documented.
Macro: int ERESTART ¶
“Interrupted system call should be restarted.”
Macro: int ECHRNG ¶
“Channel number out of range.”
Macro: int EL2NSYNC ¶
“Level 2 not synchronized.”
Macro: int EL3HLT ¶
Macro: int EL3RST ¶
Macro: int ELNRNG ¶
“Link number out of range.”
Macro: int EUNATCH ¶
“Protocol driver not attached.”
Macro: int ENOCSI ¶
“No CSI structure available.”
Macro: int EL2HLT ¶
Macro: int EBADE ¶
Macro: int EBADR ¶
“Invalid request descriptor.”
Macro: int EXFULL ¶
Macro: int ENOANO ¶
Macro: int EBADRQC ¶
“Invalid request code.”
Macro: int EBADSLT ¶
Macro: int EDEADLOCK ¶
“File locking deadlock error.”
Macro: int EBFONT ¶
“Bad font file format.”
Macro: int ENONET ¶
“Machine is not on the network.”
Macro: int ENOPKG ¶
“Package not installed.”
Macro: int EADV ¶
Macro: int ESRMNT ¶
Macro: int ECOMM ¶
“Communication error on send.”
Macro: int EDOTDOT ¶
“RFS specific error.”
Macro: int ENOTUNIQ ¶
“Name not unique on network.”
Macro: int EBADFD ¶
“File descriptor in bad state.”
Macro: int EREMCHG ¶
“Remote address changed.”
Macro: int ELIBACC ¶
“Can not access a needed shared library.”
Macro: int ELIBBAD ¶
“Accessing a corrupted shared library.”
Macro: int ELIBSCN ¶
“.lib section in a.out corrupted.”
Macro: int ELIBMAX ¶
“Attempting to link in too many shared libraries.”
Macro: int ESTRPIPE ¶
“Streams pipe error.”
Macro: int EUCLEAN ¶
“Structure needs cleaning.”
Macro: int ENOTNAM ¶
“Not a XENIX named type file.”
Macro: int ENAVAIL ¶
“No XENIX semaphores available.”
Macro: int EISNAM ¶
“Is a named type file.”
Macro: int EREMOTEIO ¶
“Remote I/O error.”
Macro: int ENOMEDIUM ¶
“No medium found.”
Macro: int EMEDIUMTYPE ¶
“Wrong medium type.”
Macro: int ENOKEY ¶
“Required key not available.”
Macro: int EKEYEXPIRED ¶
“Key has expired.”
Macro: int EKEYREVOKED ¶
“Key has been revoked.”
Macro: int EKEYREJECTED ¶
“Key was rejected by service.”
Macro: int ERFKILL ¶
“Operation not possible due to RF-kill.”
Macro: int EHWPOISON ¶
Источник
100mbru, bitrix, CentOS, cms, drupal, joomla, LAMP, linux, mysql, nicru, Open-Source, php, Red Hat, seo, Typo3, ubuntu, win, windows, авто, администрирование, алгоритмы, алкоголь, бизнес, битрикс, видео, военмех, выборы, германия, джино, домены, интересности, исследования, картинки, кино, компьютеры, ливия, магазин, маразм, мастерхост, обработка-изображений, пейнтбол, политика, политэкономия, прикольное-видео, программирование, путешествия, работа, религия, рунет, сайтостроение, сео, сми, технологии, украина, форум, хиханьки, холивары, хостинг
- Главная
- >
- Статьи и переводы
- >
- Коды системных ошибок OS LINUX
08.11.2018
ВСЕ КОДЫ ОШИБОК ОПЕРАЦИОННОЙ СИСТЕМЫ LINUX
EPERM 1 / * Операция не допускается * /
ENOENT 2 / * Нет такого файла или каталога * /
ESRCH 3 / * Нет такого процесса * /
EINTR 4 / * * Прерванный системный вызов /
EIO 5 / * I / O * ошибка /
ENXIO 6 / * Нет такого устройства или адреса * /
E2BIG 7 / * список аргументов слишком долго * /
ENOEXEC 8 / * Exec формате ошибки * /
EBADF 9 / * Плохо * номер файла /
ECHILD 10 / * Ни один ребенок процессов * /
EAGAIN 11 / * Попробуйте еще раз * /
ENOMEM 12 / * Из памяти * /
EACCES 13 / * Доступ запрещен * /
EFAULT 14 / * Плохой адрес * /
ENOTBLK 15 / * Блок устройства требуется * /
EBUSY 16 / * Устройство или ресурс занято * /
EEXIST 17 / * Файл существует * /
EXDEV 18 / * кросс-устройства ссылка * /
ENODEV 19 / * Нет такого устройства * /
ENOTDIR 20 / * Не каталога * /
EISDIR 21 / * Есть каталог * /
EINVAL 22 / * Неправильный аргумент * /
ENFILE 23 / * файл * Переполнение таблицы /
EMFILE 24 / * Слишком много открытых файлов * /
ENOTTY 25 / * Не пишущую машинку * /
ETXTBSY 26 / * Текстовый файл занят * /
EFBIG 27 / * Файл слишком большой * /
ENOSPC 28 / * Нет места на устройстве * /
ESPIPE 29 / * Незаконное искать * /
EROFS 30 / * только для чтения * файловой системы /
EMLINK 31 / * Слишком много ссылок * /
EPIPE 32 / * * Broken трубы /
EDOM 33 / * мат аргумента из области функции * /
ERANGE 34 / * мат результат не представляется * /
Код ошибки значение Описание
0 Действие завершено успешно.
1 Действие возвращается предупреждения.
67 Произошла фатальная ошибка во время установки.
ВТОРИЧНЫЙ ФАЙЛ ОТВЕТОВ КОДЫ ОШИБОК ПРИ УСТАНОВКЕ — КОД ОШИБКИ ЗНАЧЕНИЕ — ОПИСАНИЕ
3 Путь не был найден.
5 Отказано в доступе.
10 Среду произошла ошибка.
13 Недопустимые данные.
16 Создание DAS не удалось.
17 Создания экземпляра не удалось.
18 Создание базы данных не удалось.
19 Исправить изображение пакет находится на более низком уровне, чем установленного продукта.
20 Исправить изображение пакет на том же уровне, как установленного продукта. Существует ничего, чтобы обновить.
21 Есть не DB2 (R) продуктов, установленных на выбранное место. Существует ничего, чтобы обновить.
22 Для обновления уже установлен продукт DB2, используйте installFixPack команду вместо команды db2setup.
87 Один из параметров является ошибочным.
66 Установка была отменена пользователем.
74 Данные конфигурации повреждены. Обратитесь в службу поддержки.
76 Установочными файлами для этого продукта недоступен. Убедитесь, что источник существует и доступен.
82 Другая установка уже идет. Полное, что установка, прежде чем приступить к этой установки.
86 Существовал ошибка при открытии файла журнала установки. Убедитесь, что указанное место файла журнала и, что она доступна для записи.
96 Папка Temp переполнена или недоступны. Убедитесь, что папка Temp существует и что вы можете писать на нем.
97 Этот установочный пакет не поддерживается на этой платформе.
102 Другая версия этого продукта уже установлена. Установка этой версии не может продолжаться.
103 Неверный аргумент командной строки.
143 Система не имеет достаточно свободного места, чтобы продолжить установку.
Introduction to Linux Error codes
In the Linux operating system, we are working on many components. While working, we are getting lots of errors. The same errors can be acknowledged by the Linux error codes. There are different error codes available as per the execution error. We can capture the error code with the help of the “echo” command also.
To fix the error message in the Linux level jobs/query or application-level job, it is mandatory that we need to understand the nature of the error, the error description, and the error code. Accordingly, we can fix the application or job on the Linux level.
The error code utility i.e., “errno” is written by the Lars Wirzenius.
Syntax of Error Codes
errno [ OPTION ] [ STRING ]
echo $?
- errno: We can use the “errno” keyword in the syntax or command. It will take the two arguments as access OPTION and the string. As per the provided arguments, it will provide the error information as per the string or the error code.
- OPTION: We can provide the different flags as options that are compatible with the “errno” command.
- STRING: We can provide the short string as per the “error” define. It will provide the error information concerning the provided string.
- echo $?: The echo command will also provide the error code. We need to use the “?” symbol with the echo command.
How Linux Error Codes Works?
In Linux, we are having a total of 134 error codes. Every error message or the failure in the Linux environment, it will have their error code. With the help of error code, we can fetch the error description and help to fix the issue or error message. If we will keep the same error message as it is then it will be a big impact on the server level.
When we are executing any command or job on the Linux level without any error then it will be fine. But if the Linux command will not be executed properly then the Linux compiler will notify with the relevant error message to the login user.
Below are the lists of error code information available,
Sr No | Error Code | Error Number | Error Description |
1 | EPERM | 1 | It will print the error message if the operation is not permitted. |
2 | ENOENT | 2 | It will print the error message if there are no such files or directory exists. |
3 | ESRCH | 3 | It will print the error message if there is no such process exists. |
4 | EINTR | 4 | It will print the error message if any interrupted system calls. |
5 | EIO | 5 | It will print the error message if it is any input/output error. |
6 | ENXIO | 6 | It will print the error message if there is no such device or address exists. |
7 | E2BIG | 7 | It will print the error message if the argument list is too long. |
8 | ENOEXEC | 8 | It will print the error message if there is an exec format error. |
9 | EBADF | 9 | It will print the error message in it is a bad file descriptor. |
10 | ECHILD | 10 | It will print the error message if there are no child process exits. |
Examples to implement Linux Error codes
Here are the following examples mention below
Examples #1 – Print the List
The “errno” utility is a very simple and common way to check the list of error codes in a Linux environment. It will print all the list of error codes with the error number and error description.
Command :
errno -l
Explanation :
As per the above command, we can print all the list of error codes available in the Linux environment. It will print the details information of error code like an error code name, error code number, and the description of the error code.
Output :
Example #2 – Information of Individual Error Number
By default, we are getting all the list of error code information. But we can also get the individual error number information as well.
Command:
errno 9
Explanation :
In the “errno” utility, we can get the specific information error information with the help of an error number. We have used the error no “9” and get the information of “error number 9” only.
Output :
Example #3 – Information of Individual Error Name
In the error codes, we can get the individual error number information. Similarly, we are having the functionality to print the individual error name information.
Command :
errno EBADF
Explanation :
As per the above command, we can get the specific information error information with the help of the error name. We have used the error name “EBADF” and get the information of “error name (EBADF)” only.
Output :
Example #4 – Error Code Information from the Input String
In the Linux environment, we are having the functionality to get the error code and error number information from the input string. We need to use the “-s” option with the “errno” utility.
Note: we need to provide the relevant input string as an input to the “errno” command.
Command :
errno -s access
Explanation :
When we don’t know the exact error number or name then we can use the relevant string to identify the error code and description of it. We have used the “access” string and get the related information of access.
Output :
Example #5 – Get the Error Code Information with “echo” Command
In the Linux ecosystem, we are having the functionality to check the quick error code information via the “echo” command. If it will return the “0” output then the command was executed fine. If it will return the output value except “0” then there are some issues in the command or job.
Command :
cat test_file.txt
echo $?
Explanation :
In screenshot 1 (a), we are getting the echo command output as “0”. Hence, it is an indication of the proper execution of the command. In screenshot 1 (b), we are getting the echo command output as “1”. Because the previous command was not executed successfully.
Output :
Screenshot 1 (a)
Screenshot 1 (b)
Conclusion
We have seen the uncut concept of “Linux Error Codes” with the proper example, explanation, and command with different outputs. Every error code is having its unique error name and the error number. The error codes are very important in terms of fixing the issues on command or job level.
Recommended Articles
This is a guide to Linux Error Codes. Here we discuss How Linux Error Codes Works and Examples along with the commands and outputs. You may also have a look at the following articles to learn more –
- Linux Mount Command
- Linux Inode
- Linux tac
- Linux Free Command
Programmers should handle all kinds of errors to protect the program from failure.
In C programming language, there is no direct support for error handling. You have to detect the failure and handle the error. In C programming language, return values represents success or failure. Inside a C program, when a function fails, you should handle the errors accordingly, or at least record the errors in a log file.
When you are running some program on Linux environment, you might notice that it gives some error number. For example, “Error no is : 17”, which doesn’t really say much. You really need to know what error number 17 means.
This article shows all available error numbers along with it descriptions. This article might be a handy reference for you, when you encounter an error number and you would like to know what it means.
- In C programming language, there is an external variable called “errno”.
- From this errno variable you can use some error handling functions to find out the error description and handle it appropriately.
- You have to include errno.h header file to use external variable errno.
- perror function prints error description in standard error.
- The strerror function returns a string describing the error code passed in the argument errnum.
The following C code snippet tries to open a file through open system call. There are two flags in the open call. O_CREAT flag is to create a file, if the file does not exist. O_EXCL flag is used with O_CREAT, if the file is already exist open call will fail with the proper error number.
$ cat fileopen.c #include <stdio.h> #include <fcntl.h> #include <errno.h> #include <string.h> main() { // Declaration of a file descriptor int fd; // Opening a file fd = open("/root/sasikala/testing",O_CREAT|O_EXCL); // If Open is failed if ( fd < 0 ) { printf("Opening file : Failedn"); printf ("Error no is : %dn", errno); printf("Error description is : %sn",strerror(errno)); } // If Open is success else printf("Opening file : Successn"); } $ cc -o fileopen fileopen.c $ ./fileopen Opening file : Success $ ./fileopen Opening file : Failed Error no is : 17 Error description is : File exists
At first execution, open got executed successfully, and it created the file since the file was not available. In next execution, it throws an error number 17, which is “File already exist”.
The following table shows list of error numbers and its descriptions in Linux operation system
ERROR CODE TABLE | ||
---|---|---|
Error number | Error Code | Error Description |
1 | EPERM | Operation not permitted |
2 | ENOENT | No such file or directory |
3 | ESRCH | No such process |
4 | EINTR | Interrupted system call |
5 | EIO | I/O error |
6 | ENXIO | No such device or address |
7 | E2BIG | Argument list too long |
8 | ENOEXEC | Exec format error |
9 | EBADF | Bad file number |
10 | ECHILD | No child processes |
11 | EAGAIN | Try again |
12 | ENOMEM | Out of memory |
13 | EACCES | Permission denied |
14 | EFAULT | Bad address |
15 | ENOTBLK | Block device required |
16 | EBUSY | Device or resource busy |
17 | EEXIST | File exists |
18 | EXDEV | Cross-device link |
19 | ENODEV | No such device |
20 | ENOTDIR | Not a directory |
21 | EISDIR | Is a directory |
22 | EINVAL | Invalid argument |
23 | ENFILE | File table overflow |
24 | EMFILE | Too many open files |
25 | ENOTTY | Not a typewriter |
26 | ETXTBSY | Text file busy |
27 | EFBIG | File too large |
28 | ENOSPC | No space left on device |
29 | ESPIPE | Illegal seek |
30 | EROFS | Read-only file system |
31 | EMLINK | Too many links |
32 | EPIPE | Broken pipe |
33 | EDOM | Math argument out of domain of func |
34 | ERANGE | Math result not representable |
35 | EDEADLK | Resource deadlock would occur |
36 | ENAMETOOLONG | File name too long |
37 | ENOLCK | No record locks available |
38 | ENOSYS | Function not implemented |
39 | ENOTEMPTY | Directory not empty |
40 | ELOOP | Too many symbolic links encountered |
42 | ENOMSG | No message of desired type |
43 | EIDRM | Identifier removed |
44 | ECHRNG | Channel number out of range |
45 | EL2NSYNC | Level 2 not synchronized |
46 | EL3HLT | Level 3 halted |
47 | EL3RST | Level 3 reset |
48 | ELNRNG | Link number out of range |
49 | EUNATCH | Protocol driver not attached |
50 | ENOCSI | No CSI structure available |
51 | EL2HLT | Level 2 halted |
52 | EBADE | Invalid exchange |
53 | EBADR | Invalid request descriptor |
54 | EXFULL | Exchange full |
55 | ENOANO | No anode |
56 | EBADRQC | Invalid request code |
57 | EBADSLT | Invalid slot |
59 | EBFONT | Bad font file format |
60 | ENOSTR | Device not a stream |
61 | ENODATA | No data available |
62 | ETIME | Timer expired |
63 | ENOSR | Out of streams resources |
64 | ENONET | Machine is not on the network |
65 | ENOPKG | Package not installed |
66 | EREMOTE | Object is remote |
67 | ENOLINK | Link has been severed |
68 | EADV | Advertise error |
69 | ESRMNT | Srmount error |
70 | ECOMM | Communication error on send |
71 | EPROTO | Protocol error |
72 | EMULTIHOP | Multihop attempted |
73 | EDOTDOT | RFS specific error |
74 | EBADMSG | Not a data message |
75 | EOVERFLOW | Value too large for defined data type |
76 | ENOTUNIQ | Name not unique on network |
77 | EBADFD | File descriptor in bad state |
78 | EREMCHG | Remote address changed |
79 | ELIBACC | Can not access a needed shared library |
80 | ELIBBAD | Accessing a corrupted shared library |
81 | ELIBSCN | .lib section in a.out corrupted |
82 | ELIBMAX | Attempting to link in too many shared libraries |
83 | ELIBEXEC | Cannot exec a shared library directly |
84 | EILSEQ | Illegal byte sequence |
85 | ERESTART | Interrupted system call should be restarted |
86 | ESTRPIPE | Streams pipe error |
87 | EUSERS | Too many users |
88 | ENOTSOCK | Socket operation on non-socket |
89 | EDESTADDRREQ | Destination address required |
90 | EMSGSIZE | Message too long |
91 | EPROTOTYPE | Protocol wrong type for socket |
92 | ENOPROTOOPT | Protocol not available |
93 | EPROTONOSUPPORT | Protocol not supported |
94 | ESOCKTNOSUPPORT | Socket type not supported |
95 | EOPNOTSUPP | Operation not supported on transport endpoint |
96 | EPFNOSUPPORT | Protocol family not supported |
97 | EAFNOSUPPORT | Address family not supported by protocol |
98 | EADDRINUSE | Address already in use |
99 | EADDRNOTAVAIL | Cannot assign requested address |
100 | ENETDOWN | Network is down |
101 | ENETUNREACH | Network is unreachable |
102 | ENETRESET | Network dropped connection because of reset |
103 | ECONNABORTED | Software caused connection abort |
104 | ECONNRESET | Connection reset by peer |
105 | ENOBUFS | No buffer space available |
106 | EISCONN | Transport endpoint is already connected |
107 | ENOTCONN | Transport endpoint is not connected |
108 | ESHUTDOWN | Cannot send after transport endpoint shutdown |
109 | ETOOMANYREFS | Too many references: cannot splice |
110 | ETIMEDOUT | Connection timed out |
111 | ECONNREFUSED | Connection refused |
112 | EHOSTDOWN | Host is down |
113 | EHOSTUNREACH | No route to host |
114 | EALREADY | Operation already in progress |
115 | EINPROGRESS | Operation now in progress |
116 | ESTALE | Stale NFS file handle |
117 | EUCLEAN | Structure needs cleaning |
118 | ENOTNAM | Not a XENIX named type file |
119 | ENAVAIL | No XENIX semaphores available |
120 | EISNAM | Is a named type file |
121 | EREMOTEIO | Remote I/O error |
122 | EDQUOT | Quota exceeded |
123 | ENOMEDIUM | No medium found |
124 | EMEDIUMTYPE | Wrong medium type |
125 | ECANCELED | Operation Canceled |
126 | ENOKEY | Required key not available |
127 | EKEYEXPIRED | Key has expired |
128 | EKEYREVOKED | Key has been revoked |
129 | EKEYREJECTED | Key was rejected by service |
130 | EOWNERDEAD | Owner died |
131 | ENOTRECOVERABLE | State not recoverable |
When you see an error number thrown by a C program on a Linux environment, you might find the above table handy to identify what those error number means. Make sure to bookmark this article for future reference.