From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24685 invoked by alias); 16 Jun 2004 16:17:55 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 24646 invoked from network); 16 Jun 2004 16:17:52 -0000 Received: from unknown (HELO dublin.act-europe.fr) (212.157.227.154) by sourceware.org with SMTP; 16 Jun 2004 16:17:52 -0000 Received: from localhost (province.act-europe.fr [10.10.0.214]) by filtered-dublin.act-europe.fr (Postfix) with ESMTP id 99C0D22A108; Wed, 16 Jun 2004 18:17:50 +0200 (MET DST) Received: from dublin.act-europe.fr ([10.10.0.154]) by localhost (province.act-europe.fr [10.10.0.214]) (amavisd-new, port 10024) with ESMTP id 00994-01; Wed, 16 Jun 2004 18:17:50 +0200 (CEST) Received: from berne.act-europe.fr (berne.act-europe.fr [10.10.0.165]) by dublin.act-europe.fr (Postfix) with ESMTP id 6AF7B229F12; Wed, 16 Jun 2004 18:17:49 +0200 (MET DST) Received: by berne.act-europe.fr (Postfix, from userid 560) id 1750E592B; Wed, 16 Jun 2004 13:17:48 -0400 (EDT) Date: Wed, 16 Jun 2004 16:17:00 -0000 From: Jerome Guitton To: binutils@sources.redhat.com Cc: gdb-patches@sources.redhat.com Subject: [RFA] bfd_cache_close_all Message-ID: <20040616171748.GA8782@act-europe.fr> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="f2QGlHpHGjS2mn6Y" Content-Disposition: inline User-Agent: Mutt/1.4i X-Virus-Scanned: by amavisd-new at act-europe.fr X-SW-Source: 2004-06/txt/msg00377.txt.bz2 --f2QGlHpHGjS2mn6Y Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 320 Hello, In GDB, it would be useful on several platforms (e.g. win32) to force BFD to release the file handles. Details are here: http://sources.redhat.com/ml/gdb-patches/2004-05/msg00678.html The idea would be to have a function bfd_cache_close_all that would clear the file descriptor cache. OK to apply? -- Jerome --f2QGlHpHGjS2mn6Y Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="bfd_cache_close_all.dif" Content-length: 2342 2004-06-16 Jerome Guitton * bfd-in.h (bfd_cache_close_all): New function declaration. * bfd-in2.h: Regenerate. * cache.c (bfd_cache_close_all): New function definition. Index: bfd-in.h =================================================================== RCS file: /cvs/src/src/bfd/bfd-in.h,v retrieving revision 1.81 diff -u -r1.81 bfd-in.h --- bfd-in.h 15 Jun 2004 01:24:22 -0000 1.81 +++ bfd-in.h 16 Jun 2004 13:12:59 -0000 @@ -511,6 +511,8 @@ (bfd *abfd); /* NB: This declaration should match the autogenerated one in libbfd.h. */ +extern bfd_boolean bfd_cache_close_all (void); + extern bfd_boolean bfd_record_phdr (bfd *, unsigned long, bfd_boolean, flagword, bfd_boolean, bfd_vma, bfd_boolean, bfd_boolean, unsigned int, struct bfd_section **); Index: bfd-in2.h =================================================================== RCS file: /cvs/src/src/bfd/bfd-in2.h,v retrieving revision 1.280 diff -u -r1.280 bfd-in2.h --- bfd-in2.h 15 Jun 2004 01:24:22 -0000 1.280 +++ bfd-in2.h 16 Jun 2004 13:12:59 -0000 @@ -518,6 +518,8 @@ (bfd *abfd); /* NB: This declaration should match the autogenerated one in libbfd.h. */ +extern bfd_boolean bfd_cache_close_all (void); + extern bfd_boolean bfd_record_phdr (bfd *, unsigned long, bfd_boolean, flagword, bfd_boolean, bfd_vma, bfd_boolean, bfd_boolean, unsigned int, struct bfd_section **); Index: cache.c =================================================================== RCS file: /cvs/src/src/bfd/cache.c,v retrieving revision 1.14 diff -u -r1.14 cache.c --- cache.c 5 May 2004 15:39:11 -0000 1.14 +++ cache.c 16 Jun 2004 13:12:59 -0000 @@ -344,6 +344,42 @@ } /* +FUNCTION + bfd_cache_close_all + +SYNOPSIS + bfd_boolean bfd_cache_close_all (void); + +DESCRIPTION + Remove all BFDs from the cache. If the attached file is open, + then close it too. + +RETURNS + <> is returned if closing one of the file fails, <> is + returned if all is well. +*/ + +bfd_boolean +bfd_cache_close_all () +{ + bfd_boolean ret = TRUE; + register bfd *kill; + + if (!bfd_last_cache) + return TRUE; + + for (kill = bfd_last_cache->lru_prev; + open_files; + kill = kill->lru_prev) + { + ret = ret && bfd_cache_close (kill); + } + + return ret; +} + + +/* INTERNAL_FUNCTION bfd_open_file --f2QGlHpHGjS2mn6Y--