1<?xml version="1.0" encoding="UTF-8" standalone="no"?> 2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 3<html xmlns="http://www.w3.org/1999/xhtml"> 4 <head> 5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 6 <title>db_env_set_func_ftruncate</title> 7 <link rel="stylesheet" href="apiReference.css" type="text/css" /> 8 <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /> 9 <link rel="start" href="index.html" title="Berkeley DB C API Reference" /> 10 <link rel="up" href="setfunc.html" title="Appendix��3.�� Berkeley DB Application Space Static Functions" /> 11 <link rel="prev" href="db_env_set_func_fsync.html" title="db_env_set_func_fsync" /> 12 <link rel="next" href="db_env_set_func_ioinfo.html" title="db_env_set_func_ioinfo" /> 13 </head> 14 <body> 15 <div class="navheader"> 16 <table width="100%" summary="Navigation header"> 17 <tr> 18 <th colspan="3" align="center">db_env_set_func_ftruncate</th> 19 </tr> 20 <tr> 21 <td width="20%" align="left"><a accesskey="p" href="db_env_set_func_fsync.html">Prev</a>��</td> 22 <th width="60%" align="center">Appendix��3.�� 23 Berkeley DB Application Space Static Functions 24 </th> 25 <td width="20%" align="right">��<a accesskey="n" href="db_env_set_func_ioinfo.html">Next</a></td> 26 </tr> 27 </table> 28 <hr /> 29 </div> 30 <div class="sect1" lang="en" xml:lang="en"> 31 <div class="titlepage"> 32 <div> 33 <div> 34 <h2 class="title" style="clear: both"><a id="db_env_set_func_ftruncate"></a>db_env_set_func_ftruncate</h2> 35 </div> 36 </div> 37 </div> 38 <pre class="programlisting">#include <db.h> 39 40int 41db_env_set_func_ftruncate(int (*func_ftruncate)(int fd, off_t offset)); </pre> 42 <p> 43 The Berkeley DB library requires the ability to truncate a file. 44 </p> 45 <p> 46 The <code class="function">db_env_set_func_ftruncate</code> function configures all operations 47 performed by a process and all of its threads of control, not 48 operations confined to a single database environment. 49 </p> 50 <p> 51 Although the <code class="function">db_env_set_func_ftruncate</code> function may be called at any 52 time during the life of the application, it should normally be called 53 before making calls to the <a class="xref" href="envcreate.html" title="db_env_create">db_env_create</a> or 54 <a class="xref" href="dbcreate.html" title="db_create">db_create</a> methods. 55 </p> 56 <p> 57 The <code class="function">db_env_set_func_ftruncate()</code> <span> 58 function returns a non-zero error value on failure and 0 on success. 59 </span> 60 </p> 61 <div class="sect2" lang="en" xml:lang="en"> 62 <div class="titlepage"> 63 <div> 64 <div> 65 <h3 class="title"><a id="id1719361"></a>Parameters</h3> 66 </div> 67 </div> 68 </div> 69 <div class="sect3" lang="en" xml:lang="en"> 70 <div class="titlepage"> 71 <div> 72 <div> 73 <h4 class="title"><a id="id1719589"></a>func_ftruncate</h4> 74 </div> 75 </div> 76 </div> 77 <p> 78 The <span class="bold"><strong>func_ftruncate</strong></span> parameter is the 79 function which truncates a file. 80 </p> 81 <p> 82 The <span class="bold"><strong>fd</strong></span> parameter is an open file 83 descriptor on the file. 84 </p> 85 <p> 86 The <span class="bold"><strong>ftruncate</strong></span> function must truncate 87 the file to the byte length specified by the <span class="bold"><strong>offset</strong></span> parameter. 88 </p> 89 <p> 90 The <span class="bold"><strong>func_ftruncate</strong></span> function must 91 return the value of <span class="bold"><strong>errno</strong></span> on failure 92 and 0 on success. 93 </p> 94 </div> 95 </div> 96 <div class="sect2" lang="en" xml:lang="en"> 97 <div class="titlepage"> 98 <div> 99 <div> 100 <h3 class="title"><a id="id1719733"></a>See Also</h3> 101 </div> 102 </div> 103 </div> 104 <p> 105 <a href="../../programmer_reference/program_runtime.html" class="olink">Run-time configuration</a> 106 </p> 107 </div> 108 </div> 109 <div class="navfooter"> 110 <hr /> 111 <table width="100%" summary="Navigation footer"> 112 <tr> 113 <td width="40%" align="left"><a accesskey="p" href="db_env_set_func_fsync.html">Prev</a>��</td> 114 <td width="20%" align="center"> 115 <a accesskey="u" href="setfunc.html">Up</a> 116 </td> 117 <td width="40%" align="right">��<a accesskey="n" href="db_env_set_func_ioinfo.html">Next</a></td> 118 </tr> 119 <tr> 120 <td width="40%" align="left" valign="top">db_env_set_func_fsync��</td> 121 <td width="20%" align="center"> 122 <a accesskey="h" href="index.html">Home</a> 123 </td> 124 <td width="40%" align="right" valign="top">��db_env_set_func_ioinfo</td> 125 </tr> 126 </table> 127 </div> 128 </body> 129</html> 130