re35.html 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  5. <title>&lt;GMappedFile&gt;: </title>
  6. <meta name="generator" content="DocBook XSL Stylesheets V1.79.2">
  7. <link rel="home" href="index.html" title="">
  8. <link rel="up" href="ch01.html" title="GLib">
  9. <link rel="prev" href="re34.html" title="&lt;GMainLoop&gt;">
  10. <link rel="next" href="re36.html" title="&lt;%GLibMarkupCollectType&gt;">
  11. <meta name="generator" content="GTK-Doc V1.33.1 (XML mode)">
  12. <link rel="stylesheet" href="style.css" type="text/css">
  13. </head>
  14. <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
  15. <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
  16. <td width="100%" align="left" class="shortcuts"></td>
  17. <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
  18. <td><img src="up-insensitive.png" width="16" height="16" border="0"></td>
  19. <td><a accesskey="p" href="re34.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
  20. <td><a accesskey="n" href="re36.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
  21. </tr></table>
  22. <div class="refentry">
  23. <a name="id-1.1.36"></a><div class="titlepage"></div>
  24. <div class="refnamediv">
  25. <h2>&lt;GMappedFile&gt;</h2>
  26. <p>&lt;GMappedFile&gt;</p>
  27. </div>
  28. <div class="refsect1">
  29. <a name="id-1.1.36.2"></a><h2>Description</h2>
  30. <p>The <span class="type">GMappedFile</span> represents a file mapping created with
  31. <code class="function">g_mapped_file_new()</code>. It has only private members and should
  32. not be accessed directly.</p>
  33. </div>
  34. <div class="refsect1">
  35. <a name="id-1.1.36.3"></a><h2>Functions</h2>
  36. <div class="refsect2">
  37. <a name="id-1.1.36.3.2"></a><h3>free</h3>
  38. <div class="informalexample"><pre class="programlisting">(define-values () (mapped-file:free self))
  39. </pre></div>
  40. <p>This call existed before <span class="type">GMappedFile</span> had refcounting and is currently
  41. exactly the same as <code class="function">g_mapped_file_unref()</code>.</p>
  42. <div class="refsect3">
  43. <a name="id-1.1.36.3.2.4"></a><h4>Parameters</h4>
  44. <div class="informaltable"><table><tr>
  45. <td class="parameter_name"><p>file</p></td>
  46. <td class="parameter_description">
  47. <p>a <span class="type">GMappedFile</span></p>
  48. <p>Passed as <code class="code">self</code></p>
  49. </td>
  50. </tr></table></div>
  51. </div>
  52. </div>
  53. <div class="refsect2">
  54. <a name="id-1.1.36.3.3"></a><h3>get-bytes</h3>
  55. <div class="informalexample"><pre class="programlisting">(define-values (%return) (mapped-file:get-bytes self))
  56. </pre></div>
  57. <p>Creates a new <span class="type">GBytes</span> which references the data mapped from <em class="parameter"><code>file</code></em>.
  58. The mapped contents of the file must not be modified after creating this
  59. bytes object, because a <span class="type">GBytes</span> should be immutable.</p>
  60. <div class="refsect3">
  61. <a name="id-1.1.36.3.3.4"></a><h4>Parameters</h4>
  62. <div class="informaltable"><table><tr>
  63. <td class="parameter_name"><p>file</p></td>
  64. <td class="parameter_description">
  65. <p>a <span class="type">GMappedFile</span></p>
  66. <p>Passed as <code class="code">self</code></p>
  67. </td>
  68. </tr></table></div>
  69. </div>
  70. </div>
  71. <div class="refsect2">
  72. <a name="id-1.1.36.3.4"></a><h3>get-contents</h3>
  73. <div class="informalexample"><pre class="programlisting">(define-values (%return) (mapped-file:get-contents self))
  74. </pre></div>
  75. <p>Returns the contents of a <span class="type">GMappedFile</span>.
  76. </p>
  77. <p>Note that the contents may not be zero-terminated,
  78. even if the <span class="type">GMappedFile</span> is backed by a text file.
  79. </p>
  80. <p>If the file is empty then <code class="constant">NULL</code> is returned.</p>
  81. <div class="refsect3">
  82. <a name="id-1.1.36.3.4.6"></a><h4>Parameters</h4>
  83. <div class="informaltable"><table><tr>
  84. <td class="parameter_name"><p>file</p></td>
  85. <td class="parameter_description">
  86. <p>a <span class="type">GMappedFile</span></p>
  87. <p>Passed as <code class="code">self</code></p>
  88. </td>
  89. </tr></table></div>
  90. </div>
  91. </div>
  92. <div class="refsect2">
  93. <a name="id-1.1.36.3.5"></a><h3>get-length</h3>
  94. <div class="informalexample"><pre class="programlisting">(define-values (%return) (mapped-file:get-length self))
  95. </pre></div>
  96. <p>Returns the length of the contents of a <span class="type">GMappedFile</span>.</p>
  97. <div class="refsect3">
  98. <a name="id-1.1.36.3.5.4"></a><h4>Parameters</h4>
  99. <div class="informaltable"><table><tr>
  100. <td class="parameter_name"><p>file</p></td>
  101. <td class="parameter_description">
  102. <p>a <span class="type">GMappedFile</span></p>
  103. <p>Passed as <code class="code">self</code></p>
  104. </td>
  105. </tr></table></div>
  106. </div>
  107. </div>
  108. <div class="refsect2">
  109. <a name="id-1.1.36.3.6"></a><h3>ref</h3>
  110. <div class="informalexample"><pre class="programlisting">(define-values (%return) (mapped-file:ref self))
  111. </pre></div>
  112. <p>Increments the reference count of <em class="parameter"><code>file</code></em> by one. It is safe to call
  113. this function from any thread.</p>
  114. <div class="refsect3">
  115. <a name="id-1.1.36.3.6.4"></a><h4>Parameters</h4>
  116. <div class="informaltable"><table><tr>
  117. <td class="parameter_name"><p>file</p></td>
  118. <td class="parameter_description">
  119. <p>a <span class="type">GMappedFile</span></p>
  120. <p>Passed as <code class="code">self</code></p>
  121. </td>
  122. </tr></table></div>
  123. </div>
  124. </div>
  125. <div class="refsect2">
  126. <a name="id-1.1.36.3.7"></a><h3>unref</h3>
  127. <div class="informalexample"><pre class="programlisting">(define-values () (mapped-file:unref self))
  128. </pre></div>
  129. <p>Decrements the reference count of <em class="parameter"><code>file</code></em> by one. If the reference count
  130. drops to 0, unmaps the buffer of <em class="parameter"><code>file</code></em> and frees it.
  131. </p>
  132. <p>It is safe to call this function from any thread.
  133. </p>
  134. <p>Since 2.22</p>
  135. <div class="refsect3">
  136. <a name="id-1.1.36.3.7.6"></a><h4>Parameters</h4>
  137. <div class="informaltable"><table><tr>
  138. <td class="parameter_name"><p>file</p></td>
  139. <td class="parameter_description">
  140. <p>a <span class="type">GMappedFile</span></p>
  141. <p>Passed as <code class="code">self</code></p>
  142. </td>
  143. </tr></table></div>
  144. </div>
  145. </div>
  146. <div class="refsect2">
  147. <a name="id-1.1.36.3.8"></a><h3>mapped-file:new-from-fd</h3>
  148. <div class="informalexample"><pre class="programlisting">(define-values (%return) (mapped-file:new-from-fd fd writable))
  149. </pre></div>
  150. <p>Undocumented</p>
  151. <div class="refsect3">
  152. <a name="id-1.1.36.3.8.4"></a><h4>Parameters</h4>
  153. <div class="informaltable"><table>
  154. <tr>
  155. <td class="parameter_name"><p>fd</p></td>
  156. <td class="parameter_description">
  157. <p></p>
  158. <p>Passed as <code class="code">fd</code></p>
  159. </td>
  160. </tr>
  161. <tr>
  162. <td class="parameter_name"><p>writable</p></td>
  163. <td class="parameter_description">
  164. <p></p>
  165. <p>Passed as <code class="code">writable</code></p>
  166. </td>
  167. </tr>
  168. </table></div>
  169. </div>
  170. </div>
  171. <div class="refsect2">
  172. <a name="id-1.1.36.3.9"></a><h3>mapped-file:new</h3>
  173. <div class="informalexample"><pre class="programlisting">(define-values (%return) (mapped-file:new filename writable))
  174. </pre></div>
  175. <p>Undocumented</p>
  176. <div class="refsect3">
  177. <a name="id-1.1.36.3.9.4"></a><h4>Parameters</h4>
  178. <div class="informaltable"><table>
  179. <tr>
  180. <td class="parameter_name"><p>filename</p></td>
  181. <td class="parameter_description">
  182. <p></p>
  183. <p>Passed as <code class="code">filename</code></p>
  184. </td>
  185. </tr>
  186. <tr>
  187. <td class="parameter_name"><p>writable</p></td>
  188. <td class="parameter_description">
  189. <p></p>
  190. <p>Passed as <code class="code">writable</code></p>
  191. </td>
  192. </tr>
  193. </table></div>
  194. </div>
  195. </div>
  196. </div>
  197. </div>
  198. <div class="footer">
  199. <hr>Generated by GTK-Doc V1.33.1</div>
  200. </body>
  201. </html>