From: Jerome Guitton <guitton@act-europe.fr>
To: binutils@sources.redhat.com
Cc: gdb-patches@sources.redhat.com
Subject: [RFA] bfd_cache_close_all
Date: Wed, 16 Jun 2004 16:17:00 -0000 [thread overview]
Message-ID: <20040616171748.GA8782@act-europe.fr> (raw)
[-- Attachment #1: Type: text/plain, Size: 320 bytes --]
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
[-- Attachment #2: bfd_cache_close_all.dif --]
[-- Type: text/plain, Size: 2342 bytes --]
2004-06-16 Jerome Guitton <guitton@gnat.com>
* 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
+ <<FALSE>> is returned if closing one of the file fails, <<TRUE>> 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
next reply other threads:[~2004-06-16 16:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-16 16:17 Jerome Guitton [this message]
2004-06-17 2:22 ` Alan Modra
2004-06-17 11:51 ` Jerome Guitton
2004-06-17 11:58 ` Jerome Guitton
2004-06-17 12:09 ` Alan Modra
2004-06-17 12:11 ` Jerome Guitton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040616171748.GA8782@act-europe.fr \
--to=guitton@act-europe.fr \
--cc=binutils@sources.redhat.com \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox