26.02.2014 Views

Getting Started with QNX Neutrino - QNX Software Systems

Getting Started with QNX Neutrino - QNX Software Systems

Getting Started with QNX Neutrino - QNX Software Systems

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Handler routines<br />

© 2009, <strong>QNX</strong> <strong>Software</strong> <strong>Systems</strong> GmbH & Co. KG.<br />

Device dev inode rdev<br />

/dev/hd0 6 2 1<br />

/dev/hd0t77 1 12 77<br />

/hd/spud.txt 77 47343 N/A<br />

Handler routines<br />

For the raw block device, /dev/hd0, the process manager assigned both the dev and<br />

inode values (the 6 and the 2 in the table above). The resource manager picked a<br />

unique rdev value (of 1) for the device when it started.<br />

For the partition, /dev/hd0t77, the dev value came from the raw block device’s rdev<br />

number (the 1). The inode was selected by the resource manager as a unique number<br />

(<strong>with</strong>in the rdev). This is where the 12 came from. Finally, the rdev number was<br />

selected by the resource manager as well — in this case, the writer of the resource<br />

manager selected 77 because it corresponded to the partition type.<br />

Finally, for the file, /hd/spud.txt, the dev value (77) came from the partition’s rdev<br />

value. The inode was selected by the resource manager (in the case of a file, the<br />

number is selected to correspond to some internal representation of the file — it<br />

doesn’t matter what it is so long as it’s not zero, and it’s unique <strong>with</strong>in the rdev). This<br />

is where the 47343 came from. For a file, the rdev field is not meaningful.<br />

Not all outcalls correspond to client messages — some are synthesized by the kernel,<br />

and some by the library.<br />

I’ve organized this section into the following:<br />

• general notes<br />

• connect functions notes<br />

followed by an alphabetical listing of connect and I/O messages.<br />

General notes<br />

Each handler function gets passed an internal context block (the ctp argument) which<br />

should be treated as “read-only,” except for the iov member. This context block<br />

contains a few items of interest, as described above in “resmgr_context_t internal<br />

context block.” Also, each function gets passed a pointer to the message (in the msg<br />

argument). You’ll be using this message pointer extensively, as that contains the<br />

parameters that the client’s C library call has placed there for your use.<br />

The function that you supply must return a value (all functions are prototyped as<br />

returning in int). The values are selected from the following list:<br />

226 Chapter 5 • Resource Managers April 30, 2009

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!