VirtualBox

source: kBuild/vendor/grep/current/gnulib-tests/test-errno.c@ 3530

Last change on this file since 3530 was 3529, checked in by bird, 3 years ago

Imported grep 3.7 from grep-3.7.tar.gz (sha256: c22b0cf2d4f6bbe599c902387e8058990e1eee99aef333a203829e5fd3dbb342), applying minimal auto-props.

  • Property svn:eol-style set to native
File size: 2.9 KB
Line 
1/* Test of <errno.h> substitute.
2 Copyright (C) 2008-2021 Free Software Foundation, Inc.
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
16
17/* Written by Bruno Haible <[email protected]>, 2008. */
18
19#include <config.h>
20
21#include <errno.h>
22
23/* Verify that the POSIX mandated errno values exist and can be used as
24 initializers outside of a function.
25 The variable names happen to match the Linux/x86 error numbers. */
26int e1 = EPERM;
27int e2 = ENOENT;
28int e3 = ESRCH;
29int e4 = EINTR;
30int e5 = EIO;
31int e6 = ENXIO;
32int e7 = E2BIG;
33int e8 = ENOEXEC;
34int e9 = EBADF;
35int e10 = ECHILD;
36int e11 = EAGAIN;
37int e11a = EWOULDBLOCK;
38int e12 = ENOMEM;
39int e13 = EACCES;
40int e14 = EFAULT;
41int e16 = EBUSY;
42int e17 = EEXIST;
43int e18 = EXDEV;
44int e19 = ENODEV;
45int e20 = ENOTDIR;
46int e21 = EISDIR;
47int e22 = EINVAL;
48int e23 = ENFILE;
49int e24 = EMFILE;
50int e25 = ENOTTY;
51int e26 = ETXTBSY;
52int e27 = EFBIG;
53int e28 = ENOSPC;
54int e29 = ESPIPE;
55int e30 = EROFS;
56int e31 = EMLINK;
57int e32 = EPIPE;
58int e33 = EDOM;
59int e34 = ERANGE;
60int e35 = EDEADLK;
61int e36 = ENAMETOOLONG;
62int e37 = ENOLCK;
63int e38 = ENOSYS;
64int e39 = ENOTEMPTY;
65int e40 = ELOOP;
66int e42 = ENOMSG;
67int e43 = EIDRM;
68int e67 = ENOLINK;
69int e71 = EPROTO;
70int e72 = EMULTIHOP;
71int e74 = EBADMSG;
72int e75 = EOVERFLOW;
73int e84 = EILSEQ;
74int e88 = ENOTSOCK;
75int e89 = EDESTADDRREQ;
76int e90 = EMSGSIZE;
77int e91 = EPROTOTYPE;
78int e92 = ENOPROTOOPT;
79int e93 = EPROTONOSUPPORT;
80int e95 = EOPNOTSUPP;
81int e95a = ENOTSUP;
82int e97 = EAFNOSUPPORT;
83int e98 = EADDRINUSE;
84int e99 = EADDRNOTAVAIL;
85int e100 = ENETDOWN;
86int e101 = ENETUNREACH;
87int e102 = ENETRESET;
88int e103 = ECONNABORTED;
89int e104 = ECONNRESET;
90int e105 = ENOBUFS;
91int e106 = EISCONN;
92int e107 = ENOTCONN;
93int e110 = ETIMEDOUT;
94int e111 = ECONNREFUSED;
95int e113 = EHOSTUNREACH;
96int e114 = EALREADY;
97int e115 = EINPROGRESS;
98int e116 = ESTALE;
99int e122 = EDQUOT;
100int e125 = ECANCELED;
101int e130 = EOWNERDEAD;
102int e131 = ENOTRECOVERABLE;
103
104/* Don't verify that these errno values are all different, except for possibly
105 EWOULDBLOCK == EAGAIN. Even Linux/x86 does not pass this check: it has
106 ENOTSUP == EOPNOTSUPP. */
107
108int
109main ()
110{
111 /* Verify that errno can be assigned. */
112 errno = EOVERFLOW;
113
114 /* snprintf() callers want to distinguish EINVAL and EOVERFLOW. */
115 if (errno == EINVAL)
116 return 1;
117
118 return 0;
119}
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette