VxWorks notes
Prev | Chapter 7. Building Berkeley DB for VxWorks | Next

## VxWorks notes

Berkeley DB currently disallows the DB_TRUNCATE flag to the DB->open() method on VxWorks because the operations this flag represents are not fully supported under VxWorks.

The DB->sync() method is implemented using an ioctl call into the file system driver with the FIOSYNC command. Most, but not all file system drivers support this call. Berkeley DB requires the use of a file system that supports FIOSYNC.

### Building and Running the Demo Program

The demo program should be built in a manner very similar to building Berkeley DB. If you want different or additional BSP build specifications you should add them by following the directions indicated in Building for VxWorks 5.4 and 5.5.

The demo program can be downloaded and run by calling the entry function dbdemo with the pathname of a database to use. The demo program will ask for some input keys. It creates a database and adds those keys into the database, using the reverse of the key as the data value. When complete you can either enter EOF (control-D) or quit and the demo program will display all of the key/data items in the database.

### Building and Running the Utility Programs

The Berkeley DB utilities can be downloaded and run by calling the function equivalent to the utility's name. The utility functions take a string containing all the supported arguments. The program will then decompose that string into a traditional argc/argv used internally. For example, to execute db_stat utility on a database within an environment you would execute the following from the windsh prompt. Obviously you would change the pathname and database name to reflect your system.

    > db_stat "-h /tmp/myenvhome -d mydatabase.db"

### VxWorks 5.4/5.5: shared memory

The memory on VxWorks is always resident and fully shared among all tasks running on the target. For this reason, the DB_LOCKDOWN flag has no effect and the DB_SYSTEM_MEM flag is implied for any application that does not specify the DB_PRIVATE flag. Note that the DB_SYSTEM_MEM flag requires all applications use a segment ID to ensure the applications do not overwrite each other's database environments: see the DB_ENV->set_shm_key() method for more information.

### VxWorks 5.4/5.5: building a small memory footprint library

A default small footprint build is provided. This default provides equivalent to the --enable-smallbuild configuration option described in Building a small memory footprint library. In order to build the small footprint, you should move `db_config.h` aside and copy `db_config_small.h` to `db_config.h`. Then open up the appropriate small workspace file via Tornado and build as usual.

### Support for Replication Manager

The Berkeley DB Replication Manager component is available on Vxworks 6.x because it provides support for TCP/IP sockets and POSIX 1003.1 style networking and threads. You must build Berkley DB for Vxworks using the command line. Prior to building Berkeley DB, ensure you set appropriate values for the variables specified in Step 1 of Building for VxWorks 6.x. To use Berkeley DB Replication Manager, `netLib` and `ioLib` must be present in the Vxworks image.

To use the Berkeley DB on Vxworks 5.x, make the following manual changes.

- Undefine the HAVE_GETADDRINFO, HAVE_REPLICATION_THREADS, and HAVE_SYS_SOCKET_H macros in the Berkeley DB include files `db_config.h` and `db_config_small.h`.

- Remove this line: #include <pthread.h>, present in the Berkeley DB include file `db.h`.

Prev | Up | Next
Building for VxWorks 6.x | Home | VxWorks FAQ