HP-UX Reference (11i v3 07/02) - 3 Library Functions A-M (vol 6)

l
libIO(3X) libIO(3X)
libIO FUNCTION
Name
io_init(), io_end() - establishes/terminates a connection with the
dev_config driver
Synopsis
int io_init(int flag);
void io_end();
Description
The libIO library uses the dev_config driver to access information in the kernel I/O data structures.
io_init() Opens the /dev/config device special le, which causes an open(2) of the
dev_config driver.
io_init() must be called before calling any other routine in the
libIO library.
io_end() Causes a close(2) of the
dev_config driver.
io_end() must be called after the use of the
libIO library routine(s).
Note that each
io_init() call should be paired with a call to io_end().
Arguments
flag Specifies a flag to be passed to open(2) of the
/dev/config
device special file.
Defined values are:
O_RDONLY Open for read accesses only.
O_WRONLY Open for write accesses only.
O_RDWR Open for read and write accesses.
Example
if (io_init(O_RDWR) == -1) exit(1);
... User code ...
io_end();
exit(0);
Return Value
io_init():
IO_SUCCESS - Upon success.
IO_ERROR - Otherwise. io_errno is set to indicate the error.
io_end() has no return value.
Errors
[IO_E_DCONF_NOEXIST]
[IO_E_OPEN_FLAG]
[IO_E_SYSCALL]
libIO FUNCTION
Name
io_error() , io_strerror(), io_errno - libIO error messages
Synopsis
void io_error(char *str);
char *io_strerror(int errnum);
extern int io_errno;
Description
io_error() writes an error message to standard error (stderr) describing the last error encountered
during a call to libIO API. The argument str would normally include the name of the program/function
that called the libIO API and incurred the error. The external variable io_errno contains the error value
of the last error (if any) caused by a libIO API. The value of this variable should be checked right after
the API failure and it is not reset by any other libIO API.
HP-UX 11i Version 3: February 2007 3 Hewlett-Packard Company 721