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.

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

errno_addr Obtains the address of the calling task’s internal errno variable.<br />

#include <br />

unsigned long *errno_addr();<br />

Description<br />

Return Value<br />

Error Codes<br />

Notes<br />

This system call returns the address of the calling task's internal errno variable.<br />

The pSOS+ kernel maintains an internal errno variable for every task. Whenever<br />

an error is detected by any <strong>pSO<strong>System</strong></strong> component, the associated error code is<br />

stored into the running task's internal errno variable. The error code can then be<br />

retrieved by referencing the errno macro defined in the header file as<br />

follows:<br />

#define errno (*(errno_addr())<br />

For example, the following statement expands to include a call to errno_addr():<br />

if (errno == ERR_NOMGB)<br />

This system call returns the address of the errno variable of the calling task.<br />

None.<br />

1. errno_addr() provides a unique errno value for each task while maintaining<br />

compatibility with industry standard library semantics. It should never be<br />

necessary to call errno_addr() directly from application code.<br />

2. All <strong>pSO<strong>System</strong></strong> components set a task's internal errno variable. However, for<br />

the pSOS+ kernel and pHILE+ file system manager, which return error values<br />

via the function return value, use of the errno macro is superfluous.<br />

3. A successful system call does not clear the previous errno value. errno always<br />

contains the error code from the last unsuccessful call.<br />

<strong>pSO<strong>System</strong></strong> <strong>System</strong> <strong>Calls</strong> 1-23<br />

1

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

Saved successfully!

Ooh no, something went wrong!