Wolfgang Thallergcc16 merge934c3885 months agoHistory
71 lines · 2.7 KB · Text
RawDownload
@section File cachingThe file caching mechanism is embedded within BFD and allowsthe application to open as many BFDs as it wants withoutregard to the underlying operating system's file descriptorlimit (often as low as 20 open files).  The module in@code{cache.c} maintains a least recently used list of@code{bfd_cache_max_open} files, and exports the name@code{bfd_cache_lookup}, which runs around and makes sure thatthe required BFD is open. If not, then it chooses a file toclose, closes it and opens the one wanted, returning its filehandle. @subsection Caching functions  @findex bfd_cache_init@subsubsection @code{bfd_cache_init}@deftypefn {Function} bool bfd_cache_init (bfd *abfd); Add a newly opened BFD to the cache. @end deftypefn@findex bfd_cache_close@subsubsection @code{bfd_cache_close}@deftypefn {Function} bool bfd_cache_close (bfd *abfd); Remove the BFD @var{abfd} from the cache. If the attached file is open,then close it too. @code{FALSE} is returned if closing the file fails, @code{TRUE} isreturned if all is well. @end deftypefn@findex bfd_cache_close_all@subsubsection @code{bfd_cache_close_all}@deftypefn {Function} bool bfd_cache_close_all (void); Remove all BFDs from the cache. If the attached file is open,then close it too.  Note - despite its name this function willclose a BFD even if it is not marked as being cacheable, ieeven if bfd_get_cacheable() returns false. @code{FALSE} is returned if closing one of the file fails, @code{TRUE} isreturned if all is well. @end deftypefn@findex bfd_cache_set_uncloseable@subsubsection @code{bfd_cache_set_uncloseable}@deftypefn {Function} bool bfd_cache_set_uncloseable (bfd *abfd, bool value, bool *old); Internal function to mark ABFD as either closeable or not.This is used by bfd_check_format_matches to avoid raceswhere bfd_cache_close_all is called in another thread.VALUE is true to mark the BFD as temporarily uncloseableby the cache; false to mark it as closeable once again.OLD, if non-NULL, is set to the previous value of the flag.Returns false on error, true on success. @end deftypefn@findex bfd_cache_size@subsubsection @code{bfd_cache_size}@deftypefn {Function} unsigned bfd_cache_size (void); Return the number of open files in the cache. @end deftypefn@findex bfd_open_file@subsubsection @code{bfd_open_file}@deftypefn {Function} FILE* bfd_open_file (bfd *abfd); Call the OS to open a file for @var{abfd}.  Return the @code{FILE *}(possibly @code{NULL}) that results from this operation.  Set up theBFD so that future accesses know the file is open. If the @code{FILE *}returned is @code{NULL}, then it won't have been put in thecache, so it won't have to be removed from it. @end deftypefn

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t