You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

160 lines
6.6KB

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- This file documents the BFD library.
  4. Copyright (C) 1991-2020 Free Software Foundation, Inc.
  5. Permission is granted to copy, distribute and/or modify this document
  6. under the terms of the GNU Free Documentation License, Version 1.3 or
  7. any later version published by the Free Software Foundation; with the
  8. Invariant Sections being "GNU General Public License" and "Funding
  9. Free Software", the Front-Cover texts being (a) (see below), and with
  10. the Back-Cover Texts being (b) (see below). A copy of the license is
  11. included in the section entitled "GNU Free Documentation License".
  12. (a) The FSF's Front-Cover Text is:
  13. A GNU Manual
  14. (b) The FSF's Back-Cover Text is:
  15. You have freedom to copy and modify this GNU Manual, like GNU
  16. software. Copies published by the Free Software Foundation raise
  17. funds for GNU development. -->
  18. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  19. <head>
  20. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  21. <title>File Caching (Untitled Document)</title>
  22. <meta name="description" content="File Caching (Untitled Document)">
  23. <meta name="keywords" content="File Caching (Untitled Document)">
  24. <meta name="resource-type" content="document">
  25. <meta name="distribution" content="global">
  26. <meta name="Generator" content="makeinfo">
  27. <link href="index.html#Top" rel="start" title="Top">
  28. <link href="BFD-Index.html#BFD-Index" rel="index" title="BFD Index">
  29. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  30. <link href="BFD-front-end.html#BFD-front-end" rel="up" title="BFD front end">
  31. <link href="Linker-Functions.html#Linker-Functions" rel="next" title="Linker Functions">
  32. <link href="Internal.html#Internal" rel="prev" title="Internal">
  33. <style type="text/css">
  34. <!--
  35. a.summary-letter {text-decoration: none}
  36. blockquote.indentedblock {margin-right: 0em}
  37. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  38. blockquote.smallquotation {font-size: smaller}
  39. div.display {margin-left: 3.2em}
  40. div.example {margin-left: 3.2em}
  41. div.lisp {margin-left: 3.2em}
  42. div.smalldisplay {margin-left: 3.2em}
  43. div.smallexample {margin-left: 3.2em}
  44. div.smalllisp {margin-left: 3.2em}
  45. kbd {font-style: oblique}
  46. pre.display {font-family: inherit}
  47. pre.format {font-family: inherit}
  48. pre.menu-comment {font-family: serif}
  49. pre.menu-preformatted {font-family: serif}
  50. pre.smalldisplay {font-family: inherit; font-size: smaller}
  51. pre.smallexample {font-size: smaller}
  52. pre.smallformat {font-family: inherit; font-size: smaller}
  53. pre.smalllisp {font-size: smaller}
  54. span.nolinebreak {white-space: nowrap}
  55. span.roman {font-family: initial; font-weight: normal}
  56. span.sansserif {font-family: sans-serif; font-weight: normal}
  57. ul.no-bullet {list-style: none}
  58. -->
  59. </style>
  60. </head>
  61. <body lang="en">
  62. <a name="File-Caching"></a>
  63. <div class="header">
  64. <p>
  65. Next: <a href="Linker-Functions.html#Linker-Functions" accesskey="n" rel="next">Linker Functions</a>, Previous: <a href="Internal.html#Internal" accesskey="p" rel="prev">Internal</a>, Up: <a href="BFD-front-end.html#BFD-front-end" accesskey="u" rel="up">BFD front end</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="BFD-Index.html#BFD-Index" title="Index" rel="index">Index</a>]</p>
  66. </div>
  67. <hr>
  68. <a name="File-caching"></a>
  69. <h3 class="section">2.16 File caching</h3>
  70. <p>The file caching mechanism is embedded within BFD and allows
  71. the application to open as many BFDs as it wants without
  72. regard to the underlying operating system&rsquo;s file descriptor
  73. limit (often as low as 20 open files). The module in
  74. <code>cache.c</code> maintains a least recently used list of
  75. <code>bfd_cache_max_open</code> files, and exports the name
  76. <code>bfd_cache_lookup</code>, which runs around and makes sure that
  77. the required BFD is open. If not, then it chooses a file to
  78. close, closes it and opens the one wanted, returning its file
  79. handle.
  80. </p>
  81. <a name="Caching-functions"></a>
  82. <h4 class="subsection">2.16.1 Caching functions</h4>
  83. <a name="index-bfd_005fcache_005finit"></a>
  84. <a name="bfd_005fcache_005finit"></a>
  85. <h4 class="subsubsection">2.16.1.1 <code>bfd_cache_init</code></h4>
  86. <p><strong>Synopsis</strong>
  87. </p><div class="example">
  88. <pre class="example">bfd_boolean bfd_cache_init (bfd *abfd);
  89. </pre></div>
  90. <p><strong>Description</strong><br>
  91. Add a newly opened BFD to the cache.
  92. </p>
  93. <a name="index-bfd_005fcache_005fclose"></a>
  94. <a name="bfd_005fcache_005fclose"></a>
  95. <h4 class="subsubsection">2.16.1.2 <code>bfd_cache_close</code></h4>
  96. <p><strong>Synopsis</strong>
  97. </p><div class="example">
  98. <pre class="example">bfd_boolean bfd_cache_close (bfd *abfd);
  99. </pre></div>
  100. <p><strong>Description</strong><br>
  101. Remove the BFD <var>abfd</var> from the cache. If the attached file is open,
  102. then close it too.
  103. </p>
  104. <p><strong>Returns</strong><br>
  105. <code>FALSE</code> is returned if closing the file fails, <code>TRUE</code> is
  106. returned if all is well.
  107. </p>
  108. <a name="index-bfd_005fcache_005fclose_005fall"></a>
  109. <a name="bfd_005fcache_005fclose_005fall"></a>
  110. <h4 class="subsubsection">2.16.1.3 <code>bfd_cache_close_all</code></h4>
  111. <p><strong>Synopsis</strong>
  112. </p><div class="example">
  113. <pre class="example">bfd_boolean bfd_cache_close_all (void);
  114. </pre></div>
  115. <p><strong>Description</strong><br>
  116. Remove all BFDs from the cache. If the attached file is open,
  117. then close it too.
  118. </p>
  119. <p><strong>Returns</strong><br>
  120. <code>FALSE</code> is returned if closing one of the file fails, <code>TRUE</code> is
  121. returned if all is well.
  122. </p>
  123. <a name="index-bfd_005fopen_005ffile"></a>
  124. <a name="bfd_005fopen_005ffile"></a>
  125. <h4 class="subsubsection">2.16.1.4 <code>bfd_open_file</code></h4>
  126. <p><strong>Synopsis</strong>
  127. </p><div class="example">
  128. <pre class="example">FILE* bfd_open_file (bfd *abfd);
  129. </pre></div>
  130. <p><strong>Description</strong><br>
  131. Call the OS to open a file for <var>abfd</var>. Return the <code>FILE *</code>
  132. (possibly <code>NULL</code>) that results from this operation. Set up the
  133. BFD so that future accesses know the file is open. If the <code>FILE *</code>
  134. returned is <code>NULL</code>, then it won&rsquo;t have been put in the
  135. cache, so it won&rsquo;t have to be removed from it.
  136. </p>
  137. <hr>
  138. <div class="header">
  139. <p>
  140. Next: <a href="Linker-Functions.html#Linker-Functions" accesskey="n" rel="next">Linker Functions</a>, Previous: <a href="Internal.html#Internal" accesskey="p" rel="prev">Internal</a>, Up: <a href="BFD-front-end.html#BFD-front-end" accesskey="u" rel="up">BFD front end</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="BFD-Index.html#BFD-Index" title="Index" rel="index">Index</a>]</p>
  141. </div>
  142. </body>
  143. </html>