Appendix: Sample Programs

We've put copies of the code discussed in this book in an archive that you can get from the Download area of http://www.qnx.com/. This archive includes all of the samples from the book.

The top-level directories in the archive include:

web/
The web counter source code, in three phases (one directory for each version).
adios/
The ADIOS (Analog/Digital I/O Server) utility, including showsamp, tag, and the required libraries.
fsys/
The RAM Disk filesystem, the .tar filesystem, and a library used by both.
procfs/
The procfs utility from the /proc filesystem appendix.

Most directories include the following:

Web-Counter resource manager

The Web Counter is presented in three design phases. The web directory includes a Makefile for the entire project, as well as a directory for each phase.

phase-1/
Phase I consists of the following files:

You'll also need a GIF encoder.

phase-2/
Phase 2 adds the following:
phase-3/
Phase 3 includes updated versions of the files from phases 1 and 2.

ADIOS — Analog / Digital I/O Server

The ADIOS project consists of the ADIOS server, drivers for the various hardware cards, a library, API headers, and some utilities.

adios.cfg
A test configuration file.
adios/
The server consists of the following:
api/
API header files:
lib/
The ADIOS library consists of the following files:
Drivers
The source code for the drivers is in the following directories:
utils/
The utilities include:

Each utility has a usage message in a separate file.

RAM-disk and tar filesystem managers

These managers are in the same directory (fsys) in the archive because they rely on a common library.

fsys/lib/
The library includes the following:

Note: The captive filesystem utility library isn't thread-safe, but the memory pool library is.

fsys/ramdisk/
The RAM-disk filesystem includes the following:
fsys/tarfs/
The TAR filesystem and its mount_tarfs helper program consist of the following:

The /proc filesystem

The /proc filesystem utility module is in procfs/procfs.c. This program dumps just about everything it can get its hands on from this filesystem.