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.

© 2009, <strong>QNX</strong> <strong>Software</strong> <strong>Systems</strong> GmbH & Co. KG. Alphabetical listing of connect and I/O functions<br />

of struct dirent members in the directory case. For more information about<br />

returning directory entries, see the example in the “Advanced topics” section under<br />

“Returning directory entries.”<br />

The helper function iofunc_read_verify() should be called to ascertain that the file was<br />

opened in a mode compatible <strong>with</strong> reading. Also, the iofunc_sync_verify() function<br />

should be called to verify if the data needs to be synchronized to the medium. (For a<br />

read(), that means that the data returned is guaranteed to be on-media.)<br />

Returns: The number of bytes read, or the status, via the helper macro<br />

_IO_SET_READ_NBYTES, and the data itself via message reply.<br />

For an example of returning just data, take a look at “A simple io_read() example”<br />

below. For a more complicated example of returning both data and directory entries,<br />

look in the “Advanced topics” section under “Returning directory entries.”<br />

io_readlink()<br />

int io_readlink (resmgr_context_t *ctp, io_readlink_t *msg,<br />

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

Classification: Connect<br />

Default handler: none<br />

Helper functions: iofunc_readlink()<br />

Client function: readlink()<br />

Messages: _IO_CONNECT <strong>with</strong> subtype _IO_CONNECT_READLINK<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: Responsible for reading the contents of a symbolic link as specified by<br />

the path member of the input structure. The bytes returned are the contents of the<br />

symbolic link; the status returned is the number of bytes in the reply. A valid return<br />

should be done only for a symbolic link; all other accesses should return an error code.<br />

April 30, 2009 Chapter 5 • Resource Managers 245

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

Saved successfully!

Ooh no, something went wrong!