Using the HP-UX libIO Library

Using the libIO Library on HP-UX 11i v3
The libIO routines are used as follows:
1. Call io_init() to establish the connection between user application and
kernel.
2. Perform the required operations by calling libIO routines.
3. Call io_end() to close the connection.
To use the libIO library, the program must include <sys/libIO.h> and be linked
using -lIO.
io_init() – Establishing the Connection
This routine must be called before calling any other routine in the libIO library. It
establishes the connection to access the kernel I/O system. The defined flag values
are:
O_RDONLY - open for read accesses
O_WRONLY - open for write accesses
O_RDWR - open for read and write accesses
io_end() – Terminating the Connection
This routine is called to terminate the connection after the libIO library routines are
used. After calling io_end() if you need to subsequently make any other libIO calls
you must call io_init() again.
Note: There are no issues with keeping the device open in write mode for a long
time as the kernel synchronizes the operations from multiple users.