Linux下errno錯誤資訊對照
在庫函式中有個errno變數,每個errno值對應著以字串表示的錯誤型別。
以下主要來自2.6.32的核心程式碼中的/usr/include/asm-generic/errno.h及errno-base.h,輸出錯誤原因定義歸納整理如下,我們可以使用如下程式碼輸出
/*************************************************************************
> File Name: 0.c
> Author: GatieMe
> Mail: [email protected]
> Created Time: Sat 23 Jan 2016 12:07:51 AM CST
************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char ** argv)
{
int i = 0;
for(i = 0; i < 256; i++)
{
printf("| %02d | %s |\n", i, strerror(i));
}
return 0;
}
注意
perror( ) 用來將上一個函式發生錯誤的原因輸出到標準裝置(stderr)。引數 s 所指的字串會先打印出,後面再加上錯誤原因字串。此錯誤原因依照全域性變數errno 的值來決定要輸出的字串。
當你呼叫”某些”函數出錯時,該函式已經重新設定了errno的值。perror函式只是將你輸入的一些資訊和現在的errno所對應的錯誤一起輸出。
errno | 描述 |
---|---|
00 | Success |
01 | Operation not permitted |
02 | No such file or directory |
03 | No such process |
04 | Interrupted system call |
05 | Input/output error |
06 | No such device or address |
07 | Argument list too long |
08 | Exec format error |
09 | Bad file descriptor |
10 | No child processes |
11 | Resource temporarily unavailable |
12 | Cannot allocate memory |
13 | Permission denied |
14 | Bad address |
15 | Block device required |
16 | Device or resource busy |
17 | File exists |
18 | Invalid cross-device link |
19 | No such device |
20 | Not a directory |
21 | Is a directory |
22 | Invalid argument |
23 | Too many open files in system |
24 | Too many open files |
25 | Inappropriate ioctl for device |
26 | Text file busy |
27 | File too large |
28 | No space left on device |
29 | Illegal seek |
30 | Read-only file system |
31 | Too many links |
32 | Broken pipe |
33 | Numerical argument out of domain |
34 | Numerical result out of range |
35 | Resource deadlock avoided |
36 | File name too long |
37 | No locks available |
38 | Function not implemented |
39 | Directory not empty |
40 | Too many levels of symbolic links |
41 | Unknown error 41 |
42 | No message of desired type |
43 | Identifier removed |
44 | Channel number out of range |
45 | Level 2 not synchronized |
46 | Level 3 halted |
47 | Level 3 reset |
48 | Link number out of range |
49 | Protocol driver not attached |
50 | No CSI structure available |
51 | Level 2 halted |
52 | Invalid exchange |
53 | Invalid request descriptor |
54 | Exchange full |
55 | No anode |
56 | Invalid request code |
57 | Invalid slot |
58 | Unknown error 58 |
59 | Bad font file format |
60 | Device not a stream |
61 | No data available |
62 | Timer expired |
63 | Out of streams resources |
64 | Machine is not on the network |
65 | Package not installed |
66 | Object is remote |
67 | Link has been severed |
68 | Advertise error |
69 | Srmount error |
70 | Communication error on send |
71 | Protocol error |
72 | Multihop attempted |
73 | RFS specific error |
74 | Bad message |
75 | Value too large for defined data type |
76 | Name not unique on network |
77 | File descriptor in bad state |
78 | Remote address changed |
79 | Can not access a needed shared library |
80 | Accessing a corrupted shared library |
81 | .lib section in a.out corrupted |
82 | Attempting to link in too many shared libraries |
83 | Cannot exec a shared library directly |
84 | Invalid or incomplete multibyte or wide character |
85 | Interrupted system call should be restarted |
86 | Streams pipe error |
87 | Too many users |
88 | Socket operation on non-socket |
89 | Destination address required |
90 | Message too long |
91 | Protocol wrong type for socket |
92 | Protocol not available |
93 | Protocol not supported |
94 | Socket type not supported |
95 | Operation not supported |
96 | Protocol family not supported |
97 | Address family not supported by protocol |
98 | Address already in use |
99 | Cannot assign requested address |
100 | Network is down |
101 | Network is unreachable |
102 | Network dropped connection on reset |
103 | Software caused connection abort |
104 | Connection reset by peer |
105 | No buffer space available |
106 | Transport endpoint is already connected |
107 | Transport endpoint is not connected |
108 | Cannot send after transport endpoint shutdown |
109 | Too many references: cannot splice |
110 | Connection timed out |
111 | Connection refused |
112 | Host is down |
113 | No route to host |
114 | Operation already in progress |
115 | Operation now in progress |
116 | Stale NFS file handle |
117 | Structure needs cleaning |
118 | Not a XENIX named type file |
119 | No XENIX semaphores available |
120 | Is a named type file |
121 | Remote I/O error |
122 | Disk quota exceeded |
123 | No medium found |
124 | Wrong medium type |
125 | Operation canceled |
126 | Required key not available |
127 | Key has expired |
128 | Key has been revoked |
129 | Key was rejected by service |
130 | Owner died |
131 | State not recoverable |
132~ | Unknown error |
相關推薦
Linux下errno錯誤資訊對照
在庫函式中有個errno變數,每個errno值對應著以字串表示的錯誤型別。 以下主要來自2.6.32的核心程式碼中的/usr/include/asm-generic/errno.h及errno-bas
linux常見錯誤的錯誤碼及錯誤資訊對照
一些常見的錯誤的值,print出來的只有值,對應的錯誤列表,我在linux核心中找到了,分享出來。對比檢視會相對方便。 #define EPERM 1 /* Operation not permitted */ #define ENOENT 2 /* No such
linux下的錯誤捕獲errno和strerror()
#define ESUC 0 /* Success */ #define EPERM 1 /* Operation not permitted */ #define ENOENT 2 /* No such file or directory */ #define ESRCH 3 /* No suc
Linux下檢視版本資訊
檢視版本當前作業系統核心資訊 [root@node00 ~]# uname -a Linux node00 3.10.0-693.el7.x86_64 #1 SMP Tue Aug 22 21:09:27 UTC 2017 x86_64 x86_64 x86
linux下link錯誤undefined reference’dlclose’
最近因為換了工作,伺服器是在linux環境下,又開始搗鼓linux了,與同事兩天的奮戰中,發現差不多可以寫一本《某哥的linux私房菜》了,開個玩笑。對於linux我持中立態度,而且我認為linux這麼多年發展比較慢的原因是因為桌面化做的不好或者不夠好,所以我比較偏愛ubuntu。由於以前專案是makefil
Linux下send錯誤程式碼32
問題描述:今天寫程式,socket後send出現這個問題,send的返回值為-1,而errno為32,這個錯誤程式碼為broken pipe,即管道破裂。 問題形成原因:後來通過排查研究,發現出現該種問題出現的可能性為以下兩種: 1.socket失敗,與伺服器端的
linux下檢視硬碟資訊、硬碟分割槽、格式化、掛載、及swap分割槽
df 命令參看硬碟資訊 -T選項, 檢視檔案系統型別 centos6檔案系統是ext4,因為設計較早,對於現今動輒上T的海量資料處理,效能較低。centos7檔案系統是xfs,適用於海量資料。這兩種
Linux下檢視CPU資訊[/proc/cpuinfo]
最近在研究linux系統負載的時候,接觸到一些關於CPU資訊檢視的知識,和大家分享一下。通過對/proc/cpuinfo檔案中的引數的分析,也學到了不少東西。 在linux作業系統中,CPU的資訊在啟動的過程中被裝載到虛擬目錄/proc下的cpuinfo檔案中,我們可以通過
windows下編輯指令碼檔案在linux下出現錯誤
問題: 使用./shell.sh 出現出現錯誤:“/bin/sh^M:bad interpreter” 使用sh shell.sh 生成的檔案會出現"a.txt^M"或者“a.txt?” 分析: 這裡這種情況的出現是因為,指令碼是在windows下編寫的,然後傳到
Linux下./configure錯誤詳解
說明: sudo apt-get install package-name 更新你指定的軟體包 sudo apt-get update 獲取更新列表 sudo apt-get dist-upgrade 開始更新
嵌入式 Linux下段錯誤的原因和除錯方式
[email protected]:~/segfault$ catchsegv ./segfault3 Segmentation fault (core dumped) *** Segmentation fault Register dump: EAX: 00000000 EBX: 00fb3f
AES 在 Linux 下解密錯誤
javax.crypto.BadPaddingException:Given final block not properly padded。 解決方法 修改前程式碼: KeyGenerator kgen = KeyGenerator.getIns
Linux下檢視系統資訊方法總結
Linux下如何檢視系統啟動時間和執行時間1.檢視/proc/uptime檔案計算系統啟動時間: cat /proc/uptime 輸出: 5113396.94 575949.85第一數字即是系統已執行的時間5113396.94秒,運用系統工具date即可算出系統啟動時間
如何在linux下檢視gpu資訊
~$ lspci | grep -i vga 01:00.0 VGA compatible controller: NVIDIA Corporation GF119 [GeForce GT 610] (rev a1) 如果你想看gpu的詳細資訊,使用~$ lspci -
linux下errno錯誤碼介紹
errno.00 is: Success errno.01 is: Operation not permitted errno.02 is: No such file or directory errno.03 is: No such process errno.04 is: Interrupted syst
Linux下檢視CPU資訊並且計算機器的浮點運算能力
輸入 cat /proc/cpuinfo物理CPU個數: cat /proc/cpuinfo |grep "physical id"|sort |uniq|wc -l 每個CPU物理核數: cat /proc/cpuinfo |grep "cpu core
linux C 列印錯誤資訊和標準輸入輸出
Linux 使用strerror 和 perror 函式來列印響應的錯誤資訊 ,這兩個函式的標準呼叫格式說明如下: #include<string.h> char *strerror(int errnum) #include<stdio.
Linux 下JVM執行資訊追蹤
JPS 檢視當前執行java程序 JVM Process Status Tool,顯示指定系統內所有的HotSpot虛擬機器程序。 jps -lvm 用於檢視當前機器上執行的java程序。 命令格式 jps [options] [hostid] 注:如果不指定ho
linux 下檢視硬體資訊(mac,IP地址,硬碟型號,序列號等)
本機為debian 8(jessie)方法同樣使用於其他linux 系統 檢視mac和IP地址 方法一 開啟terminal輸入命令: sudo ifconfig eth0 後的 HWaddr xx:xx:xx:xx:xx:xx 即為
linux下mysql錯誤
明明裝了mysql,執行mysql命令時確報錯:-bash: mysql: command not found 原因:這是由於系