DbMpoolFile::open |
#include <db_cxx.h>int DbMpoolFile::open(const char *file, u_int32_t flags, int mode, size_t pagesize);
The DbMpoolFile::open method opens a file in the shared memory buffer pool. The file argument is the name of the file to be opened. If file is NULL, a private temporary file is created that cannot be shared with any other process (although it may be shared with other threads).
The flags and mode arguments specify how files will be opened and/or created if they do not already exist.
The flags value must be set to 0 or by bitwise inclusively OR'ing together one or more of the following values:
On UNIX systems or in IEEE/ANSI Std 1003.1 (POSIX) environments, all files created by function DbMpoolFile::open are created with mode mode (as described in chmod(2)) and modified by the process' umask value at the time of creation (see umask(2)). If mode is 0, function DbMpoolFile::open will use a default mode of readable and writable by both owner and group. On Windows systems, the mode argument is ignored. The group ownership of created files is based on the system and directory defaults, and is not further specified by Berkeley DB.
The pagesize argument is the size, in bytes, of the unit of transfer between the application and the pool, although it is not necessarily the unit of transfer between the pool and the source file.
The DbMpoolFile::open method either returns a non-zero error value or throws an exception that encapsulates a non-zero error value on failure, and returns 0 on success.
The DbMpoolFile::open method may fail and throw an exception or return a non-zero error for the following conditions:
The file has already been entered into the pool, and the pagesize value is not the same as when the file was entered into the pool, or the length of the file is not zero or a multiple of the pagesize.
The DB_RDONLY flag was specified for an in-memory pool.
The DbMpoolFile::open method may fail and throw an exception or return a non-zero error for errors specified for other Berkeley DB and C library or system methods. If a catastrophic error has occurred, the DbMpoolFile::open method may fail and either return DB_RUNRECOVERY or throw a DbRunRecoveryException, in which case all subsequent Berkeley DB calls will fail in the same way.