attach a major device number to a resource manager
#include <sys/fd.h> int qnx_device_attach( void );
The qnx_device_attach() function attaches a major device number to a resource manager. This number is used to form part of the st_dev member of a stat structure. The st_dev field is a 32-bit quantity in which the low order 10 bits form a local device minor number, the next 6 bits are the qnx_device_attach() major number and the top 16 bits are the node number.
This function is to be used by resource managers.
A device number (a small positive integer) on success. On error, a -1 is returned, and errno is set.
#include <stdio.h> #include <sys/fd.h> void main() { int devno; devno = qnx_device_attach(); printf( "Device number %d.\n", devno ); qnx_device_detach( devno ); }
QNX
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |
errno, qnx_device_detach(), stat()