06.08.2013 Views

pSOSystem System Calls - Read

pSOSystem System Calls - Read

pSOSystem System Calls - Read

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

q_create pSOS+ <strong>System</strong> <strong>Calls</strong><br />

q_create Creates an ordinary message queue.<br />

#include <br />

unsigned long q_create(<br />

char name[4], /* queue name */<br />

unsigned long count, /* queue size */<br />

unsigned long flags, /* queue attributes */<br />

unsigned long *qid /* queue identifier */<br />

)<br />

Description<br />

Arguments<br />

This system call creates an ordinary message queue by allocating and initializing a<br />

Queue Control Block (QCB) according to the specifications supplied with the call.<br />

Like all objects, a queue has a user-assigned name and a pSOS-assigned queue ID<br />

returned by q_create(). Several flag bits specify the characteristics of the<br />

message queue. Tasks can wait for messages either by task priority or strictly FIFO,<br />

and a limit can be optionally set on the maximum number of messages that can be<br />

simultaneously posted at the queue.<br />

name Specifies the user-assigned name of the new message queue.<br />

count If Q_LIMIT is set (see flags, below), then the count argument<br />

specifies the maximum number of messages that can be<br />

simultaneously posted at the queue. If Q_PRIBUF is also set, then the<br />

argument count also specifies the number of buffers set aside from<br />

the system-wide pool of message buffers for the private use of this<br />

queue. If Q_NOLIMIT is set, count is ignored.<br />

flags Specifies the attributes of the queue. flags is formed by OR-ing the<br />

following symbolic constants (one from each pair), which are defined<br />

in . For instance, to specify that the queue is globally<br />

addressable, you place Q_GLOBAL in flags. To specify that the queue<br />

is globally addressable and that tasks are queued by FIFO, you place<br />

Q_GLOBAL and Q_FIFO in flags, using the following syntax:<br />

Q_GLOBAL | Q_FIFO<br />

1-74 <strong>pSO<strong>System</strong></strong> <strong>System</strong> <strong>Calls</strong>

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

Saved successfully!

Ooh no, something went wrong!