Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
HAMANO Tsukasa
OpenLDAP
Commits
e40dae10
Commit
e40dae10
authored
Jan 06, 2014
by
Hallvard Furuseth
Browse files
Add mdb_env_<set,get>_userctx()
parent
c99525f4
Changes
2
Hide whitespace changes
Inline
Side-by-side
libraries/liblmdb/lmdb.h
View file @
e40dae10
...
...
@@ -802,6 +802,21 @@ int mdb_env_set_maxdbs(MDB_env *env, MDB_dbi dbs);
*/
int
mdb_env_get_maxkeysize
(
MDB_env
*
env
);
/** @brief Set application information associated with the #MDB_env.
*
* @param[in] env An environment handle returned by #mdb_env_create()
* @param[in] ctx An arbitrary pointer for whatever the application needs.
* @return A non-zero error value on failure and 0 on success.
*/
int
mdb_env_set_userctx
(
MDB_env
*
env
,
void
*
ctx
);
/** @brief Get the application information associated with the #MDB_env.
*
* @param[in] env An environment handle returned by #mdb_env_create()
* @return The pointer set by #mdb_env_set_userctx().
*/
void
*
mdb_env_get_userctx
(
MDB_env
*
env
);
/** @brief Create a transaction for use with the environment.
*
* The transaction handle may be discarded using #mdb_txn_abort() or #mdb_txn_commit().
...
...
libraries/liblmdb/mdb.c
View file @
e40dae10
...
...
@@ -1080,6 +1080,7 @@ struct MDB_env {
sem_t
*
me_rmutex
;
/* Shared mutexes are not supported */
sem_t
*
me_wmutex
;
#endif
void
*
me_userctx
;
/**< User-settable context */
};
/** Nested transaction */
...
...
@@ -7916,6 +7917,21 @@ mdb_env_get_flags(MDB_env *env, unsigned int *arg)
return
MDB_SUCCESS
;
}
int
mdb_env_set_userctx
(
MDB_env
*
env
,
void
*
ctx
)
{
if
(
!
env
)
return
EINVAL
;
env
->
me_userctx
=
ctx
;
return
MDB_SUCCESS
;
}
void
*
mdb_env_get_userctx
(
MDB_env
*
env
)
{
return
env
?
env
->
me_userctx
:
NULL
;
}
int
mdb_env_get_path
(
MDB_env
*
env
,
const
char
**
arg
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment