errno error code meaning and use

Source: Internet
Author: User
Tags error code reset socket connection reset

Today, when you use _trename for file renaming, consider the possibility of renaming failures, and you need to log the errors corresponding to the error. From MSDN, the function fails to return a non-0, and the corresponding error code may be known through the errno macro. In order to locate the convenience of the problem, the error code corresponding to the meaning listed.

1, errno error code meaning

<asm-generic/errno-base.h> #ifndef _asm_generic_errno_base_h #define _ASM_GENERIC_ERRNO_BASE_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 */#d Efine E2big 7/* Argument list too long */#define ENOEXEC 8/* Exec Format error */# Define EBADF 9/* Bad file number */#define ECHILD/* No child processes */#defin                                                                                  

  E eagain/* Try again */ #define ENOMEM/* Out of Memory */#define EACCES//Permission denied */#de Fine Efault 14     /* Bad address */#define ENOTBLK/* Block device required */#define EBUSY 16/ * Device or resource busy */#define EEXIST/* File exists */#define EXDEV/* Cr Oss-device link */#define ENODEV */No such device */#define ENOTDIR/* Not a Dir Ectory */#define EISDIR/* is a directory */#define EINVAL */Invalid argument * /#define ENFILE/* File table overflow */#define EMFILE//Too many open files * /#define ENOTTY */Not a typewriter */#define ETXTBSY/* Text file Busy */#de Fine efbig/* File too large */#define ENOSPC/* No space left on device */#defin          E espipe/* illegal seek */#define EROFS//read-only File system */#define Emlink *//TooMany links */#define EPIPE/* Broken pipe */#define EDOM//Math argument out of D Omain of Func */#define ERANGE/* Math result not representable */#endif <linux/asm-generic  /errno.h> #define EDEADLK//Resource deadlock would occur * * #define ENAMETOOLONG 36/*      File name too long */#define ENOLCK Notoginseng */No record locks available */#define ENOSYS 38      /* Function not implemented */#define ENOTEMPTY/* Directory not empty */#define ELOOP 40 /* Too Many symbolic links encountered */#define EWOULDBLOCK eagain/* operation would block */#define ENOM SG/* No message of desired type */#define EIDRM//Identifier removed */#define 

 ECHRNG */* Channel number out of range */#define EL2NSYNC */Level 2 not synchronized */       #define El3hlt   */Level 3 halted */#define EL3RST */Level 3 Reset */#define ELNRNG 48/*          Link number out of range */#define EUNATCH */Protocol driver not attached */#define ENOCSI           */NO CSI structure available */#define EL2HLT */Level 2 halted */#define Ebade          */* Invalid Exchange */#define EBADR */Invalid Request descriptor */#define Exfull */* Exchange full */#define ENOANO */No Anode */#define EBADRQC//Inva Lid request Code */#define EBADSLT/* Invalid slot */#define EDEADLOCK EDEADLK #define E Bfont/* Bad font file format */#define ENOSTR/* Device not a stream */#define Enod           ATA */* NO data available */#define ETIME//Timer Expired */#define ENOSR + */out of streams resources * * #define ENONET */Machine was not on the network */#define ENOPKG */Pa Ckage not installed */#define EREMOTE */Object is remote */#define ENOLINK */* Link ha  s been severed */#define EADV//Advertise Error */#define ESRMNT/* Srmount error */#define ECOMM/* Communication error on Send */#define EPROTO//Protocol Error */#define EMULTIHOP */multihop attempted */#define EDOTDOT//RFS specific error */#d Efine ebadmsg * * * NOT a data message * * #define EOVERFLOW/* Value too large for defined dat A type */#define ENOTUNIQ/* Name not unique on network */#define EBADFD */* File DESCR Iptor in Bad state */#define EREMCHG/* Remote address changed */#define ELIBACC/* Ca n not access a needed shAred Library */#define ELIBBAD/* Accessing a corrupted Shared library */#define ELIBSCN 81 /* Lib section in a.out corrupted */#define ELIBMAX/* Attempting to link in too many shared Librari ES */#define ELIBEXEC/cannot exec a shared library directly */#define EILSEQ/* ILL         Egal byte sequence */#define ERESTART//interrupted system call should be restarted */#define Estrpipe       */* Streams pipe Error */#define EUSERS */Too many users */#define ENOTSOCK 88  /* Socket operation on Non-socket */#define EDESTADDRREQ//Destination address required */#define Emsgsize/* Message too long */#define EPROTOTYPE */* Protocol wrong type for socket */#de Fine enoprotoopt */Protocol Not available */#define EPROTONOSUPPORT */* Protocol not supported */# Define Esocktnosupport 94/* Socket type not supported */#define EOPNOTSUPP/* Operation not supported on transport endpoint * /#define Epfnosupport */Protocol family not supported */#define EAFNOSUPPORT//Address Family      Not supported by protocol */#define EADDRINUSE 98/* Address already in use */#define EADDRNOTAVAIL 99 /* Cannot assign requested address */#define ENETDOWN/* Network is down */#define Enetunreach 10 1/* Network is unreachable */#define ENETRESET 102/* Network dropped connection because of reset */#de Fine econnaborted 103/* Software caused connection abort */#define ECONNRESET 104/* Connection Reset B Y peer */#define ENOBUFS/No buffer space available */#define EISCONN 106/* Transport E Ndpoint is already connected */#define ENOTCONN 107 */Transport endpoint is not connected */#define ESHUTD OWN 108/* CanNot send after transport endpoint shutdown */#define ETOOMANYREFS 109/* Too many References:cannot splice */# Define Etimedout//Connection timed out */#define ECONNREFUSED 111/* Connection refused */#defin        E Ehostdown * * * host is down */#define EHOSTUNREACH 113 * * No route to Host */#define Ealready * * Operation already in progress */#define EINPROGRESS/* Operation now in progress */#define Estale $/* Stale NFS file handle */#define EUCLEAN 117/* Structure needs cleaning */#defi NE enotnam 118/* Not a XENIX named type file */#define ENAVAIL 119 * No xenix semaphores Avail Able */#define EISNAM/* is a named type file */#define EREMOTEIO 121/* Remote I/o Erro R */#define EDQUOT 122/* Quota exceeded */#define ENOMEDIUM 123/* No Medium found */#defi  NE emediumtype 124   /* Wrong medium type */#define ecanceled/* Operation Canceled */#define ENOKEY 126/* R Equired Key Not Available */#define EKEYEXPIRED 127/* Key has expired */#define EKEYREVOKED/* Ke Y has been revoked */#define EKEYREJECTED 129/* Key was rejected by service */* for robust mutexes */#def INE Eownerdead */* Owner died */#define ENOTRECOVERABLE 131 * State not recoverable */#define ERFKI     LL operation/* possible due to Rf-kill */#endif


2, the use of errno
Errno is actually a macro, by calling the macro to get the corresponding error code, the relevant code is as follows:

        int nret = _trename (_t ("E:\\test123.txt"), _t ("E:\\test456.txt"));
        if (nret! = 0)
        {
                CString strerr;
                Strerr.format (_t ("fail to _trename, errno:%d"), errno);
                AfxMessageBox (Strerr);
        }



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.