From owner-freebsd-current@FreeBSD.ORG Mon Jan 5 02:32:18 2009 Return-Path: Delivered-To: current@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E34BA106564A for ; Mon, 5 Jan 2009 02:32:18 +0000 (UTC) (envelope-from xcllnt@mac.com) Received: from asmtpout022.mac.com (asmtpout022.mac.com [17.148.16.97]) by mx1.freebsd.org (Postfix) with ESMTP id CE4678FC17 for ; Mon, 5 Jan 2009 02:32:18 +0000 (UTC) (envelope-from xcllnt@mac.com) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Received: from [192.168.1.96] (75-101-29-67.dsl.static.sonic.net [75.101.29.67]) by asmtp022.mac.com (Sun Java(tm) System Messaging Server 6.3-7.03 (built Aug 7 2008; 32bit)) with ESMTPSA id <0KCZ00MGJ8DS2Q20@asmtp022.mac.com>; Sun, 04 Jan 2009 18:32:17 -0800 (PST) Message-id: <0AE16877-C02A-40A1-9F3B-FE839CB7B9E5@mac.com> From: Marcel Moolenaar To: Maxim Sobolev In-reply-to: <49615475.2030803@FreeBSD.org> Date: Sun, 04 Jan 2009 18:32:17 -0800 References: <20090104234238.GA44381@onelab2.iet.unipi.it> <49615475.2030803@FreeBSD.org> X-Mailer: Apple Mail (2.930.3) Cc: Luigi Rizzo , current@FreeBSD.org Subject: Re: upcoming elfdump refactoring X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jan 2009 02:32:19 -0000 On Jan 4, 2009, at 4:29 PM, Maxim Sobolev wrote: > Luigi Rizzo wrote: >> I need to extract value and size of some symbols from an ELF file, >> and make them available to a C program, something like >> nm -S /boot/kernel/kernel | grep -E "(kernload|kernbase| >> uscanner_devs)" >> Rather than using the above tools plus popen() and some parsing code, >> I have refactored src/usr.bin/elfdump/elfdump.c , >> making the main routine externally callable, returning the >> desired info in a struct rather than print them out. >> I don't know if/how other programs might need to call elfdump(), >> but given that the changes I made have no functional or performance >> drawback, I would like to commit them to the tree. >> Objections ? >> (note, the diff will be large because in the process I also removed >> global variables and staticize/constify things) > > Why not make this function part of libelf? Please don't. libelf has a standard and well-documented API. Don't add random or one-off functions simply on the basis of them having "elf" in the name. In fact, elfdump(1) should really use libelf(3) to read ELF files. -- Marcel Moolenaar xcllnt@mac.com