Using the HP-UX libIO Library

/* build the dev_t of the node */
if (io_mkdev_ext(node, dev_type, 0, &dev)!=IO_SUCCESS) {
io_error("ERROR:io_mkdev_ext:options:s0");
exit(1);
}
if (io_new_to_legacy_devs(dev, dev_type, leg_dev,
&count)== IO_ERROR)
if (io_errno == IO_E_BUF_TOO_SMALL) {
leg_dev=(dev_t *)malloc(count*sizeof(dev_t));
if (io_new_to_legacy_devs(dev, dev_type,
leg_dev, &count)==IO_ERROR ) {
io_error("ERROR io_new_to_legacy_devs");
exit (1);
}
} else {
io_error("io_new_to_legacy_devs");
exit(1);
}
}
for (i=0 ; i<count ; i++)
printf("major number of legacy dev is %d\n",
major(leg_dev[i]));
/*terminate libIO operations */
io_end();
}
Output
major number of agile dev is 11
major number of legacy dev is 188