From owner-svn-src-vendor@FreeBSD.ORG Thu Aug 29 15:20:13 2013 Return-Path: Delivered-To: svn-src-vendor@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id C4968652; Thu, 29 Aug 2013 15:20:13 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B24452FAD; Thu, 29 Aug 2013 15:20:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7TFKDcT000128; Thu, 29 Aug 2013 15:20:13 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7TFKD5f099893; Thu, 29 Aug 2013 15:20:13 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201308291520.r7TFKD5f099893@svn.freebsd.org> From: Ed Maste Date: Thu, 29 Aug 2013 15:20:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r255025 - vendor/NetBSD/libexecinfo/dist X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Aug 2013 15:20:13 -0000 Author: emaste Date: Thu Aug 29 15:20:12 2013 New Revision: 255025 URL: http://svnweb.freebsd.org/changeset/base/255025 Log: Vendor import of NetBSD's libexecinfo at 2013-08-29 Modified: vendor/NetBSD/libexecinfo/dist/backtrace.3 vendor/NetBSD/libexecinfo/dist/backtrace.c vendor/NetBSD/libexecinfo/dist/symtab.c Modified: vendor/NetBSD/libexecinfo/dist/backtrace.3 ============================================================================== --- vendor/NetBSD/libexecinfo/dist/backtrace.3 Thu Aug 29 15:12:58 2013 (r255024) +++ vendor/NetBSD/libexecinfo/dist/backtrace.3 Thu Aug 29 15:20:12 2013 (r255025) @@ -1,4 +1,4 @@ -.\" $NetBSD: backtrace.3,v 1.4 2012/06/10 00:24:36 christos Exp $ +.\" $NetBSD: backtrace.3,v 1.5 2013/08/22 17:08:43 christos Exp $ .\" .\" Copyright (c) 2012 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -116,7 +116,7 @@ on failure. .Sh RETURN VALUES The .Fn backtrace -function returns the number of elements tht were filled in the backtrace. +function returns the number of elements that were filled in the backtrace. The .Fn backtrace_symbols and Modified: vendor/NetBSD/libexecinfo/dist/backtrace.c ============================================================================== --- vendor/NetBSD/libexecinfo/dist/backtrace.c Thu Aug 29 15:12:58 2013 (r255024) +++ vendor/NetBSD/libexecinfo/dist/backtrace.c Thu Aug 29 15:20:12 2013 (r255025) @@ -1,4 +1,4 @@ -/* $NetBSD: backtrace.c,v 1.2 2012/07/09 03:11:59 christos Exp $ */ +/* $NetBSD: backtrace.c,v 1.3 2013/08/29 14:58:56 christos Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__RCSID("$NetBSD: backtrace.c,v 1.2 2012/07/09 03:11:59 christos Exp $"); +__RCSID("$NetBSD: backtrace.c,v 1.3 2013/08/29 14:58:56 christos Exp $"); #include #include @@ -50,9 +50,29 @@ __RCSID("$NetBSD: backtrace.c,v 1.2 2012 #ifdef __linux__ #define SELF "/proc/self/exe" #else +#include #define SELF "/proc/curproc/file" #endif +static int +open_self(int flags) +{ + const char *pathname = SELF; +#ifdef KERN_PROC_PATHNAME + static const int name[] = { + CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1, + }; + char path[MAXPATHLEN]; + size_t len; + + len = sizeof(path); + if (sysctl(name, __arraycount(name), path, &len, NULL, 0) != -1) + pathname = path; +#endif + return open(pathname, flags); +} + + static int __printflike(4, 5) rasprintf(char **buf, size_t *bufsiz, size_t offs, const char *fmt, ...) { @@ -162,7 +182,7 @@ backtrace_symbols_fmt(void *const *trace symtab_t *st; int fd; - if ((fd = open(SELF, O_RDONLY)) != -1) + if ((fd = open_self(O_RDONLY)) != -1) st = symtab_create(fd, -1, STT_FUNC); else st = NULL; Modified: vendor/NetBSD/libexecinfo/dist/symtab.c ============================================================================== --- vendor/NetBSD/libexecinfo/dist/symtab.c Thu Aug 29 15:12:58 2013 (r255024) +++ vendor/NetBSD/libexecinfo/dist/symtab.c Thu Aug 29 15:20:12 2013 (r255025) @@ -1,4 +1,4 @@ -/* $NetBSD: symtab.c,v 1.1 2012/05/26 22:02:29 christos Exp $ */ +/* $NetBSD: symtab.c,v 1.2 2013/08/29 15:01:57 christos Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -29,11 +29,12 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__RCSID("$NetBSD: symtab.c,v 1.1 2012/05/26 22:02:29 christos Exp $"); +__RCSID("$NetBSD: symtab.c,v 1.2 2013/08/29 15:01:57 christos Exp $"); #include #include #include +#include #include #include