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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Alphabetical listing of connect and I/O functions<br />

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

pathnames; the “original” pathname and the “new” pathname. The original pathname<br />

is passed in path, because it’s the thing being worked on (it’s the filename that’s<br />

undergoing the name change). The new pathname is the argument to the operation.<br />

You’ll see that the extra parameter passed to the connect functions conveniently<br />

contains a pointer to the argument of the operation — in this case, the new pathname.<br />

(Implementation-wise, the new pathname is stored just past the original pathname in<br />

the path pointer, <strong>with</strong> alignment taken into consideration, but you don’t have to do<br />

anything about this — the extra parameter conveniently gives you the correct pointer.)<br />

Alphabetical listing of connect and I/O functions<br />

This section gives an alphabetical listing of the connect and I/O function entry points<br />

that you can fill in (the two tables passed to resmgr_attach()). Remember that if you<br />

simply call iofunc_func_init(), all these entries will be filled in <strong>with</strong> the appropriate<br />

defaults; you’d want to modify a particular entry only if you wish to handle that<br />

particular message. In the “Examples” section, below, you’ll see some examples of the<br />

common functions.<br />

It may seem confusing at first, but note that there are in fact two unblock outcalls —<br />

one is a connect function and one is an I/O function. This is correct; it’s a reflection of<br />

when the unblock occurs. The connect version of the unblock function is used when<br />

the kernel unblocks the client immediately after the client has sent the connect<br />

message; the I/O version of the unblock function is used when the kernel unblocks the<br />

client immediately after the client has sent an I/O message.<br />

In order not to confuse the client’s C-library call (for example, open()) <strong>with</strong> the<br />

resource manager connect outcall that goes into that particular slot, we’ve given all of<br />

our functions an “io_” prefix. For example, the function description for the open<br />

connect outcall slot will be under io_open().<br />

io_chmod()<br />

int io_chmod (resmgr_context_t *ctp, io_chmod_t *msg,<br />

RESMGR_OCB_T *ocb)<br />

Classification: I/O function<br />

Default handler: iofunc_chmod_default()<br />

Helper functions: iofunc_chmod()<br />

Client functions: chmod(), fchmod()<br />

Messages: _IO_CHMOD<br />

Data structure:<br />

struct _io_chmod {<br />

uint16_t type;<br />

uint16_t combine_len;<br />

mode_t mode;<br />

};<br />

230 Chapter 5 • Resource Managers April 30, 2009

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

Saved successfully!

Ooh no, something went wrong!