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.

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

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

typedef union {<br />

struct _io_notify i;<br />

struct _io_notify_reply o;<br />

} io_notify_t;<br />

Description: The handler is responsible for installing, polling, or removing a<br />

notification handler. The action and flags determine the kind of notification operation<br />

and conditions; the event is a struct sigevent structure that defines the<br />

notification event (if any) that the client wishes to be signaled <strong>with</strong>. You’d use the<br />

MsgDeliverEvent() or iofunc_notify_trigger() functions to deliver the event to the<br />

client.<br />

Returns: The status via the helper macro _RESMGR_STATUS; the flags are returned<br />

via message reply.<br />

io_open()<br />

int io_open (resmgr_context_t *ctp, io_open_t *msg,<br />

RESMGR_HANDLE_T *handle, void *extra)<br />

Classification: Connect<br />

Default handler: iofunc_open_default()<br />

Helper functions: iofunc_open(), iofunc_ocb_attach()<br />

Client functions: open(), fopen(), sopen() (and others)<br />

Messages: _IO_CONNECT <strong>with</strong> one of _IO_CONNECT_COMBINE,<br />

_IO_CONNECT_COMBINE_CLOSE or _IO_CONNECT_OPEN subtypes.<br />

Data structure:<br />

struct _io_connect {<br />

// internal fields (as described above)<br />

uint16_t path_len;<br />

uint8_t extra_type;<br />

uint16_t extra_len;<br />

char path [1];<br />

};<br />

struct _io_connect_link_reply {<br />

uint32_t reserved1 [2];<br />

uint8_t eflag;<br />

uint8_t reserved2 [3];<br />

uint32_t umask;<br />

uint16_t nentries;<br />

uint16_t path_len;<br />

};<br />

typedef union {<br />

struct _io_connect<br />

connect;<br />

struct _io_connect_link_reply link_reply;<br />

} io_open_t;<br />

Description: This is the main entry point into the resource manager. It checks that the<br />

client indeed has the appropriate permissions to open the file, binds the OCB to the<br />

internal library structures (via resmgr_bind_ocb(), oriofunc_ocb_attach()), and<br />

242 Chapter 5 • Resource Managers April 30, 2009

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

Saved successfully!

Ooh no, something went wrong!