From owner-svn-src-head@freebsd.org Fri Feb 16 04:22:30 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 03B4DF120C8; Fri, 16 Feb 2018 04:22:30 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AA61F82E5E; Fri, 16 Feb 2018 04:22:29 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A53D680D; Fri, 16 Feb 2018 04:22:29 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1G4MTri021809; Fri, 16 Feb 2018 04:22:29 GMT (envelope-from dteske@FreeBSD.org) Received: (from dteske@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1G4MTEx021808; Fri, 16 Feb 2018 04:22:29 GMT (envelope-from dteske@FreeBSD.org) Message-Id: <201802160422.w1G4MTEx021808@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dteske set sender to dteske@FreeBSD.org using -f From: Devin Teske Date: Fri, 16 Feb 2018 04:22:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329353 - head/cddl/lib/libdtrace X-SVN-Group: head X-SVN-Commit-Author: dteske X-SVN-Commit-Paths: head/cddl/lib/libdtrace X-SVN-Commit-Revision: 329353 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Feb 2018 04:22:30 -0000 Author: dteske Date: Fri Feb 16 04:22:29 2018 New Revision: 329353 URL: https://svnweb.freebsd.org/changeset/base/329353 Log: 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 Modified: head/cddl/lib/libdtrace/errno.d Modified: head/cddl/lib/libdtrace/errno.d ============================================================================== --- head/cddl/lib/libdtrace/errno.d Fri Feb 16 04:10:10 2018 (r329352) +++ head/cddl/lib/libdtrace/errno.d Fri Feb 16 04:22:29 2018 (r329353) @@ -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 + */ +#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";