POSIX User clean up.

This commit is contained in:
Chris Johns 2016-02-26 18:22:07 +11:00 committed by Amar Takhar
parent 238bf991f2
commit fa70fd2087
23 changed files with 4984 additions and 4165 deletions

View File

@ -1,32 +1,33 @@
.. COMMENT: This is the chapter from the RTEMS POSIX 1003.1b API User's Guide that
.. COMMENT: documents the services provided by the timer @c manager.
Clock Manager
#############
Introduction
============
The clock manager provides services two primary classes
of services. The first focuses on obtaining and setting
the current date and time. The other category of services
focus on allowing a thread to delay for a specific length
of time.
The clock manager provides services two primary classes of services. The first
focuses on obtaining and setting the current date and time. The other category
of services focus on allowing a thread to delay for a specific length of time.
The directives provided by the clock manager are:
- ``clock_gettime`` - Obtain Time of Day
- clock_gettime_ - Obtain Time of Day
- ``clock_settime`` - Set Time of Day
- clock_settime_ - Set Time of Day
- ``clock_getres`` - Get Clock Resolution
- clock_getres_ - Get Clock Resolution
- ``sleep`` - Delay Process Execution
- sleep_ - Delay Process Execution
- ``usleep`` - Delay Process Execution in Microseconds
- usleep_ - Delay Process Execution in Microseconds
- ``nanosleep`` - Delay with High Resolution
- nanosleep_ - Delay with High Resolution
- ``gettimeofday`` - Get the Time of Day
- gettimeofday_ - Get the Time of Day
- ``time`` - Get time in seconds
- time_ - Get time in seconds
Background
==========
@ -41,10 +42,11 @@ There is currently no text in this section.
Directives
==========
This section details the clock manager's directives.
A subsection is dedicated to each of this manager's directives
and describes the calling sequence, related constants, usage,
and status codes.
This section details the clock manager's directives. A subsection is dedicated
to each of this manager's directives and describes the calling sequence,
related constants, usage, and status codes.
.. _clock_gettime:
clock_gettime - Obtain Time of Day
----------------------------------
@ -53,23 +55,25 @@ clock_gettime - Obtain Time of Day
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <time.h>
int clock_gettime(
clockid_t clock_id,
struct timespec \*tp
clockid_t clock_id,
struct timespec *tp
);
**STATUS CODES:**
On error, this routine returns -1 and sets errno to one of the following:
On error, this routine returns -1 and sets ``errno`` to one of the following:
*EINVAL*
The tp pointer parameter is invalid.
.. list-table::
:class: rtems-table
*EINVAL*
The clock_id specified is invalid.
* - ``EINVAL``
- The tp pointer parameter is invalid.
* - ``EINVAL``
- The clock_id specified is invalid.
**DESCRIPTION:**
@ -77,6 +81,8 @@ On error, this routine returns -1 and sets errno to one of the following:
NONE
.. _clock_settime:
clock_settime - Set Time of Day
-------------------------------
.. index:: clock_settime
@ -84,26 +90,27 @@ clock_settime - Set Time of Day
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <time.h>
int clock_settime(
clockid_t clock_id,
const struct timespec \*tp
clockid_t clock_id,
const struct timespec *tp
);
**STATUS CODES:**
On error, this routine returns -1 and sets errno to one of the following:
On error, this routine returns -1 and sets ``errno`` to one of the following:
*EINVAL*
The tp pointer parameter is invalid.
.. list-table::
:class: rtems-table
*EINVAL*
The clock_id specified is invalid.
*EINVAL*
The contents of the tp structure are invalid.
* - ``EINVAL``
- The tp pointer parameter is invalid.
* - ``EINVAL``
- The clock_id specified is invalid.
* - ``EINVAL``
- The contents of the tp structure are invalid.
**DESCRIPTION:**
@ -111,6 +118,8 @@ On error, this routine returns -1 and sets errno to one of the following:
NONE
.. _clock_getres:
clock_getres - Get Clock Resolution
-----------------------------------
.. index:: clock_getres
@ -118,29 +127,33 @@ clock_getres - Get Clock Resolution
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <time.h>
int clock_getres(
clockid_t clock_id,
struct timespec \*res
clockid_t clock_id,
struct timespec *res
);
**STATUS CODES:**
On error, this routine returns -1 and sets errno to one of the following:
On error, this routine returns -1 and sets ``errno`` to one of the following:
*EINVAL*
The res pointer parameter is invalid.
.. list-table::
:class: rtems-table
*EINVAL*
The clock_id specified is invalid.
* - ``EINVAL``
- The res pointer parameter is invalid.
* - ``EINVAL``
- The clock_id specified is invalid.
**DESCRIPTION:**
**NOTES:**
If res is NULL, then the resolution is not returned.
If ``res`` is ``NULL``, then the resolution is not returned.
.. _sleep:
sleep - Delay Process Execution
-------------------------------
@ -149,11 +162,11 @@ sleep - Delay Process Execution
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <unistd.h>
unsigned int sleep(
unsigned int seconds
unsigned int seconds
);
**STATUS CODES:**
@ -162,13 +175,15 @@ This routine returns the number of unslept seconds.
**DESCRIPTION:**
The ``sleep()`` function delays the calling thread by the specified
number of ``seconds``.
The ``sleep()`` function delays the calling thread by the specified number of
``seconds``.
**NOTES:**
This call is interruptible by a signal.
.. _usleep:
usleep - Delay Process Execution in Microseconds
------------------------------------------------
.. index:: usleep
@ -179,11 +194,11 @@ usleep - Delay Process Execution in Microseconds
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <time.h>
useconds_t usleep(
useconds_t useconds
useconds_t useconds
);
**STATUS CODES:**
@ -192,26 +207,27 @@ This routine returns the number of unslept seconds.
**DESCRIPTION:**
The ``sleep()`` function delays the calling thread by the specified
number of ``seconds``.
The ``sleep()`` function delays the calling thread by the specified number of
``seconds``.
The ``usleep()`` function suspends the calling thread from execution
until either the number of microseconds specified by the``useconds`` argument has elapsed or a signal is delivered to the
calling thread and its action is to invoke a signal-catching function
or to terminate the process.
The ``usleep()`` function suspends the calling thread from execution until
either the number of microseconds specified by the ``useconds`` argument has
elapsed or a signal is delivered to the calling thread and its action is to
invoke a signal-catching function or to terminate the process.
Because of other activity, or because of the time spent in
processing the call, the actual length of time the thread is
blocked may be longer than
the amount of time specified.
Because of other activity, or because of the time spent in processing the call,
the actual length of time the thread is blocked may be longer than the amount
of time specified.
**NOTES:**
This call is interruptible by a signal.
The Single UNIX Specification allows this service to be implemented using
the same timer as that used by the ``alarm()`` service. This is*NOT* the case for *RTEMS* and this call has no interaction with
the ``SIGALRM`` signal.
The Single UNIX Specification allows this service to be implemented using the
same timer as that used by the ``alarm()`` service. This is *NOT* the case for
*RTEMS* and this call has no interaction with the ``SIGALRM`` signal.
.. _nanosleep:
nanosleep - Delay with High Resolution
--------------------------------------
@ -220,27 +236,28 @@ nanosleep - Delay with High Resolution
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <time.h>
int nanosleep(
const struct timespec \*rqtp,
struct timespec \*rmtp
const struct timespec *rqtp,
struct timespec *rmtp
);
**STATUS CODES:**
On error, this routine returns -1 and sets errno to one of the following:
On error, this routine returns -1 and sets ``errno`` to one of the following:
*EINTR*
The routine was interrupted by a signal.
.. list-table::
:class: rtems-table
*EAGAIN*
The requested sleep period specified negative seconds or nanoseconds.
*EINVAL*
The requested sleep period specified an invalid number for the nanoseconds
field.
* - ``EINTR``
- The routine was interrupted by a signal.
* - ``EAGAIN``
- The requested sleep period specified negative seconds or nanoseconds.
* - ``EINVAL``
- The requested sleep period specified an invalid number for the nanoseconds
field.
**DESCRIPTION:**
@ -248,6 +265,8 @@ On error, this routine returns -1 and sets errno to one of the following:
This call is interruptible by a signal.
.. _gettimeofday:
gettimeofday - Get the Time of Day
----------------------------------
.. index:: gettimeofday
@ -255,28 +274,28 @@ gettimeofday - Get the Time of Day
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <sys/time.h>
#include <unistd.h>
int gettimeofday(
struct timeval \*tp,
struct timezone \*tzp
struct timeval *tp,
struct timezone *tzp
);
**STATUS CODES:**
On error, this routine returns -1 and sets ``errno`` as appropriate.
*EPERM*
``settimeofdat`` is called by someone other than the superuser.
.. list-table::
:class: rtems-table
*EINVAL*
Timezone (or something else) is invalid.
*EFAULT*
One of ``tv`` or ``tz`` pointed outside your accessible address
space
* - ``EPERM``
- ``settimeofdat`` is called by someone other than the superuser.
* - ``EINVAL``
- Timezone (or something else) is invalid.
* - ``EFAULT``
- One of ``tv`` or ``tz`` pointed outside your accessible address space
**DESCRIPTION:**
@ -284,8 +303,10 @@ This routine returns the current time of day in the ``tp`` structure.
**NOTES:**
Currently, the timezone information is not supported. The ``tzp``
argument is ignored.
Currently, the timezone information is not supported. The ``tzp`` argument is
ignored.
.. _time:
time - Get time in seconds
--------------------------
@ -294,11 +315,11 @@ time - Get time in seconds
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <time.h>
int time(
time_t \*tloc
time_t *tloc
);
**STATUS CODES:**
@ -307,17 +328,12 @@ This routine returns the number of seconds since the Epoch.
**DESCRIPTION:**
``time`` returns the time since 00:00:00 GMT, January 1, 1970,
measured in seconds
``time`` returns the time since 00:00:00 GMT, January 1, 1970, measured in
seconds
If ``tloc`` in non null, the return value is also stored in the
memory pointed to by ``t``.
If ``tloc`` in non null, the return value is also stored in the memory pointed
to by ``t``.
**NOTES:**
NONE
.. COMMENT: This is the chapter from the RTEMS POSIX 1003.1b API User's Guide that
.. COMMENT: documents the services provided by the timer @c manager.

View File

@ -1,3 +1,7 @@
.. COMMENT: COPYRIGHT (c) 1988-2002.
.. COMMENT: On-Line Applications Research Corporation (OAR).
.. COMMENT: All rights reserved.
Condition Variable Manager
##########################
@ -8,25 +12,25 @@ The condition variable manager ...
The directives provided by the condition variable manager are:
- ``pthread_condattr_init`` - Initialize a Condition Variable Attribute Set
- pthread_condattr_init_ - Initialize a Condition Variable Attribute Set
- ``pthread_condattr_destroy`` - Destroy a Condition Variable Attribute Set
- pthread_condattr_destroy_ - Destroy a Condition Variable Attribute Set
- ``pthread_condattr_setpshared`` - Set Process Shared Attribute
- pthread_condattr_setpshared_ - Set Process Shared Attribute
- ``pthread_condattr_getpshared`` - Get Process Shared Attribute
- pthread_condattr_getpshared_ - Get Process Shared Attribute
- ``pthread_cond_init`` - Initialize a Condition Variable
- pthread_cond_init_ - Initialize a Condition Variable
- ``pthread_cond_destroy`` - Destroy a Condition Variable
- pthread_cond_destroy_ - Destroy a Condition Variable
- ``pthread_cond_signal`` - Signal a Condition Variable
- pthread_cond_signal_ - Signal a Condition Variable
- ``pthread_cond_broadcast`` - Broadcast a Condition Variable
- pthread_cond_broadcast_ - Broadcast a Condition Variable
- ``pthread_cond_wait`` - Wait on a Condition Variable
- pthread_cond_wait_ - Wait on a Condition Variable
- ``pthread_cond_timedwait`` - With with Timeout a Condition Variable
- pthread_cond_timedwait_ - With with Timeout a Condition Variable
Background
==========
@ -41,10 +45,11 @@ There is currently no text in this section.
Directives
==========
This section details the condition variable manager's directives.
A subsection is dedicated to each of this manager's directives
and describes the calling sequence, related constants, usage,
and status codes.
This section details the condition variable manager's directives. A subsection
is dedicated to each of this manager's directives and describes the calling
sequence, related constants, usage, and status codes.
.. _pthread_condattr_init:
pthread_condattr_init - Initialize a Condition Variable Attribute Set
---------------------------------------------------------------------
@ -53,23 +58,25 @@ pthread_condattr_init - Initialize a Condition Variable Attribute Set
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <pthread.h>
int pthread_condattr_init(
pthread_condattr_t \*attr
pthread_condattr_t *attr
);
**STATUS CODES:**
*ENOMEM*
Insufficient memory is available to initialize the condition variable
attributes object.
* - ``ENOMEM``
- Insufficient memory is available to initialize the condition variable
attributes object.
**DESCRIPTION:**
**NOTES:**
.. _pthread_condattr_destroy:
pthread_condattr_destroy - Destroy a Condition Variable Attribute Set
---------------------------------------------------------------------
.. index:: pthread_condattr_destroy
@ -77,22 +84,27 @@ pthread_condattr_destroy - Destroy a Condition Variable Attribute Set
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <pthread.h>
int pthread_condattr_destroy(
pthread_condattr_t \*attr
pthread_condattr_t *attr
);
**STATUS CODES:**
*EINVAL*
The attribute object specified is invalid.
.. list-table::
:class: rtems-table
* - ``EINVAL``
- The attribute object specified is invalid.
**DESCRIPTION:**
**NOTES:**
.. _pthread_condattr_setpshared:
pthread_condattr_setpshared - Set Process Shared Attribute
----------------------------------------------------------
.. index:: pthread_condattr_setpshared
@ -100,23 +112,28 @@ pthread_condattr_setpshared - Set Process Shared Attribute
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <pthread.h>
int pthread_condattr_setpshared(
pthread_condattr_t \*attr,
int pshared
pthread_condattr_t *attr,
int pshared
);
**STATUS CODES:**
*EINVAL*
Invalid argument passed.
.. list-table::
:class: rtems-table
* - ``EINVAL``
- Invalid argument passed.
**DESCRIPTION:**
**NOTES:**
.. _pthread_condattr_getpshared:
pthread_condattr_getpshared - Get Process Shared Attribute
----------------------------------------------------------
.. index:: pthread_condattr_getpshared
@ -124,23 +141,28 @@ pthread_condattr_getpshared - Get Process Shared Attribute
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <pthread.h>
int pthread_condattr_getpshared(
const pthread_condattr_t \*attr,
int \*pshared
const pthread_condattr_t *attr,
int *pshared
);
**STATUS CODES:**
*EINVAL*
Invalid argument passed.
.. list-table::
:class: rtems-table
* - ``EINVAL``
- Invalid argument passed.
**DESCRIPTION:**
**NOTES:**
.. _pthread_cond_init:
pthread_cond_init - Initialize a Condition Variable
---------------------------------------------------
.. index:: pthread_cond_init
@ -148,33 +170,36 @@ pthread_cond_init - Initialize a Condition Variable
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <pthread.h>
int pthread_cond_init(
pthread_cond_t \*cond,
const pthread_condattr_t \*attr
pthread_cond_t *cond,
const pthread_condattr_t *attr
);
**STATUS CODES:**
*EAGAIN*
The system lacked a resource other than memory necessary to create the
initialize the condition variable object.
.. list-table::
:class: rtems-table
*ENOMEM*
Insufficient memory is available to initialize the condition variable object.
*EBUSY*
The specified condition variable has already been initialized.
*EINVAL*
The specified attribute value is invalid.
* - ``EAGAIN``
- The system lacked a resource other than memory necessary to create the
initialize the condition variable object.
* - ``ENOMEM``
- Insufficient memory is available to initialize the condition variable
object.
* - ``EBUSY``
- The specified condition variable has already been initialized.
* - ``EINVAL``
- The specified attribute value is invalid.
**DESCRIPTION:**
**NOTES:**
.. _pthread_cond_destroy:
pthread_cond_destroy - Destroy a Condition Variable
---------------------------------------------------
.. index:: pthread_cond_destroy
@ -182,25 +207,29 @@ pthread_cond_destroy - Destroy a Condition Variable
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <pthread.h>
int pthread_cond_destroy(
pthread_cond_t \*cond
pthread_cond_t *cond
);
**STATUS CODES:**
*EINVAL*
The specified condition variable is invalid.
.. list-table::
:class: rtems-table
*EBUSY*
The specified condition variable is currently in use.
* - ``EINVAL``
- The specified condition variable is invalid.
* - ``EBUSY``
- The specified condition variable is currently in use.
**DESCRIPTION:**
**NOTES:**
.. _pthread_cond_signal:
pthread_cond_signal - Signal a Condition Variable
-------------------------------------------------
.. index:: pthread_cond_signal
@ -208,17 +237,20 @@ pthread_cond_signal - Signal a Condition Variable
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <pthread.h>
int pthread_cond_signal(
pthread_cond_t \*cond
pthread_cond_t *cond
);
**STATUS CODES:**
*EINVAL*
The specified condition variable is not valid.
.. list-table::
:class: rtems-table
* - ``EINVAL``
- The specified condition variable is not valid.
**DESCRIPTION:**
@ -227,6 +259,8 @@ pthread_cond_signal - Signal a Condition Variable
This routine should not be invoked from a handler from an asynchronous signal
handler or an interrupt service routine.
.. _pthread_cond_broadcast:
pthread_cond_broadcast - Broadcast a Condition Variable
-------------------------------------------------------
.. index:: pthread_cond_broadcast
@ -234,17 +268,20 @@ pthread_cond_broadcast - Broadcast a Condition Variable
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <pthread.h>
int pthread_cond_broadcast(
pthread_cond_t \*cond
pthread_cond_t *cond
);
**STATUS CODES:**
*EINVAL*
The specified condition variable is not valid.
.. list-table::
:class: rtems-table
* - ``EINVAL``
- The specified condition variable is not valid.
**DESCRIPTION:**
@ -253,6 +290,8 @@ pthread_cond_broadcast - Broadcast a Condition Variable
This routine should not be invoked from a handler from an asynchronous signal
handler or an interrupt service routine.
.. _pthread_cond_wait:
pthread_cond_wait - Wait on a Condition Variable
------------------------------------------------
.. index:: pthread_cond_wait
@ -260,26 +299,31 @@ pthread_cond_wait - Wait on a Condition Variable
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <pthread.h>
int pthread_cond_wait(
pthread_cond_t \*cond,
pthread_mutex_t \*mutex
pthread_cond_t *cond,
pthread_mutex_t *mutex
);
**STATUS CODES:**
*EINVAL*
The specified condition variable or mutex is not initialized OR different
mutexes were specified for concurrent pthread_cond_wait() and
pthread_cond_timedwait() operations on the same condition variable OR
the mutex was not owned by the current thread at the time of the call.
.. list-table::
:class: rtems-table
* - ``EINVAL``
- The specified condition variable or mutex is not initialized OR different
mutexes were specified for concurrent ``pthread_cond_wait()`` and
``pthread_cond_timedwait()`` operations on the same condition variable OR
the mutex was not owned by the current thread at the time of the call.
**DESCRIPTION:**
**NOTES:**
.. _pthread_cond_timedwait:
pthread_cond_timedwait - Wait with Timeout a Condition Variable
---------------------------------------------------------------
.. index:: pthread_cond_timedwait
@ -287,34 +331,29 @@ pthread_cond_timedwait - Wait with Timeout a Condition Variable
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <pthread.h>
int pthread_cond_timedwait(
pthread_cond_t \*cond,
pthread_mutex_t \*mutex,
const struct timespec \*abstime
pthread_cond_t *cond,
pthread_mutex_t *mutex,
const struct timespec *abstime
);
**STATUS CODES:**
*EINVAL*
The specified condition variable or mutex is not initialized OR different
mutexes were specified for concurrent pthread_cond_wait() and
pthread_cond_timedwait() operations on the same condition variable OR
the mutex was not owned by the current thread at the time of the call.
.. list-table::
:class: rtems-table
*ETIMEDOUT*
The specified time has elapsed without the condition variable being
satisfied.
* - ``EINVAL``
- The specified condition variable or mutex is not initialized OR different
mutexes were specified for concurrent ``pthread_cond_wait()`` and
``pthread_cond_timedwait()`` operations on the same condition variable OR
the mutex was not owned by the current thread at the time of the call.
* - ``ETIMEDOUT``
- The specified time has elapsed without the condition variable being
satisfied.
**DESCRIPTION:**
**NOTES:**
.. COMMENT: COPYRIGHT (c) 1988-2002.
.. COMMENT: On-Line Applications Research Corporation (OAR).
.. COMMENT: All rights reserved.

View File

@ -1,3 +1,7 @@
.. COMMENT: COPYRIGHT (c) 1988-2002.
.. COMMENT: On-Line Applications Research Corporation (OAR).
.. COMMENT: All rights reserved.
Device- and Class- Specific Functions Manager
#############################################
@ -6,32 +10,32 @@ Introduction
The device- and class- specific functions manager is ...
The directives provided by the device- and class- specific functions
manager are:
The directives provided by the device- and class- specific functions manager
are:
- ``cfgetispeed`` - Reads terminal input baud rate
- cfgetispeed_ - Reads terminal input baud rate
- ``cfgetospeed`` - Reads terminal output baud rate
- cfgetospeed_ - Reads terminal output baud rate
- ``cfsetispeed`` - Sets terminal input baud rate
- cfsetispeed_ - Sets terminal input baud rate
- ``cfsetospeed`` - Set terminal output baud rate
- cfsetospeed_ - Set terminal output baud rate
- ``tcgetattr`` - Gets terminal attributes
- tcgetattr_ - Gets terminal attributes
- ``tcsetattr`` - Set terminal attributes
- tcsetattr_ - Set terminal attributes
- ``tcsendbreak`` - Sends a break to a terminal
- tcsendbreak_ - Sends a break to a terminal
- ``tcdrain`` - Waits for all output to be transmitted to the terminal
- tcdrain_ - Waits for all output to be transmitted to the terminal
- ``tcflush`` - Discards terminal data
- tcflush_ - Discards terminal data
- ``tcflow`` - Suspends/restarts terminal output
- tcflow_ - Suspends/restarts terminal output
- ``tcgetpgrp`` - Gets foreground process group ID
- tcgetpgrp_ - Gets foreground process group ID
- ``tcsetpgrp`` - Sets foreground process group ID
- tcsetpgrp_ - Sets foreground process group ID
Background
==========
@ -51,6 +55,8 @@ directives. A subsection is dedicated to each of this manager's directives
and describes the calling sequence, related constants, usage,
and status codes.
.. _cfgetispeed:
cfgetispeed - Reads terminal input baud rate
--------------------------------------------
.. index:: cfgetispeed
@ -58,11 +64,11 @@ cfgetispeed - Reads terminal input baud rate
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <termios.h>
int cfgetispeed(
const struct termios \*p
const struct termios *p
);
**STATUS CODES:**
@ -71,18 +77,21 @@ The ``cfgetispeed()`` function returns a code for baud rate.
**DESCRIPTION:**
The ``cfsetispeed()`` function stores a code for the terminal speed
stored in a struct termios. The codes are defined in ``<termios.h>``
by the macros BO, B50, B75, B110, B134, B150, B200, B300, B600, B1200,
B1800, B2400, B4800, B9600, B19200, and B38400.
The ``cfsetispeed()`` function stores a code for the terminal speed stored in a
struct termios. The codes are defined in ``<termios.h>`` by the macros ``BO``,
``B50``, ``B75``, ``B110``, ``B134``, ``B150``, ``B200``, ``B300``, ``B600``,
``B1200``, ``B1800``, ``B2400``, ``B4800``, ``B9600``, ``B19200``, and
``B38400``.
The ``cfsetispeed()`` function does not do anything to the hardware.
It merely stores a value for use by ``tcsetattr()``.
The ``cfsetispeed()`` function does not do anything to the hardware. It merely
stores a value for use by ``tcsetattr()``.
**NOTES:**
Baud rates are defined by symbols, such as B110, B1200, B2400. The actual
number returned for any given speed may change from system to system.
Baud rates are defined by symbols, such as ``B110``, ``B1200``, ``B2400``. The
actual number returned for any given speed may change from system to system.
.. _cfgetospeed:
cfgetospeed - Reads terminal output baud rate
---------------------------------------------
@ -91,11 +100,11 @@ cfgetospeed - Reads terminal output baud rate
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <termios.h>
int cfgetospeed(
const struct termios \*p
int cfgetospeed(
const struct termios *p
);
**STATUS CODES:**
@ -104,18 +113,21 @@ The ``cfgetospeed()`` function returns the termios code for the baud rate.
**DESCRIPTION:**
The ``cfgetospeed()`` function returns a code for the terminal speed
stored in a ``struct termios``. The codes are defined in ``<termios.h>``
by the macros BO, B50, B75, B110, B134, B150, B200, B300, B600, B1200, B1800,
B2400, B4800, B9600, B19200, and B38400.
The ``cfgetospeed()`` function returns a code for the terminal speed stored in
a ``struct termios``. The codes are defined in ``<termios.h>`` by the macros
``BO``, ``B50``, ``B75``, ``B110``, ``B134``, ``B150``, ``B200``, ``B300``,
``B600``, ``B1200``, ``B1800``, ``B2400``, ``B4800``, ``B9600``, ``B19200``,
and ``B38400``.
The ``cfgetospeed()`` function does not do anything to the hardware.
It merely returns the value stored by a previous call to ``tcgetattr()``.
The ``cfgetospeed()`` function does not do anything to the hardware. It merely
returns the value stored by a previous call to ``tcgetattr()``.
**NOTES:**
Baud rates are defined by symbols, such as B110, B1200, B2400. The actual
number returned for any given speed may change from system to system.
Baud rates are defined by symbols, such as ``B110``, ``B1200``, ``B2400``. The
actual number returned for any given speed may change from system to system.
.. _cfsetispeed:
cfsetispeed - Sets terminal input baud rate
-------------------------------------------
@ -124,31 +136,34 @@ cfsetispeed - Sets terminal input baud rate
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <termios.h>
int cfsetispeed(
struct termios \*p,
speed_t speed
struct termios *p,
speed_t speed
);
**STATUS CODES:**
The ``cfsetispeed()`` function returns a zero when successful and
returns -1 when an error occurs.
The ``cfsetispeed()`` function returns a zero when successful and returns -1
when an error occurs.
**DESCRIPTION:**
The ``cfsetispeed()`` function stores a code for the terminal speed
stored in a struct termios. The codes are defined in ``<termios.h>``
by the macros B0, B50, B75, B110, B134, B150, B200, B300, B600, B1200,
B1800, B2400, B4800, B9600, B19200, and B38400.
The ``cfsetispeed()`` function stores a code for the terminal speed stored in a
struct termios. The codes are defined in ``<termios.h>`` by the macros ``BO``,
``B50``, ``B75``, ``B110``, ``B134``, ``B150``, ``B200``, ``B300``, ``B600``,
``B1200``, ``B1800``, ``B2400``, ``B4800``, ``B9600``, ``B19200``, and
``B38400``.
**NOTES:**
This function merely stores a value in the ``termios`` structure. It
does not change the terminal speed until a ``tcsetattr()`` is done.
It does not detect impossible terminal speeds.
This function merely stores a value in the ``termios`` structure. It does not
change the terminal speed until a ``tcsetattr()`` is done. It does not detect
impossible terminal speeds.
.. _cfsetospeed:
cfsetospeed - Sets terminal output baud rate
--------------------------------------------
@ -157,12 +172,12 @@ cfsetospeed - Sets terminal output baud rate
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <termios.h>
int cfsetospeed(
struct termios \*p,
speed_t speed
struct termios *p,
speed_t speed
);
**STATUS CODES:**
@ -172,19 +187,22 @@ returns -1 when an error occurs.
**DESCRIPTION:**
The ``cfsetospeed()`` function stores a code for the terminal speed stored
in a struct ``termios``. The codes are defiined in ``<termios.h>`` by the
macros B0, B50, B75, B110, B134, B150, B200, B300, B600, B1200, B1800, B2400,
B4800, B9600, B19200, and B38400.
The ``cfsetospeed()`` function stores a code for the terminal speed stored in a
struct ``termios``. The codes are defiined in ``<termios.h>`` by the macros
``BO``, ``B50``, ``B75``, ``B110``, ``B134``, ``B150``, ``B200``, ``B300``,
``B600``, ``B1200``, ``B1800``, ``B2400``, ``B4800``, ``B9600``, ``B19200``,
and ``B38400``.
The ``cfsetospeed()`` function does not do anything to the hardware. It
merely stores a value for use by ``tcsetattr()``.
The ``cfsetospeed()`` function does not do anything to the hardware. It merely
stores a value for use by ``tcsetattr()``.
**NOTES:**
This function merely stores a value in the ``termios`` structure.
It does not change the terminal speed until a ``tcsetattr()`` is done.
It does not detect impossible terminal speeds.
This function merely stores a value in the ``termios`` structure. It does not
change the terminal speed until a ``tcsetattr()`` is done. It does not detect
impossible terminal speeds.
.. _tcgetattr:
tcgetattr - Gets terminal attributes
------------------------------------
@ -193,33 +211,37 @@ tcgetattr - Gets terminal attributes
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <termios.h>
#include <unistd.h>
int tcgetattr(
int fildes,
struct termios \*p
int fildes,
struct termios *p
);
**STATUS CODES:**
*EBADF*
Invalid file descriptor
.. list-table::
:class: rtems-table
*ENOOTY*
Terminal control function attempted for a file that is not a terminal.
* - ``EBADF``
- Invalid file descriptor
* - ``ENOOTY``
- Terminal control function attempted for a file that is not a terminal.
**DESCRIPTION:**
The ``tcgetattr()`` gets the parameters associated with the terminal
referred to by ``fildes`` and stores them into the ``termios()``
structure pointed to by ``termios_p``.
The ``tcgetattr()`` gets the parameters associated with the terminal referred
to by ``fildes`` and stores them into the ``termios()`` structure pointed to by
``termios_p``.
**NOTES:**
NONE
.. _tcsetattr:
tcsetattr - Set terminal attributes
-----------------------------------
.. index:: tcsetattr
@ -227,25 +249,30 @@ tcsetattr - Set terminal attributes
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <termios.h>
#include <unistd.h>
int tcsetattr(
int fildes,
int options,
const struct termios \*tp
int fildes,
int options,
const struct termios *tp
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
**NOTES:**
.. _tcsendbreak:
tcsendbreak - Sends a break to a terminal
-----------------------------------------
.. index:: tcsendbreak
@ -253,16 +280,19 @@ tcsendbreak - Sends a break to a terminal
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int tcsendbreak(
int fd
int fd
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
@ -271,6 +301,8 @@ tcsendbreak - Sends a break to a terminal
This routine is not currently supported by RTEMS but could be
in a future version.
.. _tcdrain:
tcdrain - Waits for all output to be transmitted to the terminal.
-----------------------------------------------------------------
.. index:: tcdrain
@ -278,33 +310,37 @@ tcdrain - Waits for all output to be transmitted to the terminal.
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <termios.h>
#include <unistd.h>
int tcdrain(
int fildes
int fildes
);
**STATUS CODES:**
*EBADF*
Invalid file descriptor
.. list-table::
:class: rtems-table
*EINTR*
Function was interrupted by a signal
*ENOTTY*
Terminal control function attempted for a file that is not a terminal.
* - ``EBADF``
- Invalid file descriptor
* - ``EINTR``
- Function was interrupted by a signal
* - ``ENOTTY``
- Terminal control function attempted for a file that is not a terminal.
**DESCRIPTION:**
The ``tcdrain()`` function waits until all output written to``fildes`` has been transmitted.
The ``tcdrain()`` function waits until all output written to ``fildes`` has been
transmitted.
**NOTES:**
NONE
.. _tcflush:
tcflush - Discards terminal data
--------------------------------
.. index:: tcflush
@ -312,23 +348,28 @@ tcflush - Discards terminal data
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int tcflush(
int fd
int fd
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
**NOTES:**
This routine is not currently supported by RTEMS but could be
in a future version.
This routine is not currently supported by RTEMS but could be in a future
version.
.. _tcflow:
tcflow - Suspends/restarts terminal output.
-------------------------------------------
@ -337,23 +378,28 @@ tcflow - Suspends/restarts terminal output.
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int tcflow(
int fd
int fd
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
**NOTES:**
This routine is not currently supported by RTEMS but could be
in a future version.
This routine is not currently supported by RTEMS but could be in a future
version.
.. _tcgetpgrp:
tcgetpgrp - Gets foreground process group ID
--------------------------------------------
@ -362,22 +408,27 @@ tcgetpgrp - Gets foreground process group ID
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int tcgetpgrp(
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
**NOTES:**
This routine is not currently supported by RTEMS but could be
in a future version.
This routine is not currently supported by RTEMS but could be in a future
version.
.. _tcsetpgrp:
tcsetpgrp - Sets foreground process group ID
--------------------------------------------
@ -386,26 +437,22 @@ tcsetpgrp - Sets foreground process group ID
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int tcsetpgrp(
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
**NOTES:**
This routine is not currently supported by RTEMS but could be
in a future version.
.. COMMENT: COPYRIGHT (c) 1988-2002.
.. COMMENT: On-Line Applications Research Corporation (OAR).
.. COMMENT: All rights reserved.
This routine is not currently supported by RTEMS but could be in a future
version.

File diff suppressed because it is too large Load Diff

View File

@ -2,45 +2,41 @@
RTEMS POSIX API User's Guide
============================
COPYRIGHT (c) 1988 - 2015.
RTEMS POSIX API User's Guide
----------------------------
On-Line Applications Research Corporation (OAR).
| COPYRIGHT (c) 1988 - 2015.
| On-Line Applications Research Corporation (OAR).
The authors have used their best efforts in preparing
this material. These efforts include the development, research,
and testing of the theories and programs to determine their
effectiveness. No warranty of any kind, expressed or implied,
with regard to the software or the material contained in this
document is provided. No liability arising out of the
application or use of any product described in this document is
assumed. The authors reserve the right to revise this material
and to make changes from time to time in the content hereof
without obligation to notify anyone of such revision or changes.
The authors have used their best efforts in preparing this material. These
efforts include the development, research, and testing of the theories and
programs to determine their effectiveness. No warranty of any kind, expressed
or implied, with regard to the software or the material contained in this
document is provided. No liability arising out of the application or use of
any product described in this document is assumed. The authors reserve the
right to revise this material and to make changes from time to time in the
content hereof without obligation to notify anyone of such revision or changes.
The RTEMS Project is hosted at http://www.rtems.org. Any
inquiries concerning RTEMS, its related support components, or its
documentation should be directed to the Community Project hosted athttp://www.rtems.org.
The RTEMS Project is hosted at http://www.rtems.org/. Any inquiries concerning
RTEMS, its related support components, or its documentation should be directed
to the Community Project hosted at http://www.rtems.org/.
Any inquiries for commercial services including training, support, custom
development, application development assistance should be directed tohttp://www.rtems.com.
.. COMMENT: This prevents a black box from being printed on "overflow" lines.
.. COMMENT: The alternative is to rework a sentence to avoid this problem.
Table of Contents
-----------------
.. toctree::
preface
.. topic:: RTEMS Online Resources
================ =============================
Home https://www.rtems.org/
Developers https://devel.rtems.org/
Documentation https://docs.rtems.org/
Bug Reporting https://devel.rtems.org/query
Mailing Lists https://lists.rtems.org/
Git Repositories https://git.rtems.org/
================ =============================
.. toctree::
:maxdepth: 3
:numbered:
preface
process_creation_and_execution
signal
process_environment
@ -65,6 +61,5 @@ Table of Contents
status_of_implementation
command
* :ref:`genindex`
* :ref:`search`

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,7 @@
.. COMMENT: COPYRIGHT (c) 1988-2002.
.. COMMENT: On-Line Applications Research Corporation (OAR).
.. COMMENT: All rights reserved.
Key Manager
###########
@ -9,13 +13,13 @@ specific to threads.
The directives provided by the key manager are:
- ``pthread_key_create`` - Create Thread Specific Data Key
- pthread_key_create_ - Create Thread Specific Data Key
- ``pthread_key_delete`` - Delete Thread Specific Data Key
- pthread_key_delete_ - Delete Thread Specific Data Key
- ``pthread_setspecific`` - Set Thread Specific Key Value
- pthread_setspecific_ - Set Thread Specific Key Value
- ``pthread_getspecific`` - Get Thread Specific Key Value
- pthread_getspecific_ - Get Thread Specific Key Value
Background
==========
@ -30,166 +34,177 @@ There is currently no text in this section.
Directives
==========
This section details the key manager's directives.
A subsection is dedicated to each of this manager's directives
and describes the calling sequence, related constants, usage,
and status codes.
This section details the key manager's directives. A subsection is dedicated
to each of this manager's directives and describes the calling sequence,
related constants, usage, and status codes.
.. _pthread_key_create:
pthread_key_create - Create Thread Specific Data Key
----------------------------------------------------
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <pthread.h>
int pthread_key_create(
pthread_key_t \*key,
void (\*destructor)( void )
pthread_key_t *key,
void (*destructor)( void )
);
**STATUS CODES:**
*EAGAIN*
There were not enough resources available to create another key.
.. list-table::
:class: rtems-table
*ENOMEM*
Insufficient memory exists to create the key.
* - ``EAGAIN``
- There were not enough resources available to create another key.
* - ``ENOMEM``
- Insufficient memory exists to create the key.
**DESCRIPTION**
The pthread_key_create() function shall create a thread-specific data
key visible to all threads in the process. Key values provided by
pthread_key_create() are opaque objects used to locate thread-specific
data. Although the same key value may be used by different threads, the
values bound to the key by pthread_setspecific() are maintained on a
per-thread basis and persist for the life of the calling thread.
The ``pthread_key_create()`` function shall create a thread-specific data key
visible to all threads in the process. Key values provided by
``pthread_key_create()`` are opaque objects used to locate thread-specific
data. Although the same key value may be used by different threads, the values
bound to the key by ``pthread_setspecific()`` are maintained on a per-thread
basis and persist for the life of the calling thread.
Upon key creation, the value NULL shall be associated with the new key
in all active threads. Upon thread creation, the value NULL shall be
Upon key creation, the value ``NULL`` shall be associated with the new key in
all active threads. Upon thread creation, the value ``NULL`` shall be
associated with all defined keys in the new thread.
**NOTES**
An optional destructor function may be associated with each key value.
At thread exit, if a key value has a non-NULL destructor pointer, and
the thread has a non-NULL value associated with that key, the value of
the key is set to NULL, and then the function pointed to is called with
the previously associated value as its sole argument. The order of
destructor calls is unspecified if more than one destructor exists for
a thread when it exits.
An optional destructor function may be associated with each key value. At
thread exit, if a key value has a non-``NULL`` destructor pointer, and the
thread has a non-``NULL`` value associated with that key, the value of the key
is set to NULL, and then the function pointed to is called with the previously
associated value as its sole argument. The order of destructor calls is
unspecified if more than one destructor exists for a thread when it exits.
.. _pthread_key_delete:
pthread_key_delete - Delete Thread Specific Data Key
----------------------------------------------------
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <pthread.h>
int pthread_key_delete(
pthread_key_t key);
pthread_key_t key
);
**STATUS CODES:**
*EINVAL*
The key was invalid
.. list-table::
:class: rtems-table
* - ``EINVAL``
- The key was invalid
**DESCRIPTION:**
The pthread_key_delete() function shall delete a thread-specific data key
previously returned by pthread_key_create(). The thread-specific data
values associated with key need not be NULL at the time pthread_key_delete()
is called. It is the responsibility of the application to free any
application storage or perform any cleanup actions for data structures related
to the deleted key or associated thread-specific data in any
The ``pthread_key_delete()`` function shall delete a thread-specific data key
previously returned by ``pthread_key_create()``. The thread-specific data
values associated with key need not be NULL at the time
``pthread_key_delete()`` is called. It is the responsibility of the application
to free any application storage or perform any cleanup actions for data
structures related to the deleted key or associated thread-specific data in any
threads; this cleanup can be done either before or after
pthread_key_delete() is called. Any attempt to use key following the call to
pthread_key_delete() results in undefined behavior.
``pthread_key_delete()`` is called. Any attempt to use key following the call
to ``pthread_key_delete()`` results in undefined behavior.
**NOTES:**
The pthread_key_delete() function shall be callable from within
destructor functions. No destructor functions shall be invoked by
pthread_key_delete(). Any destructor function that may have been
associated with key shall no longer be called upon thread exit.
The ``pthread_key_delete()`` function shall be callable from within destructor
functions. No destructor functions shall be invoked by
``pthread_key_delete()``. Any destructor function that may have been associated
with key shall no longer be called upon thread exit.
.. _pthread_setspecific:
pthread_setspecific - Set Thread Specific Key Value
---------------------------------------------------
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <pthread.h>
int pthread_setspecific(
pthread_key_t key,
const void \*value
pthread_key_t key,
const void *value
);
**STATUS CODES:**
*EINVAL*
The specified key is invalid.
.. list-table::
:class: rtems-table
* - ``EINVAL``
- The specified key is invalid.
**DESCRIPTION:**
The pthread_setspecific() function shall associate a thread-specific value
with a key obtained via a previous call to pthread_key_create().
Different threads may bind different values to the same key. These values
are typically pointers to blocks of dynamically allocated memory that
have been reserved for use by the calling thread.
The ``pthread_setspecific()`` function shall associate a thread-specific value
with a key obtained via a previous call to ``pthread_key_create()``. Different
threads may bind different values to the same key. These values are typically
pointers to blocks of dynamically allocated memory that have been reserved for
use by the calling thread.
**NOTES:**
The effect of calling pthread_setspecific() with a key value not obtained
from pthread_key_create() or after key has
been deleted with pthread_key_delete() is undefined.
The effect of calling ``pthread_setspecific()`` with a key value not obtained
from ``pthread_key_create()`` or after key has been deleted with
``pthread_key_delete()`` is undefined.
pthread_setspecific() may be called from a thread-specific data
destructor function. Calling pthread_setspecific() from a thread-specific
data destructor routine may result either in lost storage (after at least
PTHREAD_DESTRUCTOR_ITERATIONS attempts at destruction) or in an infinite loop.
``pthread_setspecific()`` may be called from a thread-specific data destructor
function. Calling ``pthread_setspecific()`` from a thread-specific data
destructor routine may result either in lost storage (after at least
``PTHREAD_DESTRUCTOR_ITERATIONS`` attempts at destruction) or in an infinite
loop.
.. _pthread_getspecific:
pthread_getspecific - Get Thread Specific Key Value
---------------------------------------------------
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <pthread.h>
void \*pthread_getspecific(
pthread_key_t key
void *pthread_getspecific(
pthread_key_t key
);
**STATUS CODES:**
*NULL*
There is no thread-specific data associated with the specified key.
.. list-table::
:class: rtems-table
*non-NULL*
The data associated with the specified key.
* - ``NULL``
- There is no thread-specific data associated with the specified key.
* - ``non-NULL``
- The data associated with the specified key.
**DESCRIPTION:**
The pthread_getspecific() function shall return the value currently bound to
the specified key on behalf of the calling thread.
The ``pthread_getspecific()`` function shall return the value currently bound
to the specified key on behalf of the calling thread.
**NOTES:**
The effect of calling pthread_getspecific() with a key value not obtained from
pthread_key_create() or after key has
been deleted with pthread_key_delete() is undefined.
pthread_getspecific() may be called from a thread-specific data destructor
function. A call to pthread_getspecific() for the thread-specific data key
being destroyed shall return the value NULL, unless the value is changed
(after the destructor starts) by a call to pthread_setspecific().
.. COMMENT: COPYRIGHT (c) 1988-2002.
.. COMMENT: On-Line Applications Research Corporation (OAR).
.. COMMENT: All rights reserved.
The effect of calling ``pthread_getspecific()`` with a key value not obtained
from ``pthread_key_create()`` or after key has been deleted with
``pthread_key_delete()`` is undefined.
``pthread_getspecific()`` may be called from a thread-specific data destructor
function. A call to ``pthread_getspecific()`` for the thread-specific data key
being destroyed shall return the value ``NULL``, unless the value is changed
(after the destructor starts) by a call to ``pthread_setspecific()``.

View File

@ -1,55 +1,58 @@
.. COMMENT: COPYRIGHT (c) 1988-2002.
.. COMMENT: On-Line Applications Research Corporation (OAR).
.. COMMENT: All rights reserved.
Language-Specific Services for the C Programming Language Manager
#################################################################
Introduction
============
The
language-specific services for the C programming language manager is ...
The language-specific services for the C programming language manager is ...
The directives provided by the language-specific services for the C programming language manager are:
- ``setlocale`` - Set the Current Locale
- setlocale_ - Set the Current Locale
- ``fileno`` - Obtain File Descriptor Number for this File
- fileno_ - Obtain File Descriptor Number for this File
- ``fdopen`` - Associate Stream with File Descriptor
- fdopen_ - Associate Stream with File Descriptor
- ``flockfile`` - Acquire Ownership of File Stream
- flockfile_ - Acquire Ownership of File Stream
- ``ftrylockfile`` - Poll to Acquire Ownership of File Stream
- ftrylockfile_ - Poll to Acquire Ownership of File Stream
- ``funlockfile`` - Release Ownership of File Stream
- funlockfile_ - Release Ownership of File Stream
- ``getc_unlocked`` - Get Character without Locking
- getc_unlocked_ - Get Character without Locking
- ``getchar_unlocked`` - Get Character from stdin without Locking
- getchar_unlocked_ - Get Character from stdin without Locking
- ``putc_unlocked`` - Put Character without Locking
- putc_unlocked_ - Put Character without Locking
- ``putchar_unlocked`` - Put Character to stdin without Locking
- putchar_unlocked_ - Put Character to stdin without Locking
- ``setjmp`` - Save Context for Non-Local Goto
- setjmp_ - Save Context for Non-Local Goto
- ``longjmp`` - Non-Local Jump to a Saved Context
- longjmp_ - Non-Local Jump to a Saved Context
- ``sigsetjmp`` - Save Context with Signal Status for Non-Local Goto
- sigsetjmp_ - Save Context with Signal Status for Non-Local Goto
- ``siglongjmp`` - Non-Local Jump with Signal Status to a Saved Context
- siglongjmp_ - Non-Local Jump with Signal Status to a Saved Context
- ``tzset`` - Initialize Time Conversion Information
- tzset_ - Initialize Time Conversion Information
- ``strtok_r`` - Reentrant Extract Token from String
- strtok_r_ - Reentrant Extract Token from String
- ``asctime_r`` - Reentrant struct tm to ASCII Time Conversion
- asctime_r_ - Reentrant struct tm to ASCII Time Conversion
- ``ctime_r`` - Reentrant time_t to ASCII Time Conversion
- ctime_r_ - Reentrant time_t to ASCII Time Conversion
- ``gmtime_r`` - Reentrant UTC Time Conversion
- gmtime_r_ - Reentrant UTC Time Conversion
- ``localtime_r`` - Reentrant Local Time Conversion
- localtime_r_ - Reentrant Local Time Conversion
- ``rand_r`` - Reentrant Random Number Generation
- rand_r_ - Reentrant Random Number Generation
Background
==========
@ -64,10 +67,12 @@ There is currently no text in this section.
Directives
==========
This section details the language-specific services for the C programming language manager's directives.
A subsection is dedicated to each of this manager's directives
and describes the calling sequence, related constants, usage,
and status codes.
This section details the language-specific services for the C programming
language manager's directives. A subsection is dedicated to each of this
manager's directives and describes the calling sequence, related constants,
usage, and status codes.
.. _setlocale:
setlocale - Set the Current Locale
----------------------------------
@ -76,20 +81,25 @@ setlocale - Set the Current Locale
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int setlocale(
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
**NOTES:**
.. _fileno:
fileno - Obtain File Descriptor Number for this File
----------------------------------------------------
.. index:: fileno
@ -97,20 +107,25 @@ fileno - Obtain File Descriptor Number for this File
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int fileno(
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
**NOTES:**
.. _fdopen:
fdopen - Associate Stream with File Descriptor
----------------------------------------------
.. index:: fdopen
@ -118,20 +133,25 @@ fdopen - Associate Stream with File Descriptor
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int fdopen(
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
**NOTES:**
.. _flockfile:
flockfile - Acquire Ownership of File Stream
--------------------------------------------
.. index:: flockfile
@ -139,20 +159,25 @@ flockfile - Acquire Ownership of File Stream
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int flockfile(
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
**NOTES:**
.. _ftrylockfile:
ftrylockfile - Poll to Acquire Ownership of File Stream
-------------------------------------------------------
.. index:: ftrylockfile
@ -160,20 +185,25 @@ ftrylockfile - Poll to Acquire Ownership of File Stream
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int ftrylockfile(
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
**NOTES:**
.. _funlockfile:
funlockfile - Release Ownership of File Stream
----------------------------------------------
.. index:: funlockfile
@ -181,20 +211,25 @@ funlockfile - Release Ownership of File Stream
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int funlockfile(
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
**NOTES:**
.. _getc_unlocked:
getc_unlocked - Get Character without Locking
---------------------------------------------
.. index:: getc_unlocked
@ -202,20 +237,25 @@ getc_unlocked - Get Character without Locking
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int getc_unlocked(
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
**NOTES:**
.. _getchar_unlocked:
getchar_unlocked - Get Character from stdin without Locking
-----------------------------------------------------------
.. index:: getchar_unlocked
@ -223,20 +263,25 @@ getchar_unlocked - Get Character from stdin without Locking
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int getchar_unlocked(
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
**NOTES:**
.. _putc_unlocked:
putc_unlocked - Put Character without Locking
---------------------------------------------
.. index:: putc_unlocked
@ -244,20 +289,25 @@ putc_unlocked - Put Character without Locking
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int putc_unlocked(
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
**NOTES:**
.. _putchar_unlocked:
putchar_unlocked - Put Character to stdin without Locking
---------------------------------------------------------
.. index:: putchar_unlocked
@ -265,20 +315,25 @@ putchar_unlocked - Put Character to stdin without Locking
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int putchar_unlocked(
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
**NOTES:**
.. _setjmp:
setjmp - Save Context for Non-Local Goto
----------------------------------------
.. index:: setjmp
@ -286,20 +341,25 @@ setjmp - Save Context for Non-Local Goto
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int setjmp(
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
**NOTES:**
.. _longjmp:
longjmp - Non-Local Jump to a Saved Context
-------------------------------------------
.. index:: longjmp
@ -307,20 +367,25 @@ longjmp - Non-Local Jump to a Saved Context
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int longjmp(
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
**NOTES:**
.. _sigsetjmp:
sigsetjmp - Save Context with Signal Status for Non-Local Goto
--------------------------------------------------------------
.. index:: sigsetjmp
@ -328,20 +393,25 @@ sigsetjmp - Save Context with Signal Status for Non-Local Goto
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int sigsetjmp(
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
**NOTES:**
.. _siglongjmp:
siglongjmp - Non-Local Jump with Signal Status to a Saved Context
-----------------------------------------------------------------
.. index:: siglongjmp
@ -349,20 +419,25 @@ siglongjmp - Non-Local Jump with Signal Status to a Saved Context
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int siglongjmp(
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
**NOTES:**
.. _tzset:
tzset - Initialize Time Conversion Information
----------------------------------------------
.. index:: tzset
@ -370,20 +445,25 @@ tzset - Initialize Time Conversion Information
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int tzset(
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
**NOTES:**
.. _strtok_r:
strtok_r - Reentrant Extract Token from String
----------------------------------------------
.. index:: strtok_r
@ -391,20 +471,25 @@ strtok_r - Reentrant Extract Token from String
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int strtok_r(
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
**NOTES:**
.. _asctime_r:
asctime_r - Reentrant struct tm to ASCII Time Conversion
--------------------------------------------------------
.. index:: asctime_r
@ -412,20 +497,25 @@ asctime_r - Reentrant struct tm to ASCII Time Conversion
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int asctime_r(
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
**NOTES:**
.. _ctime_r:
ctime_r - Reentrant time_t to ASCII Time Conversion
---------------------------------------------------
.. index:: ctime_r
@ -433,20 +523,25 @@ ctime_r - Reentrant time_t to ASCII Time Conversion
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int ctime_r(
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
**NOTES:**
.. _gmtime_r:
gmtime_r - Reentrant UTC Time Conversion
----------------------------------------
.. index:: gmtime_r
@ -454,20 +549,25 @@ gmtime_r - Reentrant UTC Time Conversion
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int gmtime_r(
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
**NOTES:**
.. _localtime_r:
localtime_r - Reentrant Local Time Conversion
---------------------------------------------
.. index:: localtime_r
@ -475,20 +575,25 @@ localtime_r - Reentrant Local Time Conversion
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int localtime_r(
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
**NOTES:**
.. _rand_r:
rand_r - Reentrant Random Number Generation
-------------------------------------------
.. index:: rand_r
@ -496,23 +601,19 @@ rand_r - Reentrant Random Number Generation
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int rand_r(
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
**NOTES:**
.. COMMENT: COPYRIGHT (c) 1988-2002.
.. COMMENT: On-Line Applications Research Corporation (OAR).
.. COMMENT: All rights reserved.

View File

@ -1,3 +1,7 @@
.. COMMENT: COPYRIGHT (c) 1988-2002.
.. COMMENT: On-Line Applications Research Corporation (OAR).
.. COMMENT: All rights reserved.
Memory Management Manager
#########################
@ -9,25 +13,25 @@ memory management manager is ...
The directives provided by the memory management manager are:
- ``mlockall`` - Lock the Address Space of a Process
- mlockall_ - Lock the Address Space of a Process
- ``munlockall`` - Unlock the Address Space of a Process
- munlockall_ - Unlock the Address Space of a Process
- ``mlock`` - Lock a Range of the Process Address Space
- mlock_ - Lock a Range of the Process Address Space
- ``munlock`` - Unlock a Range of the Process Address Space
- munlock_ - Unlock a Range of the Process Address Space
- ``mmap`` - Map Process Addresses to a Memory Object
- mmap_ - Map Process Addresses to a Memory Object
- ``munmap`` - Unmap Previously Mapped Addresses
- munmap_ - Unmap Previously Mapped Addresses
- ``mprotect`` - Change Memory Protection
- mprotect_ - Change Memory Protection
- ``msync`` - Memory Object Synchronization
- msync_ - Memory Object Synchronization
- ``shm_open`` - Open a Shared Memory Object
- shm_open_ - Open a Shared Memory Object
- ``shm_unlink`` - Remove a Shared Memory Object
- shm_unlink_ - Remove a Shared Memory Object
Background
==========
@ -42,10 +46,11 @@ There is currently no text in this section.
Directives
==========
This section details the memory management manager's directives.
A subsection is dedicated to each of this manager's directives
and describes the calling sequence, related constants, usage,
and status codes.
This section details the memory management manager's directives. A subsection
is dedicated to each of this manager's directives and describes the calling
sequence, related constants, usage, and status codes.
.. _mlockall:
mlockall - Lock the Address Space of a Process
----------------------------------------------
@ -54,20 +59,25 @@ mlockall - Lock the Address Space of a Process
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int mlockall(
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
**NOTES:**
.. _munlockall:
munlockall - Unlock the Address Space of a Process
--------------------------------------------------
.. index:: munlockall
@ -75,20 +85,25 @@ munlockall - Unlock the Address Space of a Process
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int munlockall(
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
**NOTES:**
.. _mlock:
mlock - Lock a Range of the Process Address Space
-------------------------------------------------
.. index:: mlock
@ -96,20 +111,25 @@ mlock - Lock a Range of the Process Address Space
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int mlock(
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
**NOTES:**
.. _munlock:
munlock - Unlock a Range of the Process Address Space
-----------------------------------------------------
.. index:: munlock
@ -117,20 +137,25 @@ munlock - Unlock a Range of the Process Address Space
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int munlock(
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
**NOTES:**
.. _mmap:
mmap - Map Process Addresses to a Memory Object
-----------------------------------------------
.. index:: mmap
@ -138,20 +163,25 @@ mmap - Map Process Addresses to a Memory Object
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int mmap(
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
**NOTES:**
.. _munmap:
munmap - Unmap Previously Mapped Addresses
------------------------------------------
.. index:: munmap
@ -159,20 +189,25 @@ munmap - Unmap Previously Mapped Addresses
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int munmap(
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
**NOTES:**
.. _mprotect:
mprotect - Change Memory Protection
-----------------------------------
.. index:: mprotect
@ -180,20 +215,25 @@ mprotect - Change Memory Protection
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int mprotect(
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
**NOTES:**
.. _msync:
msync - Memory Object Synchronization
-------------------------------------
.. index:: msync
@ -201,20 +241,25 @@ msync - Memory Object Synchronization
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int msync(
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
**NOTES:**
.. _shm_open:
shm_open - Open a Shared Memory Object
--------------------------------------
.. index:: shm_open
@ -222,20 +267,25 @@ shm_open - Open a Shared Memory Object
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int shm_open(
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
**NOTES:**
.. _shm_unlink:
shm_unlink - Remove a Shared Memory Object
------------------------------------------
.. index:: shm_unlink
@ -243,23 +293,19 @@ shm_unlink - Remove a Shared Memory Object
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int shm_unlink(
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
**NOTES:**
.. COMMENT: COPYRIGHT (c) 1988-2002.
.. COMMENT: On-Line Applications Research Corporation (OAR).
.. COMMENT: All rights reserved.

File diff suppressed because it is too large Load Diff

View File

@ -1,48 +1,51 @@
.. COMMENT: COPYRIGHT (c) 1988-2002.
.. COMMENT: On-Line Applications Research Corporation (OAR).
.. COMMENT: All rights reserved.
Mutex Manager
#############
Introduction
============
The mutex manager implements the functionality required of the mutex
manager as defined by POSIX 1003.1b-1996. This standard requires that
a compliant operating system provide the facilties to ensure that
threads can operate with mutual exclusion from one another and
defines the API that must be provided.
The mutex manager implements the functionality required of the mutex manager as
defined by POSIX 1003.1b-1996. This standard requires that a compliant
operating system provide the facilties to ensure that threads can operate with
mutual exclusion from one another and defines the API that must be provided.
The services provided by the mutex manager are:
- ``pthread_mutexattr_init`` - Initialize a Mutex Attribute Set
- pthread_mutexattr_init_ - Initialize a Mutex Attribute Set
- ``pthread_mutexattr_destroy`` - Destroy a Mutex Attribute Set
- pthread_mutexattr_destroy_ - Destroy a Mutex Attribute Set
- ``pthread_mutexattr_setprotocol`` - Set the Blocking Protocol
- pthread_mutexattr_setprotocol_ - Set the Blocking Protocol
- ``pthread_mutexattr_getprotocol`` - Get the Blocking Protocol
- pthread_mutexattr_getprotocol_ - Get the Blocking Protocol
- ``pthread_mutexattr_setprioceiling`` - Set the Priority Ceiling
- pthread_mutexattr_setprioceiling_ - Set the Priority Ceiling
- ``pthread_mutexattr_getprioceiling`` - Get the Priority Ceiling
- pthread_mutexattr_getprioceiling_ - Get the Priority Ceiling
- ``pthread_mutexattr_setpshared`` - Set the Visibility
- pthread_mutexattr_setpshared_ - Set the Visibility
- ``pthread_mutexattr_getpshared`` - Get the Visibility
- pthread_mutexattr_getpshared_ - Get the Visibility
- ``pthread_mutex_init`` - Initialize a Mutex
- pthread_mutex_init_ - Initialize a Mutex
- ``pthread_mutex_destroy`` - Destroy a Mutex
- pthread_mutex_destroy_ - Destroy a Mutex
- ``pthread_mutex_lock`` - Lock a Mutex
- pthread_mutex_lock_ - Lock a Mutex
- ``pthread_mutex_trylock`` - Poll to Lock a Mutex
- pthread_mutex_trylock_ - Poll to Lock a Mutex
- ``pthread_mutex_timedlock`` - Lock a Mutex with Timeout
- pthread_mutex_timedlock_ - Lock a Mutex with Timeout
- ``pthread_mutex_unlock`` - Unlock a Mutex
- pthread_mutex_unlock_ - Unlock a Mutex
- ``pthread_mutex_setprioceiling`` - Dynamically Set the Priority Ceiling
- pthread_mutex_setprioceiling_ - Dynamically Set the Priority Ceiling
- ``pthread_mutex_getprioceiling`` - Dynamically Get the Priority Ceiling
- pthread_mutex_getprioceiling_ - Dynamically Get the Priority Ceiling
Background
==========
@ -50,32 +53,32 @@ Background
Mutex Attributes
----------------
Mutex attributes are utilized only at mutex creation time. A mutex
attribute structure may be initialized and passed as an argument to
the ``mutex_init`` routine. Note that the priority ceiling of
a mutex may be set at run-time.
Mutex attributes are utilized only at mutex creation time. A mutex attribute
structure may be initialized and passed as an argument to the ``mutex_init``
routine. Note that the priority ceiling of a mutex may be set at run-time.
*blocking protcol*
is the XXX
.. list-table::
:class: rtems-table
*priority ceiling*
is the XXX
*pshared*
is the XXX
* - *blocking protcol*
- is the XXX
* - *priority ceiling*
- is the XXX
* - *pshared*
- is the XXX
PTHREAD_MUTEX_INITIALIZER
-------------------------
This is a special value that a variable of type ``pthread_mutex_t``
may be statically initialized to as shown below:
.. code:: c
This is a special value that a variable of type ``pthread_mutex_t`` may be
statically initialized to as shown below:
.. code-block:: c
pthread_mutex_t my_mutex = PTHREAD_MUTEX_INITIALIZER;
This indicates that ``my_mutex`` will be automatically initialized
by an implicit call to ``pthread_mutex_init`` the first time
the mutex is used.
This indicates that ``my_mutex`` will be automatically initialized by an
implicit call to ``pthread_mutex_init`` the first time the mutex is used.
Note that the mutex will be initialized with default attributes.
@ -87,10 +90,11 @@ There is currently no text in this section.
Services
========
This section details the mutex manager's services.
A subsection is dedicated to each of this manager's services
and describes the calling sequence, related constants, usage,
and status codes.
This section details the mutex manager's services. A subsection is dedicated
to each of this manager's services and describes the calling sequence, related
constants, usage, and status codes.
.. _pthread_mutexattr_init:
pthread_mutexattr_init - Initialize a Mutex Attribute Set
---------------------------------------------------------
@ -99,11 +103,11 @@ pthread_mutexattr_init - Initialize a Mutex Attribute Set
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <pthread.h>
int pthread_mutexattr_init(
pthread_mutexattr_t \*attr
pthread_mutexattr_t *attr
);
**STATUS CODES:**
@ -113,14 +117,16 @@ pthread_mutexattr_init - Initialize a Mutex Attribute Set
**DESCRIPTION:**
The ``pthread_mutexattr_init`` routine initializes the mutex attributes
object specified by ``attr`` with the default value for all of the
individual attributes.
The ``pthread_mutexattr_init`` routine initializes the mutex attributes object
specified by ``attr`` with the default value for all of the individual
attributes.
**NOTES:**
XXX insert list of default attributes here.
.. _pthread_mutexattr_destroy:
pthread_mutexattr_destroy - Destroy a Mutex Attribute Set
---------------------------------------------------------
.. index:: pthread_mutexattr_destroy
@ -128,31 +134,35 @@ pthread_mutexattr_destroy - Destroy a Mutex Attribute Set
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <pthread.h>
int pthread_mutexattr_destroy(
pthread_mutexattr_t \*attr
int pthread_mutexattr_destroy(
pthread_mutexattr_t *attr
);
**STATUS CODES:**
*EINVAL*
The attribute pointer argument is invalid.
.. list-table::
:class: rtems-table
*EINVAL*
The attribute set is not initialized.
* - ``EINVAL``
- The attribute pointer argument is invalid.
* - ``EINVAL``
- The attribute set is not initialized.
**DESCRIPTION:**
The ``pthread_mutex_attr_destroy`` routine is used to destroy a mutex
attributes object. The behavior of using an attributes object after
it is destroyed is implementation dependent.
attributes object. The behavior of using an attributes object after it is
destroyed is implementation dependent.
**NOTES:**
NONE
.. _pthread_mutexattr_setprotocol:
pthread_mutexattr_setprotocol - Set the Blocking Protocol
---------------------------------------------------------
.. index:: pthread_mutexattr_setprotocol
@ -160,47 +170,52 @@ pthread_mutexattr_setprotocol - Set the Blocking Protocol
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <pthread.h>
int pthread_mutexattr_setprotocol(
pthread_mutexattr_t \*attr,
int protocol
pthread_mutexattr_t *attr,
int protocol
);
**STATUS CODES:**
*EINVAL*
The attribute pointer argument is invalid.
.. list-table::
:class: rtems-table
*EINVAL*
The attribute set is not initialized.
*EINVAL*
The protocol argument is invalid.
* - ``EINVAL``
- The attribute pointer argument is invalid.
* - ``EINVAL``
- The attribute set is not initialized.
* - ``EINVAL``
- The protocol argument is invalid.
**DESCRIPTION:**
The ``pthread_mutexattr_setprotocol`` routine is used to set value of the``protocol`` attribute. This attribute controls the order in which
threads waiting on this mutex will receive it.
The ``pthread_mutexattr_setprotocol`` routine is used to set value of the
``protocol`` attribute. This attribute controls the order in which threads
waiting on this mutex will receive it.
The ``protocol`` can be one of the following:
*``PTHREAD_PRIO_NONE``*
in which case blocking order is FIFO.
.. list-table::
:class: rtems-table
*``PTHREAD_PRIO_INHERIT``*
in which case blocking order is priority with the priority inheritance
protocol in effect.
*``PTHREAD_PRIO_PROTECT``*
in which case blocking order is priority with the priority ceiling
protocol in effect.
* - ``PTHREAD_PRIO_NONE``
- in which case blocking order is FIFO.
* - ``PTHREAD_PRIO_INHERIT``
- in which case blocking order is priority with the priority inheritance
protocol in effect.
* - ``PTHREAD_PRIO_PROTECT``
- in which case blocking order is priority with the priority ceiling
protocol in effect.
**NOTES:**
There is currently no way to get simple priority blocking ordering
with POSIX mutexes even though this could easily by supported by RTEMS.
There is currently no way to get simple priority blocking ordering with POSIX
mutexes even though this could easily by supported by RTEMS.
.. _pthread_mutexattr_getprotocol:
pthread_mutexattr_getprotocol - Get the Blocking Protocol
---------------------------------------------------------
@ -209,35 +224,38 @@ pthread_mutexattr_getprotocol - Get the Blocking Protocol
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <pthread.h>
int pthread_mutexattr_getprotocol(
pthread_mutexattr_t \*attr,
int \*protocol
pthread_mutexattr_t *attr,
int *protocol
);
**STATUS CODES:**
*EINVAL*
The attribute pointer argument is invalid.
.. list-table::
:class: rtems-table
*EINVAL*
The attribute set is not initialized.
*EINVAL*
The protocol pointer argument is invalid.
* - ``EINVAL``
- The attribute pointer argument is invalid.
* - ``EINVAL``
- The attribute set is not initialized.
* - ``EINVAL``
- The protocol pointer argument is invalid.
**DESCRIPTION:**
The ``pthread_mutexattr_getprotocol`` routine is used to obtain
the value of the ``protocol`` attribute. This attribute controls
the order in which threads waiting on this mutex will receive it.
The ``pthread_mutexattr_getprotocol`` routine is used to obtain the value of
the ``protocol`` attribute. This attribute controls the order in which threads
waiting on this mutex will receive it.
**NOTES:**
NONE
.. _pthread_mutexattr_setprioceiling:
pthread_mutexattr_setprioceiling - Set the Priority Ceiling
-----------------------------------------------------------
.. index:: pthread_mutexattr_setprioceiling
@ -245,36 +263,40 @@ pthread_mutexattr_setprioceiling - Set the Priority Ceiling
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <pthread.h>
int pthread_mutexattr_setprioceiling(
pthread_mutexattr_t \*attr,
int prioceiling
pthread_mutexattr_t *attr,
int prioceiling
);
**STATUS CODES:**
*EINVAL*
The attribute pointer argument is invalid.
.. list-table::
:class: rtems-table
*EINVAL*
The attribute set is not initialized.
*EINVAL*
The prioceiling argument is invalid.
* - ``EINVAL``
- The attribute pointer argument is invalid.
* - ``EINVAL``
- The attribute set is not initialized.
* - ``EINVAL``
- The prioceiling argument is invalid.
**DESCRIPTION:**
The ``pthread_mutexattr_setprioceiling`` routine is used to set value of the``prioceiling`` attribute. This attribute specifies the priority that
is the ceiling for threads obtaining this mutex. Any task obtaining this
mutex may not be of greater priority that the ceiling. If it is of lower
priority, then its priority will be elevated to ``prioceiling``.
The ``pthread_mutexattr_setprioceiling`` routine is used to set value of the
``prioceiling`` attribute. This attribute specifies the priority that is the
ceiling for threads obtaining this mutex. Any task obtaining this mutex may not
be of greater priority that the ceiling. If it is of lower priority, then its
priority will be elevated to ``prioceiling``.
**NOTES:**
NONE
.. _pthread_mutexattr_getprioceiling:
pthread_mutexattr_getprioceiling - Get the Priority Ceiling
-----------------------------------------------------------
.. index:: pthread_mutexattr_getprioceiling
@ -282,35 +304,38 @@ pthread_mutexattr_getprioceiling - Get the Priority Ceiling
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <pthread.h>
int pthread_mutexattr_getprioceiling(
const pthread_mutexattr_t \*attr,
int \*prioceiling
const pthread_mutexattr_t *attr,
int *prioceiling
);
**STATUS CODES:**
*EINVAL*
The attribute pointer argument is invalid.
.. list-table::
:class: rtems-table
*EINVAL*
The attribute set is not initialized.
*EINVAL*
The prioceiling pointer argument is invalid.
* - ``EINVAL``
- The attribute pointer argument is invalid.
* - ``EINVAL``
- The attribute set is not initialized.
* - ``EINVAL``
- The prioceiling pointer argument is invalid.
**DESCRIPTION:**
The ``pthread_mutexattr_getprioceiling`` routine is used to obtain the
value of the ``prioceiling`` attribute. This attribute specifies the
priority ceiling for this mutex.
The ``pthread_mutexattr_getprioceiling`` routine is used to obtain the value of
the ``prioceiling`` attribute. This attribute specifies the priority ceiling
for this mutex.
**NOTES:**
NONE
.. _pthread_mutexattr_setpshared:
pthread_mutexattr_setpshared - Set the Visibility
-------------------------------------------------
.. index:: pthread_mutexattr_setpshared
@ -318,29 +343,32 @@ pthread_mutexattr_setpshared - Set the Visibility
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <pthread.h>
int pthread_mutexattr_setpshared(
pthread_mutexattr_t \*attr,
int pshared
pthread_mutexattr_t *attr,
int pshared
);
**STATUS CODES:**
*EINVAL*
The attribute pointer argument is invalid.
.. list-table::
:class: rtems-table
*EINVAL*
The attribute set is not initialized.
*EINVAL*
The pshared argument is invalid.
* - ``EINVAL``
- The attribute pointer argument is invalid.
* - ``EINVAL``
- The attribute set is not initialized.
* - ``EINVAL``
- The pshared argument is invalid.
**DESCRIPTION:**
**NOTES:**
.. _pthread_mutexattr_getpshared:
pthread_mutexattr_getpshared - Get the Visibility
-------------------------------------------------
.. index:: pthread_mutexattr_getpshared
@ -348,29 +376,32 @@ pthread_mutexattr_getpshared - Get the Visibility
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <pthread.h>
int pthread_mutexattr_getpshared(
const pthread_mutexattr_t \*attr,
int \*pshared
const pthread_mutexattr_t *attr,
int *pshared
);
**STATUS CODES:**
*EINVAL*
The attribute pointer argument is invalid.
.. list-table::
:class: rtems-table
*EINVAL*
The attribute set is not initialized.
*EINVAL*
The pshared pointer argument is invalid.
* - ``EINVAL``
- The attribute pointer argument is invalid.
* - ``EINVAL``
- The attribute set is not initialized.
* - ``EINVAL``
- The pshared pointer argument is invalid.
**DESCRIPTION:**
**NOTES:**
.. _pthread_mutex_init:
pthread_mutex_init - Initialize a Mutex
---------------------------------------
.. index:: pthread_mutex_init
@ -378,36 +409,37 @@ pthread_mutex_init - Initialize a Mutex
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <pthread.h>
int pthread_mutex_init(
pthread_mutex_t \*mutex,
const pthread_mutexattr_t \*attr
pthread_mutex_t *mutex,
const pthread_mutexattr_t *attr
);
**STATUS CODES:**
*EINVAL*
The attribute set is not initialized.
.. list-table::
:class: rtems-table
*EINVAL*
The specified protocol is invalid.
*EAGAIN*
The system lacked the necessary resources to initialize another mutex.
*ENOMEM*
Insufficient memory exists to initialize the mutex.
*EBUSY*
Attempted to reinialize the object reference by mutex, a previously
initialized, but not yet destroyed.
* - ``EINVAL``
- The attribute set is not initialized.
* - ``EINVAL``
- The specified protocol is invalid.
* - ``EAGAIN``
- The system lacked the necessary resources to initialize another mutex.
* - ``ENOMEM``
- Insufficient memory exists to initialize the mutex.
* - ``EBUSY``
- Attempted to reinialize the object reference by mutex, a previously
initialized, but not yet destroyed.
**DESCRIPTION:**
**NOTES:**
.. _pthread_mutex_destroy:
pthread_mutex_destroy - Destroy a Mutex
---------------------------------------
.. index:: pthread_mutex_destroy
@ -415,26 +447,30 @@ pthread_mutex_destroy - Destroy a Mutex
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <pthread.h>
int pthread_mutex_destroy(
pthread_mutex_t \*mutex
int pthread_mutex_destroy(
pthread_mutex_t *mutex
);
**STATUS CODES:**
*EINVAL*
The specified mutex is invalid.
.. list-table::
:class: rtems-table
*EBUSY*
Attempted to destroy the object reference by mutex, while it is locked or
referenced by another thread.
* - ``EINVAL``
- The specified mutex is invalid.
* - ``EBUSY``
- Attempted to destroy the object reference by mutex, while it is locked or
referenced by another thread.
**DESCRIPTION:**
**NOTES:**
.. _pthread_mutex_lock:
pthread_mutex_lock - Lock a Mutex
---------------------------------
.. index:: pthread_mutex_lock
@ -442,30 +478,33 @@ pthread_mutex_lock - Lock a Mutex
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <pthread.h>
int pthread_mutex_lock(
pthread_mutex_t \*mutex
pthread_mutex_t *mutex
);
**STATUS CODES:**
*EINVAL*
The specified mutex is invalid.
.. list-table::
:class: rtems-table
*EINVAL*
The mutex has the protocol attribute of PTHREAD_PRIO_PROTECT and the
priority of the calling thread is higher than the current priority
ceiling.
*EDEADLK*
The current thread already owns the mutex.
* - ``EINVAL``
- The specified mutex is invalid.
* - ``EINVAL``
- The mutex has the protocol attribute of ``PTHREAD_PRIO_PROTECT`` and the
priority of the calling thread is higher than the current priority
ceiling.
* - ``EDEADLK``
- The current thread already owns the mutex.
**DESCRIPTION:**
**NOTES:**
.. _pthread_mutex_trylock:
pthread_mutex_trylock - Poll to Lock a Mutex
--------------------------------------------
.. index:: pthread_mutex_trylock
@ -473,30 +512,32 @@ pthread_mutex_trylock - Poll to Lock a Mutex
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <pthread.h>
int pthread_mutex_trylock(
pthread_mutex_t \*mutex
pthread_mutex_t *mutex
);
**STATUS CODES:**
*EINVAL*
The specified mutex is invalid.
.. list-table::
:class: rtems-table
*EINVAL*
The mutex has the protocol attribute of PTHREAD_PRIO_PROTECT and the
priority of the calling thread is higher than the current priority
ceiling.
*EBUSY*
The mutex is already locked.
* - ``EINVAL``
- The specified mutex is invalid.
* - ``EINVAL``
- The mutex has the protocol attribute of ``PTHREAD_PRIO_PROTECT`` and the
priority of the calling thread is higher than the current priority ceiling.
* - ``EBUSY``
- The mutex is already locked.
**DESCRIPTION:**
**NOTES:**
.. _pthread_mutex_timedlock:
pthread_mutex_timedlock - Lock a Mutex with Timeout
---------------------------------------------------
.. index:: pthread_mutex_timedlock
@ -504,39 +545,40 @@ pthread_mutex_timedlock - Lock a Mutex with Timeout
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <pthread.h>
#include <time.h>
int pthread_mutex_timedlock(
pthread_mutex_t \*mutex,
const struct timespec \*timeout
pthread_mutex_t *mutex,
const struct timespec *timeout
);
**STATUS CODES:**
*EINVAL*
The specified mutex is invalid.
.. list-table::
:class: rtems-table
*EINVAL*
The nanoseconds field of timeout is invalid.
*EINVAL*
The mutex has the protocol attribute of PTHREAD_PRIO_PROTECT and the
priority of the calling thread is higher than the current priority
ceiling.
*EDEADLK*
The current thread already owns the mutex.
*ETIMEDOUT*
The calling thread was unable to obtain the mutex within the specified
timeout period.
* - ``EINVAL``
- The specified mutex is invalid.
* - ``EINVAL``
- The nanoseconds field of timeout is invalid.
* - ``EINVAL``
- The mutex has the protocol attribute of ``PTHREAD_PRIO_PROTECT`` and the
priority of the calling thread is higher than the current priority
ceiling.
* - ``EDEADLK``
- The current thread already owns the mutex.
* - ``ETIMEDOUT``
- The calling thread was unable to obtain the mutex within the specified
timeout period.
**DESCRIPTION:**
**NOTES:**
.. _pthread_mutex_unlock:
pthread_mutex_unlock - Unlock a Mutex
-------------------------------------
.. index:: pthread_mutex_unlock
@ -544,22 +586,27 @@ pthread_mutex_unlock - Unlock a Mutex
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <pthread.h>
int pthread_mutex_unlock(
pthread_mutex_t \*mutex
pthread_mutex_t *mutex
);
**STATUS CODES:**
*EINVAL*
The specified mutex is invalid.
.. list-table::
:class: rtems-table
* - ``EINVAL``
- The specified mutex is invalid.
**DESCRIPTION:**
**NOTES:**
.. _pthread_mutex_setprioceiling:
pthread_mutex_setprioceiling - Dynamically Set the Priority Ceiling
-------------------------------------------------------------------
.. index:: pthread_mutex_setprioceiling
@ -567,30 +614,33 @@ pthread_mutex_setprioceiling - Dynamically Set the Priority Ceiling
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <pthread.h>
int pthread_mutex_setprioceiling(
pthread_mutex_t \*mutex,
int prioceiling,
int \*oldceiling
pthread_mutex_t *mutex,
int prioceiling,
int *oldceiling
);
**STATUS CODES:**
*EINVAL*
The oldceiling pointer parameter is invalid.
.. list-table::
:class: rtems-table
*EINVAL*
The prioceiling parameter is an invalid priority.
*EINVAL*
The specified mutex is invalid.
* - ``EINVAL``
- The oldceiling pointer parameter is invalid.
* - ``EINVAL``
- The prioceiling parameter is an invalid priority.
* - ``EINVAL``
- The specified mutex is invalid.
**DESCRIPTION:**
**NOTES:**
.. _pthread_mutex_getprioceiling:
pthread_mutex_getprioceiling - Get the Current Priority Ceiling
---------------------------------------------------------------
.. index:: pthread_mutex_getprioceiling
@ -598,29 +648,24 @@ pthread_mutex_getprioceiling - Get the Current Priority Ceiling
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <pthread.h>
int pthread_mutex_getprioceiling(
pthread_mutex_t \*mutex,
int \*prioceiling
pthread_mutex_t *mutex,
int *prioceiling
);
**STATUS CODES:**
*EINVAL*
The prioceiling pointer parameter is invalid.
.. list-table::
:class: rtems-table
*EINVAL*
The specified mutex is invalid.
* - ``EINVAL``
- The prioceiling pointer parameter is invalid.
* - ``EINVAL``
- The specified mutex is invalid.
**DESCRIPTION:**
**NOTES:**
.. COMMENT: COPYRIGHT (c) 1988-2002.
.. COMMENT: On-Line Applications Research Corporation (OAR).
.. COMMENT: All rights reserved.

View File

@ -1,11 +1,14 @@
.. COMMENT: COPYRIGHT (c) 1988-2002.
.. COMMENT: On-Line Applications Research Corporation (OAR).
.. COMMENT: All rights reserved.
Preface
#######
This is the User's Guide for the POSIX API support
provided in RTEMS.
This is the User's Guide for the POSIX API support provided in RTEMS.
The functionality described in this document is based
on the following standards:
The functionality described in this document is based on the following
standards:
- POSIX 1003.1b-1993.
@ -13,57 +16,35 @@ on the following standards:
- Open Group Single UNIX Specification.
Much of the POSIX API standard is actually implemented in the
Cygnus Newlib ANSI C Library. Please refer to documentation on
Newlib for more information on the functionality it supplies.
Much of the POSIX API standard is actually implemented in the Cygnus Newlib
ANSI C Library. Please refer to documentation on Newlib for more information
on the functionality it supplies.
This manual is still under construction and improvements
are welcomed from users.
This manual is still under construction and improvements are welcomed from
users.
Acknowledgements
================
.. COMMENT: COPYRIGHT (c) 1988-2009.
The RTEMS Project has been granted permission from The Open Group IEEE to
excerpt and use portions of the POSIX standards documents in the RTEMS POSIX
API User's Guide and RTEMS Shell User's Guide. We have to include a specific
acknowledgement paragraph in these documents (e.g. preface or copyright page)
and another slightly different paragraph for each manual page that excerpts and
uses text from the standards.
.. COMMENT: On-Line Applications Research Corporation (OAR).
This file should help ensure that the paragraphs are consistent and not
duplicated
.. COMMENT: All rights reserved.
.. COMMENT: The RTEMS Project has been granted permission from The Open Group
.. COMMENT: IEEE to excerpt and use portions of the POSIX standards documents
.. COMMENT: in the RTEMS POSIX API User's Guide and RTEMS Shell User's Guide.
.. COMMENT: We have to include a specific acknowledgement paragraph in these
.. COMMENT: documents (e.g. preface or copyright page) and another slightly
.. COMMENT: different paragraph for each manual page that excerpts and uses
.. COMMENT: text from the standards.
.. COMMENT: This file should help ensure that the paragraphs are consistent
.. COMMENT: and not duplicated
The Institute of Electrical and Electronics Engineers, Inc and The
Open Group, have given us permission to reprint portions of their
documentation.
Portions of this text are reprinted and reproduced in electronic
form from IEEE Std 1003.1, 2004 Edition, Standard for Information
Technology Operating System Interface (POSIX), The Open
Group Base Specifications Issue 6, Copyright (c) 2001-2004 by the
Institute of Electrical and Electronics Engineers, Inc and The
Open Group. In the event of any discrepancy between this version
and the original IEEE and The Open Group Standard, the original
IEEE and The Open Group Standard is the referee document. The
original Standard can be obtained online athttp://www.opengroup.org/unix/online.html.
The Institute of Electrical and Electronics Engineers, Inc and The Open
Group, have given us permission to reprint portions of their documentation.
Portions of this text are reprinted and reproduced in electronic form from
IEEE Std 1003.1, 2004 Edition, Standard for Information Technology
Operating System Interface (POSIX), The Open Group Base Specifications
Issue 6, Copyright (c) 2001-2004 by the Institute of Electrical and
Electronics Engineers, Inc and The Open Group. In the event of any
discrepancy between this version and the original IEEE and The Open Group
Standard, the original IEEE and The Open Group Standard is the referee
document. The original Standard can be obtained online at
http://www.opengroup.org/unix/online.html.
This notice shall appear on any product containing this material.
.. COMMENT: COPYRIGHT (c) 1988-2002.
.. COMMENT: On-Line Applications Research Corporation (OAR).
.. COMMENT: All rights reserved.

View File

@ -1,66 +1,68 @@
.. COMMENT: COPYRIGHT (c) 1988-2002.
.. COMMENT: On-Line Applications Research Corporation (OAR).
.. COMMENT: All rights reserved.
Process Creation and Execution Manager
######################################
Introduction
============
The process creation and execution manager provides the
functionality associated with the creation and termination
of processes.
The process creation and execution manager provides the functionality
associated with the creation and termination of processes.
The directives provided by the process creation and execution manager are:
- ``fork`` - Create a Process
- fork_ - Create a Process
- ``execl`` - Execute a File
- execl_ - Execute a File
- ``execv`` - Execute a File
- execv_ - Execute a File
- ``execle`` - Execute a File
- execle_ - Execute a File
- ``execve`` - Execute a File
- execve_ - Execute a File
- ``execlp`` - Execute a File
- execlp_ - Execute a File
- ``execvp`` - Execute a File
- execvp_ - Execute a File
- ``pthread_atfork`` - Register Fork Handlers
- pthread_atfork_ - Register Fork Handlers
- ``wait`` - Wait for Process Termination
- wait_ - Wait for Process Termination
- ``waitpid`` - Wait for Process Termination
- waitpid_ - Wait for Process Termination
- ``_exit`` - Terminate a Process
- `_exit`_ - Terminate a Process
Background
==========
POSIX process functionality can not be completely
supported by RTEMS. This is because RTEMS provides no memory
protection and implements a *single process, multi-threaded
execution model*. In this light, RTEMS provides none of the
routines that are associated with the creation of new processes.
However, since the entire RTEMS application (e.g. executable)
is logically a single POSIX process, RTEMS is able to provide
implementations of many operations on processes. The rule of
thumb is that those routines provide a meaningful result.
For example, ``getpid()`` returns the node number.
POSIX process functionality can not be completely supported by RTEMS. This is
because RTEMS provides no memory protection and implements a *single process,
multi-threaded execution model*. In this light, RTEMS provides none of the
routines that are associated with the creation of new processes. However,
since the entire RTEMS application (e.g. executable) is logically a single
POSIX process, RTEMS is able to provide implementations of many operations on
processes. The rule of thumb is that those routines provide a meaningful
result. For example, ``getpid()`` returns the node number.
Operations
==========
The only functionality method defined by this manager which is
supported by RTEMS is the ``_exit`` service. The
implementation of ``_exit`` shuts the application down and
is equivalent to invoking either ``exit`` or``rtems_shutdown_executive``.
The only functionality method defined by this manager which is supported by
RTEMS is the ``_exit`` service. The implementation of ``_exit`` shuts the
application down and is equivalent to invoking either ``exit`` or
``rtems_shutdown_executive``.
Directives
==========
This section details the process creation and execution manager's directives.
A subsection is dedicated to each of this manager's directives
and describes the calling sequence, related constants, usage,
and status codes.
A subsection is dedicated to each of this manager's directives and describes
the calling sequence, related constants, usage, and status codes.
.. _fork:
fork - Create a Process
-----------------------
@ -69,15 +71,18 @@ fork - Create a Process
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <sys/types.h>
int fork( void );
**STATUS CODES:**
*ENOSYS*
This routine is not supported by RTEMS.
.. list-table::
:class: rtems-table
* - ``ENOSYS``
- This routine is not supported by RTEMS.
**DESCRIPTION:**
@ -87,6 +92,8 @@ This routine is not supported by RTEMS.
NONE
.. _execl:
execl - Execute a File
----------------------
.. index:: execl
@ -94,18 +101,21 @@ execl - Execute a File
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int execl(
const char \*path,
const char \*arg,
...
const char *path,
const char *arg,
...
);
**STATUS CODES:**
*ENOSYS*
This routine is not supported by RTEMS.
.. list-table::
:class: rtems-table
* - ``ENOSYS``
- This routine is not supported by RTEMS.
**DESCRIPTION:**
@ -115,6 +125,8 @@ This routine is not supported by RTEMS.
NONE
.. _execv:
execv - Execute a File
----------------------
.. index:: execv
@ -122,18 +134,21 @@ execv - Execute a File
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int execv(
const char \*path,
char const \*argv[],
...
const char *path,
char const *argv[],
...
);
**STATUS CODES:**
*ENOSYS*
This routine is not supported by RTEMS.
.. list-table::
:class: rtems-table
* - ``ENOSYS``
- This routine is not supported by RTEMS.
**DESCRIPTION:**
@ -143,6 +158,8 @@ This routine is not supported by RTEMS.
NONE
.. _execle:
execle - Execute a File
-----------------------
.. index:: execle
@ -150,18 +167,21 @@ execle - Execute a File
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int execle(
const char \*path,
const char \*arg,
...
const char *path,
const char *arg,
...
);
**STATUS CODES:**
*ENOSYS*
This routine is not supported by RTEMS.
.. list-table::
:class: rtems-table
* - ``ENOSYS``
- This routine is not supported by RTEMS.
**DESCRIPTION:**
@ -171,6 +191,8 @@ This routine is not supported by RTEMS.
NONE
.. _execve:
execve - Execute a File
-----------------------
.. index:: execve
@ -178,18 +200,21 @@ execve - Execute a File
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int execve(
const char \*path,
char \*const argv[],
char \*const envp[]
const char *path,
char *const argv[],
char *const envp[]
);
**STATUS CODES:**
*ENOSYS*
This routine is not supported by RTEMS.
.. list-table::
:class: rtems-table
* - ``ENOSYS``
- This routine is not supported by RTEMS.
**DESCRIPTION:**
@ -199,6 +224,8 @@ This routine is not supported by RTEMS.
NONE
.. _execlp:
execlp - Execute a File
-----------------------
.. index:: execlp
@ -206,18 +233,21 @@ execlp - Execute a File
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int execlp(
const char \*file,
const char \*arg,
...
const char *file,
const char *arg,
...
);
**STATUS CODES:**
*ENOSYS*
This routine is not supported by RTEMS.
.. list-table::
:class: rtems-table
* - ``ENOSYS``
- This routine is not supported by RTEMS.
**DESCRIPTION:**
@ -227,6 +257,8 @@ This routine is not supported by RTEMS.
NONE
.. _execvp:
execvp - Execute a File
-----------------------
.. index:: execvp
@ -234,18 +266,21 @@ execvp - Execute a File
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int execvp(
const char \*file,
char \*const argv[]
...
const char *file,
char *const argv[],
...
);
**STATUS CODES:**
*ENOSYS*
This routine is not supported by RTEMS.
.. list-table::
:class: rtems-table
* - ``ENOSYS``
- This routine is not supported by RTEMS.
**DESCRIPTION:**
@ -255,6 +290,8 @@ This routine is not supported by RTEMS.
NONE
.. _pthread_atfork:
pthread_atfork - Register Fork Handlers
---------------------------------------
.. index:: pthread_atfork
@ -262,19 +299,22 @@ pthread_atfork - Register Fork Handlers
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <sys/types.h>
int pthread_atfork(
void (\*prepare)(void),
void (\*parent)(void),
void (\*child)(void)
void (*prepare)(void),
void (*parent)(void),
void (*child)(void)
);
**STATUS CODES:**
*ENOSYS*
This routine is not supported by RTEMS.
.. list-table::
:class: rtems-table
* - ``ENOSYS``
- This routine is not supported by RTEMS.
**DESCRIPTION:**
@ -284,6 +324,8 @@ This routine is not supported by RTEMS.
NONE
.. _wait:
wait - Wait for Process Termination
-----------------------------------
.. index:: wait
@ -291,18 +333,21 @@ wait - Wait for Process Termination
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <sys/types.h>
#include <sys/wait.h>
int wait(
int \*stat_loc
int *stat_loc
);
**STATUS CODES:**
*ENOSYS*
This routine is not supported by RTEMS.
.. list-table::
:class: rtems-table
* - ``ENOSYS``
- This routine is not supported by RTEMS.
**DESCRIPTION:**
@ -312,6 +357,8 @@ This routine is not supported by RTEMS.
NONE
.. _waitpid:
waitpid - Wait for Process Termination
--------------------------------------
.. index:: waitpid
@ -319,18 +366,21 @@ waitpid - Wait for Process Termination
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int wait(
pid_t pid,
int \*stat_loc,
int options
pid_t pid,
int *stat_loc,
int options
);
**STATUS CODES:**
*ENOSYS*
This routine is not supported by RTEMS.
.. list-table::
:class: rtems-table
* - ``ENOSYS``
- This routine is not supported by RTEMS.
**DESCRIPTION:**
@ -340,6 +390,8 @@ This routine is not supported by RTEMS.
NONE
.. _\_exit:
_exit - Terminate a Process
---------------------------
.. index:: _exit
@ -347,10 +399,10 @@ _exit - Terminate a Process
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
void _exit(
int status
int status
);
**STATUS CODES:**
@ -365,10 +417,3 @@ The ``_exit()`` function terminates the calling process.
In RTEMS, a process is equivalent to the entire application on a single
processor. Invoking this service terminates the application.
.. COMMENT: COPYRIGHT (c) 1988-2002.
.. COMMENT: On-Line Applications Research Corporation (OAR).
.. COMMENT: All rights reserved.

View File

@ -1,59 +1,63 @@
.. COMMENT: COPYRIGHT (c) 1988-2002.
.. COMMENT: On-Line Applications Research Corporation (OAR).
.. COMMENT: All rights reserved.
Process Environment Manager
###########################
Introduction
============
The process environment manager is responsible for providing the
functions related to user and group Id management.
The process environment manager is responsible for providing the functions
related to user and group Id management.
The directives provided by the process environment manager are:
- ``getpid`` - Get Process ID
- getpid_ - Get Process ID
- ``getppid`` - Get Parent Process ID
- getppid_ - Get Parent Process ID
- ``getuid`` - Get User ID
- getuid_ - Get User ID
- ``geteuid`` - Get Effective User ID
- geteuid_ - Get Effective User ID
- ``getgid`` - Get Real Group ID
- getgid_ - Get Real Group ID
- ``getegid`` - Get Effective Group ID
- getegid_ - Get Effective Group ID
- ``setuid`` - Set User ID
- setuid_ - Set User ID
- ``setgid`` - Set Group ID
- setgid_ - Set Group ID
- ``getgroups`` - Get Supplementary Group IDs
- getgroups_ - Get Supplementary Group IDs
- ``getlogin`` - Get User Name
- getlogin_ - Get User Name
- ``getlogin_r`` - Reentrant Get User Name
- getlogin_r_ - Reentrant Get User Name
- ``getpgrp`` - Get Process Group ID
- getpgrp_ - Get Process Group ID
- ``setsid`` - Create Session and Set Process Group ID
- setsid_ - Create Session and Set Process Group ID
- ``setpgid`` - Set Process Group ID for Job Control
- setpgid_ - Set Process Group ID for Job Control
- ``uname`` - Get System Name
- uname_ - Get System Name
- ``times`` - Get Process Times
- times_ - Get Process Times
- ``getenv`` - Get Environment Variables
- getenv_ - Get Environment Variables
- ``setenv`` - Set Environment Variables
- setenv_ - Set Environment Variables
- ``ctermid`` - Generate Terminal Pathname
- ctermid_ - Generate Terminal Pathname
- ``ttyname`` - Determine Terminal Device Name
- ttyname_ - Determine Terminal Device Name
- ``ttyname_r`` - Reentrant Determine Terminal Device Name
- ttyname_r_ - Reentrant Determine Terminal Device Name
- ``isatty`` - Determine if File Descriptor is Terminal
- isatty_ - Determine if File Descriptor is Terminal
- ``sysconf`` - Get Configurable System Variables
- sysconf_ - Get Configurable System Variables
Background
==========
@ -61,51 +65,45 @@ Background
Users and Groups
----------------
RTEMS provides a single process, multi-threaded execution environment.
In this light, the notion of user and group is somewhat without meaning.
But RTEMS does provide services to provide a synthetic version of
user and group. By default, a single user and group is associated
with the application. Thus unless special actions are taken,
every thread in the application shares the same user and group Id.
The initial rationale for providing user and group Id functionality
in RTEMS was for the filesystem infrastructure to implement
file permission checks. The effective user/group Id capability
has since been used to implement permissions checking by
the ``ftpd`` server.
RTEMS provides a single process, multi-threaded execution environment. In this
light, the notion of user and group is somewhat without meaning. But RTEMS
does provide services to provide a synthetic version of user and group. By
default, a single user and group is associated with the application. Thus
unless special actions are taken, every thread in the application shares the
same user and group Id. The initial rationale for providing user and group Id
functionality in RTEMS was for the filesystem infrastructure to implement file
permission checks. The effective user/group Id capability has since been used
to implement permissions checking by the ``ftpd`` server.
In addition to the "real" user and group Ids, a process may
have an effective user/group Id. This allows a process to
function using a more limited permission set for certain operations.
In addition to the "real" user and group Ids, a process may have an effective
user/group Id. This allows a process to function using a more limited
permission set for certain operations.
User and Group Names
--------------------
POSIX considers user and group Ids to be a unique integer that
may be associated with a name. This is usually accomplished
via a file named ``/etc/passwd`` for user Id mapping and``/etc/groups`` for group Id mapping. Again, although
RTEMS is effectively a single process and thus single user
system, it provides limited support for user and group
names. When configured with an appropriate filesystem, RTEMS
will access the appropriate files to map user and group Ids
to names.
POSIX considers user and group Ids to be a unique integer that may be
associated with a name. This is usually accomplished via a file named
:file:`/etc/passwd` for user Id mapping and :file:`/etc/groups` for group Id
mapping. Again, although RTEMS is effectively a single process and thus single
user system, it provides limited support for user and group names. When
configured with an appropriate filesystem, RTEMS will access the appropriate
files to map user and group Ids to names.
If these files do not exist, then RTEMS will synthesize
a minimal version so this family of services return without
error. It is important to remember that a design goal of
the RTEMS POSIX services is to provide useable and
meaningful results even though a full process model
is not available.
If these files do not exist, then RTEMS will synthesize a minimal version so
this family of services return without error. It is important to remember that
a design goal of the RTEMS POSIX services is to provide useable and meaningful
results even though a full process model is not available.
Environment Variables
---------------------
POSIX allows for variables in the run-time environment. These are
name/value pairs that make be dynamically set and obtained by
programs. In a full POSIX environment with command line shell
and multiple processes, environment variables may be set in
one process - such as the shell - and inherited by child
processes. In RTEMS, there is only one process and thus
only one set of environment variables across all processes.
POSIX allows for variables in the run-time environment. These are name/value
pairs that make be dynamically set and obtained by programs. In a full POSIX
environment with command line shell and multiple processes, environment
variables may be set in one process - such as the shell - and inherited by
child processes. In RTEMS, there is only one process and thus only one set of
environment variables across all processes.
Operations
==========
@ -113,24 +111,24 @@ Operations
Accessing User and Group Ids
----------------------------
The user Id associated with the current thread may be obtain
using the ``getuid()`` service. Similarly, the group Id
may be obtained using the ``getgid()`` service.
The user Id associated with the current thread may be obtain using the
``getuid()`` service. Similarly, the group Id may be obtained using the
``getgid()`` service.
Accessing Environment Variables
-------------------------------
The value associated with an environment variable may be
obtained using the ``getenv()`` service and set using
the ``putenv()`` service.
The value associated with an environment variable may be obtained using the
``getenv()`` service and set using the ``putenv()`` service.
Directives
==========
This section details the process environment manager's directives.
A subsection is dedicated to each of this manager's directives
and describes the calling sequence, related constants, usage,
and status codes.
This section details the process environment manager's directives. A
subsection is dedicated to each of this manager's directives and describes the
calling sequence, related constants, usage, and status codes.
.. _getpid:
getpid - Get Process ID
-----------------------
@ -139,7 +137,7 @@ getpid - Get Process ID
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int getpid( void );
@ -155,6 +153,8 @@ This service returns the process Id.
NONE
.. _getppid:
getppid - Get Parent Process ID
-------------------------------
.. index:: getppid
@ -162,7 +162,7 @@ getppid - Get Parent Process ID
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int getppid( void );
@ -178,6 +178,8 @@ This service returns the parent process Id.
NONE
.. _getuid:
getuid - Get User ID
--------------------
.. index:: getuid
@ -185,7 +187,7 @@ getuid - Get User ID
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int getuid( void );
@ -201,6 +203,8 @@ This service returns the effective user Id.
NONE
.. _geteuid:
geteuid - Get Effective User ID
-------------------------------
.. index:: geteuid
@ -208,7 +212,7 @@ geteuid - Get Effective User ID
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int geteuid( void );
@ -224,6 +228,8 @@ This service returns the effective group Id.
NONE
.. _getgid:
getgid - Get Real Group ID
--------------------------
.. index:: getgid
@ -231,7 +237,7 @@ getgid - Get Real Group ID
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int getgid( void );
@ -247,6 +253,8 @@ This service returns the group Id.
NONE
.. _getegid:
getegid - Get Effective Group ID
--------------------------------
.. index:: getegid
@ -254,7 +262,7 @@ getegid - Get Effective Group ID
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int getegid( void );
@ -270,6 +278,8 @@ This service returns the effective group Id.
NONE
.. _setuid:
setuid - Set User ID
--------------------
.. index:: setuid
@ -277,10 +287,10 @@ setuid - Set User ID
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int setuid(
uid_t uid
uid_t uid
);
**STATUS CODES:**
@ -295,6 +305,8 @@ This service sets the user Id to ``uid``.
NONE
.. _setgid:
setgid - Set Group ID
---------------------
.. index:: setgid
@ -302,10 +314,10 @@ setgid - Set Group ID
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int setgid(
gid_t gid
gid_t gid
);
**STATUS CODES:**
@ -320,6 +332,8 @@ This service sets the group Id to ``gid``.
NONE
.. _getgroups:
getgroups - Get Supplementary Group IDs
---------------------------------------
.. index:: getgroups
@ -327,11 +341,11 @@ getgroups - Get Supplementary Group IDs
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int getgroups(
int gidsetsize,
gid_t grouplist[]
int gidsetsize,
gid_t grouplist[]
);
**STATUS CODES:**
@ -340,13 +354,13 @@ NA
**DESCRIPTION:**
This service is not implemented as RTEMS has no notion of
supplemental groups.
This service is not implemented as RTEMS has no notion of supplemental groups.
**NOTES:**
If supported, this routine would only be allowed for
the super-user.
If supported, this routine would only be allowed for the super-user.
.. _getlogin:
getlogin - Get User Name
------------------------
@ -355,14 +369,13 @@ getlogin - Get User Name
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
char \*getlogin( void );
char *getlogin( void );
**STATUS CODES:**
Returns a pointer to a string containing the name of the
current user.
Returns a pointer to a string containing the name of the current user.
**DESCRIPTION:**
@ -370,7 +383,10 @@ This routine returns the name of the current user.
**NOTES:**
This routine is not reentrant and subsequent calls to``getlogin()`` will overwrite the same buffer.
This routine is not reentrant and subsequent calls to ``getlogin()`` will
overwrite the same buffer.
.. _getlogin_r:
getlogin_r - Reentrant Get User Name
------------------------------------
@ -380,28 +396,33 @@ getlogin_r - Reentrant Get User Name
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int getlogin_r(
char \*name,
size_t namesize
char *name,
size_t namesize
);
**STATUS CODES:**
*EINVAL*
The arguments were invalid.
.. list-table::
:class: rtems-table
* - ``EINVAL``
- The arguments were invalid.
**DESCRIPTION:**
This is a reentrant version of the ``getlogin()`` service. The
caller specified their own buffer, ``name``, as well as the
length of this buffer, ``namesize``.
This is a reentrant version of the ``getlogin()`` service. The caller
specified their own buffer, ``name``, as well as the length of this buffer,
``namesize``.
**NOTES:**
NONE
.. _getpgrp:
getpgrp - Get Process Group ID
------------------------------
.. index:: getpgrp
@ -409,7 +430,7 @@ getpgrp - Get Process Group ID
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
pid_t getpgrp( void );
@ -423,8 +444,10 @@ This service returns the current progress group Id.
**NOTES:**
This routine is implemented in a somewhat meaningful
way for RTEMS but is truly not functional.
This routine is implemented in a somewhat meaningful way for RTEMS but is truly
not functional.
.. _setsid:
setsid - Create Session and Set Process Group ID
------------------------------------------------
@ -433,25 +456,29 @@ setsid - Create Session and Set Process Group ID
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
pid_t setsid( void );
**STATUS CODES:**
*EPERM*
The application does not have permission to create a process group.
.. list-table::
:class: rtems-table
* - ``EPERM``
- The application does not have permission to create a process group.
**DESCRIPTION:**
This routine always returns ``EPERM`` as RTEMS has no way
to create new processes and thus no way to create a new process
group.
This routine always returns ``EPERM`` as RTEMS has no way to create new
processes and thus no way to create a new process group.
**NOTES:**
NONE
.. _setpgid:
setpgid - Set Process Group ID for Job Control
----------------------------------------------
.. index:: setpgid
@ -459,27 +486,31 @@ setpgid - Set Process Group ID for Job Control
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int setpgid(
pid_t pid,
pid_t pgid
pid_t pid,
pid_t pgid
);
**STATUS CODES:**
*ENOSYS*
The routine is not implemented.
.. list-table::
:class: rtems-table
* - ``ENOSYS``
- The routine is not implemented.
**DESCRIPTION:**
This service is not implemented for RTEMS as process groups are not
supported.
This service is not implemented for RTEMS as process groups are not supported.
**NOTES:**
NONE
.. _uname:
uname - Get System Name
-----------------------
.. index:: uname
@ -487,29 +518,33 @@ uname - Get System Name
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int uname(
struct utsname \*name
struct utsname \*name
);
**STATUS CODES:**
*EPERM*
The provided structure pointer is invalid.
.. list-table::
:class: rtems-table
* - ``EPERM``
- The provided structure pointer is invalid.
**DESCRIPTION:**
This service returns system information to the caller. It does this
by filling in the ``struct utsname`` format structure for the
caller.
This service returns system information to the caller. It does this by filling
in the ``struct utsname`` format structure for the caller.
**NOTES:**
The information provided includes the operating system (RTEMS in
all configurations), the node number, the release as the RTEMS
version, and the CPU family and model. The CPU model name
will indicate the multilib executive variant being used.
The information provided includes the operating system (RTEMS in all
configurations), the node number, the release as the RTEMS version, and the CPU
family and model. The CPU model name will indicate the multilib executive
variant being used.
.. _times:
times - Get process times
-------------------------
@ -518,32 +553,32 @@ times - Get process times
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <sys/time.h>
clock_t times(
struct tms \*ptms
struct tms *ptms
);
**STATUS CODES:**
This routine returns the number of clock ticks that have elapsed
since the system was initialized (e.g. the application was
started).
This routine returns the number of clock ticks that have elapsed since the
system was initialized (e.g. the application was started).
**DESCRIPTION:**
``times`` stores the current process times in ``ptms``. The
format of ``struct tms`` is as defined in``<sys/times.h>``. RTEMS fills in the field ``tms_utime``
with the number of ticks that the calling thread has executed
and the field ``tms_stime`` with the number of clock ticks
since system boot (also returned). All other fields in the``ptms`` are left zero.
``times`` stores the current process times in ``ptms``. The format of ``struct
tms`` is as defined in ``<sys/times.h>``. RTEMS fills in the field
``tms_utime`` with the number of ticks that the calling thread has executed and
the field ``tms_stime`` with the number of clock ticks since system boot (also
returned). All other fields in the ``ptms`` are left zero.
**NOTES:**
RTEMS has no way to distinguish between user and system time
so this routine returns the most meaningful information
possible.
RTEMS has no way to distinguish between user and system time so this routine
returns the most meaningful information possible.
.. _getenv:
getenv - Get Environment Variables
----------------------------------
@ -552,30 +587,33 @@ getenv - Get Environment Variables
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
char \*getenv(
const char \*name
char *getenv(
const char \*name
);
**STATUS CODES:**
*NULL*
when no match
.. list-table::
:class: rtems-table
*pointer to value*
when successful
* - ``NULL``
- when no match
* - `pointer to value`
- when successful
**DESCRIPTION:**
This service searches the set of environment variables for
a string that matches the specified ``name``. If found,
it returns the associated value.
This service searches the set of environment variables for a string that
matches the specified ``name``. If found, it returns the associated value.
**NOTES:**
The environment list consists of name value pairs that
are of the form *name = value*.
The environment list consists of name value pairs that are of the form ``name =
value``.
.. _setenv:
setenv - Set Environment Variables
----------------------------------
@ -584,12 +622,12 @@ setenv - Set Environment Variables
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int setenv(
const char \*name,
const char \*value,
int overwrite
const char *name,
const char *value,
int overwrite
);
**STATUS CODES:**
@ -598,14 +636,16 @@ Returns 0 if successful and -1 otherwise.
**DESCRIPTION:**
This service adds the variable ``name`` to the environment with``value``. If ``name`` is not already exist, then it is
created. If ``name`` exists and ``overwrite`` is zero, then
the previous value is not overwritten.
This service adds the variable ``name`` to the environment with ``value``. If
``name`` is not already exist, then it is created. If ``name`` exists and
``overwrite`` is zero, then the previous value is not overwritten.
**NOTES:**
NONE
.. _ctermid:
ctermid - Generate Terminal Pathname
------------------------------------
.. index:: ctermid
@ -613,10 +653,10 @@ ctermid - Generate Terminal Pathname
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
char \*ctermid(
char \*s
char *ctermid(
char *s
);
**STATUS CODES:**
@ -626,18 +666,19 @@ terminal.
**DESCRIPTION:**
This service returns the name of the terminal device associated with
this process. If ``s`` is NULL, then a pointer to a static buffer
is returned. Otherwise, ``s`` is assumed to have a buffer of
sufficient size to contain the name of the controlling terminal.
This service returns the name of the terminal device associated with this
process. If ``s`` is NULL, then a pointer to a static buffer is returned.
Otherwise, ``s`` is assumed to have a buffer of sufficient size to contain the
name of the controlling terminal.
**NOTES:**
By default on RTEMS systems, the controlling terminal is ``/dev/console``.
Again this implementation is of limited meaning, but it provides
true and useful results which should be sufficient to ease porting
applications from a full POSIX implementation to the reduced
profile supported by RTEMS.
By default on RTEMS systems, the controlling terminal is :file:`/dev/console`.
Again this implementation is of limited meaning, but it provides true and
useful results which should be sufficient to ease porting applications from a
full POSIX implementation to the reduced profile supported by RTEMS.
.. _ttyname:
ttyname - Determine Terminal Device Name
----------------------------------------
@ -646,27 +687,29 @@ ttyname - Determine Terminal Device Name
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
char \*ttyname(
int fd
char *ttyname(
int fd
);
**STATUS CODES:**
Pointer to a string containing the terminal device name or
NULL is returned on any error.
Pointer to a string containing the terminal device name or ``NULL`` is returned
on any error.
**DESCRIPTION:**
This service returns a pointer to the pathname of the terminal
device that is open on the file descriptor ``fd``. If``fd`` is not a valid descriptor for a terminal device,
then NULL is returned.
This service returns a pointer to the pathname of the terminal device that is
open on the file descriptor ``fd``. If ``fd`` is not a valid descriptor for a
terminal device, then NULL is returned.
**NOTES:**
This routine uses a static buffer.
.. _ttyname_r:
ttyname_r - Reentrant Determine Terminal Device Name
----------------------------------------------------
.. index:: ttyname_r
@ -674,33 +717,37 @@ ttyname_r - Reentrant Determine Terminal Device Name
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int ttyname_r(
int fd,
char \*name,
int namesize
int fd,
char *name,
int namesize
);
**STATUS CODES:**
This routine returns -1 and sets ``errno`` as follows:
*EBADF*
If not a valid descriptor for a terminal device.
.. list-table::
:class: rtems-table
*EINVAL*
If ``name`` is NULL or ``namesize`` are insufficient.
* - ``EBADF``
- If not a valid descriptor for a terminal device.
* - ``EINVAL``
- If ``name`` is ``NULL`` or ``namesize`` are insufficient.
**DESCRIPTION:**
This service the pathname of the terminal device that is open
on the file descriptor ``fd``.
This service the pathname of the terminal device that is open on the file
descriptor ``fd``.
**NOTES:**
NONE
.. _isatty:
isatty - Determine if File Descriptor is Terminal
-------------------------------------------------
.. index:: isatty
@ -708,10 +755,10 @@ isatty - Determine if File Descriptor is Terminal
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int isatty(
int fd
int fd
);
**STATUS CODES:**
@ -720,11 +767,13 @@ Returns 1 if ``fd`` is a terminal device and 0 otherwise.
**DESCRIPTION:**
This service returns 1 if ``fd`` is an open file descriptor
connected to a terminal and 0 otherwise.
This service returns 1 if ``fd`` is an open file descriptor connected to a
terminal and 0 otherwise.
**NOTES:**
.. _sysconf:
sysconf - Get Configurable System Variables
-------------------------------------------
.. index:: sysconf
@ -732,34 +781,25 @@ sysconf - Get Configurable System Variables
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
long sysconf(
int name
int name
);
**STATUS CODES:**
The value returned is the actual value of the system resource.
If the requested configuration name is a feature flag, then
1 is returned if the available and 0 if it is not. On any
other error condition, -1 is returned.
The value returned is the actual value of the system resource. If the
requested configuration name is a feature flag, then 1 is returned if the
available and 0 if it is not. On any other error condition, -1 is returned.
**DESCRIPTION:**
This service is the mechanism by which an application determines
values for system limits or options at runtime.
This service is the mechanism by which an application determines values for
system limits or options at runtime.
**NOTES:**
Much of the information that may be obtained via ``sysconf``
has equivalent macros in ``<unistd.h``. However, those
macros reflect conservative limits which may have been altered
by application configuration.
.. COMMENT: COPYRIGHT (c) 1988-2002.
.. COMMENT: On-Line Applications Research Corporation (OAR).
.. COMMENT: All rights reserved.
Much of the information that may be obtained via ``sysconf`` has equivalent
macros in ``unistd.h``. However, those macros reflect conservative limits
which may have been altered by application configuration.

View File

@ -1,3 +1,7 @@
.. COMMENT: COPYRIGHT (c) 1988-2002.
.. COMMENT: On-Line Applications Research Corporation (OAR).
.. COMMENT: All rights reserved.
Scheduler Manager
#################
@ -8,13 +12,13 @@ The scheduler manager ...
The directives provided by the scheduler manager are:
- ``sched_get_priority_min`` - Get Minimum Priority Value
- sched_get_priority_min_ - Get Minimum Priority Value
- ``sched_get_priority_max`` - Get Maximum Priority Value
- sched_get_priority_max_ - Get Maximum Priority Value
- ``sched_rr_get_interval`` - Get Timeslicing Quantum
- sched_rr_get_interval_ - Get Timeslicing Quantum
- ``sched_yield`` - Yield the Processor
- sched_yield_ - Yield the Processor
Background
==========
@ -22,8 +26,9 @@ Background
Priority
--------
In the RTEMS implementation of the POSIX API, the priorities range from
the low priority of ``sched_get_priority_min()`` to the highest priority of``sched_get_priority_max()``. Numerically higher values represent higher
In the RTEMS implementation of the POSIX API, the priorities range from the low
priority of ``sched_get_priority_min()`` to the highest priority of
``sched_get_priority_max()``. Numerically higher values represent higher
priorities.
Scheduling Policies
@ -32,8 +37,8 @@ Scheduling Policies
The following scheduling policies are available:
*SCHED_FIFO*
Priority-based, preemptive scheduling with no timeslicing. This is equivalent
to what is called "manual round-robin" scheduling.
Priority-based, preemptive scheduling with no timeslicing. This is
equivalent to what is called "manual round-robin" scheduling.
*SCHED_RR*
Priority-based, preemptive scheduling with timeslicing. Time quantums are
@ -46,11 +51,12 @@ The following scheduling policies are available:
maintained on a per-thread basis and are reset at each context switch.
*SCHED_SPORADIC*
Priority-based, preemptive scheduling utilizing three additional parameters:
budget, replenishment period, and low priority. Under this policy, the
thread is allowed to execute for "budget" amount of time before its priority
is lowered to "low priority". At the end of each replenishment period,
the thread resumes its initial priority and has its budget replenished.
Priority-based, preemptive scheduling utilizing three additional
parameters: budget, replenishment period, and low priority. Under this
policy, the thread is allowed to execute for "budget" amount of time before
its priority is lowered to "low priority". At the end of each replenishment
period, the thread resumes its initial priority and has its budget
replenished.
Operations
==========
@ -60,10 +66,11 @@ There is currently no text in this section.
Directives
==========
This section details the scheduler manager's directives.
A subsection is dedicated to each of this manager's directives
and describes the calling sequence, related constants, usage,
and status codes.
This section details the scheduler manager's directives. A subsection is
dedicated to each of this manager's directives and describes the calling
sequence, related constants, usage, and status codes.
.. _sched_get_priority_min:
sched_get_priority_min - Get Minimum Priority Value
---------------------------------------------------
@ -72,29 +79,34 @@ sched_get_priority_min - Get Minimum Priority Value
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <sched.h>
int sched_get_priority_min(
int policy
int policy
);
**STATUS CODES:**
On error, this routine returns -1 and sets errno to one of the following:
On error, this routine returns -1 and sets ``errno`` to one of the following:
*EINVAL*
The indicated policy is invalid.
.. list-table::
:class: rtems-table
* - ``EINVAL``
- The indicated policy is invalid.
**DESCRIPTION:**
This routine return the minimum (numerically and logically lowest) priority
for the specified ``policy``.
This routine return the minimum (numerically and logically lowest) priority for
the specified ``policy``.
**NOTES:**
NONE
.. _sched_get_priority_max:
sched_get_priority_max - Get Maximum Priority Value
---------------------------------------------------
.. index:: sched_get_priority_max
@ -102,19 +114,22 @@ sched_get_priority_max - Get Maximum Priority Value
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <sched.h>
int sched_get_priority_max(
int policy
int policy
);
**STATUS CODES:**
On error, this routine returns -1 and sets errno to one of the following:
On error, this routine returns -1 and sets ``errno`` to one of the following:
*EINVAL*
The indicated policy is invalid.
.. list-table::
:class: rtems-table
* - ``EINVAL``
- The indicated policy is invalid.
**DESCRIPTION:**
@ -125,6 +140,8 @@ for the specified ``policy``.
NONE
.. _sched_rr_get_interval:
sched_rr_get_interval - Get Timeslicing Quantum
-----------------------------------------------
.. index:: sched_rr_get_interval
@ -132,32 +149,37 @@ sched_rr_get_interval - Get Timeslicing Quantum
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <sched.h>
int sched_rr_get_interval(
pid_t pid,
struct timespec \*interval
pid_t pid,
struct timespec *interval
);
**STATUS CODES:**
On error, this routine returns -1 and sets errno to one of the following:
On error, this routine returns -1 and sets ``errno`` to one of the following:
*ESRCH*
The indicated process id is invalid.
.. list-table::
:class: rtems-table
*EINVAL*
The specified interval pointer parameter is invalid.
* - ``ESRCH``
- The indicated process id is invalid.
* - ``EINVAL``
- The specified interval pointer parameter is invalid.
**DESCRIPTION:**
This routine returns the length of the timeslice quantum in the``interval`` parameter for the specified ``pid``.
This routine returns the length of the timeslice quantum in the ``interval``
parameter for the specified ``pid``.
**NOTES:**
The ``pid`` argument should be 0 to indicate the calling process.
.. _sched_yield:
sched_yield - Yield the Processor
---------------------------------
.. index:: sched_yield
@ -165,7 +187,7 @@ sched_yield - Yield the Processor
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <sched.h>
int sched_yield( void );
@ -177,16 +199,9 @@ This routine always returns zero to indicate success.
**DESCRIPTION:**
This call forces the calling thread to yield the processor to another
thread. Normally this is used to implement voluntary round-robin
task scheduling.
thread. Normally this is used to implement voluntary round-robin task
scheduling.
**NOTES:**
NONE
.. COMMENT: COPYRIGHT (c) 1988-2002.
.. COMMENT: On-Line Applications Research Corporation (OAR).
.. COMMENT: All rights reserved.

View File

@ -1,3 +1,7 @@
.. COMMENT: COPYRIGHT (c) 1989-2008.
.. COMMENT: On-Line Applications Research Corporation (OAR).
.. COMMENT: All rights reserved.
Semaphore Manager
#################
@ -9,25 +13,25 @@ semaphores. This manager is based on the POSIX 1003.1 standard.
The directives provided by the semaphore manager are:
- ``sem_init`` - Initialize an unnamed semaphore
- sem_init_ - Initialize an unnamed semaphore
- ``sem_destroy`` - Destroy an unnamed semaphore
- sem_destroy_ - Destroy an unnamed semaphore
- ``sem_open`` - Open a named semaphore
- sem_open_ - Open a named semaphore
- ``sem_close`` - Close a named semaphore
- sem_close_ - Close a named semaphore
- ``sem_unlink`` - Remove a named semaphore
- sem_unlink_ - Remove a named semaphore
- ``sem_wait`` - Lock a semaphore
- sem_wait_ - Lock a semaphore
- ``sem_trywait`` - Lock a semaphore
- sem_trywait_ - Lock a semaphore
- ``sem_timedwait`` - Wait on a Semaphore for a Specified Time
- sem_timedwait_ - Wait on a Semaphore for a Specified Time
- ``sem_post`` - Unlock a semaphore
- sem_post_ - Unlock a semaphore
- ``sem_getvalue`` - Get the value of a semeaphore
- sem_getvalue_ - Get the value of a semeaphore
Background
==========
@ -51,7 +55,8 @@ semaphore, the tasks will be placed in the queue.
The ``sem_t`` structure is used to represent semaphores. It is passed as an
argument to the semaphore directives and is defined as follows:
.. code:: c
.. code-block:: c
typedef int sem_t;
@ -71,17 +76,19 @@ Creating a semaphore with a limit on the count of 1 effectively restricts the
semaphore to being a binary semaphore. When the binary semaphore is available,
the count is 1. When the binary semaphore is unavailable, the count is 0.
Since this does not result in a true binary semaphore, advanced binary features like the Priority Inheritance and Priority Ceiling Protocols are not available.
Since this does not result in a true binary semaphore, advanced binary features
like the Priority Inheritance and Priority Ceiling Protocols are not available.
There is currently no text in this section.
Directives
==========
This section details the semaphore manager's directives.
A subsection is dedicated to each of this manager's directives
and describes the calling sequence, related constants, usage,
and status codes.
This section details the semaphore manager's directives. A subsection is
dedicated to each of this manager's directives and describes the calling
sequence, related constants, usage, and status codes.
.. _sem_init:
sem_init - Initialize an unnamed semaphore
------------------------------------------
@ -90,45 +97,47 @@ sem_init - Initialize an unnamed semaphore
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int sem_init(
sem_t \*sem,
int pshared,
unsigned int value
sem_t *sem,
int pshared,
unsigned int value
);
**STATUS CODES:**
*EINVAL*
The value argument exceeds SEM_VALUE_MAX
.. list-table::
:class: rtems-table
*ENOSPC*
A resource required to initialize the semaphore has been exhausted
The limit on semaphores (SEM_VALUE_MAX) has been reached
*ENOSYS*
The function sem_init is not supported by this implementation
*EPERM*
The process lacks appropriate privileges to initialize the semaphore
* - ``EINVAL``
- The value argument exceeds ``SEM_VALUE_MAX``
* - ``ENOSPC``
- A resource required to initialize the semaphore has been exhausted The
limit on semaphores (``SEM_VALUE_MAX``) has been reached
* - ``ENOSYS``
- The function sem_init is not supported by this implementation
* - ``EPERM``
- The process lacks appropriate privileges to initialize the semaphore
**DESCRIPTION:**
The sem_init function is used to initialize the unnamed semaphore referred to
by "sem". The value of the initialized semaphore is the parameter "value". The
semaphore remains valid until it is destroyed.
The ``sem_init`` function is used to initialize the unnamed semaphore referred
to by ``sem``. The value of the initialized semaphore is the parameter
``value``. The semaphore remains valid until it is destroyed.
ADD MORE HERE XXX
.. COMMENT: ADD MORE HERE XXX
**NOTES:**
If the functions completes successfully, it shall return a value of zero.
Otherwise, it shall return a value of -1 and set "errno" to specify the error
otherwise, it shall return a value of -1 and set ``errno`` to specify the error
that occurred.
Multiprocessing is currently not supported in this implementation.
.. _sem_destroy:
sem_destroy - Destroy an unnamed semaphore
------------------------------------------
.. index:: sem_destroy
@ -136,37 +145,40 @@ sem_destroy - Destroy an unnamed semaphore
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int sem_destroy(
sem_t \*sem
sem_t *sem
);
**STATUS CODES:**
*EINVAL*
The value argument exceeds SEM_VALUE_MAX
.. list-table::
:class: rtems-table
*ENOSYS*
The function sem_init is not supported by this implementation
*EBUSY*
There are currently processes blocked on the semaphore
* - ``EINVAL``
- The value argument exceeds ``SEM_VALUE_MAX``
* - ``ENOSYS``
- The function ``sem_init`` is not supported by this implementation
* - ``EBUSY``
- There are currently processes blocked on the semaphore
**DESCRIPTION:**
The sem_destroy function is used to destroy an unnamed semaphore refered to by
"sem". sem_destroy can only be used on a semaphore that was created using
sem_init.
The ``sem_destroy`` function is used to destroy an unnamed semaphore refered to
by ``sem``. ``sem_destroy`` can only be used on a semaphore that was created
using sem_init.
**NOTES:**
If the functions completes successfully, it shall return a value of zero.
Otherwise, it shall return a value of -1 and set "errno" to specify the error
Otherwise, it shall return a value of -1 and set ``errno`` to specify the error
that occurred.
Multiprocessing is currently not supported in this implementation.
.. _sem_open:
sem_open - Open a named semaphore
---------------------------------
.. index:: sem_open
@ -174,66 +186,70 @@ sem_open - Open a named semaphore
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int sem_open(
const char \*name,
int oflag
const char *name,
int oflag
);
**ARGUMENTS:**
The following flag bit may be set in oflag:
``O_CREAT`` - Creates the semaphore if it does not already exist. If O_CREAT
is set and the semaphore already exists then O_CREAT has no effect. Otherwise,
sem_open() creates a semaphore. The O_CREAT flag requires the third and fourth
argument: mode and value of type mode_t and unsigned int, respectively.
.. list-table::
:class: rtems-table
``O_EXCL`` - If O_EXCL and O_CREAT are set, all call to sem_open() shall fail
if the semaphore name exists
* - ``O_CREAT``
- Creates the semaphore if it does not already exist. If ``O_CREAT`` is set
and the semaphore already exists then ``O_CREAT`` has no
effect. Otherwise, ``sem_open()`` creates a semaphore. The ``O_CREAT``
flag requires the third and fourth argument: mode and value of type
``mode_t`` and ``unsigned int``, respectively.
* - ``O_EXCL``
- If ``O_EXCL`` and ``O_CREAT`` are set, all call to ``sem_open()`` shall
fail if the semaphore name exists
**STATUS CODES:**
*EACCES*
Valid name specified but oflag permissions are denied, or the semaphore name
specified does not exist and permission to create the named semaphore is denied.
.. list-table::
:class: rtems-table
*EEXIST*
O_CREAT and O_EXCL are set and the named semaphore already exists.
*EINTR*
The sem_open() operation was interrupted by a signal.
*EINVAL*
The sem_open() operation is not supported for the given name.
*EMFILE*
Too many semaphore descriptors or file descriptors in use by this process.
*ENAMETOOLONG*
The length of the name exceed PATH_MAX or name component is longer than NAME_MAX
while POSIX_NO_TRUNC is in effect.
*ENOENT*
O_CREAT is not set and the named semaphore does not exist.
*ENOSPC*
There is insufficient space for the creation of a new named semaphore.
*ENOSYS*
The function sem_open() is not supported by this implementation.
* - ``EACCES``
- Valid name specified but oflag permissions are denied, or the semaphore
name specified does not exist and permission to create the named semaphore
is denied.
* - ``EEXIST``
- ``O_CREAT`` and ``O_EXCL`` are set and the named semaphore already exists.
* - ``EINTR``
- The ``sem_open()`` operation was interrupted by a signal.
* - ``EINVAL``
- The ``sem_open()`` operation is not supported for the given name.
* - ``EMFILE``
- Too many semaphore descriptors or file descriptors in use by this process.
* - ``ENAMETOOLONG``
- The length of the name exceed ``PATH_MAX`` or name component is longer
than ``NAME_MAX`` while ``POSIX_NO_TRUNC`` is in effect.
* - ``ENOENT``
- ``O_CREAT`` is not set and the named semaphore does not exist.
* - ``ENOSPC``
- There is insufficient space for the creation of a new named semaphore.
* - ``ENOSYS``
- The function ``sem_open()`` is not supported by this implementation.
**DESCRIPTION:**
The sem_open() function establishes a connection between a specified semaphore and
a process. After a call to sem_open with a specified semaphore name, a process
can reference to semaphore by the associated name using the address returned by
the call. The oflag arguments listed above control the state of the semaphore by
determining if the semaphore is created or accessed by a call to sem_open().
The ``sem_open()`` function establishes a connection between a specified
semaphore and a process. After a call to sem_open with a specified semaphore
name, a process can reference to semaphore by the associated name using the
address returned by the call. The oflag arguments listed above control the
state of the semaphore by determining if the semaphore is created or accessed
by a call to ``sem_open()``.
**NOTES:**
.. _sem_close:
sem_close - Close a named semaphore
-----------------------------------
.. index:: sem_close
@ -241,30 +257,34 @@ sem_close - Close a named semaphore
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int sem_close(
sem_t \*sem_close
sem_t *sem_close
);
**STATUS CODES:**
*EACCES*
The semaphore argument is not a valid semaphore descriptor.
.. list-table::
:class: rtems-table
*ENOSYS*
The function sem_close is not supported by this implementation.
* - ``EACCES``
- The semaphore argument is not a valid semaphore descriptor.
* - ``ENOSYS``
- The function ``sem_close`` is not supported by this implementation.
**DESCRIPTION:**
The sem_close() function is used to indicate that the calling process is finished
using the named semaphore indicated by sem. The function sem_close deallocates
any system resources that were previously allocated by a sem_open system call. If
sem_close() completes successfully it returns a 1, otherwise a value of -1 is
return and errno is set.
The ``sem_close()`` function is used to indicate that the calling process is
finished using the named semaphore indicated by ``sem``. The function
``sem_close`` deallocates any system resources that were previously allocated
by a ``sem_open`` system call. If ``sem_close()`` completes successfully it
returns a 1, otherwise a value of -1 is return and ``errno`` is set.
**NOTES:**
.. _sem_unlink:
sem_unlink - Unlink a semaphore
-------------------------------
.. index:: sem_unlink
@ -272,43 +292,46 @@ sem_unlink - Unlink a semaphore
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int sem_unlink(
const char \*name
const char *name
);
**STATUS CODES:**
*EACCESS*
Permission is denied to unlink a semaphore.
.. list-table::
:class: rtems-table
*ENAMETOOLONG*
The length of the strong name exceed NAME_MAX while POSIX_NO_TRUNC is in effect.
*ENOENT*
The name of the semaphore does not exist.
*ENOSPC*
There is insufficient space for the creation of a new named semaphore.
*ENOSYS*
The function sem_unlink is not supported by this implementation.
* - ``EACCESS``
- Permission is denied to unlink a semaphore.
* - ``ENAMETOOLONG``
- The length of the strong name exceed ``NAME_MAX`` while ``POSIX_NO_TRUNC``
is in effect.
* - ``ENOENT``
- The name of the semaphore does not exist.
* - ``ENOSPC``
- There is insufficient space for the creation of a new named semaphore.
* - ``ENOSYS``
- The function ``sem_unlink`` is not supported by this implementation.
**DESCRIPTION:**
The sem_unlink() function shall remove the semaphore name by the string name. If
a process is currently accessing the name semaphore, the sem_unlink command has
no effect. If one or more processes have the semaphore open when the sem_unlink
function is called, the destruction of semaphores shall be postponed until all
reference to semaphore are destroyed by calls to sem_close, _exit(), or exec.
After all references have been destroyed, it returns immediately.
The ``sem_unlink()`` function shall remove the semaphore name by the string
name. If a process is currently accessing the name semaphore, the
``sem_unlink`` command has no effect. If one or more processes have the
semaphore open when the ``sem_unlink`` function is called, the destruction of
semaphores shall be postponed until all reference to semaphore are destroyed by
calls to ``sem_close``, ``_exit()``, or ``exec``. After all references have
been destroyed, it returns immediately.
If the termination is successful, the function shall return 0. Otherwise, a -1
is returned and the errno is set.
is returned and the ``errno`` is set.
**NOTES:**
.. _sem_wait:
sem_wait - Wait on a Semaphore
------------------------------
.. index:: sem_wait
@ -316,16 +339,19 @@ sem_wait - Wait on a Semaphore
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int sem_wait(
sem_t \*sem
sem_t *sem
);
**STATUS CODES:**
*EINVAL*
The "sem" argument does not refer to a valid semaphore
.. list-table::
:class: rtems-table
* - ``EINVAL``
- The ``sem`` argument does not refer to a valid semaphore
**DESCRIPTION:**
@ -336,13 +362,15 @@ value is zero), then the function will block until the semaphore becomes
available. It will then successfully lock the semaphore. The semaphore
remains locked until released by a ``sem_post()`` call.
If the call is unsuccessful, then the function returns -1 and sets errno to the
appropriate error code.
If the call is unsuccessful, then the function returns -1 and sets ``errno`` to
the appropriate error code.
**NOTES:**
Multiprocessing is not supported in this implementation.
.. _sem_trywait:
sem_trywait - Non-blocking Wait on a Semaphore
----------------------------------------------
.. index:: sem_trywait
@ -350,36 +378,41 @@ sem_trywait - Non-blocking Wait on a Semaphore
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int sem_trywait(
sem_t \*sem
sem_t *sem
);
**STATUS CODES:**
*EAGAIN*
The semaphore is not available (i.e., the semaphore value is zero), so the
semaphore could not be locked.
.. list-table::
:class: rtems-table
*EINVAL*
The ``sem`` argument does not refewr to a valid semaphore
* - ``EAGAIN``
- The semaphore is not available (i.e., the semaphore value is zero), so the
semaphore could not be locked.
* - ``EINVAL``
- The ``sem`` argument does not refewr to a valid semaphore
**DESCRIPTION:**
This function attempts to lock a semaphore specified by ``sem``. If the
semaphore is available, then the semaphore is locked (i.e., the semaphore
value is decremented) and the function returns a value of 0. The semaphore
remains locked until released by a ``sem_post()`` call. If the semaphore
is unavailable (i.e., the semaphore value is zero), then the function will
return a value of -1 immediately and set ``errno`` to EAGAIN.
semaphore is available, then the semaphore is locked (i.e., the semaphore value
is decremented) and the function returns a value of 0. The semaphore remains
locked until released by a ``sem_post()`` call. If the semaphore is unavailable
(i.e., the semaphore value is zero), then the function will return a value
of -1 immediately and set ``errno`` to ``EAGAIN``.
If the call is unsuccessful, then the function returns -1 and sets``errno`` to the appropriate error code.
If the call is unsuccessful, then the function returns -1 and sets ``errno`` to
the appropriate error code.
**NOTES:**
Multiprocessing is not supported in this implementation.
.. _sem_timedwait:
sem_timedwait - Wait on a Semaphore for a Specified Time
--------------------------------------------------------
.. index:: sem_timedwait
@ -387,40 +420,45 @@ sem_timedwait - Wait on a Semaphore for a Specified Time
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int sem_timedwait(
sem_t \*sem,
const struct timespec \*abstime
sem_t *sem,
const struct timespec *abstime
);
**STATUS CODES:**
*EAGAIN*
The semaphore is not available (i.e., the semaphore value is zero), so the
semaphore could not be locked.
.. list-table::
:class: rtems-table
*EINVAL*
The ``sem`` argument does not refewr to a valid semaphore
* - ``EAGAIN``
- The semaphore is not available (i.e., the semaphore value is zero), so the
semaphore could not be locked.
* - ``EINVAL``
- The ``sem`` argument does not refewr to a valid semaphore
**DESCRIPTION:**
This function attemtps to lock a semaphore specified by ``sem``,
and will wait for the semaphore until the absolute time specified by``abstime``. If the semaphore is available, then the semaphore is
locked (i.e., the semaphore value is decremented) and the function
returns a value of 0. The semaphore remains locked until released by
a ``sem_post()`` call. If the semaphore is unavailable, then the
function will wait for the semaphore to become available for the amount
of time specified by ``timeout``.
This function attemtps to lock a semaphore specified by ``sem``, and will wait
for the semaphore until the absolute time specified by ``abstime``. If the
semaphore is available, then the semaphore is locked (i.e., the semaphore value
is decremented) and the function returns a value of 0. The semaphore remains
locked until released by a ``sem_post()`` call. If the semaphore is
unavailable, then the function will wait for the semaphore to become available
for the amount of time specified by ``timeout``.
If the semaphore does not become available within the interval specified by``timeout``, then the function returns -1 and sets ``errno`` to EAGAIN.
If any other error occurs, the function returns -1 and sets ``errno`` to
the appropriate error code.
If the semaphore does not become available within the interval specified by
``timeout``, then the function returns -1 and sets ``errno`` to ``EAGAIN``. If
any other error occurs, the function returns -1 and sets ``errno`` to the
appropriate error code.
**NOTES:**
Multiprocessing is not supported in this implementation.
.. _sem_post:
sem_post - Unlock a Semaphore
-----------------------------
.. index:: sem_post
@ -428,25 +466,28 @@ sem_post - Unlock a Semaphore
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int sem_post(
sem_t \*sem
sem_t *sem
);
**STATUS CODES:**
*EINVAL*
The ``sem`` argument does not refer to a valid semaphore
.. list-table::
:class: rtems-table
* - ``EINVAL``
- The ``sem`` argument does not refer to a valid semaphore
**DESCRIPTION:**
This function attempts to release the semaphore specified by ``sem``. If
other tasks are waiting on the semaphore, then one of those tasks (which one
depends on the scheduler being used) is allowed to lock the semaphore and
return from its ``sem_wait()``, ``sem_trywait()``, or``sem_timedwait()`` call. If there are no other tasks waiting on the
semaphore, then the semaphore value is simply incremented. ``sem_post()``
returns 0 upon successful completion.
This function attempts to release the semaphore specified by ``sem``. If other
tasks are waiting on the semaphore, then one of those tasks (which one depends
on the scheduler being used) is allowed to lock the semaphore and return from
its ``sem_wait()``, ``sem_trywait()``, or ``sem_timedwait()`` call. If there
are no other tasks waiting on the semaphore, then the semaphore value is simply
incremented. ``sem_post()`` returns 0 upon successful completion.
If an error occurs, the function returns -1 and sets ``errno`` to the
appropriate error code.
@ -455,6 +496,8 @@ appropriate error code.
Multiprocessing is not supported in this implementation.
.. _sem_getvalue:
sem_getvalue - Get the value of a semaphore
-------------------------------------------
.. index:: sem_getvalue
@ -462,42 +505,37 @@ sem_getvalue - Get the value of a semaphore
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int sem_getvalue(
sem_t \*sem,
int \*sval
sem_t *sem,
int *sval
);
**STATUS CODES:**
*EINVAL*
The "sem" argument does not refer to a valid semaphore
.. list-table::
:class: rtems-table
*ENOSYS*
The function sem_getvalue is not supported by this implementation
* - ``EINVAL``
- The ``sem`` argument does not refer to a valid semaphore
* - ``ENOSYS``
- The function ``sem_getvalue`` is not supported by this implementation
**DESCRIPTION:**
The sem_getvalue functions sets the location referenced by the "sval" argument
to the value of the semaphore without affecting the state of the semaphore. The
updated value represents a semaphore value that occurred at some point during
the call, but is not necessarily the actual value of the semaphore when it
returns to the calling process.
The ``sem_getvalue`` functions sets the location referenced by the ``sval``
argument to the value of the semaphore without affecting the state of the
semaphore. The updated value represents a semaphore value that occurred at some
point during the call, but is not necessarily the actual value of the semaphore
when it returns to the calling process.
If "sem" is locked, the value returned by sem_getvalue will be zero or a
If ``sem`` is locked, the value returned by ``sem_getvalue`` will be zero or a
negative number whose absolute value is the number of processes waiting for the
semaphore at some point during the call.
**NOTES:**
If the functions completes successfully, it shall return a value of zero.
Otherwise, it shall return a value of -1 and set "errno" to specify the error
Otherwise, it shall return a value of -1 and set ``errno`` to specify the error
that occurred.
.. COMMENT: COPYRIGHT (c) 1989-2008.
.. COMMENT: On-Line Applications Research Corporation (OAR).
.. COMMENT: All rights reserved.

View File

@ -1,3 +1,7 @@
.. COMMENT: COPYRIGHT (c) 1988-2002.
.. COMMENT: On-Line Applications Research Corporation (OAR).
.. COMMENT: All rights reserved.
Services Provided by C Library (libc)
#####################################
@ -292,15 +296,18 @@ Reentrant Versions of Functions
- ``errno_r`` - XXX
- Locale functions:
- ``localeconv_r`` - XXX
- ``setlocale_r`` - XXX
- Equivalents for stdio variables:
- ``stdin_r`` - XXX
- ``stdout_r`` - XXX
- ``stderr_r`` - XXX
- Stdio functions:
- ``fdopen_r`` - XXX
- ``perror_r`` - XXX
- ``tempnam_r`` - XXX
@ -323,6 +330,7 @@ Reentrant Versions of Functions
- ``sprintf_r`` - XXX
- Signal functions:
- ``init_signal_r`` - XXX
- ``signal_r`` - XXX
- ``kill_r`` - XXX
@ -330,6 +338,7 @@ Reentrant Versions of Functions
- ``raise_r`` - XXX
- Stdlib functions:
- ``calloc_r`` - XXX
- ``mblen_r`` - XXX
- ``srand_r`` - XXX
@ -355,9 +364,11 @@ Reentrant Versions of Functions
- ``setenv_r`` - XXX
- String functions:
- ``strtok_r`` - XXX
- System functions:
- ``close_r`` - XXX
- ``link_r`` - XXX
- ``unlink_r`` - XXX
@ -377,6 +388,7 @@ Reentrant Versions of Functions
- ``times_r`` - XXX
- Time function:
- ``asctime_r`` - XXX
Miscellaneous Macros and Functions
@ -388,11 +400,13 @@ Variable Argument Lists
=======================
- Stdarg (stdarg.h):
- ``va_start`` - XXX
- ``va_arg`` - XXX
- ``va_end`` - XXX
- Vararg (varargs.h):
- ``va_alist`` - XXX
- ``va_start-trad`` - XXX
- ``va_arg-trad`` - XXX
@ -424,10 +438,3 @@ Reentrant System Calls
- ``unlink_r`` - XXX
- ``sbrk_r`` - XXX
.. COMMENT: COPYRIGHT (c) 1988-2002.
.. COMMENT: On-Line Applications Research Corporation (OAR).
.. COMMENT: All rights reserved.

File diff suppressed because it is too large Load Diff

View File

@ -14,6 +14,7 @@ are provided and do work in a coherent manner. This is significant
when porting existing code from UNIX to RTEMS.
- Implementation
- The current implementation of ``dup()`` is insufficient.
- FIFOs ``mkfifo()`` are not currently implemented.
- Asynchronous IO is not implemented.
@ -21,16 +22,17 @@ when porting existing code from UNIX to RTEMS.
- getc/putc unlocked family is not implemented
- Shared Memory is not implemented
- Mapped Memory is not implemented
- NOTES:
- For Shared Memory and Mapped Memory services, it is unclear what
level of support is appropriate and possible for RTEMS.
- Functional Testing
- Tests for unimplemented services
- Performance Testing
- There are no POSIX Performance Tests.
- Documentation
@ -40,4 +42,3 @@ when porting existing code from UNIX to RTEMS.
background and operations sections.
- Example programs (not just tests) would be very nice.

View File

@ -1,29 +1,32 @@
.. COMMENT: COPYRIGHT(c) 1988-2002.
.. COMMENT: On-Line Applications Research Corporation(OAR).
.. COMMENT: All rights reserved.
System Databases Manager
########################
Introduction
============
The
system databases manager is ...
The system databases manager is ...
The directives provided by the system databases manager are:
- ``getgrgid`` - Get Group File Entry for ID
- getgrgid_ - Get Group File Entry for ID
- ``getgrgid_r`` - Reentrant Get Group File Entry
- getgrgid_r_ - Reentrant Get Group File Entry
- ``getgrnam`` - Get Group File Entry for Name
- getgrnam_ - Get Group File Entry for Name
- ``getgrnam_r`` - Reentrant Get Group File Entry for Name
- getgrnam_r_ - Reentrant Get Group File Entry for Name
- ``getpwuid`` - Get Password File Entry for UID
- getpwuid_ - Get Password File Entry for UID
- ``getpwuid_r`` - Reentrant Get Password File Entry for UID
- getpwuid_r_ - Reentrant Get Password File Entry for UID
- ``getpwnam`` - Get Password File Entry for Name
- getpwnam_ - Get Password File Entry for Name
- ``getpwnam_r`` - Reentrant Get Password File Entry for Name
- getpwnam_r_ - Reentrant Get Password File Entry for Name
Background
==========
@ -38,10 +41,11 @@ There is currently no text in this section.
Directives
==========
This section details the system databases manager's directives.
A subsection is dedicated to each of this manager's directives
and describes the calling sequence, related constants, usage,
and status codes.
This section details the system databases manager's directives. A subsection
is dedicated to each of this manager's directives and describes the calling
sequence, related constants, usage, and status codes.
.. _getgrgid:
getgrgid - Get Group File Entry for ID
--------------------------------------
@ -50,20 +54,25 @@ getgrgid - Get Group File Entry for ID
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int getgrgid(
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
**NOTES:**
.. _getgrgid_r:
getgrgid_r - Reentrant Get Group File Entry
-------------------------------------------
.. index:: getgrgid_r
@ -71,20 +80,25 @@ getgrgid_r - Reentrant Get Group File Entry
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int getgrgid_r(
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
**NOTES:**
.. _getgrnam:
getgrnam - Get Group File Entry for Name
----------------------------------------
.. index:: getgrnam
@ -92,20 +106,25 @@ getgrnam - Get Group File Entry for Name
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int getgrnam(
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
**NOTES:**
.. _getgrnam_r:
getgrnam_r - Reentrant Get Group File Entry for Name
----------------------------------------------------
.. index:: getgrnam_r
@ -113,20 +132,25 @@ getgrnam_r - Reentrant Get Group File Entry for Name
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int getgrnam_r(
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
**NOTES:**
.. _getpwuid:
getpwuid - Get Password File Entry for UID
------------------------------------------
.. index:: getpwuid
@ -134,20 +158,25 @@ getpwuid - Get Password File Entry for UID
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int getpwuid(
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
**NOTES:**
.. _getpwuid_r:
getpwuid_r - Reentrant Get Password File Entry for UID
------------------------------------------------------
.. index:: getpwuid_r
@ -155,20 +184,25 @@ getpwuid_r - Reentrant Get Password File Entry for UID
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int getpwuid_r(
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
**NOTES:**
.. _getpwnam:
getpwnam - Password File Entry for Name
---------------------------------------
.. index:: getpwnam
@ -176,20 +210,25 @@ getpwnam - Password File Entry for Name
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int getpwnam(
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
**NOTES:**
.. _getpwnam_r:
getpwnam_r - Reentrant Get Password File Entry for Name
-------------------------------------------------------
.. index:: getpwnam_r
@ -197,23 +236,19 @@ getpwnam_r - Reentrant Get Password File Entry for Name
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int getpwnam_r(
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
**NOTES:**
.. COMMENT: COPYRIGHT(c) 1988-2002.
.. COMMENT: On-Line Applications Research Corporation(OAR).
.. COMMENT: All rights reserved.

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,7 @@
.. COMMENT: COPYRIGHT (c) 1988-2002.
.. COMMENT: On-Line Applications Research Corporation (OAR).
.. COMMENT: All rights reserved.
Thread Cancellation Manager
###########################
@ -9,17 +13,17 @@ thread cancellation manager is ...
The directives provided by the thread cancellation manager are:
- ``pthread_cancel`` - Cancel Execution of a Thread
- pthread_cancel_ - Cancel Execution of a Thread
- ``pthread_setcancelstate`` - Set Cancelability State
- pthread_setcancelstate_ - Set Cancelability State
- ``pthread_setcanceltype`` - Set Cancelability Type
- pthread_setcanceltype_ - Set Cancelability Type
- ``pthread_testcancel`` - Create Cancellation Point
- pthread_testcancel_ - Create Cancellation Point
- ``pthread_cleanup_push`` - Establish Cancellation Handler
- pthread_cleanup_push_ - Establish Cancellation Handler
- ``pthread_cleanup_pop`` - Remove Cancellation Handler
- pthread_cleanup_pop_ - Remove Cancellation Handler
Background
==========
@ -34,10 +38,11 @@ There is currently no text in this section.
Directives
==========
This section details the thread cancellation manager's directives.
A subsection is dedicated to each of this manager's directives
and describes the calling sequence, related constants, usage,
and status codes.
This section details the thread cancellation manager's directives. A
subsection is dedicated to each of this manager's directives and describes the
calling sequence, related constants, usage, and status codes.
.. _pthread_cancel:
pthread_cancel - Cancel Execution of a Thread
---------------------------------------------
@ -46,20 +51,25 @@ pthread_cancel - Cancel Execution of a Thread
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int pthread_cancel(
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
**NOTES:**
.. _pthread_setcancelstate:
pthread_setcancelstate - Set Cancelability State
------------------------------------------------
.. index:: pthread_setcancelstate
@ -67,20 +77,25 @@ pthread_setcancelstate - Set Cancelability State
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int pthread_setcancelstate(
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
**NOTES:**
.. _pthread_setcanceltype:
pthread_setcanceltype - Set Cancelability Type
----------------------------------------------
.. index:: pthread_setcanceltype
@ -88,20 +103,25 @@ pthread_setcanceltype - Set Cancelability Type
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int pthread_setcanceltype(
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
**NOTES:**
.. _pthread_testcancel:
pthread_testcancel - Create Cancellation Point
----------------------------------------------
.. index:: pthread_testcancel
@ -109,20 +129,25 @@ pthread_testcancel - Create Cancellation Point
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int pthread_testcancel(
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
**NOTES:**
.. _pthread_cleanup_push:
pthread_cleanup_push - Establish Cancellation Handler
-----------------------------------------------------
.. index:: pthread_cleanup_push
@ -130,20 +155,25 @@ pthread_cleanup_push - Establish Cancellation Handler
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int pthread_cleanup_push(
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
**NOTES:**
.. _pthread_cleanup_pop:
pthread_cleanup_pop - Remove Cancellation Handler
-------------------------------------------------
.. index:: pthread_cleanup_pop
@ -151,23 +181,19 @@ pthread_cleanup_pop - Remove Cancellation Handler
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
int pthread_cleanup_push(
);
**STATUS CODES:**
*E*
The
.. list-table::
:class: rtems-table
* - ``E``
- The
**DESCRIPTION:**
**NOTES:**
.. COMMENT: COPYRIGHT (c) 1988-2002.
.. COMMENT: On-Line Applications Research Corporation (OAR).
.. COMMENT: All rights reserved.

View File

@ -1,3 +1,7 @@
.. COMMENT: COPYRIGHT(c) 1988-2002.
.. COMMENT: On-Line Applications Research Corporation(OAR).
.. COMMENT: All rights reserved.
Timer Manager
#############
@ -8,15 +12,15 @@ The timer manager is ...
The services provided by the timer manager are:
- ``timer_create`` - Create a Per-Process Timer
- timer_create_ - Create a Per-Process Timer
- ``timer_delete`` - Delete a Per-Process Timer
- timer_delete_ - Delete a Per-Process Timer
- ``timer_settime`` - Set Next Timer Expiration
- timer_settime_ - Set Next Timer Expiration
- ``timer_gettime`` - Get Time Remaining on Timer
- timer_gettime_ - Get Time Remaining on Timer
- ``timer_getoverrun`` - Get Timer Overrun Count
- timer_getoverrun_ - Get Timer Overrun Count
Background
==========
@ -27,26 +31,27 @@ Operations
System Calls
============
This section details the timer manager's services.
A subsection is dedicated to each of this manager's services
and describes the calling sequence, related constants, usage,
and status codes.
This section details the timer manager's services. A subsection is dedicated
to each of this manager's services and describes the calling sequence, related
constants, usage, and status codes.
.. COMMENT: timer_create
.. _timer_create:
timer_create - Create a Per-Process Timer
-----------------------------------------
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <time.h>
#include <signal.h>
int timer_create(
clockid_t clock_id,
struct sigevent \*evp,
timer_t \*timerid
clockid_t clock_id,
struct sigevent *evp,
timer_t *timerid
);
**STATUS CODES:**
@ -59,16 +64,18 @@ timer_create - Create a Per-Process Timer
.. COMMENT: timer_delete
.. _timer_delete:
timer_delete - Delete a Per-Process Timer
-----------------------------------------
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <time.h>
int timer_delete(
timer_t timerid
timer_t timerid
);
**STATUS CODES:**
@ -81,19 +88,21 @@ timer_delete - Delete a Per-Process Timer
.. COMMENT: timer_settime
.. _timer_settime:
timer_settime - Set Next Timer Expiration
-----------------------------------------
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <time.h>
int timer_settime(
timer_t timerid,
int flags,
const struct itimerspec \*value,
struct itimerspec \*ovalue
timer_t timerid,
int flags,
const struct itimerspec *value,
struct itimerspec *ovalue
);
**STATUS CODES:**
@ -106,17 +115,19 @@ timer_settime - Set Next Timer Expiration
.. COMMENT: timer_gettime
.. _timer_gettime:
timer_gettime - Get Time Remaining on Timer
-------------------------------------------
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <time.h>
int timer_gettime(
timer_t timerid,
struct itimerspec \*value
timer_t timerid,
struct itimerspec *value
);
**STATUS CODES:**
@ -129,16 +140,18 @@ timer_gettime - Get Time Remaining on Timer
.. COMMENT: timer_getoverrun
.. _timer_getoverrun:
timer_getoverrun - Get Timer Overrun Count
------------------------------------------
**CALLING SEQUENCE:**
.. code:: c
.. code-block:: c
#include <time.h>
int timer_getoverrun(
timer_t timerid
timer_t timerid
);
**STATUS CODES:**
@ -148,10 +161,3 @@ timer_getoverrun - Get Timer Overrun Count
**DESCRIPTION:**
**NOTES:**
.. COMMENT: COPYRIGHT(c) 1988-2002.
.. COMMENT: On-Line Applications Research Corporation(OAR).
.. COMMENT: All rights reserved.