Belinda <yye@borg.cs.dal.ca> wrote:
Hi,
In the chapter -" writing a resource manager" of the book- “get started
with qnx neutrino2” , it is said that calling the rsrcdbmgr_devno_attach()
can obtain major and minor device number. However, I couldn’t find it
in the Library Reference. Is there other functions to obtain minor device
number?
It is there … I assure you. Perhaps you spelt it wrong
in the search. Look through the contents and you should
see several rsrcdbmgr_* functions. In any case:
rsrcdbmgr_devno_attach()
Get a major and minor number
Synopsis:
#include <sys/rsrcdbmgr.h>
#include <sys/rsrcdbmsg.h>
dev_t rsrcdbmgr_devno_attach( char *name,
int minor_request,
int flags );
Library:
libc
Description:
The function rsrcdbmgr_devno_attach() gets a name major number and
minor_request minor number. You can extract the major and minor number
values from dev_t using the major() and minor() macros defined in
<sys/types.h> (see stat() for descriptions). There’s a maximum of 64
majors and a maximum of 1024 minors.
Presently, there are no flags (flags = 0).
Returns:
A major and minor number. If you specify -1 in minor_request, the
function returns the first free minor number. If an error occurs, the
function returns -1 and sets errno.
Errors:
EINVAL Invalid argument.
Examples:
#include <sys/rsrcdbmgr.h>
#include <sys/rsrcdbmsg.h>
char *dev_name;
int myminor_request, flags=0;
dev_t major_minor;
major_minor = rsrcdbmgr_devno_attach
( dev_name, myminor_request, flags );
…
rsrcdbmgr_devno_detach( major_minor, flags );
Thomas
Thomas (toe-mah) Fletcher QNX Software Systems
thomasf@qnx.com Core OS Technology Group
(613)-591-0931 http://www.qnx.com/