1<!--$Id: env_set_intermediate_dir_mode.so,v 1.1 2008/01/15 15:35:22 bostic Exp $-->
2<!--Copyright (c) 1997,2008 Oracle.  All rights reserved.-->
3<!--See the file LICENSE for redistribution information.-->
4<html>
5<head>
6<title>Berkeley DB: DbEnv::set_intermediate_dir_mode</title>
7<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
8<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++">
9</head>
10<body bgcolor=white>
11<table width="100%"><tr valign=top>
12<td>
13<b>DbEnv::set_intermediate_dir_mode</b>
14</td>
15<td align=right>
16<a href="../api_cxx/api_core.html"><img src="../images/api.gif" alt="API"></a>
17<a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a></td>
18</tr></table>
19<hr size=1 noshade>
20<tt>
21<b><pre>
22#include &lt;db_cxx.h&gt;
23<p>
24int
25DbEnv::set_intermediate_dir_mode(u_int32_t mode);
26<p>
27int
28DbEnv::get_intermediate_dir_mode(u_int32_t *modep);
29</pre></b>
30<hr size=1 noshade>
31<b>Description: DbEnv::set_intermediate_dir_mode</b>
32<p>By default, Berkeley DB does not create intermediate directories needed for
33recovery, that is, if the file <b>/a/b/c/mydatabase</b> is being
34recovered, and the directory path <b>b/c</b> does not exist, recovery
35will fail.   This default behavior is because Berkeley DB does not know what
36permissions are appropriate for intermediate directory creation, and
37creating the directory might result in a security problem.</p>
38<p>The DbEnv::set_intermediate_dir_mode method causes Berkeley DB to create any
39intermediate directories needed during recovery, using the specified
40permissions.</p>
41<p>On UNIX systems or in IEEE/ANSI Std 1003.1 (POSIX) environments, created directories
42are owned by the process owner; the group ownership of created
43directories is based on the system and directory defaults, and is not
44further specified by Berkeley DB.</p>
45<p>The database environment's intermediate directory permissions may also be configured using the
46environment's <a href="../ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> file.  The syntax of the entry in that
47file is a single line with the string "set_intermediate_dir_mode", one or more whitespace
48characters, and the directory permissions.
49Because the <a href="../ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> file is read when the database environment
50is opened, it will silently overrule configuration done before that
51time.</p>
52<p>The DbEnv::set_intermediate_dir_mode method configures operations performed using the specified
53<a href="../api_cxx/env_class.html">DbEnv</a> handle, not all operations performed on the underlying
54database environment.</p>
55<p>The DbEnv::set_intermediate_dir_mode method may not be called after the <a href="../api_cxx/env_open.html">DbEnv::open</a> method is
56called.
57</p>
58<p>The DbEnv::set_intermediate_dir_mode method
59either returns a non-zero error value
60or throws an exception that encapsulates a non-zero error value on
61failure, and returns 0 on success.
62</p>
63<b>Parameters</b> <br>
64 <b>mode</b><ul compact><li>The <b>mode</b> parameter specifies the directory permissions.
65<p>Directory permissions are interpreted as a string of nine characters,
66using the character set <b>r</b> (read), <b>w</b> (write), <b>x</b>
67(execute or search), and <b>-</b> (none).  The first character is the
68read permissions for the directory owner (set to either <b>r</b> or
69<b>-</b>). The second character is the write permissions for the
70directory owner (set to either <b>w</b> or <b>-</b>). The third
71character is the execute permissions for the directory owner (set to
72either <b>x</b> or <b>-</b>).</p>
73<p>Similarly, the second set of three characters are the read, write and
74execute/search permissions for the directory group, and the third set
75of three characters are the read, write and execute/search permissions
76for all others.  For example, the string <b>rwx------</b> would
77configure read, write and execute/search access for the owner only.  The
78string <b>rwxrwx---</b> would configure read, write and execute/search
79access for both the owner and the group.  The string <b>rwxr-----</b>
80would configure read, write and execute/search access for the directory
81owner and read-only access for the directory group.</p></ul>
82<br>
83<br><b>Errors</b>
84<p>The DbEnv::set_intermediate_dir_mode method
85may fail and throw
86<a href="../api_cxx/except_class.html">DbException</a>,
87encapsulating one of the following non-zero errors, or return one of
88the following non-zero errors:</p>
89<br>
90<b>EINVAL</b><ul compact><li>If the method was called after <a href="../api_cxx/env_open.html">DbEnv::open</a> was called; or if an
91invalid flag value or parameter was specified.</ul>
92<br>
93<hr size=1 noshade>
94<b>Description: DbEnv::get_intermediate_dir_mode</b>
95<p>The DbEnv::get_intermediate_dir_mode method returns the intermediate directory permissions.</p>
96<p>The DbEnv::get_intermediate_dir_mode method may be called at any time during the life of the
97application.</p>
98<p>The DbEnv::get_intermediate_dir_mode method
99either returns a non-zero error value
100or throws an exception that encapsulates a non-zero error value on
101failure, and returns 0 on success.
102</p>
103<b>Parameters</b> <br>
104 <b>modep</b><ul compact><li>The DbEnv::get_intermediate_dir_mode method returns a reference to the
105intermediate directory permissions in <b>modep</b>.</ul>
106<br>
107<hr size=1 noshade>
108<br><b>Class</b>
109<a href="../api_cxx/env_class.html">DbEnv</a>
110<br><b>See Also</b>
111<a href="../api_cxx/env_list.html">Database Environments and Related Methods</a>
112</tt>
113<table width="100%"><tr><td><br></td><td align=right>
114<a href="../api_cxx/api_core.html"><img src="../images/api.gif" alt="API"></a><a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a>
115</td></tr></table>
116<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
117</body>
118</html>
119