Home | History | Annotate | Download | only in lib
      1 /*
      2  * Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
      3  * Copyright (c) 2009-2013 Cyril Hrubis <chrubis (at) suse.cz>
      4  *
      5  * This program is free software; you can redistribute it and/or modify it
      6  * under the terms of version 2 of the GNU General Public License as
      7  * published by the Free Software Foundation.
      8  *
      9  * This program is distributed in the hope that it would be useful, but
     10  * WITHOUT ANY WARRANTY; without even the implied warranty of
     11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     12  *
     13  * Further, this software is distributed without any warranty that it is
     14  * free of the rightful claim of any third person regarding infringement
     15  * or the like.  Any license provided herein, whether implied or
     16  * otherwise, applies only to this software file.  Patent licenses, if
     17  * any, provided herein do not apply to combinations of this program with
     18  * other software, or any other product whatsoever.
     19  *
     20  * You should have received a copy of the GNU General Public License along
     21  * with this program; if not, write the Free Software Foundation, Inc.,
     22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
     23  *
     24  * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
     25  * Mountain View, CA  94043, or:
     26  */
     27 
     28 const char *tst_strerrno(int err)
     29 {
     30 	static const struct pair errno_pairs[] = {
     31 		STRPAIR(0, "SUCCESS")
     32 		/* asm-generic/errno-base.h */
     33 		PAIR(EPERM)
     34 		PAIR(ENOENT)
     35 		PAIR(ESRCH)
     36 		PAIR(EINTR)
     37 		PAIR(EIO)
     38 		PAIR(ENXIO)
     39 		PAIR(E2BIG)
     40 		PAIR(ENOEXEC)
     41 		PAIR(EBADF)
     42 		PAIR(ECHILD)
     43 		STRPAIR(EAGAIN, "EAGAIN/EWOULDBLOCK")
     44 		PAIR(ENOMEM)
     45 		PAIR(EACCES)
     46 		PAIR(EFAULT)
     47 		PAIR(ENOTBLK)
     48 		PAIR(EBUSY)
     49 		PAIR(EEXIST)
     50 		PAIR(EXDEV)
     51 		PAIR(ENODEV)
     52 		PAIR(ENOTDIR)
     53 		PAIR(EISDIR)
     54 		PAIR(EINVAL)
     55 		PAIR(ENFILE)
     56 		PAIR(EMFILE)
     57 		PAIR(ENOTTY)
     58 		PAIR(ETXTBSY)
     59 		PAIR(EFBIG)
     60 		PAIR(ENOSPC)
     61 		PAIR(ESPIPE)
     62 		PAIR(EROFS)
     63 		PAIR(EMLINK)
     64 		PAIR(EPIPE)
     65 		PAIR(EDOM)
     66 		PAIR(ERANGE)
     67 		/* asm-generic/errno.h */
     68 		PAIR(EDEADLK)
     69 		PAIR(ENAMETOOLONG)
     70 		PAIR(ENOLCK)
     71 		PAIR(ENOSYS)
     72 		PAIR(ENOTEMPTY)
     73 		PAIR(ELOOP)
     74 		/* EWOULDBLOCK == EAGAIN skipped */
     75 		PAIR(ENOMSG)
     76 		PAIR(EIDRM)
     77 		PAIR(ECHRNG)
     78 		PAIR(EL2NSYNC)
     79 		PAIR(EL3HLT)
     80 		PAIR(EL3RST)
     81 		PAIR(ELNRNG)
     82 		PAIR(EUNATCH)
     83 		PAIR(ENOCSI)
     84 		PAIR(EL2HLT)
     85 		PAIR(EBADE)
     86 		PAIR(EBADR)
     87 		PAIR(EXFULL)
     88 		PAIR(ENOANO)
     89 		PAIR(EBADRQC)
     90 		PAIR(EBADSLT)
     91 		/* EDEADLOCK == EDEADLK skipped */
     92 		PAIR(EBFONT)
     93 		PAIR(ENOSTR)
     94 		PAIR(ENODATA)
     95 		PAIR(ETIME)
     96 		PAIR(ENOSR)
     97 		PAIR(ENONET)
     98 		PAIR(ENOPKG)
     99 		PAIR(EREMOTE)
    100 		PAIR(ENOLINK)
    101 		PAIR(EADV)
    102 		PAIR(ESRMNT)
    103 		PAIR(ECOMM)
    104 		PAIR(EPROTO)
    105 		PAIR(EMULTIHOP)
    106 		PAIR(EDOTDOT)
    107 		PAIR(EBADMSG)
    108 		PAIR(EOVERFLOW)
    109 		PAIR(ENOTUNIQ)
    110 		PAIR(EBADFD)
    111 		PAIR(EREMCHG)
    112 		PAIR(ELIBACC)
    113 		PAIR(ELIBBAD)
    114 		PAIR(ELIBSCN)
    115 		PAIR(ELIBMAX)
    116 		PAIR(ELIBEXEC)
    117 		PAIR(EILSEQ)
    118 		PAIR(ERESTART)
    119 		PAIR(ESTRPIPE)
    120 		PAIR(EUSERS)
    121 		PAIR(ENOTSOCK)
    122 		PAIR(EDESTADDRREQ)
    123 		PAIR(EMSGSIZE)
    124 		PAIR(EPROTOTYPE)
    125 		PAIR(ENOPROTOOPT)
    126 		PAIR(EPROTONOSUPPORT)
    127 		PAIR(ESOCKTNOSUPPORT)
    128 		PAIR(EOPNOTSUPP)
    129 		PAIR(EPFNOSUPPORT)
    130 		PAIR(EAFNOSUPPORT)
    131 		PAIR(EADDRINUSE)
    132 		PAIR(EADDRNOTAVAIL)
    133 		PAIR(ENETDOWN)
    134 		PAIR(ENETUNREACH)
    135 		PAIR(ENETRESET)
    136 		PAIR(ECONNABORTED)
    137 		PAIR(ECONNRESET)
    138 		PAIR(ENOBUFS)
    139 		PAIR(EISCONN)
    140 		PAIR(ENOTCONN)
    141 		PAIR(ESHUTDOWN)
    142 		PAIR(ETOOMANYREFS)
    143 		PAIR(ETIMEDOUT)
    144 		PAIR(ECONNREFUSED)
    145 		PAIR(EHOSTDOWN)
    146 		PAIR(EHOSTUNREACH)
    147 		PAIR(EALREADY)
    148 		PAIR(EINPROGRESS)
    149 		PAIR(ESTALE)
    150 		PAIR(EUCLEAN)
    151 		PAIR(ENOTNAM)
    152 		PAIR(ENAVAIL)
    153 		PAIR(EISNAM)
    154 		PAIR(EREMOTEIO)
    155 		PAIR(EDQUOT)
    156 		PAIR(ENOMEDIUM)
    157 		PAIR(EMEDIUMTYPE)
    158 		PAIR(ECANCELED)
    159 #ifdef ENOKEY
    160 		PAIR(ENOKEY)
    161 #endif
    162 #ifdef EKEYEXPIRED
    163 		PAIR(EKEYEXPIRED)
    164 #endif
    165 #ifdef EKEYREVOKED
    166 		PAIR(EKEYREVOKED)
    167 #endif
    168 #ifdef EKEYREJECTED
    169 		PAIR(EKEYREJECTED)
    170 #endif
    171 #ifdef EOWNERDEAD
    172 		PAIR(EOWNERDEAD)
    173 #endif
    174 #ifdef ENOTRECOVERABLE
    175 		PAIR(ENOTRECOVERABLE)
    176 #endif
    177 #ifdef ERFKILL
    178 		PAIR(ERFKILL)
    179 #endif
    180 #ifdef EHWPOISON
    181 		PAIR(EHWPOISON)
    182 #endif
    183 	};
    184 
    185 	PAIR_LOOKUP(errno_pairs, err);
    186 }
    187