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.

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

_RESMGR_NOREPLY<br />

_RESMGR_NPARTS (n)<br />

Indicates to the resource manager library that it should not<br />

perform the MsgReplyv() — the assumption is that you’ve either<br />

performed it yourself in your handler function, or that you’re<br />

going to do it some time later.<br />

The resource manager library should return an n-part IOV when it<br />

does the MsgReplyv() (the IOV is located in ctp -> iov). Your<br />

function is responsible for filling in the iov member of the ctp<br />

structure, and then returning _RESMGR_NPARTS <strong>with</strong> the correct<br />

number of parts.<br />

The iov member of ctp is allocated dynamically, so it must be big enough to hold the<br />

number of array elements that you’re writing into the iov member! See the section<br />

“resmgr_attr_t control structure” above, for information on setting the<br />

nparts_max member.<br />

_RESMGR_DEFAULT<br />

An errno value<br />

_RESMGR_ERRNO (errno)<br />

_RESMGR_PTR (ctp, addr, len)<br />

This instructs the resource manager library to perform the<br />

low-level default function (This is not the same as the<br />

iofunc_*_default() functions!) You’d rarely ever use this return<br />

value. In general, it causes the resource manager library to return<br />

an errno of ENOSYS to the client, which indicates that the function<br />

is not supported.<br />

Indicates to the resource manager library that it should call<br />

MsgError() <strong>with</strong> this value as the error parameter. This generally<br />

causes the client function (e.g. open()) to return -1 and set errno<br />

on the client side to the returned value.<br />

(Deprecated) This return value had been used to “wrap” an errno<br />

number as the return value of the message. For example, if a client<br />

issued an open() request for a read-only device, it would be<br />

appropriate to return the error value EROFS. Since this function is<br />

deprecated, you can return the error number directly instead of<br />

wrapping it <strong>with</strong> the _RESMGR_ERRNO macro (e.g., return<br />

(EROFS); instead of the more cumbersome return<br />

(_RESMGR_ERRNO (EROFS));.)<br />

This is a convenience macro that accepts the context pointer ctp,<br />

and fills its first IOV element to point to the address specified by<br />

addr for the length specified by len, and then returns the equivalent<br />

of _RESMGR_NPARTS (1) to the library. You’d generally use this<br />

if you return single-part IOVs from your function.<br />

April 30, 2009 Chapter 5 • Resource Managers 227

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

Saved successfully!

Ooh no, something went wrong!