Using the HP-UX libIO Library
major(dev), minor(dev));
/*terminate libio operations */
io_end();
}
Output
Legacy view
===========
The major num: 188 minor num: 24576
Agile view
==============
The major num: 11 minor num: 0
Example 2
Get all the dev_ts of a disk device in the agile kernel I/O data structure and print
the number of agile dev_ts found.
Algorithm
1. Initialize the libIO library.
2. Search for a disk device in the agile kernel I/O data structures.
3. Get all the dev_ts of this agile I/O node and count the number of dev_ts.
4. Terminate the connection.
Solution
#include <sys/libIO.h>
#include <stdio.h>
#include <stdlib.h>
main()
{
io_token_t node;
io_dev_info_t *dev_array; /* buffer of io_dev_t */
int count=1, ret=0;
dev_array=(io_dev_info_t *)malloc(sizeof(io_dev_info_t));
/*initialize libIO operations */
if (io_init(O_RDONLY)!=IO_SUCCESS) {
io_error("ERROR:io_init");
exit(1);
}
/*get an existing disk node */
if ((node=io_search((io_token_t)NULL, S_IOTREE_EXT, Q_SW,