1. 程式人生 > >errno.h標頭檔案介紹

errno.h標頭檔案介紹

檢視錯誤程式碼errno是除錯程式的一個重要方法。當linux C api函式發生異常時,一般會將errno變數(需include errno.h)賦一個整數值,不同的值表示不同的含義,可以通過檢視該值推測出錯的原因。在實際程式設計中用這一招解決了不少原本看來莫名其妙的問題。比較 麻煩的是每次都要去linux原始碼裡面查詢錯誤程式碼的含義,現在把它貼出來,以後需要查時就來這裡看了。

以下來自linux 2.4.20-18的核心程式碼中的/usr/include/asm/errno.h

#ifndef _I386_ERRNO_H

#define _I386_ERRNO_H

#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 /* I/O error */

#define ENXIO   6 /* No such device or address */

#define E2BIG   7 /* Arg list too long */

#define ENOEXEC   8 /* Exec format error */

#define EBADF   9 /* Bad file number */

#define ECHILD 10 /* No child processes */

#define EAGAIN 11 /* Try again */

#define ENOMEM 12 /* Out of 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 /* 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 /* File table overflow */

#define EMFILE 24 /* Too many open files */

#define ENOTTY 25 /* Not a typewriter */

#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 /* Math argument out of domain of func */

#define ERANGE 34 /* Math result not representable */

#define EDEADLK 35 /* Resource deadlock would occur */

#define ENAMETOOLONG 36 /* File name too long */

#define ENOLCK 37 /* No record locks available */

#define ENOSYS 38 /* Function not implemented */

#define ENOTEMPTY 39 /* Directory not empty */

#define ELOOP 40 /* Too many symbolic links encountered */

#define EWOULDBLOCK EAGAIN /* Operation would block */

#define ENOMSG 42 /* No message of desired type */

#define EIDRM 43 /* Identifier removed */

#define ECHRNG 44 /* Channel number out of range */

#define EL2NSYNC 45 /* Level 2 not synchronized */

#define EL3HLT 46 /* Level 3 halted */

#define EL3RST 47 /* Level 3 reset */

#define ELNRNG 48 /* Link number out of range */

#define EUNATCH 49 /* Protocol driver not attached */

#define ENOCSI 50 /* No CSI structure available */

#define EL2HLT 51 /* Level 2 halted */

#define EBADE 52 /* Invalid exchange */

#define EBADR 53 /* Invalid request descriptor */

#define EXFULL 54 /* Exchange full */

#define ENOANO 55 /* No anode */

#define EBADRQC 56 /* Invalid request code */

#define EBADSLT 57 /* Invalid slot */

#define EDEADLOCK EDEADLK

#define EBFONT 59 /* Bad font file format */

#define ENOSTR 60 /* Device not a stream */

#define ENODATA 61 /* No data available */

#define ETIME 62 /* Timer expired */

#define ENOSR 63 /* Out of streams resources */

#define ENONET 64 /* Machine is not on the network */

#define ENOPKG 65 /* Package not installed */

#define EREMOTE 66 /* Object is remote */

#define ENOLINK 67 /* Link has been severed */

#define EADV 68 /* Advertise error */

#define ESRMNT 69 /* Srmount error */

#define ECOMM 70 /* Communication error on send */

#define EPROTO 71 /* Protocol error */

#define EMULTIHOP 72 /* Multihop attempted */

#define EDOTDOT 73 /* RFS specific error */

#define EBADMSG 74 /* Not a data message */

#define EOVERFLOW 75 /* Value too large for defined data type */

#define ENOTUNIQ 76 /* Name not unique on network */

#define EBADFD 77 /* File descriptor in bad state */

#define EREMCHG 78 /* Remote address changed */

#define ELIBACC 79 /* Can not access a needed shared library */

#define ELIBBAD 80 /* Accessing a corrupted shared library */

#define ELIBSCN 81 /* .lib section in a.out corrupted */

#define ELIBMAX 82 /* Attempting to link in too many shared libraries */

#define ELIBEXEC 83 /* Cannot exec a shared library directly */

#define EILSEQ 84 /* Illegal byte sequence */

#define ERESTART 85 /* Interrupted system call should be restarted */

#define ESTRPIPE 86 /* Streams pipe error */

#define EUSERS 87 /* Too many users */

#define ENOTSOCK 88 /* Socket operation on non-socket */

#define EDESTADDRREQ 89 /* Destination address required */

#define EMSGSIZE 90 /* Message too long */

#define EPROTOTYPE 91 /* Protocol wrong type for socket */

#define ENOPROTOOPT 92 /* Protocol not available */

#define EPROTONOSUPPORT 93 /* Protocol not supported */

#define ESOCKTNOSUPPORT 94 /* Socket type not supported */

#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */

#define EPFNOSUPPORT 96 /* Protocol family not supported */

#define EAFNOSUPPORT 97 /* Address family not supported by protocol */

#define EADDRINUSE 98 /* Address already in use */

#define EADDRNOTAVAIL 99 /* Cannot assign requested address */

#define ENETDOWN 100 /* Network is down */

#define ENETUNREACH 101 /* Network is unreachable */

#define ENETRESET 102 /* Network dropped connection because of reset */

#define ECONNABORTED 103 /* Software caused connection abort */

#define ECONNRESET 104 /* Connection reset by peer */

#define ENOBUFS 105 /* No buffer space available */

#define EISCONN 106 /* Transport endpoint is already connected */

#define ENOTCONN 107 /* Transport endpoint is not connected */

#define ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */

#define ETOOMANYREFS 109 /* Too many references: cannot splice */

#define ETIMEDOUT 110 /* Connection timed out */

#define ECONNREFUSED 111 /* Connection refused */

#define EHOSTDOWN 112 /* Host is down */

#define EHOSTUNREACH 113 /* No route to host */

#define EALREADY 114 /* Operation already in progress */

#define EINPROGRESS 115 /* Operation now in progress */

#define ESTALE 116 /* Stale NFS file handle */

#define EUCLEAN 117 /* Structure needs cleaning */

#define ENOTNAM 118 /* Not a XENIX named type file */

#define ENAVAIL 119 /* No XENIX semaphores available */

#define EISNAM 120 /* Is a named type file */

#define EREMOTEIO 121 /* Remote I/O error */

#define EDQUOT 122 /* Quota exceeded */

#define ENOMEDIUM 123 /* No medium found */

#define EMEDIUMTYPE 124 /* Wrong medium type */

#endif

相關推薦

errno.h檔案介紹

檢視錯誤程式碼errno是除錯程式的一個重要方法。當linux C api函式發生異常時,一般會將errno變數(需include errno.h)賦一個整數值,不同的值表示不同的含義,可以通過檢視該值推測出錯的原因。在實際程式設計中用這一招解決了不少原本看來莫名其妙的問題。比較 麻煩的是每次都要去l

C++中stdlib.h檔案介紹

stdlib標頭檔案即standard library標準庫標頭檔案,stdlib標頭檔案裡包含了C、C++語言的最常用的系統函式,該檔案包含了C語言標準庫函式的定義,stdlib.h中定義了物種型別:一些巨集和通用工具函式。型別如:size_t、wchar_t、div_t

C++primer(第五版)Sales_item.h檔案

C++primer(第五版)1.51練習章節需要有一個Sales_item類,但是給的網站有點蛋疼,直接複製下面就好咯: #ifndef SALESITEM_H #define SALESITEM_H #include <iostream> #include <string

JNI學習之Android studio 生成.h 檔案

Android Studio  生成.h標頭檔案的方法之一 1、在任意class類 中編寫一個native 方法。 public class MainActivity extends Activity { /** * 編寫native 靜態方法 */

C++ assert.h檔案

NVIDIA面試筆試題之一: assert.h是c標準庫的一個頭檔案,該標頭檔案的主要目的就是提供一個assert的巨集定義。 assert只是對所給的表示式求值,就像if判斷語句中一樣,然後如果該值為真則正常執行,否則報錯,並呼叫abort(),產生異常中斷,exit出來。 該巨集可以

h檔案 lib庫檔案 dll動態庫檔案之間的關係

分享一下我老師大神的人工智慧教程!零基礎,通俗易懂!http://blog.csdn.net/jiangjunshow 也歡迎大家轉載本篇文章。分享知識,造福人民,實現我們中華民族偉大復興!        

android studio ndk生成h檔案(找不到類的問題)

今天在學習android studio的ndk程式設計時遇到了些阻力,再用javah命令生成h標頭檔案時總是失敗,還是沒什麼基礎,網上可以找到許多許多的方法,我只能說總有一款適合你,慢慢試,我的方法如下:在android studio中的teriminal視窗中輸入set classpath=E:\

windows下通過javah.exe生成java類的.h檔案

最近在研究JNI,需要製作java的.h標頭檔案。搞了一下發現AndroidStudio中的終端不好用,就用了windows上面安裝的jdk來製作,記錄一下方便後面檢視。 1.首先保證電腦上面的javah命令可以用,不行的話可以點選此連結:https://jingyan.baidu.com

程式設計基礎35 tips stdio.h檔案下的全域性陣列問題

使用<stdio.h>,然後對程式進行c的執行時, 全域性變數中如果使用字串或者是二維字串, 便會出錯。 一, 例如: #include<stdio.h> #include<string.h> const int max_n = 100; ch

c語言windows.h檔案詳解

如果c語言庫裡沒有某個標頭檔案 只需要將下好的標頭檔案放入下面的路徑即可 windows.h標頭檔案包含的函式及其用法 1.GetAsyncKeyState()()//通過函式來判斷按鍵按下的狀態 主要用法是VK_鍵的名稱 例如 GetAsyncKeyState(VK_SH

ubuntu下找不到sys/time.h檔案(沒有/usr/include/sys目錄)

今天編譯一個工程,編譯器報錯sys/time.h標頭檔案找不到~ 開啟目錄/usr/include看了一下,發現下面根本沒有sys目錄 實際上不是沒有sys目錄,只是系統給換路徑了 32位系統:/usr/incude/i386-linux-gnu/sys 64位系統:/usr/inc

Linux CURL安裝及C程式設計中curl.h檔案缺少問題解決

curl安裝 –獲得安裝包,從網上直接下載或者其他途徑,這裡直接wget # wget http://curl.haxx.se/download/curl-7.17.1.tar.gz  此處可以選擇最新版本。官網http://curl.haxx.se/ –解壓到當前目錄

【C】stdint.h檔案和inttype.h檔案的使用方法

Date: 2018.10.23 1、參考: 2、使用方法     這兩個標頭檔案是C99標準定義的關於型別重定義的,主要目的是實現統一的跨平臺資料定義。但是VC編譯器對C99標準的相容性很差,有

解決ffmpeg引入SDL.h檔案出現undefine reference to'qMain(int,char**)'錯誤

加入SDL的標頭檔案之後,編譯的時候會提示main函式沒有定義 原因是 SDL_main.h中有如下一段話: #if defined(SDL_MAIN_NEEDED) || defined(SDL_MAIN_AVAILABLE) #define ma

Javac編譯生成.h檔案

首先分兩種情況: 1、新建Java工程 ①編譯成.class檔案,重新整理工程編譯或者工程右鍵點選Build Project編譯。(在bin下生成.class檔案) ②在命令列cd 到bin目錄下,執行:javah -classpath . -jni com.android

如何自定義C語言.h檔案

    在專案實踐中,如果一個.c檔案程式過長,可以把檔案中的函式單獨放在一個頭檔案中,然後在.c中包含該標頭檔案即可。這兩天,根據所看的書《C語言的科學與藝術》和網上的資料,發現實際上有兩種寫法。寫法1:在.h標頭檔案中就包含函式的實現,這種標頭檔案實際上是把函式放在一起,

.h檔案 .lib庫檔案 .dll動態連結庫檔案關係

.h標頭檔案是編譯時必須的,lib是連結時需要的,dll是執行時需要的。 附加依賴項的是.lib不是.dll,若生成了DLL,則肯定也生成 LIB檔案。如果要完成原始碼的編譯和連結,有標頭檔案和lib就夠了。如果也使動態連線的程式執行起來,有dll就夠了。在開發和除錯階段,當然最好都有。 .h .lib .

Unix——《Unix網路程式設計》配置unp.h檔案

《Unix網路程式設計 卷1》unp.h 標頭檔案及其編譯問題 本書原始碼下載地址 http://www.unpbook.com 解壓tar -zxvf unpv13e.tar.gz 其實各個編譯過程都在README中,下面給出正確的編譯過程 首

關於編譯“bits/stdc++.h檔案

首先講講“bits/stdc++.h”這個標頭檔案,一般都叫做萬能標頭檔案,比賽的時候用它基本上就不用寫其他的標頭檔案了,大部分的線上判題都支援。G++ 4.4以上就支援這個標頭檔案了 最近遇到的問題是在macos系統下,這段時間蘋果釋出了macOS High

jni.h檔案詳解(一)

1.jni.h標頭檔案路徑:   /usr/lib/jvm/jdk_1.6.0_43/include/jni.h 2.jni.h標頭檔案組成分析圖: 3.下面通過上圖進行分析講解jni.h標頭檔案.   一. jni規範中定義的基本資料型別. #define JNI