Berkeley DB: DBENV->set_func_map
Description: Berkeley DB: An embedded database programmatic toolkit.
Keywords: embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++

# DBENV->set_func_map |

`

###

    #include <db.h>

    int
    DBENV->set_func_map(DB_ENV *dbenv,
        int (*func_map)(char *path,
        size_t len, int is_region, int is_rdonly, void **addr));

# Description

The Berkeley DB library requires the ability to map a file into memory and to create shared memory regions (which may or may not be backed by files). The func_map argument must conform to the following interface:

>     int map(char *path, size_t len,
>     int is_region, int is_rdonly, void **addr);

The path argument is the name of a file.

The is_region argument will be zero if the intention is to map a file into shared memory. In this case, the map function must map the first len bytes of the file into memory and return a pointer to the mapped location in the memory location referenced by the argument addr. The is_rdonly argument will be non-zero if the file is considered read-only by the caller.

The is_region argument will be non-zero if the memory is intended to be used as a shared memory region for synchronization between Berkeley DB threads/processes. In this case, the returned memory may be of any kind (e.g., anonymous), but must be able to support semaphores. In this case, the path argument may be ignored (although future map calls using the same path must return the same memory), and the is_rdonly argument will always be zero.

The func_map function must return the value of errno on failure and 0 on success.

The DBENV->set_func_map interface affects the entire application, not only the environment in which it is called.

The DBENV->set_func_map interface may only be used to configure Berkeley DB before the DBENV->open interface is called.

The DBENV->set_func_map function returns a non-zero error value on failure and 0 on success.

# Errors

EINVAL
  An invalid flag value or parameter was specified.

  Called after DBENV->open was called.

# See Also

DBENV->set_func_close, DBENV->set_func_dirfree, DBENV->set_func_dirlist, DBENV->set_func_exists, DBENV->set_func_free, DBENV->set_func_fsync, DBENV->set_func_ioinfo, DBENV->set_func_malloc, DBENV->set_func_map, DBENV->set_func_open, DBENV->set_func_read, DBENV->set_func_realloc, DBENV->set_func_seek, DBENV->set_func_sleep, DBENV->set_func_unlink, DBENV->set_func_unmap, DBENV->set_func_write and DBENV->set_func_yield.`

Copyright Sleepycat Software