From owner-freebsd-current@FreeBSD.ORG Sun Jan 4 23:37:44 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 E37D1106577D for ; Sun, 4 Jan 2009 23:37:44 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.9.129]) by mx1.freebsd.org (Postfix) with ESMTP id AC1548FC21 for ; Sun, 4 Jan 2009 23:37:44 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: by onelab2.iet.unipi.it (Postfix, from userid 275) id C8BC1730A6; Mon, 5 Jan 2009 00:42:38 +0100 (CET) Date: Mon, 5 Jan 2009 00:42:38 +0100 From: Luigi Rizzo To: current@freebsd.org Message-ID: <20090104234238.GA44381@onelab2.iet.unipi.it> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.3i Cc: Subject: 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: Sun, 04 Jan 2009 23:37:45 -0000 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) cheers luigi