00001 /* Test of <errno.h> substitute. 00002 Copyright (C) 2008 Free Software Foundation, Inc. 00003 00004 This program is free software: you can redistribute it and/or modify 00005 it under the terms of the GNU General Public License as published by 00006 the Free Software Foundation; either version 3 of the License, or 00007 (at your option) any later version. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 GNU General Public License for more details. 00013 00014 You should have received a copy of the GNU General Public License 00015 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 00016 00017 /* Written by Bruno Haible <bruno@clisp.org>, 2008. */ 00018 00019 #include <config.h> 00020 00021 #include <errno.h> 00022 00023 /* Verify that the POSIX mandated errno values exist and can be used as 00024 initializers outside of a function. 00025 The variable names happen to match the Linux/x86 error numbers. */ 00026 int e1 = EPERM; 00027 int e2 = ENOENT; 00028 int e3 = ESRCH; 00029 int e4 = EINTR; 00030 int e5 = EIO; 00031 int e6 = ENXIO; 00032 int e7 = E2BIG; 00033 int e8 = ENOEXEC; 00034 int e9 = EBADF; 00035 int e10 = ECHILD; 00036 int e11 = EAGAIN; 00037 int e11a = EWOULDBLOCK; 00038 int e12 = ENOMEM; 00039 int e13 = EACCES; 00040 int e14 = EFAULT; 00041 int e16 = EBUSY; 00042 int e17 = EEXIST; 00043 int e18 = EXDEV; 00044 int e19 = ENODEV; 00045 int e20 = ENOTDIR; 00046 int e21 = EISDIR; 00047 int e22 = EINVAL; 00048 int e23 = ENFILE; 00049 int e24 = EMFILE; 00050 int e25 = ENOTTY; 00051 int e26 = ETXTBSY; 00052 int e27 = EFBIG; 00053 int e28 = ENOSPC; 00054 int e29 = ESPIPE; 00055 int e30 = EROFS; 00056 int e31 = EMLINK; 00057 int e32 = EPIPE; 00058 int e33 = EDOM; 00059 int e34 = ERANGE; 00060 int e35 = EDEADLK; 00061 int e36 = ENAMETOOLONG; 00062 int e37 = ENOLCK; 00063 int e38 = ENOSYS; 00064 int e39 = ENOTEMPTY; 00065 int e40 = ELOOP; 00066 int e42 = ENOMSG; 00067 int e43 = EIDRM; 00068 int e67 = ENOLINK; 00069 int e71 = EPROTO; 00070 int e72 = EMULTIHOP; 00071 int e74 = EBADMSG; 00072 int e75 = EOVERFLOW; 00073 int e84 = EILSEQ; 00074 int e88 = ENOTSOCK; 00075 int e89 = EDESTADDRREQ; 00076 int e90 = EMSGSIZE; 00077 int e91 = EPROTOTYPE; 00078 int e92 = ENOPROTOOPT; 00079 int e93 = EPROTONOSUPPORT; 00080 int e95 = EOPNOTSUPP; 00081 int e95a = ENOTSUP; 00082 int e97 = EAFNOSUPPORT; 00083 int e98 = EADDRINUSE; 00084 int e99 = EADDRNOTAVAIL; 00085 int e100 = ENETDOWN; 00086 int e101 = ENETUNREACH; 00087 int e102 = ENETRESET; 00088 int e103 = ECONNABORTED; 00089 int e104 = ECONNRESET; 00090 int e105 = ENOBUFS; 00091 int e106 = EISCONN; 00092 int e107 = ENOTCONN; 00093 int e110 = ETIMEDOUT; 00094 int e111 = ECONNREFUSED; 00095 int e113 = EHOSTUNREACH; 00096 int e114 = EALREADY; 00097 int e115 = EINPROGRESS; 00098 int e116 = ESTALE; 00099 int e122 = EDQUOT; 00100 int e125 = ECANCELED; 00101 00102 /* Don't verify that these errno values are all different, except for possibly 00103 EWOULDBLOCK == EAGAIN. Even Linux/x86 does not pass this check: it has 00104 ENOTSUP == EOPNOTSUPP. */ 00105 00106 int 00107 main () 00108 { 00109 /* Verify that errno can be assigned. */ 00110 errno = EOVERFLOW; 00111 00112 /* snprintf() callers want to distinguish EINVAL and EOVERFLOW. */ 00113 if (errno == EINVAL) 00114 return 1; 00115 00116 return 0; 00117 }
1.5.6