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: DB_ENV->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>DB_ENV->set_intermediate_dir_mode</b> 14</td> 15<td align=right> 16<a href="../api_c/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 <db.h> 23<p> 24int 25DB_ENV->set_intermediate_dir_mode(DB_ENV *dbenv, const char *mode); 26<p> 27int 28DB_ENV->get_intermediate_dir_mode(DB_ENV *dbenv, const char **modep); 29</pre></b> 30<hr size=1 noshade> 31<b>Description: DB_ENV->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 DB_ENV->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 DB_ENV->set_intermediate_dir_mode method configures operations performed using the specified 53<a href="../api_c/env_class.html">DB_ENV</a> handle, not all operations performed on the underlying 54database environment.</p> 55<p>The DB_ENV->set_intermediate_dir_mode method may not be called after the <a href="../api_c/env_open.html">DB_ENV->open</a> method is 56called. 57</p> 58<p>The DB_ENV->set_intermediate_dir_mode method 59returns a non-zero error value on failure 60and 0 on success. 61</p> 62<b>Parameters</b> <br> 63 <b>mode</b><ul compact><li>The <b>mode</b> parameter specifies the directory permissions. 64<p>Directory permissions are interpreted as a string of nine characters, 65using the character set <b>r</b> (read), <b>w</b> (write), <b>x</b> 66(execute or search), and <b>-</b> (none). The first character is the 67read permissions for the directory owner (set to either <b>r</b> or 68<b>-</b>). The second character is the write permissions for the 69directory owner (set to either <b>w</b> or <b>-</b>). The third 70character is the execute permissions for the directory owner (set to 71either <b>x</b> or <b>-</b>).</p> 72<p>Similarly, the second set of three characters are the read, write and 73execute/search permissions for the directory group, and the third set 74of three characters are the read, write and execute/search permissions 75for all others. For example, the string <b>rwx------</b> would 76configure read, write and execute/search access for the owner only. The 77string <b>rwxrwx---</b> would configure read, write and execute/search 78access for both the owner and the group. The string <b>rwxr-----</b> 79would configure read, write and execute/search access for the directory 80owner and read-only access for the directory group.</p></ul> 81<br> 82<br><b>Errors</b> 83<p>The DB_ENV->set_intermediate_dir_mode method 84may fail and return one of the following non-zero errors:</p> 85<br> 86<b>EINVAL</b><ul compact><li>If the method was called after <a href="../api_c/env_open.html">DB_ENV->open</a> was called; or if an 87invalid flag value or parameter was specified.</ul> 88<br> 89<hr size=1 noshade> 90<b>Description: DB_ENV->get_intermediate_dir_mode</b> 91<p>The DB_ENV->get_intermediate_dir_mode method returns the intermediate directory permissions.</p> 92<p>The DB_ENV->get_intermediate_dir_mode method may be called at any time during the life of the 93application.</p> 94<p>The DB_ENV->get_intermediate_dir_mode method 95returns a non-zero error value on failure 96and 0 on success. 97</p> 98<b>Parameters</b> <br> 99 <b>modep</b><ul compact><li>The DB_ENV->get_intermediate_dir_mode method returns a reference to the 100intermediate directory permissions in <b>modep</b>.</ul> 101<br> 102<hr size=1 noshade> 103<br><b>Class</b> 104<a href="../api_c/env_class.html">DB_ENV</a> 105<br><b>See Also</b> 106<a href="../api_c/env_list.html">Database Environments and Related Methods</a> 107</tt> 108<table width="100%"><tr><td><br></td><td align=right> 109<a href="../api_c/api_core.html"><img src="../images/api.gif" alt="API"></a><a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a> 110</td></tr></table> 111<p><font size=1>Copyright (c) 1996,2008 Oracle. All rights reserved.</font> 112</body> 113</html> 114