aboutsummaryrefslogtreecommitdiff
path: root/cddl/lib/libdtrace
diff options
context:
space:
mode:
authorDevin Teske <dteske@FreeBSD.org>2018-02-16 04:22:29 +0000
committerDevin Teske <dteske@FreeBSD.org>2018-02-16 04:22:29 +0000
commit492494d92fcb954a51c15c890abf44c2f6311be4 (patch)
tree5fd3ab0d5cf5791af8f0b0e9d9c63f478268166f /cddl/lib/libdtrace
parent27fac8ff4c078b950b250ee2fbd7e5a0c3eed663 (diff)
downloadsrc-492494d92fcb954a51c15c890abf44c2f6311be4.tar.gz
src-492494d92fcb954a51c15c890abf44c2f6311be4.zip
Add inline to errno.d for translating int to string
Gives DTrace scripts strerror(3) functionality. Reviewed by: markj Sponsored by: Smule, Inc. Differential Revision: https://reviews.freebsd.org/D14386
Notes
Notes: svn path=/head/; revision=329353
Diffstat (limited to 'cddl/lib/libdtrace')
-rw-r--r--cddl/lib/libdtrace/errno.d110
1 files changed, 110 insertions, 0 deletions
diff --git a/cddl/lib/libdtrace/errno.d b/cddl/lib/libdtrace/errno.d
index 44ebad08960e..373657b5beb4 100644
--- a/cddl/lib/libdtrace/errno.d
+++ b/cddl/lib/libdtrace/errno.d
@@ -20,6 +20,7 @@
* CDDL HEADER END
*
* Portions Copyright 2006-2008 John Birrell jb@freebsd.org
+ * Portions Copyright 2018 Devin Teske dteske@freebsd.org
*
* $FreeBSD$
*/
@@ -236,3 +237,112 @@ inline int EDIRIOCTL = -4;
#pragma D binding "1.0" EDIRIOCTL
inline int ERELOOKUP = -5;
#pragma D binding "1.13" ERELOOKUP
+
+/*
+ * Error strings from <sys/errno.h>
+ */
+#pragma D binding "1.13" strerror
+inline string strerror[int errno] =
+ errno == 0 ? "Success" :
+ errno == EPERM ? "Operation not permitted" :
+ errno == ENOENT ? "No such file or directory" :
+ errno == ESRCH ? "No such process" :
+ errno == EINTR ? "Interrupted system call" :
+ errno == EIO ? "Input/output error" :
+ errno == ENXIO ? "Device not configured" :
+ errno == E2BIG ? "Argument list too long" :
+ errno == ENOEXEC ? "Exec format error" :
+ errno == EBADF ? "Bad file descriptor" :
+ errno == ECHILD ? "No child processes" :
+ errno == EDEADLK ? "Resource deadlock avoided" :
+ errno == ENOMEM ? "Cannot allocate memory" :
+ errno == EACCES ? "Permission denied" :
+ errno == EFAULT ? "Bad address" :
+ errno == ENOTBLK ? "Block device required" :
+ errno == EBUSY ? "Device busy" :
+ errno == EEXIST ? "File exists" :
+ errno == EXDEV ? "Cross-device link" :
+ errno == ENODEV ? "Operation not supported by device" :
+ errno == ENOTDIR ? "Not a directory" :
+ errno == EISDIR ? "Is a directory" :
+ errno == EINVAL ? "Invalid argument" :
+ errno == ENFILE ? "Too many open files in system" :
+ errno == EMFILE ? "Too many open files" :
+ errno == ENOTTY ? "Inappropriate ioctl for device" :
+ errno == ETXTBSY ? "Text file busy" :
+ errno == EFBIG ? "File too large" :
+ errno == ENOSPC ? "No space left on device" :
+ errno == ESPIPE ? "Illegal seek" :
+ errno == EROFS ? "Read-only filesystem" :
+ errno == EMLINK ? "Too many links" :
+ errno == EPIPE ? "Broken pipe" :
+ errno == EDOM ? "Numerical argument out of domain" :
+ errno == ERANGE ? "Result too large" :
+ errno == EAGAIN ? "Resource temporarily unavailable" :
+ errno == EINPROGRESS ? "Operation now in progress" :
+ errno == EALREADY ? "Operation already in progress" :
+ errno == ENOTSOCK ? "Socket operation on non-socket" :
+ errno == EDESTADDRREQ ? "Destination address required" :
+ errno == EMSGSIZE ? "Message too long" :
+ errno == EPROTOTYPE ? "Protocol wrong type for socket" :
+ errno == ENOPROTOOPT ? "Protocol not available" :
+ errno == EPROTONOSUPPORT ? "Protocol not supported" :
+ errno == ESOCKTNOSUPPORT ? "Socket type not supported" :
+ errno == EOPNOTSUPP ? "Operation not supported" :
+ errno == EPFNOSUPPORT ? "Protocol family not supported" :
+ errno == EAFNOSUPPORT ? "Address family not supported by protocol family" :
+ errno == EADDRINUSE ? "Address already in use" :
+ errno == EADDRNOTAVAIL ? "Can't assign requested address" :
+ errno == ENETDOWN ? "Network is down" :
+ errno == ENETUNREACH ? "Network is unreachable" :
+ errno == ENETRESET ? "Network dropped connection on reset" :
+ errno == ECONNABORTED ? "Software caused connection abort" :
+ errno == ECONNRESET ? "Connection reset by peer" :
+ errno == ENOBUFS ? "No buffer space available" :
+ errno == EISCONN ? "Socket is already connected" :
+ errno == ENOTCONN ? "Socket is not connected" :
+ errno == ESHUTDOWN ? "Can't send after socket shutdown" :
+ errno == ETOOMANYREFS ? "Too many references: can't splice" :
+ errno == ETIMEDOUT ? "Operation timed out" :
+ errno == ECONNREFUSED ? "Connection refused" :
+ errno == ELOOP ? "Too many levels of symbolic links" :
+ errno == ENAMETOOLONG ? "File name too long" :
+ errno == EHOSTDOWN ? "Host is down" :
+ errno == EHOSTUNREACH ? "No route to host" :
+ errno == ENOTEMPTY ? "Directory not empty" :
+ errno == EPROCLIM ? "Too many processes" :
+ errno == EUSERS ? "Too many users" :
+ errno == EDQUOT ? "Disc quota exceeded" :
+ errno == ESTALE ? "Stale NFS file handle" :
+ errno == EREMOTE ? "Too many levels of remote in path" :
+ errno == EBADRPC ? "RPC struct is bad" :
+ errno == ERPCMISMATCH ? "RPC version wrong" :
+ errno == EPROGUNAVAIL ? "RPC prog. not avail" :
+ errno == EPROGMISMATCH ? "Program version wrong" :
+ errno == EPROCUNAVAIL ? "Bad procedure for program" :
+ errno == ENOLCK ? "No locks available" :
+ errno == ENOSYS ? "Function not implemented" :
+ errno == EFTYPE ? "Inappropriate file type or format" :
+ errno == EAUTH ? "Authentication error" :
+ errno == ENEEDAUTH ? "Need authenticator" :
+ errno == EIDRM ? "Identifier removed" :
+ errno == ENOMSG ? "No message of desired type" :
+ errno == EOVERFLOW ? "Value too large to be stored in data type" :
+ errno == ECANCELED ? "Operation canceled" :
+ errno == EILSEQ ? "Illegal byte sequence" :
+ errno == ENOATTR ? "Attribute not found" :
+ errno == EDOOFUS ? "Programming error" :
+ errno == EBADMSG ? "Bad message" :
+ errno == EMULTIHOP ? "Multihop attempted" :
+ errno == ENOLINK ? "Link has been severed" :
+ errno == EPROTO ? "Protocol error" :
+ errno == ENOTCAPABLE ? "Capabilities insufficient" :
+ errno == ECAPMODE ? "Not permitted in capability mode" :
+ errno == ENOTRECOVERABLE ? "State not recoverable" :
+ errno == EOWNERDEAD ? "Previous owner died" :
+ errno == ERESTART ? "restart syscall" :
+ errno == EJUSTRETURN ? "don't modify regs, just return" :
+ errno == ENOIOCTL ? "ioctl not handled by this layer" :
+ errno == EDIRIOCTL ? "do direct ioctl in GEOM" :
+ errno == ERELOOKUP ? "retry the directory lookup" :
+ "Unknown error";