| 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>prelude-io: libprelude Reference Manual</title> |
| 6 |
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1"> |
| 7 |
<link rel="home" href="index.html" title="libprelude Reference Manual"> |
| 8 |
<link rel="up" href="ch01.html" title="[Insert title here]"> |
| 9 |
<link rel="prev" href="libprelude-idmef-tree-wrap.html" title="idmef-tree-wrap"> |
| 10 |
<link rel="next" href="libprelude-prelude-log.html" title="prelude-log"> |
| 11 |
<meta name="generator" content="GTK-Doc V1.28 (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"> |
| 17 |
<a href="#" class="shortcut">Top</a><span id="nav_description"> <span class="dim">|</span> |
| 18 |
<a href="#libprelude-prelude-io.description" class="shortcut">Description</a></span> |
| 19 |
</td> |
| 20 |
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td> |
| 21 |
<td><a accesskey="u" href="ch01.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td> |
| 22 |
<td><a accesskey="p" href="libprelude-idmef-tree-wrap.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td> |
| 23 |
<td><a accesskey="n" href="libprelude-prelude-log.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td> |
| 24 |
</tr></table> |
| 25 |
<div class="refentry"> |
| 26 |
<a name="libprelude-prelude-io"></a><div class="titlepage"></div> |
| 27 |
<div class="refnamediv"><table width="100%"><tr> |
| 28 |
<td valign="top"> |
| 29 |
<h2><span class="refentrytitle"><a name="libprelude-prelude-io.top_of_page"></a>prelude-io</span></h2> |
| 30 |
<p>prelude-io</p> |
| 31 |
</td> |
| 32 |
<td class="gallery_image" valign="top" align="right"></td> |
| 33 |
</tr></table></div> |
| 34 |
<div class="refsect1"> |
| 35 |
<a name="libprelude-prelude-io.functions"></a><h2>Functions</h2> |
| 36 |
<div class="informaltable"><table width="100%" border="0"> |
| 37 |
<colgroup> |
| 38 |
<col width="150px" class="functions_return"> |
| 39 |
<col class="functions_name"> |
| 40 |
</colgroup> |
| 41 |
<tbody> |
| 42 |
<tr> |
| 43 |
<td class="function_type"> |
| 44 |
<span class="returnvalue">int</span> |
| 45 |
</td> |
| 46 |
<td class="function_name"> |
| 47 |
<a class="link" href="libprelude-prelude-io.html#prelude-io-new" title="prelude_io_new ()">prelude_io_new</a> <span class="c_punctuation">()</span> |
| 48 |
</td> |
| 49 |
</tr> |
| 50 |
<tr> |
| 51 |
<td class="function_type"> |
| 52 |
<span class="returnvalue">void</span> |
| 53 |
</td> |
| 54 |
<td class="function_name"> |
| 55 |
<a class="link" href="libprelude-prelude-io.html#prelude-io-destroy" title="prelude_io_destroy ()">prelude_io_destroy</a> <span class="c_punctuation">()</span> |
| 56 |
</td> |
| 57 |
</tr> |
| 58 |
<tr> |
| 59 |
<td class="function_type"> |
| 60 |
<span class="returnvalue">void</span> |
| 61 |
</td> |
| 62 |
<td class="function_name"> |
| 63 |
<a class="link" href="libprelude-prelude-io.html#prelude-io-set-file-io" title="prelude_io_set_file_io ()">prelude_io_set_file_io</a> <span class="c_punctuation">()</span> |
| 64 |
</td> |
| 65 |
</tr> |
| 66 |
<tr> |
| 67 |
<td class="function_type"> |
| 68 |
<span class="returnvalue">void</span> |
| 69 |
</td> |
| 70 |
<td class="function_name"> |
| 71 |
<a class="link" href="libprelude-prelude-io.html#prelude-io-set-tls-io" title="prelude_io_set_tls_io ()">prelude_io_set_tls_io</a> <span class="c_punctuation">()</span> |
| 72 |
</td> |
| 73 |
</tr> |
| 74 |
<tr> |
| 75 |
<td class="function_type"> |
| 76 |
<span class="returnvalue">void</span> |
| 77 |
</td> |
| 78 |
<td class="function_name"> |
| 79 |
<a class="link" href="libprelude-prelude-io.html#prelude-io-set-sys-io" title="prelude_io_set_sys_io ()">prelude_io_set_sys_io</a> <span class="c_punctuation">()</span> |
| 80 |
</td> |
| 81 |
</tr> |
| 82 |
<tr> |
| 83 |
<td class="function_type"> |
| 84 |
<span class="returnvalue">int</span> |
| 85 |
</td> |
| 86 |
<td class="function_name"> |
| 87 |
<a class="link" href="libprelude-prelude-io.html#prelude-io-set-buffer-io" title="prelude_io_set_buffer_io ()">prelude_io_set_buffer_io</a> <span class="c_punctuation">()</span> |
| 88 |
</td> |
| 89 |
</tr> |
| 90 |
<tr> |
| 91 |
<td class="function_type"> |
| 92 |
<span class="returnvalue">void</span> |
| 93 |
</td> |
| 94 |
<td class="function_name"> |
| 95 |
<a class="link" href="libprelude-prelude-io.html#prelude-io-set-fdptr" title="prelude_io_set_fdptr ()">prelude_io_set_fdptr</a> <span class="c_punctuation">()</span> |
| 96 |
</td> |
| 97 |
</tr> |
| 98 |
<tr> |
| 99 |
<td class="function_type"> |
| 100 |
<span class="returnvalue">void</span> |
| 101 |
</td> |
| 102 |
<td class="function_name"> |
| 103 |
<a class="link" href="libprelude-prelude-io.html#prelude-io-set-pending-callback" title="prelude_io_set_pending_callback ()">prelude_io_set_pending_callback</a> <span class="c_punctuation">()</span> |
| 104 |
</td> |
| 105 |
</tr> |
| 106 |
<tr> |
| 107 |
<td class="function_type"> |
| 108 |
<span class="returnvalue">void</span> |
| 109 |
</td> |
| 110 |
<td class="function_name"> |
| 111 |
<a class="link" href="libprelude-prelude-io.html#prelude-io-set-read-callback" title="prelude_io_set_read_callback ()">prelude_io_set_read_callback</a> <span class="c_punctuation">()</span> |
| 112 |
</td> |
| 113 |
</tr> |
| 114 |
<tr> |
| 115 |
<td class="function_type"> |
| 116 |
<span class="returnvalue">void</span> |
| 117 |
</td> |
| 118 |
<td class="function_name"> |
| 119 |
<a class="link" href="libprelude-prelude-io.html#prelude-io-set-write-callback" title="prelude_io_set_write_callback ()">prelude_io_set_write_callback</a> <span class="c_punctuation">()</span> |
| 120 |
</td> |
| 121 |
</tr> |
| 122 |
<tr> |
| 123 |
<td class="function_type"> |
| 124 |
<span class="returnvalue">int</span> |
| 125 |
</td> |
| 126 |
<td class="function_name"> |
| 127 |
<a class="link" href="libprelude-prelude-io.html#prelude-io-close" title="prelude_io_close ()">prelude_io_close</a> <span class="c_punctuation">()</span> |
| 128 |
</td> |
| 129 |
</tr> |
| 130 |
<tr> |
| 131 |
<td class="function_type"> |
| 132 |
<span class="returnvalue">ssize_t</span> |
| 133 |
</td> |
| 134 |
<td class="function_name"> |
| 135 |
<a class="link" href="libprelude-prelude-io.html#prelude-io-read" title="prelude_io_read ()">prelude_io_read</a> <span class="c_punctuation">()</span> |
| 136 |
</td> |
| 137 |
</tr> |
| 138 |
<tr> |
| 139 |
<td class="function_type"> |
| 140 |
<span class="returnvalue">ssize_t</span> |
| 141 |
</td> |
| 142 |
<td class="function_name"> |
| 143 |
<a class="link" href="libprelude-prelude-io.html#prelude-io-read-wait" title="prelude_io_read_wait ()">prelude_io_read_wait</a> <span class="c_punctuation">()</span> |
| 144 |
</td> |
| 145 |
</tr> |
| 146 |
<tr> |
| 147 |
<td class="function_type"> |
| 148 |
<span class="returnvalue">ssize_t</span> |
| 149 |
</td> |
| 150 |
<td class="function_name"> |
| 151 |
<a class="link" href="libprelude-prelude-io.html#prelude-io-read-delimited" title="prelude_io_read_delimited ()">prelude_io_read_delimited</a> <span class="c_punctuation">()</span> |
| 152 |
</td> |
| 153 |
</tr> |
| 154 |
<tr> |
| 155 |
<td class="function_type"> |
| 156 |
<span class="returnvalue">ssize_t</span> |
| 157 |
</td> |
| 158 |
<td class="function_name"> |
| 159 |
<a class="link" href="libprelude-prelude-io.html#prelude-io-write" title="prelude_io_write ()">prelude_io_write</a> <span class="c_punctuation">()</span> |
| 160 |
</td> |
| 161 |
</tr> |
| 162 |
<tr> |
| 163 |
<td class="function_type"> |
| 164 |
<span class="returnvalue">ssize_t</span> |
| 165 |
</td> |
| 166 |
<td class="function_name"> |
| 167 |
<a class="link" href="libprelude-prelude-io.html#prelude-io-write-delimited" title="prelude_io_write_delimited ()">prelude_io_write_delimited</a> <span class="c_punctuation">()</span> |
| 168 |
</td> |
| 169 |
</tr> |
| 170 |
<tr> |
| 171 |
<td class="function_type"> |
| 172 |
<span class="returnvalue">ssize_t</span> |
| 173 |
</td> |
| 174 |
<td class="function_name"> |
| 175 |
<a class="link" href="libprelude-prelude-io.html#prelude-io-forward" title="prelude_io_forward ()">prelude_io_forward</a> <span class="c_punctuation">()</span> |
| 176 |
</td> |
| 177 |
</tr> |
| 178 |
<tr> |
| 179 |
<td class="function_type"> |
| 180 |
<span class="returnvalue">int</span> |
| 181 |
</td> |
| 182 |
<td class="function_name"> |
| 183 |
<a class="link" href="libprelude-prelude-io.html#prelude-io-get-fd" title="prelude_io_get_fd ()">prelude_io_get_fd</a> <span class="c_punctuation">()</span> |
| 184 |
</td> |
| 185 |
</tr> |
| 186 |
<tr> |
| 187 |
<td class="function_type"> |
| 188 |
<span class="returnvalue">void</span> * |
| 189 |
</td> |
| 190 |
<td class="function_name"> |
| 191 |
<a class="link" href="libprelude-prelude-io.html#prelude-io-get-fdptr" title="prelude_io_get_fdptr ()">prelude_io_get_fdptr</a> <span class="c_punctuation">()</span> |
| 192 |
</td> |
| 193 |
</tr> |
| 194 |
<tr> |
| 195 |
<td class="function_type"> |
| 196 |
<span class="returnvalue">ssize_t</span> |
| 197 |
</td> |
| 198 |
<td class="function_name"> |
| 199 |
<a class="link" href="libprelude-prelude-io.html#prelude-io-pending" title="prelude_io_pending ()">prelude_io_pending</a> <span class="c_punctuation">()</span> |
| 200 |
</td> |
| 201 |
</tr> |
| 202 |
<tr> |
| 203 |
<td class="function_type"> |
| 204 |
<a class="link" href="libprelude-prelude-inttypes.html#prelude-bool-t" title="enum prelude_bool_t"><span class="returnvalue">prelude_bool_t</span></a> |
| 205 |
</td> |
| 206 |
<td class="function_name"> |
| 207 |
<a class="link" href="libprelude-prelude-io.html#prelude-io-is-error-fatal" title="prelude_io_is_error_fatal ()">prelude_io_is_error_fatal</a> <span class="c_punctuation">()</span> |
| 208 |
</td> |
| 209 |
</tr> |
| 210 |
</tbody> |
| 211 |
</table></div> |
| 212 |
</div> |
| 213 |
<div class="refsect1"> |
| 214 |
<a name="libprelude-prelude-io.other"></a><h2>Types and Values</h2> |
| 215 |
<div class="informaltable"><table width="100%" border="0"> |
| 216 |
<colgroup> |
| 217 |
<col width="150px" class="name"> |
| 218 |
<col class="description"> |
| 219 |
</colgroup> |
| 220 |
<tbody><tr> |
| 221 |
<td class="typedef_keyword">typedef</td> |
| 222 |
<td class="function_name"><a class="link" href="libprelude-prelude-io.html#prelude-io-t" title="prelude_io_t">prelude_io_t</a></td> |
| 223 |
</tr></tbody> |
| 224 |
</table></div> |
| 225 |
</div> |
| 226 |
<div class="refsect1"> |
| 227 |
<a name="libprelude-prelude-io.description"></a><h2>Description</h2> |
| 228 |
</div> |
| 229 |
<div class="refsect1"> |
| 230 |
<a name="libprelude-prelude-io.functions_details"></a><h2>Functions</h2> |
| 231 |
<div class="refsect2"> |
| 232 |
<a name="prelude-io-new"></a><h3>prelude_io_new ()</h3> |
| 233 |
<pre class="programlisting"><span class="returnvalue">int</span> |
| 234 |
prelude_io_new (<em class="parameter"><code><a class="link" href="libprelude-prelude-io.html#prelude-io-t" title="prelude_io_t"><span class="type">prelude_io_t</span></a> **ret</code></em>);</pre> |
| 235 |
<p>Create a new prelude IO object.</p> |
| 236 |
<div class="refsect3"> |
| 237 |
<a name="prelude-io-new.parameters"></a><h4>Parameters</h4> |
| 238 |
<div class="informaltable"><table width="100%" border="0"> |
| 239 |
<colgroup> |
| 240 |
<col width="150px" class="parameters_name"> |
| 241 |
<col class="parameters_description"> |
| 242 |
<col width="200px" class="parameters_annotations"> |
| 243 |
</colgroup> |
| 244 |
<tbody><tr> |
| 245 |
<td class="parameter_name"><p>ret</p></td> |
| 246 |
<td class="parameter_description"><p>Pointer where to store the created <a class="link" href="libprelude-prelude-io.html#prelude-io-t" title="prelude_io_t"><span class="type">prelude_io_t</span></a> object.</p></td> |
| 247 |
<td class="parameter_annotations"> </td> |
| 248 |
</tr></tbody> |
| 249 |
</table></div> |
| 250 |
</div> |
| 251 |
<div class="refsect3"> |
| 252 |
<a name="prelude-io-new.returns"></a><h4>Returns</h4> |
| 253 |
<p> 0 on success, or a negative value if an error occur.</p> |
| 254 |
</div> |
| 255 |
</div> |
| 256 |
<hr> |
| 257 |
<div class="refsect2"> |
| 258 |
<a name="prelude-io-destroy"></a><h3>prelude_io_destroy ()</h3> |
| 259 |
<pre class="programlisting"><span class="returnvalue">void</span> |
| 260 |
prelude_io_destroy (<em class="parameter"><code><a class="link" href="libprelude-prelude-io.html#prelude-io-t" title="prelude_io_t"><span class="type">prelude_io_t</span></a> *pio</code></em>);</pre> |
| 261 |
<p>Destroy the <em class="parameter"><code>pio</code></em> |
| 262 |
object.</p> |
| 263 |
<div class="refsect3"> |
| 264 |
<a name="prelude-io-destroy.parameters"></a><h4>Parameters</h4> |
| 265 |
<div class="informaltable"><table width="100%" border="0"> |
| 266 |
<colgroup> |
| 267 |
<col width="150px" class="parameters_name"> |
| 268 |
<col class="parameters_description"> |
| 269 |
<col width="200px" class="parameters_annotations"> |
| 270 |
</colgroup> |
| 271 |
<tbody><tr> |
| 272 |
<td class="parameter_name"><p>pio</p></td> |
| 273 |
<td class="parameter_description"><p>Pointer to a <a class="link" href="libprelude-prelude-io.html#prelude-io-t" title="prelude_io_t"><span class="type">prelude_io_t</span></a> object.</p></td> |
| 274 |
<td class="parameter_annotations"> </td> |
| 275 |
</tr></tbody> |
| 276 |
</table></div> |
| 277 |
</div> |
| 278 |
</div> |
| 279 |
<hr> |
| 280 |
<div class="refsect2"> |
| 281 |
<a name="prelude-io-set-file-io"></a><h3>prelude_io_set_file_io ()</h3> |
| 282 |
<pre class="programlisting"><span class="returnvalue">void</span> |
| 283 |
prelude_io_set_file_io (<em class="parameter"><code><a class="link" href="libprelude-prelude-io.html#prelude-io-t" title="prelude_io_t"><span class="type">prelude_io_t</span></a> *pio</code></em>, |
| 284 |
<em class="parameter"><code><span class="type">FILE</span> *fd</code></em>);</pre> |
| 285 |
<p>Setup the <em class="parameter"><code>pio</code></em> |
| 286 |
object to work with file I/O function. |
| 287 |
The <em class="parameter"><code>pio</code></em> |
| 288 |
object is then associated with <em class="parameter"><code>fd</code></em> |
| 289 |
.</p> |
| 290 |
<div class="refsect3"> |
| 291 |
<a name="prelude-io-set-file-io.parameters"></a><h4>Parameters</h4> |
| 292 |
<div class="informaltable"><table width="100%" border="0"> |
| 293 |
<colgroup> |
| 294 |
<col width="150px" class="parameters_name"> |
| 295 |
<col class="parameters_description"> |
| 296 |
<col width="200px" class="parameters_annotations"> |
| 297 |
</colgroup> |
| 298 |
<tbody> |
| 299 |
<tr> |
| 300 |
<td class="parameter_name"><p>pio</p></td> |
| 301 |
<td class="parameter_description"><p>A pointer on the <a class="link" href="libprelude-prelude-io.html#prelude-io-t" title="prelude_io_t"><span class="type">prelude_io_t</span></a> object.</p></td> |
| 302 |
<td class="parameter_annotations"> </td> |
| 303 |
</tr> |
| 304 |
<tr> |
| 305 |
<td class="parameter_name"><p>fd</p></td> |
| 306 |
<td class="parameter_description"><p>File descriptor identifying a file.</p></td> |
| 307 |
<td class="parameter_annotations"> </td> |
| 308 |
</tr> |
| 309 |
</tbody> |
| 310 |
</table></div> |
| 311 |
</div> |
| 312 |
</div> |
| 313 |
<hr> |
| 314 |
<div class="refsect2"> |
| 315 |
<a name="prelude-io-set-tls-io"></a><h3>prelude_io_set_tls_io ()</h3> |
| 316 |
<pre class="programlisting"><span class="returnvalue">void</span> |
| 317 |
prelude_io_set_tls_io (<em class="parameter"><code><a class="link" href="libprelude-prelude-io.html#prelude-io-t" title="prelude_io_t"><span class="type">prelude_io_t</span></a> *pio</code></em>, |
| 318 |
<em class="parameter"><code><span class="type">void</span> *tls</code></em>);</pre> |
| 319 |
<p>Setup the <em class="parameter"><code>pio</code></em> |
| 320 |
object to work with TLS based I/O function. |
| 321 |
The <em class="parameter"><code>pio</code></em> |
| 322 |
object is then associated with <em class="parameter"><code>tls</code></em> |
| 323 |
.</p> |
| 324 |
<div class="refsect3"> |
| 325 |
<a name="prelude-io-set-tls-io.parameters"></a><h4>Parameters</h4> |
| 326 |
<div class="informaltable"><table width="100%" border="0"> |
| 327 |
<colgroup> |
| 328 |
<col width="150px" class="parameters_name"> |
| 329 |
<col class="parameters_description"> |
| 330 |
<col width="200px" class="parameters_annotations"> |
| 331 |
</colgroup> |
| 332 |
<tbody> |
| 333 |
<tr> |
| 334 |
<td class="parameter_name"><p>pio</p></td> |
| 335 |
<td class="parameter_description"><p>A pointer on the <a class="link" href="libprelude-prelude-io.html#prelude-io-t" title="prelude_io_t"><span class="type">prelude_io_t</span></a> object.</p></td> |
| 336 |
<td class="parameter_annotations"> </td> |
| 337 |
</tr> |
| 338 |
<tr> |
| 339 |
<td class="parameter_name"><p>tls</p></td> |
| 340 |
<td class="parameter_description"><p>Pointer on the TLS structure holding the TLS connection data.</p></td> |
| 341 |
<td class="parameter_annotations"> </td> |
| 342 |
</tr> |
| 343 |
</tbody> |
| 344 |
</table></div> |
| 345 |
</div> |
| 346 |
</div> |
| 347 |
<hr> |
| 348 |
<div class="refsect2"> |
| 349 |
<a name="prelude-io-set-sys-io"></a><h3>prelude_io_set_sys_io ()</h3> |
| 350 |
<pre class="programlisting"><span class="returnvalue">void</span> |
| 351 |
prelude_io_set_sys_io (<em class="parameter"><code><a class="link" href="libprelude-prelude-io.html#prelude-io-t" title="prelude_io_t"><span class="type">prelude_io_t</span></a> *pio</code></em>, |
| 352 |
<em class="parameter"><code><span class="type">int</span> fd</code></em>);</pre> |
| 353 |
<p>Setup the <em class="parameter"><code>pio</code></em> |
| 354 |
object to work with system based I/O function. |
| 355 |
The <em class="parameter"><code>pio</code></em> |
| 356 |
object is then associated with <em class="parameter"><code>fd</code></em> |
| 357 |
.</p> |
| 358 |
<div class="refsect3"> |
| 359 |
<a name="prelude-io-set-sys-io.parameters"></a><h4>Parameters</h4> |
| 360 |
<div class="informaltable"><table width="100%" border="0"> |
| 361 |
<colgroup> |
| 362 |
<col width="150px" class="parameters_name"> |
| 363 |
<col class="parameters_description"> |
| 364 |
<col width="200px" class="parameters_annotations"> |
| 365 |
</colgroup> |
| 366 |
<tbody> |
| 367 |
<tr> |
| 368 |
<td class="parameter_name"><p>pio</p></td> |
| 369 |
<td class="parameter_description"><p>A pointer on the <a class="link" href="libprelude-prelude-io.html#prelude-io-t" title="prelude_io_t"><span class="type">prelude_io_t</span></a> object.</p></td> |
| 370 |
<td class="parameter_annotations"> </td> |
| 371 |
</tr> |
| 372 |
<tr> |
| 373 |
<td class="parameter_name"><p>fd</p></td> |
| 374 |
<td class="parameter_description"><p>A file descriptor.</p></td> |
| 375 |
<td class="parameter_annotations"> </td> |
| 376 |
</tr> |
| 377 |
</tbody> |
| 378 |
</table></div> |
| 379 |
</div> |
| 380 |
</div> |
| 381 |
<hr> |
| 382 |
<div class="refsect2"> |
| 383 |
<a name="prelude-io-set-buffer-io"></a><h3>prelude_io_set_buffer_io ()</h3> |
| 384 |
<pre class="programlisting"><span class="returnvalue">int</span> |
| 385 |
prelude_io_set_buffer_io (<em class="parameter"><code><a class="link" href="libprelude-prelude-io.html#prelude-io-t" title="prelude_io_t"><span class="type">prelude_io_t</span></a> *pio</code></em>);</pre> |
| 386 |
</div> |
| 387 |
<hr> |
| 388 |
<div class="refsect2"> |
| 389 |
<a name="prelude-io-set-fdptr"></a><h3>prelude_io_set_fdptr ()</h3> |
| 390 |
<pre class="programlisting"><span class="returnvalue">void</span> |
| 391 |
prelude_io_set_fdptr (<em class="parameter"><code><a class="link" href="libprelude-prelude-io.html#prelude-io-t" title="prelude_io_t"><span class="type">prelude_io_t</span></a> *pio</code></em>, |
| 392 |
<em class="parameter"><code><span class="type">void</span> *ptr</code></em>);</pre> |
| 393 |
<p>Set an user defined pointer that might be retrieved using |
| 394 |
<a class="link" href="libprelude-prelude-io.html#prelude-io-get-fdptr" title="prelude_io_get_fdptr ()"><code class="function">prelude_io_get_fdptr()</code></a>.</p> |
| 395 |
<div class="refsect3"> |
| 396 |
<a name="prelude-io-set-fdptr.parameters"></a><h4>Parameters</h4> |
| 397 |
<div class="informaltable"><table width="100%" border="0"> |
| 398 |
<colgroup> |
| 399 |
<col width="150px" class="parameters_name"> |
| 400 |
<col class="parameters_description"> |
| 401 |
<col width="200px" class="parameters_annotations"> |
| 402 |
</colgroup> |
| 403 |
<tbody> |
| 404 |
<tr> |
| 405 |
<td class="parameter_name"><p>pio</p></td> |
| 406 |
<td class="parameter_description"><p>Pointer to a <a class="link" href="libprelude-prelude-io.html#prelude-io-t" title="prelude_io_t"><span class="type">prelude_io_t</span></a> object.</p></td> |
| 407 |
<td class="parameter_annotations"> </td> |
| 408 |
</tr> |
| 409 |
<tr> |
| 410 |
<td class="parameter_name"><p>ptr</p></td> |
| 411 |
<td class="parameter_description"><p>Pointer to user defined data.</p></td> |
| 412 |
<td class="parameter_annotations"> </td> |
| 413 |
</tr> |
| 414 |
</tbody> |
| 415 |
</table></div> |
| 416 |
</div> |
| 417 |
</div> |
| 418 |
<hr> |
| 419 |
<div class="refsect2"> |
| 420 |
<a name="prelude-io-set-pending-callback"></a><h3>prelude_io_set_pending_callback ()</h3> |
| 421 |
<pre class="programlisting"><span class="returnvalue">void</span> |
| 422 |
prelude_io_set_pending_callback (<em class="parameter"><code><a class="link" href="libprelude-prelude-io.html#prelude-io-t" title="prelude_io_t"><span class="type">prelude_io_t</span></a> *pio</code></em>, |
| 423 |
<em class="parameter"><code><span class="type">ssize_t</span> (*pending) (prelude_io_t *io)</code></em>);</pre> |
| 424 |
<p>Set an user defined read callback function to be called on |
| 425 |
<a class="link" href="libprelude-prelude-io.html#prelude-io-pending" title="prelude_io_pending ()"><code class="function">prelude_io_pending()</code></a>.</p> |
| 426 |
<div class="refsect3"> |
| 427 |
<a name="prelude-io-set-pending-callback.parameters"></a><h4>Parameters</h4> |
| 428 |
<div class="informaltable"><table width="100%" border="0"> |
| 429 |
<colgroup> |
| 430 |
<col width="150px" class="parameters_name"> |
| 431 |
<col class="parameters_description"> |
| 432 |
<col width="200px" class="parameters_annotations"> |
| 433 |
</colgroup> |
| 434 |
<tbody> |
| 435 |
<tr> |
| 436 |
<td class="parameter_name"><p>pio</p></td> |
| 437 |
<td class="parameter_description"><p>Pointer to a <a class="link" href="libprelude-prelude-io.html#prelude-io-t" title="prelude_io_t"><span class="type">prelude_io_t</span></a> object.</p></td> |
| 438 |
<td class="parameter_annotations"> </td> |
| 439 |
</tr> |
| 440 |
<tr> |
| 441 |
<td class="parameter_name"><p>pending</p></td> |
| 442 |
<td class="parameter_description"><p>Callback function to be called on <a class="link" href="libprelude-prelude-io.html#prelude-io-pending" title="prelude_io_pending ()"><code class="function">prelude_io_pending()</code></a>.</p></td> |
| 443 |
<td class="parameter_annotations"> </td> |
| 444 |
</tr> |
| 445 |
</tbody> |
| 446 |
</table></div> |
| 447 |
</div> |
| 448 |
</div> |
| 449 |
<hr> |
| 450 |
<div class="refsect2"> |
| 451 |
<a name="prelude-io-set-read-callback"></a><h3>prelude_io_set_read_callback ()</h3> |
| 452 |
<pre class="programlisting"><span class="returnvalue">void</span> |
| 453 |
prelude_io_set_read_callback (<em class="parameter"><code><a class="link" href="libprelude-prelude-io.html#prelude-io-t" title="prelude_io_t"><span class="type">prelude_io_t</span></a> *pio</code></em>, |
| 454 |
<em class="parameter"><code><span class="type">ssize_t</span> (*read) (prelude_io_t *io, void *buf, size_t count)</code></em>);</pre> |
| 455 |
<p>Set an user defined read callback function to be called on |
| 456 |
<a class="link" href="libprelude-prelude-io.html#prelude-io-read" title="prelude_io_read ()"><code class="function">prelude_io_read()</code></a>.</p> |
| 457 |
<div class="refsect3"> |
| 458 |
<a name="prelude-io-set-read-callback.parameters"></a><h4>Parameters</h4> |
| 459 |
<div class="informaltable"><table width="100%" border="0"> |
| 460 |
<colgroup> |
| 461 |
<col width="150px" class="parameters_name"> |
| 462 |
<col class="parameters_description"> |
| 463 |
<col width="200px" class="parameters_annotations"> |
| 464 |
</colgroup> |
| 465 |
<tbody> |
| 466 |
<tr> |
| 467 |
<td class="parameter_name"><p>pio</p></td> |
| 468 |
<td class="parameter_description"><p>Pointer to a <a class="link" href="libprelude-prelude-io.html#prelude-io-t" title="prelude_io_t"><span class="type">prelude_io_t</span></a> object.</p></td> |
| 469 |
<td class="parameter_annotations"> </td> |
| 470 |
</tr> |
| 471 |
<tr> |
| 472 |
<td class="parameter_name"><p>read</p></td> |
| 473 |
<td class="parameter_description"><p>Callback function to be called on <a class="link" href="libprelude-prelude-io.html#prelude-io-read" title="prelude_io_read ()"><code class="function">prelude_io_read()</code></a>.</p></td> |
| 474 |
<td class="parameter_annotations"> </td> |
| 475 |
</tr> |
| 476 |
</tbody> |
| 477 |
</table></div> |
| 478 |
</div> |
| 479 |
</div> |
| 480 |
<hr> |
| 481 |
<div class="refsect2"> |
| 482 |
<a name="prelude-io-set-write-callback"></a><h3>prelude_io_set_write_callback ()</h3> |
| 483 |
<pre class="programlisting"><span class="returnvalue">void</span> |
| 484 |
prelude_io_set_write_callback (<em class="parameter"><code><a class="link" href="libprelude-prelude-io.html#prelude-io-t" title="prelude_io_t"><span class="type">prelude_io_t</span></a> *pio</code></em>, |
| 485 |
<em class="parameter"><code><span class="type">ssize_t</span> (*write) (prelude_io_t *io, const void *buf, size_t count)</code></em>);</pre> |
| 486 |
<p>Set an user defined write callback function to be called on |
| 487 |
<a class="link" href="libprelude-prelude-io.html#prelude-io-write" title="prelude_io_write ()"><code class="function">prelude_io_write()</code></a>.</p> |
| 488 |
<div class="refsect3"> |
| 489 |
<a name="prelude-io-set-write-callback.parameters"></a><h4>Parameters</h4> |
| 490 |
<div class="informaltable"><table width="100%" border="0"> |
| 491 |
<colgroup> |
| 492 |
<col width="150px" class="parameters_name"> |
| 493 |
<col class="parameters_description"> |
| 494 |
<col width="200px" class="parameters_annotations"> |
| 495 |
</colgroup> |
| 496 |
<tbody> |
| 497 |
<tr> |
| 498 |
<td class="parameter_name"><p>pio</p></td> |
| 499 |
<td class="parameter_description"><p>Pointer to a <a class="link" href="libprelude-prelude-io.html#prelude-io-t" title="prelude_io_t"><span class="type">prelude_io_t</span></a> object.</p></td> |
| 500 |
<td class="parameter_annotations"> </td> |
| 501 |
</tr> |
| 502 |
<tr> |
| 503 |
<td class="parameter_name"><p>write</p></td> |
| 504 |
<td class="parameter_description"><p>Callback function to be called on <a class="link" href="libprelude-prelude-io.html#prelude-io-write" title="prelude_io_write ()"><code class="function">prelude_io_write()</code></a>.</p></td> |
| 505 |
<td class="parameter_annotations"> </td> |
| 506 |
</tr> |
| 507 |
</tbody> |
| 508 |
</table></div> |
| 509 |
</div> |
| 510 |
</div> |
| 511 |
<hr> |
| 512 |
<div class="refsect2"> |
| 513 |
<a name="prelude-io-close"></a><h3>prelude_io_close ()</h3> |
| 514 |
<pre class="programlisting"><span class="returnvalue">int</span> |
| 515 |
prelude_io_close (<em class="parameter"><code><a class="link" href="libprelude-prelude-io.html#prelude-io-t" title="prelude_io_t"><span class="type">prelude_io_t</span></a> *pio</code></em>);</pre> |
| 516 |
<p>prelude_io_close() closes the file descriptor indentified by <em class="parameter"><code>pio</code></em> |
| 517 |
,</p> |
| 518 |
<p>The case where the <code class="function">close()</code> function would be interrupted by a signal is |
| 519 |
handled internally. So you don't have to check for EINTR.</p> |
| 520 |
<p>However, and especially when the underlaying layer is TLS, <a class="link" href="libprelude-prelude-io.html#prelude-io-close" title="prelude_io_close ()"><code class="function">prelude_io_close()</code></a> |
| 521 |
might return error. If this happen, you should continue calling the function |
| 522 |
until it return zero.</p> |
| 523 |
<div class="refsect3"> |
| 524 |
<a name="prelude-io-close.parameters"></a><h4>Parameters</h4> |
| 525 |
<div class="informaltable"><table width="100%" border="0"> |
| 526 |
<colgroup> |
| 527 |
<col width="150px" class="parameters_name"> |
| 528 |
<col class="parameters_description"> |
| 529 |
<col width="200px" class="parameters_annotations"> |
| 530 |
</colgroup> |
| 531 |
<tbody><tr> |
| 532 |
<td class="parameter_name"><p>pio</p></td> |
| 533 |
<td class="parameter_description"><p>Pointer to a <a class="link" href="libprelude-prelude-io.html#prelude-io-t" title="prelude_io_t"><span class="type">prelude_io_t</span></a> object.</p></td> |
| 534 |
<td class="parameter_annotations"> </td> |
| 535 |
</tr></tbody> |
| 536 |
</table></div> |
| 537 |
</div> |
| 538 |
<div class="refsect3"> |
| 539 |
<a name="prelude-io-close.returns"></a><h4>Returns</h4> |
| 540 |
<p> zero on success, or -1 if an error occurred.</p> |
| 541 |
</div> |
| 542 |
</div> |
| 543 |
<hr> |
| 544 |
<div class="refsect2"> |
| 545 |
<a name="prelude-io-read"></a><h3>prelude_io_read ()</h3> |
| 546 |
<pre class="programlisting"><span class="returnvalue">ssize_t</span> |
| 547 |
prelude_io_read (<em class="parameter"><code><a class="link" href="libprelude-prelude-io.html#prelude-io-t" title="prelude_io_t"><span class="type">prelude_io_t</span></a> *pio</code></em>, |
| 548 |
<em class="parameter"><code><span class="type">void</span> *buf</code></em>, |
| 549 |
<em class="parameter"><code><span class="type">size_t</span> count</code></em>);</pre> |
| 550 |
<p>prelude_io_read() attempts to read up to <em class="parameter"><code>count</code></em> |
| 551 |
bytes from the |
| 552 |
file descriptor identified by <em class="parameter"><code>pio</code></em> |
| 553 |
into the buffer starting at <em class="parameter"><code>buf</code></em> |
| 554 |
.</p> |
| 555 |
<p>If <em class="parameter"><code>count</code></em> |
| 556 |
is zero, <a class="link" href="libprelude-prelude-io.html#prelude-io-read" title="prelude_io_read ()"><code class="function">prelude_io_read()</code></a> returns zero and has no other |
| 557 |
results. If <em class="parameter"><code>count</code></em> |
| 558 |
is greater than SSIZE_MAX, the result is unspecified.</p> |
| 559 |
<p>The case where the read function would be interrupted by a signal is |
| 560 |
handled internally. So you don't have to check for EINTR.</p> |
| 561 |
<div class="refsect3"> |
| 562 |
<a name="prelude-io-read.parameters"></a><h4>Parameters</h4> |
| 563 |
<div class="informaltable"><table width="100%" border="0"> |
| 564 |
<colgroup> |
| 565 |
<col width="150px" class="parameters_name"> |
| 566 |
<col class="parameters_description"> |
| 567 |
<col width="200px" class="parameters_annotations"> |
| 568 |
</colgroup> |
| 569 |
<tbody> |
| 570 |
<tr> |
| 571 |
<td class="parameter_name"><p>pio</p></td> |
| 572 |
<td class="parameter_description"><p>Pointer to a <a class="link" href="libprelude-prelude-io.html#prelude-io-t" title="prelude_io_t"><span class="type">prelude_io_t</span></a> object.</p></td> |
| 573 |
<td class="parameter_annotations"> </td> |
| 574 |
</tr> |
| 575 |
<tr> |
| 576 |
<td class="parameter_name"><p>buf</p></td> |
| 577 |
<td class="parameter_description"><p>Pointer to the buffer to store data into.</p></td> |
| 578 |
<td class="parameter_annotations"> </td> |
| 579 |
</tr> |
| 580 |
<tr> |
| 581 |
<td class="parameter_name"><p>count</p></td> |
| 582 |
<td class="parameter_description"><p>Number of bytes to read.</p></td> |
| 583 |
<td class="parameter_annotations"> </td> |
| 584 |
</tr> |
| 585 |
</tbody> |
| 586 |
</table></div> |
| 587 |
</div> |
| 588 |
<div class="refsect3"> |
| 589 |
<a name="prelude-io-read.returns"></a><h4>Returns</h4> |
| 590 |
<p> On success, the number of bytes read is returned (zero |
| 591 |
indicates end of file). It is not an error if this number is smaller |
| 592 |
than the number of bytes requested; this may happen for example because |
| 593 |
fewer bytes are actually available right now or because <code class="function">read()</code> was |
| 594 |
interrupted by a signal.</p> |
| 595 |
<p>On error, a negative value is returned. In this case it is left unspecified |
| 596 |
whether the file position (if any) changes.</p> |
| 597 |
</div> |
| 598 |
</div> |
| 599 |
<hr> |
| 600 |
<div class="refsect2"> |
| 601 |
<a name="prelude-io-read-wait"></a><h3>prelude_io_read_wait ()</h3> |
| 602 |
<pre class="programlisting"><span class="returnvalue">ssize_t</span> |
| 603 |
prelude_io_read_wait (<em class="parameter"><code><a class="link" href="libprelude-prelude-io.html#prelude-io-t" title="prelude_io_t"><span class="type">prelude_io_t</span></a> *pio</code></em>, |
| 604 |
<em class="parameter"><code><span class="type">void</span> *buf</code></em>, |
| 605 |
<em class="parameter"><code><span class="type">size_t</span> count</code></em>);</pre> |
| 606 |
<p>prelude_io_read_wait() attempts to read up to <em class="parameter"><code>count</code></em> |
| 607 |
bytes from the |
| 608 |
file descriptor identified by <em class="parameter"><code>pio</code></em> |
| 609 |
into the buffer starting at <em class="parameter"><code>buf</code></em> |
| 610 |
.</p> |
| 611 |
<p>If <em class="parameter"><code>count</code></em> |
| 612 |
is zero, <a class="link" href="libprelude-prelude-io.html#prelude-io-read" title="prelude_io_read ()"><code class="function">prelude_io_read()</code></a> returns zero and has no other |
| 613 |
results. If <em class="parameter"><code>count</code></em> |
| 614 |
is greater than SSIZE_MAX, the result is unspecified.</p> |
| 615 |
<p>The case where the read function would be interrupted by a signal is |
| 616 |
handled internally. So you don't have to check for EINTR.</p> |
| 617 |
<p>prelude_io_read_wait() always return the number of bytes requested. |
| 618 |
Be carefull that this function is blocking.</p> |
| 619 |
<div class="refsect3"> |
| 620 |
<a name="prelude-io-read-wait.parameters"></a><h4>Parameters</h4> |
| 621 |
<div class="informaltable"><table width="100%" border="0"> |
| 622 |
<colgroup> |
| 623 |
<col width="150px" class="parameters_name"> |
| 624 |
<col class="parameters_description"> |
| 625 |
<col width="200px" class="parameters_annotations"> |
| 626 |
</colgroup> |
| 627 |
<tbody> |
| 628 |
<tr> |
| 629 |
<td class="parameter_name"><p>pio</p></td> |
| 630 |
<td class="parameter_description"><p>Pointer to a <a class="link" href="libprelude-prelude-io.html#prelude-io-t" title="prelude_io_t"><span class="type">prelude_io_t</span></a> object.</p></td> |
| 631 |
<td class="parameter_annotations"> </td> |
| 632 |
</tr> |
| 633 |
<tr> |
| 634 |
<td class="parameter_name"><p>buf</p></td> |
| 635 |
<td class="parameter_description"><p>Pointer to the buffer to store data into.</p></td> |
| 636 |
<td class="parameter_annotations"> </td> |
| 637 |
</tr> |
| 638 |
<tr> |
| 639 |
<td class="parameter_name"><p>count</p></td> |
| 640 |
<td class="parameter_description"><p>Number of bytes to read.</p></td> |
| 641 |
<td class="parameter_annotations"> </td> |
| 642 |
</tr> |
| 643 |
</tbody> |
| 644 |
</table></div> |
| 645 |
</div> |
| 646 |
<div class="refsect3"> |
| 647 |
<a name="prelude-io-read-wait.returns"></a><h4>Returns</h4> |
| 648 |
<p> On success, the number of bytes read is returned (zero |
| 649 |
indicates end of file).</p> |
| 650 |
<p>On error, -1 is returned, and errno is set appropriately. In this |
| 651 |
case it is left unspecified whether the file position (if any) changes.</p> |
| 652 |
</div> |
| 653 |
</div> |
| 654 |
<hr> |
| 655 |
<div class="refsect2"> |
| 656 |
<a name="prelude-io-read-delimited"></a><h3>prelude_io_read_delimited ()</h3> |
| 657 |
<pre class="programlisting"><span class="returnvalue">ssize_t</span> |
| 658 |
prelude_io_read_delimited (<em class="parameter"><code><a class="link" href="libprelude-prelude-io.html#prelude-io-t" title="prelude_io_t"><span class="type">prelude_io_t</span></a> *pio</code></em>, |
| 659 |
<em class="parameter"><code>unsigned <span class="type">char</span> **buf</code></em>);</pre> |
| 660 |
<p>prelude_io_read_delimited() read message written by <code class="function">prelude_write_delimited()</code>. |
| 661 |
Theses messages are sents along with the len of the message.</p> |
| 662 |
<p>Uppon return the <em class="parameter"><code>buf</code></em> |
| 663 |
argument is updated to point on a newly allocated |
| 664 |
buffer containing the data read. The <em class="parameter"><code>count</code></em> |
| 665 |
argument is set to the number of |
| 666 |
bytes the message was containing.</p> |
| 667 |
<p>The case where the read function would be interrupted by a signal is |
| 668 |
handled internally. So you don't have to check for EINTR.</p> |
| 669 |
<div class="refsect3"> |
| 670 |
<a name="prelude-io-read-delimited.parameters"></a><h4>Parameters</h4> |
| 671 |
<div class="informaltable"><table width="100%" border="0"> |
| 672 |
<colgroup> |
| 673 |
<col width="150px" class="parameters_name"> |
| 674 |
<col class="parameters_description"> |
| 675 |
<col width="200px" class="parameters_annotations"> |
| 676 |
</colgroup> |
| 677 |
<tbody> |
| 678 |
<tr> |
| 679 |
<td class="parameter_name"><p>pio</p></td> |
| 680 |
<td class="parameter_description"><p>Pointer to a <a class="link" href="libprelude-prelude-io.html#prelude-io-t" title="prelude_io_t"><span class="type">prelude_io_t</span></a> object.</p></td> |
| 681 |
<td class="parameter_annotations"> </td> |
| 682 |
</tr> |
| 683 |
<tr> |
| 684 |
<td class="parameter_name"><p>buf</p></td> |
| 685 |
<td class="parameter_description"><p>Pointer to the address of a buffer to store address of data into.</p></td> |
| 686 |
<td class="parameter_annotations"> </td> |
| 687 |
</tr> |
| 688 |
</tbody> |
| 689 |
</table></div> |
| 690 |
</div> |
| 691 |
<div class="refsect3"> |
| 692 |
<a name="prelude-io-read-delimited.returns"></a><h4>Returns</h4> |
| 693 |
<p> On success, the number of bytes read is returned (zero |
| 694 |
indicates end of file).</p> |
| 695 |
<p>On error, -1 is returned, and errno is set appropriately. In this |
| 696 |
case it is left unspecified whether the file position (if any) changes.</p> |
| 697 |
</div> |
| 698 |
</div> |
| 699 |
<hr> |
| 700 |
<div class="refsect2"> |
| 701 |
<a name="prelude-io-write"></a><h3>prelude_io_write ()</h3> |
| 702 |
<pre class="programlisting"><span class="returnvalue">ssize_t</span> |
| 703 |
prelude_io_write (<em class="parameter"><code><a class="link" href="libprelude-prelude-io.html#prelude-io-t" title="prelude_io_t"><span class="type">prelude_io_t</span></a> *pio</code></em>, |
| 704 |
<em class="parameter"><code>const <span class="type">void</span> *buf</code></em>, |
| 705 |
<em class="parameter"><code><span class="type">size_t</span> count</code></em>);</pre> |
| 706 |
<p>prelude_io_write() writes up to <em class="parameter"><code>count</code></em> |
| 707 |
bytes to the file descriptor |
| 708 |
identified by <em class="parameter"><code>pio</code></em> |
| 709 |
from the buffer starting at <em class="parameter"><code>buf</code></em> |
| 710 |
. POSIX requires |
| 711 |
that a <code class="function">read()</code> which can be proved to occur after a <code class="function">write()</code> has returned |
| 712 |
returns the new data. Note that not all file systems are POSIX conforming.</p> |
| 713 |
<p>The case where the <code class="function">write()</code> function would be interrupted by a signal is |
| 714 |
handled internally. So you don't have to check for EINTR.</p> |
| 715 |
<div class="refsect3"> |
| 716 |
<a name="prelude-io-write.parameters"></a><h4>Parameters</h4> |
| 717 |
<div class="informaltable"><table width="100%" border="0"> |
| 718 |
<colgroup> |
| 719 |
<col width="150px" class="parameters_name"> |
| 720 |
<col class="parameters_description"> |
| 721 |
<col width="200px" class="parameters_annotations"> |
| 722 |
</colgroup> |
| 723 |
<tbody> |
| 724 |
<tr> |
| 725 |
<td class="parameter_name"><p>pio</p></td> |
| 726 |
<td class="parameter_description"><p>Pointer to a <a class="link" href="libprelude-prelude-io.html#prelude-io-t" title="prelude_io_t"><span class="type">prelude_io_t</span></a> object.</p></td> |
| 727 |
<td class="parameter_annotations"> </td> |
| 728 |
</tr> |
| 729 |
<tr> |
| 730 |
<td class="parameter_name"><p>buf</p></td> |
| 731 |
<td class="parameter_description"><p>Pointer to the buffer to write data from.</p></td> |
| 732 |
<td class="parameter_annotations"> </td> |
| 733 |
</tr> |
| 734 |
<tr> |
| 735 |
<td class="parameter_name"><p>count</p></td> |
| 736 |
<td class="parameter_description"><p>Number of bytes to write.</p></td> |
| 737 |
<td class="parameter_annotations"> </td> |
| 738 |
</tr> |
| 739 |
</tbody> |
| 740 |
</table></div> |
| 741 |
</div> |
| 742 |
<div class="refsect3"> |
| 743 |
<a name="prelude-io-write.returns"></a><h4>Returns</h4> |
| 744 |
<p> On success, the number of bytes written are returned (zero |
| 745 |
indicates nothing was written). On error, -1 is returned, and errno |
| 746 |
is set appropriately. If <em class="parameter"><code>count</code></em> |
| 747 |
is zero and the file descriptor refers |
| 748 |
to a regular file, 0 will be returned without causing any other effect. |
| 749 |
For a special file, the results are not portable.</p> |
| 750 |
</div> |
| 751 |
</div> |
| 752 |
<hr> |
| 753 |
<div class="refsect2"> |
| 754 |
<a name="prelude-io-write-delimited"></a><h3>prelude_io_write_delimited ()</h3> |
| 755 |
<pre class="programlisting"><span class="returnvalue">ssize_t</span> |
| 756 |
prelude_io_write_delimited (<em class="parameter"><code><a class="link" href="libprelude-prelude-io.html#prelude-io-t" title="prelude_io_t"><span class="type">prelude_io_t</span></a> *pio</code></em>, |
| 757 |
<em class="parameter"><code>const <span class="type">void</span> *buf</code></em>, |
| 758 |
<em class="parameter"><code><a class="link" href="libprelude-prelude-inttypes.html#uint16-t" title="uint16_t"><span class="type">uint16_t</span></a> count</code></em>);</pre> |
| 759 |
<p>prelude_io_write_delimited() writes up to <em class="parameter"><code>count</code></em> |
| 760 |
bytes to the file descriptor |
| 761 |
identified by <em class="parameter"><code>pio</code></em> |
| 762 |
from the buffer starting at <em class="parameter"><code>buf</code></em> |
| 763 |
. POSIX requires |
| 764 |
that a <code class="function">read()</code> which can be proved to occur after a <code class="function">write()</code> has returned |
| 765 |
returns the new data. Note that not all file systems are POSIX conforming.</p> |
| 766 |
<p>prelude_io_write_delimited() also write the len of the data to be sent. |
| 767 |
which allow <a class="link" href="libprelude-prelude-io.html#prelude-io-read-delimited" title="prelude_io_read_delimited ()"><code class="function">prelude_io_read_delimited()</code></a> to safely know if it got all the |
| 768 |
data a given write contain.</p> |
| 769 |
<p>The case where the <code class="function">write()</code> function would be interrupted by a signal is |
| 770 |
handled internally. So you don't have to check for EINTR.</p> |
| 771 |
<div class="refsect3"> |
| 772 |
<a name="prelude-io-write-delimited.parameters"></a><h4>Parameters</h4> |
| 773 |
<div class="informaltable"><table width="100%" border="0"> |
| 774 |
<colgroup> |
| 775 |
<col width="150px" class="parameters_name"> |
| 776 |
<col class="parameters_description"> |
| 777 |
<col width="200px" class="parameters_annotations"> |
| 778 |
</colgroup> |
| 779 |
<tbody> |
| 780 |
<tr> |
| 781 |
<td class="parameter_name"><p>pio</p></td> |
| 782 |
<td class="parameter_description"><p>Pointer to a <a class="link" href="libprelude-prelude-io.html#prelude-io-t" title="prelude_io_t"><span class="type">prelude_io_t</span></a> object.</p></td> |
| 783 |
<td class="parameter_annotations"> </td> |
| 784 |
</tr> |
| 785 |
<tr> |
| 786 |
<td class="parameter_name"><p>buf</p></td> |
| 787 |
<td class="parameter_description"><p>Pointer to the buffer to write data from.</p></td> |
| 788 |
<td class="parameter_annotations"> </td> |
| 789 |
</tr> |
| 790 |
<tr> |
| 791 |
<td class="parameter_name"><p>count</p></td> |
| 792 |
<td class="parameter_description"><p>Number of bytes to write.</p></td> |
| 793 |
<td class="parameter_annotations"> </td> |
| 794 |
</tr> |
| 795 |
</tbody> |
| 796 |
</table></div> |
| 797 |
</div> |
| 798 |
<div class="refsect3"> |
| 799 |
<a name="prelude-io-write-delimited.returns"></a><h4>Returns</h4> |
| 800 |
<p> On success, the number of bytes written are returned (zero |
| 801 |
indicates nothing was written). On error, -1 is returned, and errno |
| 802 |
is set appropriately.</p> |
| 803 |
</div> |
| 804 |
</div> |
| 805 |
<hr> |
| 806 |
<div class="refsect2"> |
| 807 |
<a name="prelude-io-forward"></a><h3>prelude_io_forward ()</h3> |
| 808 |
<pre class="programlisting"><span class="returnvalue">ssize_t</span> |
| 809 |
prelude_io_forward (<em class="parameter"><code><a class="link" href="libprelude-prelude-io.html#prelude-io-t" title="prelude_io_t"><span class="type">prelude_io_t</span></a> *dst</code></em>, |
| 810 |
<em class="parameter"><code><a class="link" href="libprelude-prelude-io.html#prelude-io-t" title="prelude_io_t"><span class="type">prelude_io_t</span></a> *src</code></em>, |
| 811 |
<em class="parameter"><code><span class="type">size_t</span> count</code></em>);</pre> |
| 812 |
<p>prelude_io_forward() attempts to transfer up to <em class="parameter"><code>count</code></em> |
| 813 |
bytes from |
| 814 |
the file descriptor identified by <em class="parameter"><code>src</code></em> |
| 815 |
into the file descriptor |
| 816 |
identified by <em class="parameter"><code>dst</code></em> |
| 817 |
.</p> |
| 818 |
<div class="refsect3"> |
| 819 |
<a name="prelude-io-forward.parameters"></a><h4>Parameters</h4> |
| 820 |
<div class="informaltable"><table width="100%" border="0"> |
| 821 |
<colgroup> |
| 822 |
<col width="150px" class="parameters_name"> |
| 823 |
<col class="parameters_description"> |
| 824 |
<col width="200px" class="parameters_annotations"> |
| 825 |
</colgroup> |
| 826 |
<tbody> |
| 827 |
<tr> |
| 828 |
<td class="parameter_name"><p>src</p></td> |
| 829 |
<td class="parameter_description"><p>Pointer to a <a class="link" href="libprelude-prelude-io.html#prelude-io-t" title="prelude_io_t"><span class="type">prelude_io_t</span></a> object.</p></td> |
| 830 |
<td class="parameter_annotations"> </td> |
| 831 |
</tr> |
| 832 |
<tr> |
| 833 |
<td class="parameter_name"><p>dst</p></td> |
| 834 |
<td class="parameter_description"><p>Pointer to a <a class="link" href="libprelude-prelude-io.html#prelude-io-t" title="prelude_io_t"><span class="type">prelude_io_t</span></a> object.</p></td> |
| 835 |
<td class="parameter_annotations"> </td> |
| 836 |
</tr> |
| 837 |
<tr> |
| 838 |
<td class="parameter_name"><p>count</p></td> |
| 839 |
<td class="parameter_description"><p>Number of byte to forward from <em class="parameter"><code>src</code></em> |
| 840 |
to <em class="parameter"><code>dst</code></em> |
| 841 |
.</p></td> |
| 842 |
<td class="parameter_annotations"> </td> |
| 843 |
</tr> |
| 844 |
</tbody> |
| 845 |
</table></div> |
| 846 |
</div> |
| 847 |
<div class="refsect3"> |
| 848 |
<a name="prelude-io-forward.returns"></a><h4>Returns</h4> |
| 849 |
<p> If the transfer was successful, the number of bytes written |
| 850 |
to <em class="parameter"><code>dst</code></em> |
| 851 |
is returned. On error, -1 is returned, and errno is set appropriately.</p> |
| 852 |
</div> |
| 853 |
</div> |
| 854 |
<hr> |
| 855 |
<div class="refsect2"> |
| 856 |
<a name="prelude-io-get-fd"></a><h3>prelude_io_get_fd ()</h3> |
| 857 |
<pre class="programlisting"><span class="returnvalue">int</span> |
| 858 |
prelude_io_get_fd (<em class="parameter"><code><a class="link" href="libprelude-prelude-io.html#prelude-io-t" title="prelude_io_t"><span class="type">prelude_io_t</span></a> *pio</code></em>);</pre> |
| 859 |
<div class="refsect3"> |
| 860 |
<a name="prelude-io-get-fd.parameters"></a><h4>Parameters</h4> |
| 861 |
<div class="informaltable"><table width="100%" border="0"> |
| 862 |
<colgroup> |
| 863 |
<col width="150px" class="parameters_name"> |
| 864 |
<col class="parameters_description"> |
| 865 |
<col width="200px" class="parameters_annotations"> |
| 866 |
</colgroup> |
| 867 |
<tbody><tr> |
| 868 |
<td class="parameter_name"><p>pio</p></td> |
| 869 |
<td class="parameter_description"><p>A pointer on a <a class="link" href="libprelude-prelude-io.html#prelude-io-t" title="prelude_io_t"><span class="type">prelude_io_t</span></a> object.</p></td> |
| 870 |
<td class="parameter_annotations"> </td> |
| 871 |
</tr></tbody> |
| 872 |
</table></div> |
| 873 |
</div> |
| 874 |
<div class="refsect3"> |
| 875 |
<a name="prelude-io-get-fd.returns"></a><h4>Returns</h4> |
| 876 |
<p> The FD associated with this object.</p> |
| 877 |
</div> |
| 878 |
</div> |
| 879 |
<hr> |
| 880 |
<div class="refsect2"> |
| 881 |
<a name="prelude-io-get-fdptr"></a><h3>prelude_io_get_fdptr ()</h3> |
| 882 |
<pre class="programlisting"><span class="returnvalue">void</span> * |
| 883 |
prelude_io_get_fdptr (<em class="parameter"><code><a class="link" href="libprelude-prelude-io.html#prelude-io-t" title="prelude_io_t"><span class="type">prelude_io_t</span></a> *pio</code></em>);</pre> |
| 884 |
<div class="refsect3"> |
| 885 |
<a name="prelude-io-get-fdptr.parameters"></a><h4>Parameters</h4> |
| 886 |
<div class="informaltable"><table width="100%" border="0"> |
| 887 |
<colgroup> |
| 888 |
<col width="150px" class="parameters_name"> |
| 889 |
<col class="parameters_description"> |
| 890 |
<col width="200px" class="parameters_annotations"> |
| 891 |
</colgroup> |
| 892 |
<tbody><tr> |
| 893 |
<td class="parameter_name"><p>pio</p></td> |
| 894 |
<td class="parameter_description"><p>A pointer on a <a class="link" href="libprelude-prelude-io.html#prelude-io-t" title="prelude_io_t"><span class="type">prelude_io_t</span></a> object.</p></td> |
| 895 |
<td class="parameter_annotations"> </td> |
| 896 |
</tr></tbody> |
| 897 |
</table></div> |
| 898 |
</div> |
| 899 |
<div class="refsect3"> |
| 900 |
<a name="prelude-io-get-fdptr.returns"></a><h4>Returns</h4> |
| 901 |
<p> Pointer associated with this object (file, tls, buffer, or NULL).</p> |
| 902 |
</div> |
| 903 |
</div> |
| 904 |
<hr> |
| 905 |
<div class="refsect2"> |
| 906 |
<a name="prelude-io-pending"></a><h3>prelude_io_pending ()</h3> |
| 907 |
<pre class="programlisting"><span class="returnvalue">ssize_t</span> |
| 908 |
prelude_io_pending (<em class="parameter"><code><a class="link" href="libprelude-prelude-io.html#prelude-io-t" title="prelude_io_t"><span class="type">prelude_io_t</span></a> *pio</code></em>);</pre> |
| 909 |
<p>prelude_io_pending return the number of bytes waiting to |
| 910 |
be read on an TLS or socket fd.</p> |
| 911 |
<div class="refsect3"> |
| 912 |
<a name="prelude-io-pending.parameters"></a><h4>Parameters</h4> |
| 913 |
<div class="informaltable"><table width="100%" border="0"> |
| 914 |
<colgroup> |
| 915 |
<col width="150px" class="parameters_name"> |
| 916 |
<col class="parameters_description"> |
| 917 |
<col width="200px" class="parameters_annotations"> |
| 918 |
</colgroup> |
| 919 |
<tbody><tr> |
| 920 |
<td class="parameter_name"><p>pio</p></td> |
| 921 |
<td class="parameter_description"><p>Pointer to a <a class="link" href="libprelude-prelude-io.html#prelude-io-t" title="prelude_io_t"><span class="type">prelude_io_t</span></a> object.</p></td> |
| 922 |
<td class="parameter_annotations"> </td> |
| 923 |
</tr></tbody> |
| 924 |
</table></div> |
| 925 |
</div> |
| 926 |
<div class="refsect3"> |
| 927 |
<a name="prelude-io-pending.returns"></a><h4>Returns</h4> |
| 928 |
<p> Number of byte waiting to be read on <em class="parameter"><code>pio</code></em> |
| 929 |
, or -1 |
| 930 |
if <em class="parameter"><code>pio</code></em> |
| 931 |
is not of type TLS or socket.</p> |
| 932 |
</div> |
| 933 |
</div> |
| 934 |
<hr> |
| 935 |
<div class="refsect2"> |
| 936 |
<a name="prelude-io-is-error-fatal"></a><h3>prelude_io_is_error_fatal ()</h3> |
| 937 |
<pre class="programlisting"><a class="link" href="libprelude-prelude-inttypes.html#prelude-bool-t" title="enum prelude_bool_t"><span class="returnvalue">prelude_bool_t</span></a> |
| 938 |
prelude_io_is_error_fatal (<em class="parameter"><code><a class="link" href="libprelude-prelude-io.html#prelude-io-t" title="prelude_io_t"><span class="type">prelude_io_t</span></a> *pio</code></em>, |
| 939 |
<em class="parameter"><code><span class="type">int</span> error</code></em>);</pre> |
| 940 |
<p>Check whether the returned error is fatal, or not.</p> |
| 941 |
<div class="refsect3"> |
| 942 |
<a name="prelude-io-is-error-fatal.parameters"></a><h4>Parameters</h4> |
| 943 |
<div class="informaltable"><table width="100%" border="0"> |
| 944 |
<colgroup> |
| 945 |
<col width="150px" class="parameters_name"> |
| 946 |
<col class="parameters_description"> |
| 947 |
<col width="200px" class="parameters_annotations"> |
| 948 |
</colgroup> |
| 949 |
<tbody> |
| 950 |
<tr> |
| 951 |
<td class="parameter_name"><p>pio</p></td> |
| 952 |
<td class="parameter_description"><p>Pointer to a <a class="link" href="libprelude-prelude-io.html#prelude-io-t" title="prelude_io_t"><span class="type">prelude_io_t</span></a> object.</p></td> |
| 953 |
<td class="parameter_annotations"> </td> |
| 954 |
</tr> |
| 955 |
<tr> |
| 956 |
<td class="parameter_name"><p>error</p></td> |
| 957 |
<td class="parameter_description"><p>Error returned by one of the <a class="link" href="libprelude-prelude-io.html#prelude-io-t" title="prelude_io_t"><span class="type">prelude_io_t</span></a> function.</p></td> |
| 958 |
<td class="parameter_annotations"> </td> |
| 959 |
</tr> |
| 960 |
</tbody> |
| 961 |
</table></div> |
| 962 |
</div> |
| 963 |
<div class="refsect3"> |
| 964 |
<a name="prelude-io-is-error-fatal.returns"></a><h4>Returns</h4> |
| 965 |
<p> TRUE if error is fatal, FALSE if it is not.</p> |
| 966 |
</div> |
| 967 |
</div> |
| 968 |
</div> |
| 969 |
<div class="refsect1"> |
| 970 |
<a name="libprelude-prelude-io.other_details"></a><h2>Types and Values</h2> |
| 971 |
<div class="refsect2"> |
| 972 |
<a name="prelude-io-t"></a><h3>prelude_io_t</h3> |
| 973 |
<pre class="programlisting">typedef struct prelude_io prelude_io_t; |
| 974 |
</pre> |
| 975 |
</div> |
| 976 |
</div> |
| 977 |
</div> |
| 978 |
<div class="footer"> |
| 979 |
<hr>Generated by GTK-Doc V1.28</div> |
| 980 |
</body> |
| 981 |
</html> |