Berkeley DB Reference Guide: QNX
Description: Berkeley DB: An embedded database programmatic toolkit.
Keywords: embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++

### Berkeley DB Reference Guide: Building Berkeley DB for UNIX/POSIX systems |

### QNX

1. To what versions of QNX has DB been ported?

   Berkeley DB has been ported to the QNX Neutrino technology which is commonly referred to as QNX RTP (Real-Time Platform). Berkeley DB has not been ported to earlier versions of QNX, such as QNX 4.25.

2. Building Berkeley DB shared libraries fails.

   The /bin/sh utility distributed with some QNX releases drops core when running the GNU libtool script (which is used to build Berkeley DB shared libraries). There are two workarounds for this problem: First, only build static libraries. You can disable building shared libraries by specifying the --disable-shared configuration flag when configuring Berkeley DB.

   Second, build Berkeley DB using an alternate shell. QNX distributions include an accessories disk with additional tools. One of the included tools is the GNU bash shell, which is able to run the libtool script. To build Berkeley DB using an alternate shell, move /bin/sh aside, link or copy the alternate shell into that location, configure, build and install Berkeley DB, and then replace the original shell utility.

3. Are there any QNX filesystem issues?

   Berkeley DB generates temporary files for use in transactionally protected file system operations. Due to the filename length limit of 48 characters in the QNX filesystem, applications that are using transactions should specify a database name that is at most 43 characters.

4. What is the impact of QNX's use of shm_open(2) for shared memory regions?

   QNX requires the use of the POSIX shm_open(2) and shm_unlink(2) calls for shared memory regions that will later be mapped into memory using mmap(2). QNX's implementation of the shared memory functions requires that the name given must begin with a slash, and that no other slash may appear in the name.

   In order to comply with those requirements and allow relative pathnames to find the same environment, Berkeley DB uses only the last component of the home directory path and the name of the shared memory file, separated by a colon, as the name specified to the shared memory functions. For example, if an application specifies a home directory of /home/db/DB_DIR, Berkeley DB will use /DB_DIR:__db.001 as the name for the shared memory area argument to shm_open(2).

   The impact of this decision is that the last component of all environment home directory pathnames on QNX must be unique with respect to each other. Additionally, Berkeley DB requires that environments use home directories for QNX in order to generate a reasonable entry in the shared memory area.

5. What are the implications of QNX's requirement to use shm_open(2) in order to use mmap(2)?

   QNX requires that files mapped with mmap(2) be opened using shm_open(2). There are other places in addition to the environment shared memory regions, where Berkeley DB tries to memory map files if it can.

   The memory pool subsystem normally attempts to use mmap(2) even when using private memory, as indicated by the DB_PRIVATE flag to DB_ENV->open. In the case of QNX, if an application is using private memory, Berkeley DB will not attempt to map the memory and will instead use the local cache.

6. What are the implications of QNX's mutex implementation using microkernel resources?

   On QNX, the primitives implementing mutexes consume system resources. Therefore, if an application unexpectedly fails, those resources could leak. Berkeley DB solves this problem by always allocating mutexes in the persistent shared memory regions. Then, if an application fails, running recovery or explicitly removing the database environment by calling the DB_ENV->remove method will allow Berkeley DB to release those previously held mutex resources. If an application specifies the DB_PRIVATE flag (choosing not to use persistent shared memory), and then fails, mutexes allocated in that private memory may leak their underlying system resources. Therefore, the DB_PRIVATE flag should be used with caution on QNX.

Copyright (c) 1996-2006 Oracle Corporation - All rights reserved.