| // Copyright 2020 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #include <errno.h> |
| #include <fidl/fuchsia.posix/cpp/wire.h> |
| |
| // This file asserts that the errno definitions in fuchsia.posix/Errno match the ones in errno.h. |
| |
| #define COMPARE(e, fidl, name) \ |
| static_assert(e == static_cast<int32_t>(fidl), \ |
| name " mismatch between errno.h and fuchsia.posix/Errno") |
| |
| #define ASSERT_MATCHES(e, f) COMPARE(e, fuchsia_posix::wire::Errno::f, #e) |
| #define ASSERT_MATCHES_ALIASED(e, f) COMPARE(e, fuchsia_posix::wire::f, #e) |
| |
| ASSERT_MATCHES(EPERM, kEperm); |
| ASSERT_MATCHES(ENOENT, kEnoent); |
| ASSERT_MATCHES(ESRCH, kEsrch); |
| ASSERT_MATCHES(EINTR, kEintr); |
| ASSERT_MATCHES(EIO, kEio); |
| ASSERT_MATCHES(ENXIO, kEnxio); |
| ASSERT_MATCHES(E2BIG, kE2Big); |
| ASSERT_MATCHES(ENOEXEC, kEnoexec); |
| ASSERT_MATCHES(EBADF, kEbadf); |
| ASSERT_MATCHES(ECHILD, kEchild); |
| ASSERT_MATCHES(EAGAIN, kEagain); |
| ASSERT_MATCHES(ENOMEM, kEnomem); |
| ASSERT_MATCHES(EACCES, kEacces); |
| ASSERT_MATCHES(EFAULT, kEfault); |
| ASSERT_MATCHES(ENOTBLK, kEnotblk); |
| ASSERT_MATCHES(EBUSY, kEbusy); |
| ASSERT_MATCHES(EEXIST, kEexist); |
| ASSERT_MATCHES(EXDEV, kExdev); |
| ASSERT_MATCHES(ENODEV, kEnodev); |
| ASSERT_MATCHES(ENOTDIR, kEnotdir); |
| ASSERT_MATCHES(EISDIR, kEisdir); |
| ASSERT_MATCHES(EINVAL, kEinval); |
| ASSERT_MATCHES(ENFILE, kEnfile); |
| ASSERT_MATCHES(EMFILE, kEmfile); |
| ASSERT_MATCHES(ENOTTY, kEnotty); |
| ASSERT_MATCHES(ETXTBSY, kEtxtbsy); |
| ASSERT_MATCHES(EFBIG, kEfbig); |
| ASSERT_MATCHES(ENOSPC, kEnospc); |
| ASSERT_MATCHES(ESPIPE, kEspipe); |
| ASSERT_MATCHES(EROFS, kErofs); |
| ASSERT_MATCHES(EMLINK, kEmlink); |
| ASSERT_MATCHES(EPIPE, kEpipe); |
| ASSERT_MATCHES(EDOM, kEdom); |
| ASSERT_MATCHES(ERANGE, kErange); |
| ASSERT_MATCHES(EDEADLK, kEdeadlk); |
| ASSERT_MATCHES(ENAMETOOLONG, kEnametoolong); |
| ASSERT_MATCHES(ENOLCK, kEnolck); |
| ASSERT_MATCHES(ENOSYS, kEnosys); |
| ASSERT_MATCHES(ENOTEMPTY, kEnotempty); |
| ASSERT_MATCHES(ELOOP, kEloop); |
| ASSERT_MATCHES_ALIASED(EWOULDBLOCK, kEwouldblock); |
| ASSERT_MATCHES(ENOMSG, kEnomsg); |
| ASSERT_MATCHES(EIDRM, kEidrm); |
| ASSERT_MATCHES(ECHRNG, kEchrng); |
| ASSERT_MATCHES(EL2NSYNC, kEl2Nsync); |
| ASSERT_MATCHES(EL3HLT, kEl3Hlt); |
| ASSERT_MATCHES(EL3RST, kEl3Rst); |
| ASSERT_MATCHES(ELNRNG, kElnrng); |
| ASSERT_MATCHES(EUNATCH, kEunatch); |
| ASSERT_MATCHES(ENOCSI, kEnocsi); |
| ASSERT_MATCHES(EL2HLT, kEl2Hlt); |
| ASSERT_MATCHES(EBADE, kEbade); |
| ASSERT_MATCHES(EBADR, kEbadr); |
| ASSERT_MATCHES(EXFULL, kExfull); |
| ASSERT_MATCHES(ENOANO, kEnoano); |
| ASSERT_MATCHES(EBADRQC, kEbadrqc); |
| ASSERT_MATCHES(EBADSLT, kEbadslt); |
| ASSERT_MATCHES_ALIASED(EDEADLOCK, kEdeadlock); |
| ASSERT_MATCHES(EBFONT, kEbfont); |
| ASSERT_MATCHES(ENOSTR, kEnostr); |
| ASSERT_MATCHES(ENODATA, kEnodata); |
| ASSERT_MATCHES(ETIME, kEtime); |
| ASSERT_MATCHES(ENOSR, kEnosr); |
| ASSERT_MATCHES(ENONET, kEnonet); |
| ASSERT_MATCHES(ENOPKG, kEnopkg); |
| ASSERT_MATCHES(EREMOTE, kEremote); |
| ASSERT_MATCHES(ENOLINK, kEnolink); |
| ASSERT_MATCHES(EADV, kEadv); |
| ASSERT_MATCHES(ESRMNT, kEsrmnt); |
| ASSERT_MATCHES(ECOMM, kEcomm); |
| ASSERT_MATCHES(EPROTO, kEproto); |
| ASSERT_MATCHES(EMULTIHOP, kEmultihop); |
| ASSERT_MATCHES(EDOTDOT, kEdotdot); |
| ASSERT_MATCHES(EBADMSG, kEbadmsg); |
| ASSERT_MATCHES(EOVERFLOW, kEoverflow); |
| ASSERT_MATCHES(ENOTUNIQ, kEnotuniq); |
| ASSERT_MATCHES(EBADFD, kEbadfd); |
| ASSERT_MATCHES(EREMCHG, kEremchg); |
| ASSERT_MATCHES(ELIBACC, kElibacc); |
| ASSERT_MATCHES(ELIBBAD, kElibbad); |
| ASSERT_MATCHES(ELIBSCN, kElibscn); |
| ASSERT_MATCHES(ELIBMAX, kElibmax); |
| ASSERT_MATCHES(ELIBEXEC, kElibexec); |
| ASSERT_MATCHES(EILSEQ, kEilseq); |
| ASSERT_MATCHES(ERESTART, kErestart); |
| ASSERT_MATCHES(ESTRPIPE, kEstrpipe); |
| ASSERT_MATCHES(EUSERS, kEusers); |
| ASSERT_MATCHES(ENOTSOCK, kEnotsock); |
| ASSERT_MATCHES(EDESTADDRREQ, kEdestaddrreq); |
| ASSERT_MATCHES(EMSGSIZE, kEmsgsize); |
| ASSERT_MATCHES(EPROTOTYPE, kEprototype); |
| ASSERT_MATCHES(ENOPROTOOPT, kEnoprotoopt); |
| ASSERT_MATCHES(EPROTONOSUPPORT, kEprotonosupport); |
| ASSERT_MATCHES(ESOCKTNOSUPPORT, kEsocktnosupport); |
| ASSERT_MATCHES(EOPNOTSUPP, kEopnotsupp); |
| ASSERT_MATCHES_ALIASED(ENOTSUP, kEnotsup); |
| ASSERT_MATCHES(EPFNOSUPPORT, kEpfnosupport); |
| ASSERT_MATCHES(EAFNOSUPPORT, kEafnosupport); |
| ASSERT_MATCHES(EADDRINUSE, kEaddrinuse); |
| ASSERT_MATCHES(EADDRNOTAVAIL, kEaddrnotavail); |
| ASSERT_MATCHES(ENETDOWN, kEnetdown); |
| ASSERT_MATCHES(ENETUNREACH, kEnetunreach); |
| ASSERT_MATCHES(ENETRESET, kEnetreset); |
| ASSERT_MATCHES(ECONNABORTED, kEconnaborted); |
| ASSERT_MATCHES(ECONNRESET, kEconnreset); |
| ASSERT_MATCHES(ENOBUFS, kEnobufs); |
| ASSERT_MATCHES(EISCONN, kEisconn); |
| ASSERT_MATCHES(ENOTCONN, kEnotconn); |
| ASSERT_MATCHES(ESHUTDOWN, kEshutdown); |
| ASSERT_MATCHES(ETOOMANYREFS, kEtoomanyrefs); |
| ASSERT_MATCHES(ETIMEDOUT, kEtimedout); |
| ASSERT_MATCHES(ECONNREFUSED, kEconnrefused); |
| ASSERT_MATCHES(EHOSTDOWN, kEhostdown); |
| ASSERT_MATCHES(EHOSTUNREACH, kEhostunreach); |
| ASSERT_MATCHES(EALREADY, kEalready); |
| ASSERT_MATCHES(EINPROGRESS, kEinprogress); |
| ASSERT_MATCHES(ESTALE, kEstale); |
| ASSERT_MATCHES(EUCLEAN, kEuclean); |
| ASSERT_MATCHES(ENOTNAM, kEnotnam); |
| ASSERT_MATCHES(ENAVAIL, kEnavail); |
| ASSERT_MATCHES(EISNAM, kEisnam); |
| ASSERT_MATCHES(EREMOTEIO, kEremoteio); |
| ASSERT_MATCHES(EDQUOT, kEdquot); |
| ASSERT_MATCHES(ENOMEDIUM, kEnomedium); |
| ASSERT_MATCHES(EMEDIUMTYPE, kEmediumtype); |
| ASSERT_MATCHES(ECANCELED, kEcanceled); |
| ASSERT_MATCHES(ENOKEY, kEnokey); |
| ASSERT_MATCHES(EKEYEXPIRED, kEkeyexpired); |
| ASSERT_MATCHES(EKEYREVOKED, kEkeyrevoked); |
| ASSERT_MATCHES(EKEYREJECTED, kEkeyrejected); |
| ASSERT_MATCHES(EOWNERDEAD, kEownerdead); |
| ASSERT_MATCHES(ENOTRECOVERABLE, kEnotrecoverable); |
| ASSERT_MATCHES(ERFKILL, kErfkill); |
| ASSERT_MATCHES(EHWPOISON, kEhwpoison); |