c library-errno.h

来源:互联网 发布:宏业询价通道软件 编辑:程序博客网 时间:2024/05/22 02:19

此函数定义了宏:

  int errno;


errno

这个宏被扩展成一个int型的左值。在程序开始执行时置为0,而后被特定函数修改为非0值以指示出错类型。当然也可以人为的修改errno的值。


在这个头文件中至少声明了以下两个宏,用于errno的值:

EDOM:Domain error, 一些数学函数只接受特定范围的值,如果用一个负数作为参数调用sqrt则引发EDOM 

ERANGE: Range error,由于值太大或太小而超过了变量表示的范围



另外,Posix添加了如下宏:


#define E2BIG          [argument list too long]

#define EACCES         [process lacks access permission]

#define EAGAIN          [resource temporarily unavailable]

#define EBADF       [bad file descriptor]

#define EBADMSG          [bad message]

#define EBUSY         [resource is busy]

#define ECANCELED       [operation canceled]

#define ECHILD          [no child process present]

#define EDEADLK         [resource deadlock was avoided]

#define EEXIST         [file already exists]

#define EFAULT        [bad memory address]

#define EFBIG          [file would become too big]

#define EINPROGRESS         [asynchronous operation not completed]

#define EINTR         [operation interrupted by a signal]

#define EINVAL        [invalid argument]

#define EIO         [input/output error]

#define EISDIR         [can't write to a directory]

#define EMFILE         [process has too many files open]

#define EMLINK         [too many links to a file]

#define EMSGSIZE         [bad message buffer size]

#define ENAMETOOLONG         [file name too long]

#define ENFILE         [system has too many files open]

#define ENODEV          [invalid device operation]

#define ENOENT         [bad file or directory name]

#define ENOEXEC         [can't execute file]

#define ENOLCK         [too many locks on a file or record]

#define ENOMEM         [insufficient memory]

#define ENOSPC         [insufficient space on a device]

#define ENOSYS          [unimplemented function]

#define ENOTDIR         [invalid directory name]

#define ENOTEMPTY        [directory not empty]

#define ENOTSUP         [unsupported feature[

#define ENOTTY          [bad I/O control operation]

#define ENXIO          [bad device specifier]

#define EPERM          [process lacks permission]

#define EPIPE        [write to a broken pipe]

#define EROFS           [write to a read-only file system]

#define ESPIPE          [seek on a pipe]

#define ESRCH           [process search failed]

#define ETIMEDOUT            [time limit expired]

#define EXDEV           [link across file systems]

原创粉丝点击