[Previous]
[Contents]
[Next]

qnx_device_attach()

attach a major device number to a resource manager

Synopsis:

#include <sys/fd.h>
int qnx_device_attach( void );

Description:

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.

Returns:

A device number (a small positive integer) on success. On error, a -1 is returned, and errno is set.

Errors:

EAGAIN
All the major devices in the system are in use.
EPERM
The calling process does not have permissions to attach a major device number.

Examples:

#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 );

  }

Classification:

QNX

Safety:
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

errno, qnx_device_detach(), stat()


[Previous]
[Contents]
[Next]