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. The client’s view<br />

Finding the server<br />

The first thing that a client does is call open() to get a file descriptor. (Note that if the<br />

client calls the higher-level function fopen() instead, the same discussion applies —<br />

fopen() eventually calls open()).<br />

Inside the C library implementation of open(), a message is constructed, and sent to<br />

the process manager (procnto) component. The process manager is responsible for<br />

maintaining information about the pathname space. This information consists of a tree<br />

structure that contains pathnames and node descriptor, process ID, channel ID, and<br />

handle associations:<br />

Resource managers<br />

Pathname space<br />

(stored by the Process Manager)<br />

Resource managers<br />

(0,1,1,1) procnto / fsys-qnx4 (0,4965,1,1)<br />

(0,1,1,1) procnto<br />

proc dev<br />

procnto (0,1,1,1)<br />

(0,1,1,1)<br />

procnto<br />

boot ser1 devc-ser8250 (0,44,1,1)<br />

(0,1,1,1)<br />

procnto<br />

1 ser2 devc-ser8250 (0,44,1,2)<br />

(0,1,1,1)<br />

procnto<br />

4965 con devc-con (0,725,1,1)<br />

...<br />

...<br />

<strong>Neutrino</strong>’s namespace.<br />

Note that in the diagram above and in the descriptions that follow, I’ve used the<br />

designation fs-qnx4 as the name of the resource manager that implements the <strong>QNX</strong> 4<br />

filesystem — in reality, it’s a bit more complicated, because the filesystem drivers are<br />

based on a series of DLLs that get bundled together. So, there’s actually no executable<br />

called fs-qnx4; we’re just using it as a placeholder for the filesystem component.<br />

Let’s say that the client calls open():<br />

fd = open ("/dev/ser1", O_WRONLY);<br />

In the client’s C library implementation of open(), a message is constructed and sent to<br />

the process manager. This message states, “I want to open /dev/ser1; who should I<br />

talk to?”<br />

(1) Query<br />

Client<br />

(2) Response<br />

Process<br />

Manager<br />

First stage of name resolution.<br />

April 30, 2009 Chapter 5 • Resource Managers 193

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

Saved successfully!

Ooh no, something went wrong!