| 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_intermediate_dir_mode()</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="env.html" title="Chapter 5. The DB_ENV Handle" /> |
| 11 | <link rel="prev" href="envset_flags.html" title="DB_ENV->set_flags()" /> |
| 12 | <link rel="next" href="envset_isalive.html" title="DB_ENV->set_isalive()" /> |
| 13 | </head> |
| 14 | <body> |
| 15 | <div xmlns="" class="navheader"> |
| 16 | <div class="libver"> |
| 17 | <p>Library Version 11.2.5.3</p> |
| 18 | </div> |
| 19 | <table width="100%" summary="Navigation header"> |
| 20 | <tr> |
| 21 | <th colspan="3" align="center">DB_ENV->set_intermediate_dir_mode()</th> |
| 22 | </tr> |
| 23 | <tr> |
| 24 | <td width="20%" align="left"><a accesskey="p" href="envset_flags.html">Prev</a> </td> |
| 25 | <th width="60%" align="center">Chapter 5. |
| 26 | The DB_ENV Handle |
| 27 | </th> |
| 28 | <td width="20%" align="right"> <a accesskey="n" href="envset_isalive.html">Next</a></td> |
| 29 | </tr> |
| 30 | </table> |
| 31 | <hr /> |
| 32 | </div> |
| 33 | <div class="sect1" lang="en" xml:lang="en"> |
| 34 | <div class="titlepage"> |
| 35 | <div> |
| 36 | <div> |
| 37 | <h2 class="title" style="clear: both"><a id="envset_intermediate_dir_mode"></a>DB_ENV->set_intermediate_dir_mode()</h2> |
| 38 | </div> |
| 39 | </div> |
| 40 | </div> |
| 41 | <pre class="programlisting">#include <db.h> |
| 42 | |
| 43 | int |
| 44 | DB_ENV->set_intermediate_dir_mode(DB_ENV *dbenv, const char *mode); </pre> |
| 45 | <p> |
| 46 | By default, Berkeley DB does not create intermediate directories |
| 47 | needed for recovery, that is, if the file <span class="bold"><strong>/a/b/c/mydatabase</strong></span> is being recovered, and the |
| 48 | directory path <span class="bold"><strong>b/c</strong></span> does not exist, |
| 49 | recovery will fail. This default behavior is because Berkeley DB |
| 50 | does not know what permissions are appropriate for intermediate |
| 51 | directory creation, and creating the directory might result in a |
| 52 | security problem. |
| 53 | </p> |
| 54 | <p> |
| 55 | The <code class="methodname">DB_ENV->set_intermediate_dir_mode()</code> method causes Berkeley DB to |
| 56 | create any intermediate directories needed during recovery, using the |
| 57 | specified permissions. |
| 58 | </p> |
| 59 | <p> |
| 60 | On UNIX systems or in IEEE/ANSI Std 1003.1 (POSIX) environments, |
| 61 | created directories are owned by the process owner; the group |
| 62 | ownership of created directories is based on the system and directory |
| 63 | defaults, and is not further specified by Berkeley DB. |
| 64 | </p> |
| 65 | <p> |
| 66 | The database environment's intermediate directory permissions may |
| 67 | also be configured using the environment's <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file. The |
| 68 | syntax of the entry in that file is a single line with the string |
| 69 | "set_intermediate_dir_mode", one or more whitespace characters, |
| 70 | and the directory permissions. Because the <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file is |
| 71 | read when the database environment is opened, it will silently |
| 72 | overrule configuration done before that time. |
| 73 | </p> |
| 74 | <p> |
| 75 | The <code class="methodname">DB_ENV->set_intermediate_dir_mode()</code> method configures operations |
| 76 | performed using the specified |
| 77 | <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> handle, not all |
| 78 | operations performed on the underlying database environment. |
| 79 | </p> |
| 80 | <p> |
| 81 | The <code class="methodname">DB_ENV->set_intermediate_dir_mode()</code> method may not be called |
| 82 | after the <a class="xref" href="envopen.html" title="DB_ENV->open()">DB_ENV->open()</a> |
| 83 | method is called. |
| 84 | </p> |
| 85 | <p> |
| 86 | The <code class="methodname">DB_ENV->set_intermediate_dir_mode()</code> <span> |
| 87 | <span> |
| 88 | method returns a non-zero error value on failure and 0 on success. |
| 89 | </span> |
| 90 | |
| 91 | </span> |
| 92 | </p> |
| 93 | <div class="sect2" lang="en" xml:lang="en"> |
| 94 | <div class="titlepage"> |
| 95 | <div> |
| 96 | <div> |
| 97 | <h3 class="title"><a id="idp52032712"></a>Parameters</h3> |
| 98 | </div> |
| 99 | </div> |
| 100 | </div> |
| 101 | <div class="sect3" lang="en" xml:lang="en"> |
| 102 | <div class="titlepage"> |
| 103 | <div> |
| 104 | <div> |
| 105 | <h4 class="title"><a id="idp52034520"></a>mode</h4> |
| 106 | </div> |
| 107 | </div> |
| 108 | </div> |
| 109 | <p> |
| 110 | The <span class="bold"><strong>mode</strong></span> parameter specifies the |
| 111 | directory permissions. |
| 112 | </p> |
| 113 | <p> |
| 114 | Directory permissions are interpreted as a string of nine characters, |
| 115 | using the character set <span class="bold"><strong>r</strong></span> (read), |
| 116 | <span class="bold"><strong>w</strong></span> (write), <span class="bold"><strong>x</strong></span> (execute or search), and <span class="bold"><strong>-</strong></span> (none). The first character is the read |
| 117 | permissions for the directory owner (set to either <span class="bold"><strong>r</strong></span> or <span class="bold"><strong>-</strong></span>). The |
| 118 | second character is the write permissions for the directory owner (set |
| 119 | to either <span class="bold"><strong>w</strong></span> or <span class="bold"><strong>-</strong></span>). The third character is the execute |
| 120 | permissions for the directory owner (set to either <span class="bold"><strong>x</strong></span> or <span class="bold"><strong>-</strong></span>). |
| 121 | </p> |
| 122 | <p> |
| 123 | Similarly, the second set of three characters are the read, write and |
| 124 | execute/search permissions for the directory group, and the third set |
| 125 | of three characters are the read, write and execute/search permissions |
| 126 | for all others. For example, the string <span class="bold"><strong>rwx------</strong></span> would configure read, write and |
| 127 | execute/search access for the owner only. The string <span class="bold"><strong>rwxrwx---</strong></span> would configure read, write and |
| 128 | execute/search access for both the owner and the group. The string |
| 129 | <span class="bold"><strong>rwxr-----</strong></span> would configure read, write |
| 130 | and execute/search access for the directory owner and read-only access |
| 131 | for the directory group. |
| 132 | </p> |
| 133 | </div> |
| 134 | </div> |
| 135 | <div class="sect2" lang="en" xml:lang="en"> |
| 136 | <div class="titlepage"> |
| 137 | <div> |
| 138 | <div> |
| 139 | <h3 class="title"><a id="idp52086800"></a>Errors</h3> |
| 140 | </div> |
| 141 | </div> |
| 142 | </div> |
| 143 | <p> |
| 144 | The <code class="methodname">DB_ENV->set_intermediate_dir_mode()</code> |
| 145 | <span> |
| 146 | <span> |
| 147 | method may fail and return one of the following non-zero errors: |
| 148 | </span> |
| 149 | |
| 150 | </span> |
| 151 | </p> |
| 152 | <div class="sect3" lang="en" xml:lang="en"> |
| 153 | <div class="titlepage"> |
| 154 | <div> |
| 155 | <div> |
| 156 | <h4 class="title"><a id="idp52119856"></a>EINVAL</h4> |
| 157 | </div> |
| 158 | </div> |
| 159 | </div> |
| 160 | <p> |
| 161 | If the method was called after <a class="xref" href="envopen.html" title="DB_ENV->open()">DB_ENV->open()</a> |
| 162 | was called; or if an invalid flag value or parameter was specified. |
| 163 | </p> |
| 164 | </div> |
| 165 | </div> |
| 166 | <div class="sect2" lang="en" xml:lang="en"> |
| 167 | <div class="titlepage"> |
| 168 | <div> |
| 169 | <div> |
| 170 | <h3 class="title"><a id="idp52118776"></a>Class</h3> |
| 171 | </div> |
| 172 | </div> |
| 173 | </div> |
| 174 | <p> |
| 175 | <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> |
| 176 | </p> |
| 177 | </div> |
| 178 | <div class="sect2" lang="en" xml:lang="en"> |
| 179 | <div class="titlepage"> |
| 180 | <div> |
| 181 | <div> |
| 182 | <h3 class="title"><a id="idp52121920"></a>See Also</h3> |
| 183 | </div> |
| 184 | </div> |
| 185 | </div> |
| 186 | <p> |
| 187 | <a class="xref" href="env.html#envlist" title="Database Environments and Related Methods">Database Environments and Related Methods</a> |
| 188 | </p> |
| 189 | </div> |
| 190 | </div> |
| 191 | <div class="navfooter"> |
| 192 | <hr /> |
| 193 | <table width="100%" summary="Navigation footer"> |
| 194 | <tr> |
| 195 | <td width="40%" align="left"><a accesskey="p" href="envset_flags.html">Prev</a> </td> |
| 196 | <td width="20%" align="center"> |
| 197 | <a accesskey="u" href="env.html">Up</a> |
| 198 | </td> |
| 199 | <td width="40%" align="right"> <a accesskey="n" href="envset_isalive.html">Next</a></td> |
| 200 | </tr> |
| 201 | <tr> |
| 202 | <td width="40%" align="left" valign="top">DB_ENV->set_flags() </td> |
| 203 | <td width="20%" align="center"> |
| 204 | <a accesskey="h" href="index.html">Home</a> |
| 205 | </td> |
| 206 | <td width="40%" align="right" valign="top"> DB_ENV->set_isalive()</td> |
| 207 | </tr> |
| 208 | </table> |
| 209 | </div> |
| 210 | </body> |
| 211 | </html> |