diff --git a/Documentation/NuttxPortingGuide.html b/Documentation/NuttxPortingGuide.html index e609b5287b..90dfcec54f 100644 --- a/Documentation/NuttxPortingGuide.html +++ b/Documentation/NuttxPortingGuide.html @@ -16,7 +16,7 @@

by

Gregory Nutt

-

Last Update: March 22, 2007

+

Last Update: March 26, 2007

Table of Contents

@@ -34,8 +34,11 @@
  • 2.4 drivers
  • 2.5 examples
  • @@ -45,8 +48,13 @@
  • 2.9 mm
  • 2.10 sched
  • 2.11 tools
  • +
  • 2.12 Makefile
  • + +
  • 3.0 Configuring and Building
  • + -
  • 3.0 Configuring and Building
  • 4.0 Architecture APIs
  • -

    -Assumptions/Limitations: -

    - POSIX Compatibility: Comparable to the POSIX +

    +Assumptions/Limitations: +

    + POSIX Compatibility: Comparable to the POSIX interface of the same name.

    2.2.4 sched_getscheduler

    -

    -Function Prototype: +

    +Function Prototype:

         #include <sched.h>
         int sched_getscheduler (pid_t pid);
     
    -

    - Description: +

    + Description: sched_getscheduler() returns the scheduling policy currently applied to the task identified by pid. If pid equals zero, the policy of the calling process will @@ -712,18 +746,18 @@ interface of the same name. This function returns the current scheduling policy. -

    -Input Parameters: -

      -
    • pid. +

      +Input Parameters: +

        +
      • pid. The task ID of the task to query. If pid is zero, the calling task is queried.
      • -
      -

      -Returned Values: -

        -
      • +
      +

      +Returned Values: +

        +
      • On success, sched_getscheduler() returns the policy for the task (either SCHED_FIFO or SCHED_RR). On error, ERROR (-1) is returned, and errno is set appropriately: @@ -731,114 +765,114 @@ policy.
      • ESRCH The task whose ID is pid could not be found.
    • -
    -

    -Assumptions/Limitations: -

    - POSIX Compatibility: Comparable to the POSIX + +

    +Assumptions/Limitations: +

    + POSIX Compatibility: Comparable to the POSIX interface of the same name. Differences from the full POSIX implementation include: -

      -
    • Does not report errors via errno. -
    +
      +
    • Does not report errors via errno. +

    2.2.5 sched_yield

    -

    -Function Prototype: +

    +Function Prototype:

         #include <sched.h>
         int sched_yield( void );
     
    -

    -Description: This function forces the calling task to give +

    +Description: This function forces the calling task to give up the CPU (only to other tasks at the same priority). -

    -Input Parameters: None. -

    -Returned Values: -

      -
    • 0 (OK) or -1 (ERROR) -
    +

    +Input Parameters: None. +

    +Returned Values: +

      +
    • 0 (OK) or -1 (ERROR) +
    -

    -Assumptions/Limitations: -

    - POSIX Compatibility: Comparable to the POSIX +

    +Assumptions/Limitations: +

    + POSIX Compatibility: Comparable to the POSIX interface of the same name.

    2.2.6 sched_get_priority_max

    -

    -Function Prototype: +

    +Function Prototype:

         #include <sched.h>
         int sched_get_priority_max (int policy)
     
    -

    -Description: This function returns the value of the highest +

    +Description: This function returns the value of the highest possible task priority for a specified scheduling policy. -

    -Input Parameters: -

      -
    • policy. Scheduling policy requested. -
    +

    +Input Parameters: +

      +
    • policy. Scheduling policy requested. +
    -

    -Returned Values: -

      -
    • The maximum priority value or -1 (ERROR). -
    +

    +Returned Values: +

      +
    • The maximum priority value or -1 (ERROR). +
    -

    -Assumptions/Limitations: -

    - POSIX Compatibility: Comparable to the POSIX +

    +Assumptions/Limitations: +

    + POSIX Compatibility: Comparable to the POSIX interface of the same name.

    2.2.7 sched_get_priority_min

    -

    -Function Prototype: +

    +Function Prototype:

         #include <sched.h>
         int sched_get_priority_min (int policy);
     
    -

    -Description: This function returns the value of the lowest +

    +Description: This function returns the value of the lowest possible task priority for a specified scheduling policy. -

    -Input Parameters: -

      -
    • policy. Scheduling policy requested. -
    +

    +Input Parameters: +

      +
    • policy. Scheduling policy requested. +
    -

    -Returned Values: -

      -
    • The minimum priority value or -1 (ERROR) -
    +

    +Returned Values: +

      +
    • The minimum priority value or -1 (ERROR) +
    -

    -Assumptions/Limitations: -

    - POSIX Compatibility: Comparable to the POSIX +

    +Assumptions/Limitations: +

    + POSIX Compatibility: Comparable to the POSIX interface of the same name.

    2.2.8 sched_get_rr_interval

    -

    -Function Prototype: +

    +Function Prototype:

         #include <sched.h>
         int sched_get_rr_interval (pid_t pid, struct timespec *interval);
     
    -

    - Description: +

    + Description: sched_rr_get_interval() writes the timeslice interval for task identified by pid into the timespec structure pointed to by interval. If pid is zero, the timeslice @@ -846,35 +880,35 @@ interface of the same name. identified process should be running under the SCHED_RR scheduling policy.'

    -

    - Input Parameters: +

    + Input Parameters:

    -
      -
    • pid. The task ID of the task. If pid is zero, the +
        +
      • pid. The task ID of the task. If pid is zero, the priority of the calling task is returned. -
      • interval. A structure used to return the time slice. -
      +
    • interval. A structure used to return the time slice. +
    -

    - Returned Values: +

    + Returned Values: On success, sched_rr_get_interval() returns OK (0). On error, ERROR (-1) is returned, and errno is set to:

    -
      -
    • EFAULT Cannot copy to interval
    • -
    • EINVAL Invalid pid.
    • -
    • ENOSYS The system call is not yet implemented.
    • -
    • ESRCH The process whose ID is pid could not be found.
    • -
    +
      +
    • EFAULT Cannot copy to interval
    • +
    • EINVAL Invalid pid.
    • +
    • ENOSYS The system call is not yet implemented.
    • +
    • ESRCH The process whose ID is pid could not be found.
    • +
    -

    - Assumptions/Limitations: -

    - POSIX Compatibility: Comparable to the POSIX +

    + Assumptions/Limitations: +

    + POSIX Compatibility: Comparable to the POSIX interface of the same name.

    -

    2.3 Task Switching Interfaces

    +

    2.3 Task Switching Interfaces

    • 2.3.1 sched_lock
    • @@ -884,31 +918,31 @@ priority of the calling task is returned.

      2.3.1 sched_lock

      -

      -Function Prototype: +

      +Function Prototype:

           #include <sched.h>
           STATUS sched_lock( void );
       
      -

      -Description: This function disables context switching by +

      +Description: This function disables context switching by Disabling addition of new tasks to the ready-to-run task list. The task that calls this function will be the only task that is allowed to run until it either calls sched_unlock (the appropriate number of times) or until it blocks itself. -

      -Input Parameters: None. -

      -Returned Values: -

        -
      • OK or ERROR. -
      +

      +Input Parameters: None. +

      +Returned Values: +

        +
      • OK or ERROR. +
      -

      -Assumptions/Limitations: -

      - POSIX Compatibility: This is a NON-POSIX interface. +

      +Assumptions/Limitations: +

      + POSIX Compatibility: This is a NON-POSIX interface. VxWorks provides the comparable interface:

           STATUS taskLock( void );
      @@ -916,32 +950,32 @@ VxWorks provides the comparable interface:
       
       

      2.3.2 sched_unlock

      -

      -Function Prototype: +

      +Function Prototype:

           #include <sched.h>
           STATUS sched_unlock( void );
       
      -

      -Description: This function decrements the preemption lock +

      +Description: This function decrements the preemption lock count. Typically this is paired with sched_lock() and concludes a critical section of code. Preemption will not be unlocked until sched_unlock() has been called as many times as sched_lock(). When the lockCount is decremented to zero, any tasks that were eligible to preempt the current task will execute. -

      -Input Parameters: None. -

      -Returned Values: -

        -
      • OK or ERROR. -
      +

      +Input Parameters: None. +

      +Returned Values: +

        +
      • OK or ERROR. +
      -

      -Assumptions/Limitations: -

      - POSIX Compatibility: This is a NON-POSIX interface. +

      +Assumptions/Limitations: +

      + POSIX Compatibility: This is a NON-POSIX interface. VxWorks provides the comparable interface:

           STATUS taskUnlock( void );
      @@ -949,33 +983,33 @@ VxWorks provides the comparable interface:
       
       

      2.3.3 sched_lockcount

      -

      -Function Prototype: +

      +Function Prototype:

           #include <sched.h>
           sint32 sched_lockcount( void )
       
      -

      -Description: This function returns the current value of +

      +Description: This function returns the current value of the lockCount. If zero, preemption is enabled; if non-zero, this value indicates the number of times that sched_lock() has been called on this thread of execution. -

      -Input Parameters: None. -

      -Returned Values: -

        -
      • The current value of the lockCount. -
      +

      +Input Parameters: None. +

      +Returned Values: +

        +
      • The current value of the lockCount. +
      -

      -Assumptions/Limitations: -

      - POSIX Compatibility: None. -


      +

      +Assumptions/Limitations: +

      + POSIX Compatibility: None. +


      -

      2.4 Named Message Queue Interfaces

      +

      2.4 Named Message Queue Interfaces

      NuttX supports POSIX named message queues for intertask communication. @@ -995,43 +1029,43 @@ on this thread of execution.

      2.4.1 mq_open

      -

      -Function Prototype: +

      +Function Prototype:

           #include <mqueue.h>
           mqd_t mq_open( const char *mqName, int oflags, ... );
       
      -

      -Description: This function establish a connection between +

      +Description: This function establish a connection between a named message queue and the calling task. After a successful call of mq_open(), the task can reference the message queue using the address returned by the call. The message queue remains usable until it is closed by a successful call to mq_close(). -

      -Input Parameters: -

        -
      • mqName. Name of the queue to open -
      • oflags. Open flags. These may be any combination of: -
          -
        • O_RDONLY. Open for read access. -
        • O_WRONLY. Open for write access. -
        • O_RDWR. Open for both read & write access. -
        • O_CREAT. Create message queue if it does not already +

          +Input Parameters: +

            +
          • mqName. Name of the queue to open +
          • oflags. Open flags. These may be any combination of: +
              +
            • O_RDONLY. Open for read access. +
            • O_WRONLY. Open for write access. +
            • O_RDWR. Open for both read & write access. +
            • O_CREAT. Create message queue if it does not already exist. -
            • O_EXCL. Name must not exist when opened. -
            • O_NONBLOCK. Don't wait for data. -
            +
          • O_EXCL. Name must not exist when opened. +
          • O_NONBLOCK. Don't wait for data. +
          -
        • ... Optional parameters. +
        • ... Optional parameters. When the O_CREAT flag is specified, POSIX requires that a third and fourth parameter be supplied: -
            -
          • mode. The mode parameter is of type mode_t. In the POSIX +
              +
            • mode. The mode parameter is of type mode_t. In the POSIX specification, this mode value provides file permission bits for the message queue. This parameter is required but not used in the present implementation. -
            • attr. A pointer to an mq_attr that is provided to initialize. +
            • attr. A pointer to an mq_attr that is provided to initialize. the message queue. If attr is NULL, then the messages queue is created with implementation-defined default message queue attributes. If attr is non-NULL, then the message queue mq_maxmsg attribute is set to the @@ -1041,247 +1075,247 @@ addition attempts to send messages on the message queue fail or cause the sender to block; the mq_msgsize attribute determines the maximum size of a message that can be sent or received. Other elements of attr are ignored (i.e, set to default message queue attributes). -
            -
          +
        +
      -

      -Returned Values: -

        -
      • A message queue descriptor or -1 (ERROR) -
      +

      +Returned Values: +

        +
      • A message queue descriptor or -1 (ERROR) +
      -

      -Assumptions/Limitations: -

      - POSIX Compatibility: Comparable to the POSIX interface +

      +Assumptions/Limitations: +

      + POSIX Compatibility: Comparable to the POSIX interface of the same name. Differences from the full POSIX implementation include: -

        -
      • The mq_msgsize attributes determines the maximum size of a message that +
          +
        • The mq_msgsize attributes determines the maximum size of a message that may be sent or received. In the present implementation, this maximum message size is limited at 22 bytes. -
        +

      2.4.2 mq_close

      -

      -Function Prototype: +

      +Function Prototype:

           #include <mqueue.h>
           int mq_close( mqd_t mqdes );
       
      -

      -Description: This function is used to indicate that the +

      +Description: This function is used to indicate that the calling task is finished with the specified message queued mqdes. The mq_close() deallocates any system resources allocated by the system for use by this task for its message queue. -

      +

      If the calling task has attached a notification request to the message queue via this mqdes (see mq_notify()), this attachment will be removed and the message queue is available for another task to attach for notification. -

      -Input Parameters: -

        -
      • mqdes. Message queue descriptor. -
      +

      +Input Parameters: +

        +
      • mqdes. Message queue descriptor. +
      -

      -Returned Values: -

        -
      • 0 (OK) if the message queue is closed successfully, otherwise, +

        +Returned Values: +

          +
        • 0 (OK) if the message queue is closed successfully, otherwise, -1 (ERROR). -
        +
      -

      -Assumptions/Limitations: -

      -

        -
      • The behavior of a task that is blocked on either a mq_send() or +

        +Assumptions/Limitations: +

        +

          +
        • The behavior of a task that is blocked on either a mq_send() or mq_receive() is undefined when mq_close() is called. -
        • The result of using this message queue descriptor after successful +
        • The result of using this message queue descriptor after successful return from mq_close() is undefined. -
        -

        - POSIX Compatibility: Comparable to the POSIX interface +

      +

      + POSIX Compatibility: Comparable to the POSIX interface of the same name.

      2.4.3 mq_unlink

      -

      -Function Prototype: +

      +Function Prototype:

           #include <mqueue.h>
           int mq_unlink( const char *mqName );
       
      -

      -Description: This function removes the message queue named +

      +Description: This function removes the message queue named by "mqName." If one or more tasks have the message queue open when mq_unlink() is called, removal of the message queue is postponed until all references to the message queue have been closed. -

      -Input Parameters: -

        -
      • mqName. Name of the message queue -
      +

      +Input Parameters: +

        +
      • mqName. Name of the message queue +
      -

      -Returned Values: None. -

      -Assumptions/Limitations: -

      - POSIX Compatibility: Comparable to the POSIX +

      +Returned Values: None. +

      +Assumptions/Limitations: +

      + POSIX Compatibility: Comparable to the POSIX interface of the same name.

      2.4.4 mq_send

      -

      -Function Prototype: +

      +Function Prototype:

           #include <mqueue.h>
           int mq_send( mqd_t mqdes, const void *msg, size_t msgLen, int msgPrio );
       
      -

      -Description: This function adds the specified message (msg) +

      +Description: This function adds the specified message (msg) to the message queue (mqdes). The "msgLen" parameter specifies the length of the message in bytes pointed to by "msg." This length must not exceed the maximum message length from the mq_getattr(). -

      +

      If the message queue is not full, mq_send() will in the message in the message queue at the position indicated by the "msgPrio" argument. Messages with higher priority will be inserted before lower priority messages. The value of "msgPrio" must not exceed MQ_PRIO_MAX. -

      +

      If the specified message queue is full and O_NONBLOCK is not set in the message queue, then mq_send() will block until space becomes available to the queue the message. -

      +

      If the message queue is full and osNON_BLOCK is set, the message is not queued and ERROR is returned. -

      -Input Parameters: -

        -
      • mqdes. Message queue descriptor -
      • msg. Message to send -
      • msgLen. The length of the message in bytes -
      • msgPrio. The priority of the message -
      +

      +Input Parameters: +

        +
      • mqdes. Message queue descriptor +
      • msg. Message to send +
      • msgLen. The length of the message in bytes +
      • msgPrio. The priority of the message +
      -

      -Returned Values: None. -

      -Assumptions/Limitations: -

      - POSIX Compatibility: Comparable to the POSIX +

      +Returned Values: None. +

      +Assumptions/Limitations: +

      + POSIX Compatibility: Comparable to the POSIX interface of the same name. Differences from the full POSIX implementation include: -

        -
      • Control is not returned if a signal is received. -
      +
        +
      • Control is not returned if a signal is received. +

      2.4.5 mq_receive

      -

      -Function Prototype: +

      +Function Prototype:

           #include <mqueue.h>
           int mq_receive( mqd_t mqdes, void *msg, size_t msgLen, int *msgPrio );
       
      -

      -Description: This function receives the oldest of the highest +

      +Description: This function receives the oldest of the highest priority messages from the message queue specified by "mqdes." If the size of the buffer in bytes (msgLen) is less than the "mq_msgsize" attribute of the message queue, mq_receive will return an error. Otherwise, the select message is removed from the queue and copied to "msg." -

      +

      If the message queue is empty and O_NONBLOCK was not set, mq_receive() will block until a message is added to the message queue. If more than one task is waiting to receive a message, only the task with the highest priority that has waited the longest will be unblocked. -

      +

      If the queue is empty and O_NONBLOCK is set, ERROR will be returned. -

      -Input Parameters: -

        -
      • mqdes. Message Queue Descriptor -
      • msg. Buffer to receive the message -
      • msgLen. Size of the buffer in bytes -
      • msgPrio. If not NULL, the location to store message +

        +Input Parameters: +

          +
        • mqdes. Message Queue Descriptor +
        • msg. Buffer to receive the message +
        • msgLen. Size of the buffer in bytes +
        • msgPrio. If not NULL, the location to store message priority. -
        +
      -

      -Returned Values: -

        -
      • Length of the selected message in bytes, otherwise -1 (ERROR). -
      +

      +Returned Values: +

        +
      • Length of the selected message in bytes, otherwise -1 (ERROR). +
      -

      -Assumptions/Limitations: -

      - POSIX Compatibility: Comparable to the POSIX +

      +Assumptions/Limitations: +

      + POSIX Compatibility: Comparable to the POSIX interface of the same name. Differences from the full POSIX implementation include: -

        -
      • Control is not returned if a signal is received. -
      +
        +
      • Control is not returned if a signal is received. +

      2.4.6 mq_notify

      -

      -Function Prototype: +

      +Function Prototype:

           #include <mqueue.h>
           int mq_notify( mqd_t mqdes, const struct sigevent *notification );
       
      -

      -Description: If the "notification" input parameter +

      +Description: If the "notification" input parameter is not NULL, this function connects the task with the message queue such that the specified signal will be sent to the task whenever the message changes from empty to non-empty. One notification can be attached to a message queue. -

      +

      If "notification" is NULL, the attached notification is detached (if it was held by the calling task) and the queue is available to attach another notification. -

      +

      When the notification is sent to the registered task, its registration will be removed. The message queue will then be available for registration. -

      -Input Parameters: -

        -
      • mqdes. Message queue descriptor -
      • notification. Real-time signal structure containing: -
          -
        • sigev_notify. Should be osSIGEV_SIGNAL (but actually +

          +Input Parameters: +

            +
          • mqdes. Message queue descriptor +
          • notification. Real-time signal structure containing: +
              +
            • sigev_notify. Should be osSIGEV_SIGNAL (but actually ignored) -
            • sigev_signo. The signo to use for the notification -
            • sigev_value. Value associated with the signal -
            +
          • sigev_signo. The signo to use for the notification +
          • sigev_value. Value associated with the signal +
          -
        +
      -

      -Returned Values: None. -

      -Assumptions/Limitations: -

      - POSIX Compatibility: Comparable to the POSIX interface +

      +Returned Values: None. +

      +Assumptions/Limitations: +

      + POSIX Compatibility: Comparable to the POSIX interface of the same name. Differences from the full POSIX implementation include: -

        -
      • The notification signal will be sent to the registered task even if +
          +
        • The notification signal will be sent to the registered task even if another task is waiting for the message queue to become non-empty. This is inconsistent with the POSIX specification which states, "If a process has registered for notification of message arrival at a message queue and @@ -1289,87 +1323,87 @@ some process is blocked in mq_receive waiting to receive a message when a message arrives at the queue, the arriving message shall satisfy the appropriate mq_receive() ... The resulting behavior is as if the message queue remains empty, and no notification shall be sent." -
        +

      2.4.7 mq_setattr

      -

      -Function Prototype: +

      +Function Prototype:

           #include <mqueue.h>
           int mq_setattr( mqd_t mqdes, const struct mq_attr *mqStat,
                            struct mq_attr *oldMqStat);
       
      -

      -Description: This function sets the attributes associated +

      +Description: This function sets the attributes associated with the specified message queue "mqdes." Only the "O_NONBLOCK" bit of the "mq_flags" can be changed. -

      +

      If "oldMqStat" is non-null, mq_setattr() will store the previous message queue attributes at that location (just as would have been returned by mq_getattr()). -

      -Input Parameters: -

        -
      • mqdes. Message queue descriptor -
      • mqStat. New attributes -
      • oldMqState. Old attributes -
      +

      +Input Parameters: +

        +
      • mqdes. Message queue descriptor +
      • mqStat. New attributes +
      • oldMqState. Old attributes +
      -

      -Returned Values: -

        -
      • 0 (OK) if attributes are set successfully, otherwise -1 +

        +Returned Values: +

          +
        • 0 (OK) if attributes are set successfully, otherwise -1 (ERROR). -
        +
      -

      -Assumptions/Limitations: -

      - POSIX Compatibility: Comparable to the POSIX +

      +Assumptions/Limitations: +

      + POSIX Compatibility: Comparable to the POSIX interface of the same name.

      2.4.8 mq_getattr

      -

      -Function Prototype: +

      +Function Prototype:

           #include <mqueue.h>
           int mq_getattr( mqd_t mqdes, struct mq_attr *mqStat);
       
      -

      -Description: This functions gets status information and +

      +Description: This functions gets status information and attributes associated with the specified message queue. -

      -Input Parameters: -

        -
      • mqdes. Message queue descriptor -
      • mqStat. Buffer in which to return attributes. The returned +

        +Input Parameters: +

          +
        • mqdes. Message queue descriptor +
        • mqStat. Buffer in which to return attributes. The returned attributes include: -
            -
          • mq_maxmsg. Max number of messages in queue. -
          • mq_msgsize. Max message size. -
          • mq_flags. Queue flags. -
          • mq_curmsgs. Number of messages currently in queue. -
          +
            +
          • mq_maxmsg. Max number of messages in queue. +
          • mq_msgsize. Max message size. +
          • mq_flags. Queue flags. +
          • mq_curmsgs. Number of messages currently in queue. +
          -
        +
      -

      -Returned Values: -

        -
      • 0 (OK) if attributes provided, -1 (ERROR) otherwise. -
      +

      +Returned Values: +

        +
      • 0 (OK) if attributes provided, -1 (ERROR) otherwise. +
      -

      -Assumptions/Limitations: -

      - POSIX Compatibility: Comparable to the POSIX +

      +Assumptions/Limitations: +

      + POSIX Compatibility: Comparable to the POSIX interface of the same name. -

      2.5 Counting Semaphore Interfaces

      +

      2.5 Counting Semaphore Interfaces

      Semaphores. Semaphores are the basis for @@ -1385,16 +1419,16 @@ interface of the same name. and, as a result, can adversely affect system response times.

      - Priority Inversion. Proper use of semaphores avoids the issues of + Priority Inversion. Proper use of semaphores avoids the issues of sched_lock(). However, consider the following example:

        -
      1. Some low-priority task, Task C, acquires a semphore in order to +
      2. Some low-priority task, Task C, acquires a semphore in order to get exclusive access to a protected resource.
      3. -
      4. Task C is suspended to allow some high-priority task,
      5. +
      6. Task C is suspended to allow some high-priority task,
      7. Task A, to execute. -
      8. Task A attempts to acquire the semaphore held by Task C and +
      9. Task A attempts to acquire the semaphore held by Task C and gets blocked until Task C relinquishes the semaphore.
      10. -
      11. Task C is allowed to execute again, but gets suspended by some +
      12. Task C is allowed to execute again, but gets suspended by some medium-priority Task B.

      @@ -1413,13 +1447,13 @@ interface of the same name. provide implementations that will not suffer from priority inversion. The designer may, as examples:

      -
        -
      • Implement all tasks that need the semphore-managed resources at the +
          +
        • Implement all tasks that need the semphore-managed resources at the same priority level,
        • -
        • Boost the priority of the low-priority task before the semaphore is +
        • Boost the priority of the low-priority task before the semaphore is acquired, or
        • -
        • Use sched_lock() in the low-priority task.
        • -
        +
      • Use sched_lock() in the low-priority task.
      • +

      POSIX semaphore interfaces:

      @@ -1437,413 +1471,413 @@ interface of the same name.

      2.5.1 sem_init

      -

      -Function Prototype: +

      +Function Prototype:

           #include <semaphore.h>
           int sem_init ( sem_t *sem, int pshared, unsigned int value );
       
      -

      -Description: This function initializes the UN-NAMED semaphore +

      +Description: This function initializes the UN-NAMED semaphore sem. Following a successful call to sem_init(), the semaphore may be used in subsequent calls to sem_wait(), sem_post(), and sem_trywait(). The semaphore remains usable until it is destroyed. -

      +

      Only sem itself may be used for performing synchronization. The result of referring to copies of sem in calls to sem_wait(), sem_trywait(), sem_post(), and sem_destroy(), is not defined. -

      -Input Parameters: -

        -
      • sem. Semaphore to be initialized -
      • pshared. Process sharing (not used) -
      • value. Semaphore initialization value -
      +

      +Input Parameters: +

        +
      • sem. Semaphore to be initialized +
      • pshared. Process sharing (not used) +
      • value. Semaphore initialization value +
      -

      -Returned Values: -

        -
      • 0 (OK), or -1 (ERROR) if unsuccessful. -
      +

      +Returned Values: +

        +
      • 0 (OK), or -1 (ERROR) if unsuccessful. +
      -

      -Assumptions/Limitations: -

      - POSIX Compatibility: Comparable to the POSIX +

      +Assumptions/Limitations: +

      + POSIX Compatibility: Comparable to the POSIX interface of the same name. Differences from the full POSIX implementation include: -

        -
      • pshared is not used. -
      +
        +
      • pshared is not used. +

      2.5.2 sem_destroy

      -

      -Function Prototype: +

      +Function Prototype:

           #include <semaphore.h>
           int sem_destroy ( sem_t *sem );
       
      -

      -Description: This function is used to destroy the un-named semaphore +

      +Description: This function is used to destroy the un-named semaphore indicated by sem. Only a semaphore that was created using sem_init() may be destroyed using sem_destroy(). The effect of calling sem_destroy() with a named semaphore is undefined. The effect of subsequent use of the semaphore sem is undefined until sem is re-initialized by another call to sem_init(). -

      +

      The effect of destroying a semaphore upon which other tasks are currently blocked is undefined. -

      -Input Parameters: -

        -
      • sem. Semaphore to be destroyed. -
      +

      +Input Parameters: +

        +
      • sem. Semaphore to be destroyed. +
      -

      -Returned Values: -

        -
      • 0 (OK), or -1 (ERROR) if unsuccessful. -
      +

      +Returned Values: +

        +
      • 0 (OK), or -1 (ERROR) if unsuccessful. +
      -

      -Assumptions/Limitations: -

      - POSIX Compatibility: Comparable to the POSIX +

      +Assumptions/Limitations: +

      + POSIX Compatibility: Comparable to the POSIX interface of the same name.

      2.5.3 sem_open

      -

      -Function Prototype: +

      +Function Prototype:

           #include <semaphore.h>
           sem_t *sem_open ( const char *name, int oflag, ...);
       
      -

      -Description: This function establishes a connection between +

      +Description: This function establishes a connection between named semaphores and a task. Following a call to sem_open() with the semaphore name, the task may reference the semaphore associated with name using the address returned by this call. The semaphore may be used in subsequent calls to sem_wait(), sem_trywait(), and sem_post(). The semaphore remains usable until the semaphore is closed by a successful call to sem_close(). -

      +

      If a task makes multiple calls to sem_open() with the same name, then the same semaphore address is returned (provided there have been no calls to sem_unlink()). -

      -Input Parameters: -

        -
      • name. Semaphore name -
      • oflag. Semaphore creation options. This may one of +

        +Input Parameters: +

          +
        • name. Semaphore name +
        • oflag. Semaphore creation options. This may one of the following bit settings: -
            -
          • oflag = 0: Connect to the semaphore only if it already +
              +
            • oflag = 0: Connect to the semaphore only if it already exists. -
            • oflag = O_CREAT: Connect to the semaphore if it exists, +
            • oflag = O_CREAT: Connect to the semaphore if it exists, otherwise create the semaphore. -
            • oflag = O_CREAT with O_EXCL (O_CREAT|O_EXCL): Create +
            • oflag = O_CREAT with O_EXCL (O_CREAT|O_EXCL): Create a new semaphore unless one of this name already exists. -
            -
          • ... Optional parameters. +
          +
        • ... Optional parameters. NOTE: When the O_CREAT flag is specified, POSIX requires that a third and fourth parameter be supplied: -
            -
          • mode. The mode parameter is of type mode_t. +
              +
            • mode. The mode parameter is of type mode_t. This parameter is required but not used in the present implementation. -
            • value. The value parameter is type unsigned int. The semaphore +
            • value. The value parameter is type unsigned int. The semaphore is created with an initial value of value. Valid initial values for semaphores must be less than or equal to SEM_VALUE_MAX (defined in include/limits.h). -
            -
          +
        +
      -

      -Returned Values: -

        -
      • A pointer to sem_t or -1 (ERROR) if unsuccessful. -
      +

      +Returned Values: +

        +
      • A pointer to sem_t or -1 (ERROR) if unsuccessful. +
      -

      -Assumptions/Limitations: -

      - POSIX Compatibility: Comparable to the POSIX +

      +Assumptions/Limitations: +

      + POSIX Compatibility: Comparable to the POSIX interface of the same name. Differences from the full POSIX implementation include: -

        -
      • Treatment of links/connections is highly simplified. It is +
          +
        • Treatment of links/connections is highly simplified. It is just a counting semaphore. -
        +

      2.5.4 sem_close

      -

      -Function Prototype: +

      +Function Prototype:

           #include <semaphore.h>
           int sem_close ( sem_t *sem );
       
      -

      -Description: This function is called to indicate that the +

      +Description: This function is called to indicate that the calling task is finished with the specified named semaphore, sem. The sem_close() deallocates any system resources allocated by the system for this named semaphore. -

      +

      If the semaphore has not been removed with a call to sem_unlink(), then sem_close() has no effect on the named semaphore. However, when the named semaphore has been fully unlinked, the semaphore will vanish when the last task closes it. -

      +

      Care must be taken to avoid risking the deletion of a semaphore that another calling task has already locked. -

      -Input Parameters: -

        -
      • sem. Semaphore descriptor -
      +

      +Input Parameters: +

        +
      • sem. Semaphore descriptor +
      -

      -Returned Values: -

        -
      • 0 (OK), or -1 (ERROR) if unsuccessful. -
      +

      +Returned Values: +

        +
      • 0 (OK), or -1 (ERROR) if unsuccessful. +
      -

      -Assumptions/Limitations: -

        -
      • Care must be taken to avoid deletion of a semaphore that another task +

        +Assumptions/Limitations: +

          +
        • Care must be taken to avoid deletion of a semaphore that another task has already locked. -
        • sem_close() must not be called with an un-named semaphore. -
        -

        - POSIX Compatibility: Comparable to the POSIX +

      • sem_close() must not be called with an un-named semaphore. +
      +

      + POSIX Compatibility: Comparable to the POSIX interface of the same name.

      2.5.5 sem_unlink

      -

      -Function Prototype: +

      +Function Prototype:

           #include <semaphore.h>
           int sem_unlink ( const char *name );
       
      -

      -Description: This function will remove the semaphore named by the +

      +Description: This function will remove the semaphore named by the input name parameter. If one or more tasks have the semaphore named by name oepn when sem_unlink() is called, destruction of the semaphore will be postponed until all references have been destroyed by calls to sem_close(). -

      -Input Parameters: -

        -
      • name. Semaphore name -
      +

      +Input Parameters: +

        +
      • name. Semaphore name +
      -

      -Returned Values: -

        -
      • 0 (OK), or -1 (ERROR) if unsuccessful. -
      +

      +Returned Values: +

        +
      • 0 (OK), or -1 (ERROR) if unsuccessful. +
      -

      -Assumptions/Limitations: -

        -
      • Care must be taken to avoid deletion of a semaphore that another task +

        +Assumptions/Limitations: +

          +
        • Care must be taken to avoid deletion of a semaphore that another task has already locked. -
        • sem_unlink() must not be called with an un-named semaphore. -
        -

        - POSIX Compatibility: Comparable to the POSIX +

      • sem_unlink() must not be called with an un-named semaphore. +
      +

      + POSIX Compatibility: Comparable to the POSIX interface of the same name. Differences from the full POSIX implementation include: -

        -
      • Treatment of links/connections is highly simplified. It is +
          +
        • Treatment of links/connections is highly simplified. It is just a counting semaphore. -
        • Calls to sem_open() to re-create or re-connect to the semaphore may +
        • Calls to sem_open() to re-create or re-connect to the semaphore may refer to the same semaphore; POSIX specifies that a new semaphore with the same name should be created after sem_unlink() is called. -
        +

      2.5.6 sem_wait

      -

      -Function Prototype: +

      +Function Prototype:

           #include <semaphore.h>
           int sem_wait ( sem_t *sem );
       
      -

      -Description: This function attempts to lock the semaphore +

      +Description: This function attempts to lock the semaphore referenced by sem. If the semaphore as already locked by another task, the calling task will not return until it either successfully acquires the lock or the call is interrupted by a signal. -

      -Input Parameters: -

        -
      • sem. Semaphore descriptor. -
      +

      +Input Parameters: +

        +
      • sem. Semaphore descriptor. +
      -

      -Returned Values: -

        -
      • 0 (OK), or -1 (ERROR) is unsuccessful -
      -

      +

      +Returned Values: +

        +
      • 0 (OK), or -1 (ERROR) is unsuccessful +
      +

      If sem_wait returns -1 (ERROR) then the cause of the failure will be indicated by the thread-specific errno value (a pointer to this value can be obtained using get_errno_ptr()). The following lists the possible values for errno: -

      -

        -
      • EINVAL: Indicates that the sem input parameter is +

        +

          +
        • EINVAL: Indicates that the sem input parameter is not valid. -
        • EINTR: Indicates that the wait was interrupt by a signal +
        • EINTR: Indicates that the wait was interrupt by a signal received by this task. In this case, the semaphore has not be acquired. -
        -

        -Assumptions/Limitations: -

        - POSIX Compatibility: Comparable to the POSIX +

      +

      +Assumptions/Limitations: +

      + POSIX Compatibility: Comparable to the POSIX interface of the same name.

      2.5.7 sem_trywait

      -

      -Function Prototype: +

      +Function Prototype:

           #include <semaphore.h>
           int sem_trywait ( sem_t *sem );
       
      -

      -Description: This function locks the specified semaphore +

      +Description: This function locks the specified semaphore only if the semaphore is currently not locked. In any event, the call returns without blocking. -

      -Input Parameters: -

        -
      • sem. The semaphore descriptor -
      +

      +Input Parameters: +

        +
      • sem. The semaphore descriptor +
      -

      -Returned Values: -

        -
      • 0 (OK) or -1 (ERROR) if unsuccessful -
      +

      +Returned Values: +

        +
      • 0 (OK) or -1 (ERROR) if unsuccessful +
      If sem_wait returns -1 (ERROR) then the cause of the failure will be indicated by the thread-specific errno value (a pointer to this value can be obtained using get_errno_ptr()). The following lists the possible values for errno: -

      -

        -
      • EINVAL: Indicates that the sem input parameter is +

        +

          +
        • EINVAL: Indicates that the sem input parameter is not valid. -
        • EAGAIN: Indicates that the semaphore was not acquired. -
        -

        +

      • EAGAIN: Indicates that the semaphore was not acquired. +
      +

      -

      -Assumptions/Limitations: -

      - POSIX Compatibility: Comparable to the POSIX +

      +Assumptions/Limitations: +

      + POSIX Compatibility: Comparable to the POSIX interface of the same name.

      2.5.8 sem_post

      -

      -Function Prototype: +

      +Function Prototype:

           #include <semaphore.h>
           int sem_post ( sem_t *sem );
       
      -

      -Description: When a task has finished with a semaphore, +

      +Description: When a task has finished with a semaphore, it will call sem_post(). This function unlocks the semaphore referenced by sem by performing the semaphore unlock operation. -

      +

      If the semaphore value resulting from this operation is positive, then no tasks were blocked waiting for the semaphore to become unlocked; The semaphore value is simply incremented. -

      +

      If the value of the semaphore resulting from this operation is zero, then on of the tasks blocked waiting for the semaphore will be allowed to return successfully from its call to sem_wait(). -

      -NOTE: sem_post() may be called from an interrupt handler. -

      -Input Parameters: -

        -
      • sem. Semaphore descriptor -
      +

      +NOTE: sem_post() may be called from an interrupt handler. +

      +Input Parameters: +

        +
      • sem. Semaphore descriptor +
      -

      -Returned Values: -

        -
      • 0 (OK) or -1 (ERROR) if unsuccessful. -
      +

      +Returned Values: +

        +
      • 0 (OK) or -1 (ERROR) if unsuccessful. +
      -

      -Assumptions/Limitations: This function cannot be called +

      +Assumptions/Limitations: This function cannot be called from an interrupt handler. It assumes the currently executing task is the one that is performing the unlock. -

      - POSIX Compatibility: Comparable to the POSIX +

      + POSIX Compatibility: Comparable to the POSIX interface of the same name.

      2.5.9 sem_getvalue

      -

      -Function Prototype: +

      +Function Prototype:

           #include <semaphore.h>
           int sem_getvalue ( sem_t *sem, int *sval );
       
      -

      -Description: This function updates the location referenced +

      +Description: This function updates the location referenced by sval argument to have the value of the semaphore referenced by sem without effecting the state of the semaphore. The updated value represents the actual semaphore value that occurred at some unspecified time during the call, but may not reflect the actual value of the semaphore when it is returned to the calling task. -

      +

      If sem is locked, the value return by sem_getvalue() will either be zero or a negative number whose absolute value represents the number of tasks waiting for the semaphore. -

      -Input Parameters: -

        -
      • sem. Semaphore descriptor -
      • sval. Buffer by which the value is returned -
      +

      +Input Parameters: +

        +
      • sem. Semaphore descriptor +
      • sval. Buffer by which the value is returned +
      -

      -Returned Values: -

        -
      • 0 (OK) or -1 (ERROR) if unsuccessful. -
      +

      +Returned Values: +

        +
      • 0 (OK) or -1 (ERROR) if unsuccessful. +
      -

      -Assumptions/Limitations: -

      - POSIX Compatibility: Comparable to the POSIX +

      +Assumptions/Limitations: +

      + POSIX Compatibility: Comparable to the POSIX interface of the same name. -


      +
      -

      2.6 Watchdog Timer Interfaces

      +

      2.6 Watchdog Timer Interfaces

      -

      +

      NuttX provides a general watchdog timer facility. This facility allows the NuttX user to specify a watchdog timer function that will run after a specified delay. @@ -1861,174 +1895,174 @@ interface of the same name.

      2.6.1 wd_create

      -

      -Function Prototype: +

      +Function Prototype:

           #include <wdog.h>
           WDOG_ID wd_create (void);
       
      -

      -Description: The wd_create function will create a watchdog +

      +Description: The wd_create function will create a watchdog by allocating the appropriate resources for the watchdog. -

      -Input Parameters: None. -

      -Returned Values: -

        -
      • Pointer to watchdog that may be used as a handle in subsequent +

        +Input Parameters: None. +

        +Returned Values: +

          +
        • Pointer to watchdog that may be used as a handle in subsequent NuttX calls (i.e., the watchdog ID), or NULL if insufficient resources are available to create the watchdogs. -
        +
      -

      -Assumptions/Limitations: -

      - POSIX Compatibility: This is a NON-POSIX interface. +

      +Assumptions/Limitations: +

      + POSIX Compatibility: This is a NON-POSIX interface. VxWorks provides the following comparable interface:

           WDOG_ID wdCreate (void);
       
      -

      +

      Differences from the VxWorks interface include: -

        -
      • The number of available watchdogs is fixed (configured at +
          +
        • The number of available watchdogs is fixed (configured at initialization time). -
        +

      2.6.2 wd_delete

      -

      -Function Prototype: +

      +Function Prototype:

           #include <wdog.h>
           STATUS wd_delete (WDOG_ID wdog);
       
      -

      -Description: The wd_delete function will deallocate a +

      +Description: The wd_delete function will deallocate a watchdog. The watchdog will be removed from the timer queue if has been started. -

      -Input Parameters: -

        -
      • wdog. The watchdog ID to delete. This is actually a +

        +Input Parameters: +

          +
        • wdog. The watchdog ID to delete. This is actually a pointer to a watchdog structure. -
        +
      -

      -Returned Values: -

        -
      • OK or ERROR -
      +

      +Returned Values: +

        +
      • OK or ERROR +
      -

      -Assumptions/Limitations: It is the responsibility of the +

      +Assumptions/Limitations: It is the responsibility of the caller to assure that the watchdog is inactive before deleting it. -

      - POSIX Compatibility: This is a NON-POSIX interface. +

      + POSIX Compatibility: This is a NON-POSIX interface. VxWorks provides the following comparable interface:

           STATUS wdDelete (WDOG_ID wdog);
       
      -

      +

      Differences from the VxWorks interface include: -

        -
      • Does not make any checks to see if the watchdog is being used +
          +
        • Does not make any checks to see if the watchdog is being used before de-allocating it (i.e., never returns ERROR). -
        +

      2.6.3 wd_start

      -

      -Function Prototype: +

      +Function Prototype:

           #include <wdog.h>
           STATUS wd_start( WDOG_ID wdog, int delay, wdentry_t wdentry,
                            intt argc, ....);
       
      -

      -Description: This function adds a watchdog to the timer +

      +Description: This function adds a watchdog to the timer queue. The specified watchdog function will be called from the interrupt level after the specified number of ticks has elapsed. Watchdog timers may be started from the interrupt level. -

      +

      Watchdog times execute in the context of the timer interrupt handler, but with the PIC/PID address environment that was in place when wd_start() was called. -

      +

      Watchdog timers execute only once. -

      +

      To replace either the timeout delay or the function to be executed, call wd_start again with the same wdog; only the most recent wd_start() on a given watchdog ID has any effect. -

      -Input Parameters: -

        -
      • wdog. Watchdog ID -
      • delay. Delay count in clock ticks -
      • wdentry. Function to call on timeout -
      • argc. The number of uint32 parameters to pass to wdentry. -
      • .... uint32 size parameters to pass to wdentry -
      +

      +Input Parameters: +

        +
      • wdog. Watchdog ID +
      • delay. Delay count in clock ticks +
      • wdentry. Function to call on timeout +
      • argc. The number of uint32 parameters to pass to wdentry. +
      • .... uint32 size parameters to pass to wdentry +
      -

      -Returned Values: -

        -
      • OK or ERROR -
      +

      +Returned Values: +

        +
      • OK or ERROR +
      -

      -Assumptions/Limitations: The watchdog routine runs in the +

      +Assumptions/Limitations: The watchdog routine runs in the context of the timer interrupt handler and is subject to all ISR restrictions. -

      - POSIX Compatibility: This is a NON-POSIX interface. +

      + POSIX Compatibility: This is a NON-POSIX interface. VxWorks provides the following comparable interface:

           STATUS wdStart (WDOG_ID wdog, int delay, FUNCPTR wdentry, int parameter);
       
      -

      +

      Differences from the VxWorks interface include: -

        -
      • The present implementation supports multiple parameters passed +
          +
        • The present implementation supports multiple parameters passed to wdentry; VxWorks supports only a single parameter. The maximum number of parameters is determined by -
        +

      2.6.4 wd_cancel

      -

      -Function Prototype: +

      +Function Prototype:

           #include <wdog.h>
           STATUS wd_cancel (WDOG_ID wdog);
       
      -

      -Description: This function cancels a currently running +

      +Description: This function cancels a currently running watchdog timer. Watchdog timers may be canceled from the interrupt level. -

      -Input Parameters: -

        -
      • wdog. ID of the watchdog to cancel. -
      +

      +Input Parameters: +

        +
      • wdog. ID of the watchdog to cancel. +
      -

      -Returned Values: -

        -
      • OK or ERROR -
      +

      +Returned Values: +

        +
      • OK or ERROR +
      -

      -Assumptions/Limitations: -

      - POSIX Compatibility: This is a NON-POSIX interface. +

      +Assumptions/Limitations: +

      + POSIX Compatibility: This is a NON-POSIX interface. VxWorks provides the following comparable interface:

           STATUS wdCancel (WDOG_ID wdog);
      @@ -2058,9 +2092,9 @@ VxWorks provides the following comparable interface:
         means either that wdog is not valid or that the wdog has already expired.
       

      -
      +
      -

      2.7 Clocks and Timers

      +

      2.7 Clocks and Timers

      -

      2.7.1 clock_settime

      +

      2.7.1 clock_settime

      Function Prototype:

      @@ -2100,10 +2134,10 @@ VxWorks provides the following comparable interface: Otherwise, an non-zero error number will be returned to indicate the error:

        -
      • Exxx.
      • +
      • To be provided.
      -

      2.7.2 clock_gettime

      +

      2.7.2 clock_gettime

      Function Prototype:

      @@ -2128,10 +2162,10 @@ VxWorks provides the following comparable interface: Otherwise, an non-zero error number will be returned to indicate the error:

        -
      • Exxx.
      • +
      • To be provided.
      -

      2.7.3 clock_getres

      +

      2.7.3 clock_getres

      Function Prototype:

      @@ -2156,10 +2190,10 @@ VxWorks provides the following comparable interface: Otherwise, an non-zero error number will be returned to indicate the error:

        -
      • Exxx.
      • +
      • To be provided.
      -

      2.7.4 mktime

      +

      2.7.4 mktime

      Function Prototype:

      @@ -2184,10 +2218,10 @@ VxWorks provides the following comparable interface: Otherwise, an non-zero error number will be returned to indicate the error:

        -
      • Exxx.
      • +
      • To be provided.
      -

      2.7.5 gmtime_r

      +

      2.7.5 gmtime_r

      Function Prototype:

      @@ -2212,16 +2246,16 @@ VxWorks provides the following comparable interface: Otherwise, an non-zero error number will be returned to indicate the error:

        -
      • Exxx.
      • +
      • To be provided.
      -

      2.7.6 localtime_r

      +

      2.7.6 localtime_r

           #include <time.h>
           #define localtime_r(c,r) gmtime_r(c,r)
       
      -

      2.7.7 timer_create

      +

      2.7.7 timer_create

      Function Prototype:

      @@ -2291,7 +2325,7 @@ VxWorks provides the following comparable interface:
    • Only CLOCK_REALTIME is supported for the clockid argument.
    -

    2.7.8 timer_delete

    +

    2.7.8 timer_delete

    Function Prototype:

    @@ -2329,7 +2363,7 @@ VxWorks provides the following comparable interface: Comparable to the POSIX interface of the same name.

    -

    2.7.9 timer_settime

    +

    2.7.9 timer_settime

    Function Prototype:

    @@ -2411,7 +2445,7 @@ VxWorks provides the following comparable interface:
  • The ovalue argument is ignored.
  • -

    2.7.10 timer_gettime

    +

    2.7.10 timer_gettime

    Function Prototype:

    @@ -2458,7 +2492,7 @@ VxWorks provides the following comparable interface: Comparable to the POSIX interface of the same name.

    -

    2.7.11 timer_getoverrun

    +

    2.7.11 timer_getoverrun

    Function Prototype:

    @@ -2513,14 +2547,14 @@ VxWorks provides the following comparable interface:
  • This interface is not currently implemented by NuttX.
  • -Assumptions/Limitations: -

    -POSIX Compatibility: Comparable to the POSIX +Assumptions/Limitations: +

    +POSIX Compatibility: Comparable to the POSIX interface of the same name. -


    +
    -

    2.8 Signal Interfaces

    +

    2.8 Signal Interfaces

    NuttX provides signal interfaces for tasks. Signals are used to @@ -2563,412 +2597,412 @@ interface of the same name.

    2.8.1 sigemptyset

    -

    -Function Prototype: +

    +Function Prototype:

         #include <signal.h>
         int sigemptyset(sigset_t *set);
     
    -

    -Description: This function initializes the signal set specified +

    +Description: This function initializes the signal set specified by set such that all signals are excluded. -

    -Input Parameters: -

      -
    • set. Signal set to initialize. -
    +

    +Input Parameters: +

      +
    • set. Signal set to initialize. +
    -

    -Returned Values: -

      -
    • 0 (OK), or -1 (ERROR) if the signal set cannot be initialized. -
    +

    +Returned Values: +

      +
    • 0 (OK), or -1 (ERROR) if the signal set cannot be initialized. +
    -

    -Assumptions/Limitations: -

    - POSIX Compatibility: Comparable to the POSIX +

    +Assumptions/Limitations: +

    + POSIX Compatibility: Comparable to the POSIX interface of the same name.

    2.8.2 sigfillset

    -

    -Function Prototype: +

    +Function Prototype:

         #include <signal.h>
         int sigfillset(sigset_t *set);
     
    -

    -Description: This function initializes the signal set specified +

    +Description: This function initializes the signal set specified by set such that all signals are included. -

    -Input Parameters: -

      -
    • set. Signal set to initialize -
    +

    +Input Parameters: +

      +
    • set. Signal set to initialize +
    -

    -Returned Values: -

      -
    • 0 (OK), or -1 (ERROR) if the signal set cannot be initialized. -
    +

    +Returned Values: +

      +
    • 0 (OK), or -1 (ERROR) if the signal set cannot be initialized. +
    -

    -Assumptions/Limitations: -

    - POSIX Compatibility: Comparable to the POSIX +

    +Assumptions/Limitations: +

    + POSIX Compatibility: Comparable to the POSIX interface of the same name.

    2.8.3 sigaddset

    -

    -Function Prototype: +

    +Function Prototype:

         #include <signal.h>
         int sigaddset(sigset_t *set, int signo);
     
    -

    -Description: This function adds the signal specified by +

    +Description: This function adds the signal specified by signo to the signal set specified by set. -

    -Input Parameters: -

      -
    • set. Signal set to add signal to -
    • signo. Signal to add -
    +

    +Input Parameters: +

      +
    • set. Signal set to add signal to +
    • signo. Signal to add +
    -

    -Returned Values: -

      -
    • 0 (OK), or -1 (ERROR) if the signal number is invalid. -
    +

    +Returned Values: +

      +
    • 0 (OK), or -1 (ERROR) if the signal number is invalid. +
    -

    -Assumptions/Limitations: -

    - POSIX Compatibility: Comparable to the POSIX +

    +Assumptions/Limitations: +

    + POSIX Compatibility: Comparable to the POSIX interface of the same name.

    2.8.4 sigdelset

    -

    -Function Prototype: +

    +Function Prototype:

         #include <signal.h>
         int sigdelset(sigset_t *set, int signo);
     
    -

    -Description: This function deletes the signal specified +

    +Description: This function deletes the signal specified by signo from the signal set specified by set. -

    -Input Parameters: -

      -
    • set. Signal set to delete the signal from -
    • signo. Signal to delete -
    +

    +Input Parameters: +

      +
    • set. Signal set to delete the signal from +
    • signo. Signal to delete +
    -

    -Returned Values: -

      -
    • 0 (OK), or -1 (ERROR) if the signal number is invalid. -
    +

    +Returned Values: +

      +
    • 0 (OK), or -1 (ERROR) if the signal number is invalid. +
    -

    -Assumptions/Limitations: -

    - POSIX Compatibility: Comparable to the POSIX +

    +Assumptions/Limitations: +

    + POSIX Compatibility: Comparable to the POSIX interface of the same name.

    2.8.5 sigismember

    -

    -Function Prototype: +

    +Function Prototype:

         #include <signal.h>
         int  sigismember(const sigset_t *set, int signo);
     
    -

    -Description: This function tests whether the signal specified +

    +Description: This function tests whether the signal specified by signo is a member of the set specified by set. -

    -Input Parameters: -

      -
    • set. Signal set to test -
    • signo. Signal to test for -
    +

    +Input Parameters: +

      +
    • set. Signal set to test +
    • signo. Signal to test for +
    -

    -Returned Values: -

      -
    • 1 (TRUE), if the specified signal is a member of the set, -
    • 0 (OK or FALSE), if it is not, or -
    • -1 (ERROR) if the signal number is invalid. -
    +

    +Returned Values: +

      +
    • 1 (TRUE), if the specified signal is a member of the set, +
    • 0 (OK or FALSE), if it is not, or +
    • -1 (ERROR) if the signal number is invalid. +
    -

    -Assumptions/Limitations: -

    - POSIX Compatibility: Comparable to the POSIX +

    +Assumptions/Limitations: +

    + POSIX Compatibility: Comparable to the POSIX interface of the same name.

    2.8.6 sigaction

    -

    -Function Prototype: +

    +Function Prototype:

         #include <signal.h>
         int sigaction( int signo, const struct sigaction *act,
                        struct sigaction *oact );
     
    -

    -Description: This function allows the calling task to +

    +Description: This function allows the calling task to examine and/or specify the action to be associated with a specific signal. -

    +

    The structure sigaction, used to describe an action to be taken, is defined to include the following members: -

      -
    • sa_u.sa_handler. A pointer to a signal-catching function. -
    • sa_u.sa_sigaction. An alternative form for the signal catching +
        +
      • sa_u.sa_handler. A pointer to a signal-catching function. +
      • sa_u.sa_sigaction. An alternative form for the signal catching function. -
      • sa_mask. Additional set of signals to be blocked during +
      • sa_mask. Additional set of signals to be blocked during execution of the signal-catching function. -
      • sa_flags: Special flags to affect behavior of a signal. -
      -

      +

    • sa_flags: Special flags to affect behavior of a signal. +
    +

    If the argument act is not NULL, it points to a structure specifying the action to be associated with the specified signal. If the argument oact is not NULL, the action previously associated with the signal is stored in the location pointed to by the argument oact. If the argument act is NULL, signal handling is unchanged by this function call; thus, the call can be used to enquire about the current handling of a given signal. -

    +

    When a signal is caught by a signal-catching function installed by the sigaction() function, a new signal mask is calculated and installed for the duration of the signal-catching function. This mask is formed by taking the union of the current signal mask and the value of the sa_mask for the signal being delivered, and then including the signal being delivered. If and when the signal handler returns, the original signal mask is restored. -

    +

    Signal catching functions execute in the same address environment as the task that called sigaction() to install the signal-catching function. -

    +

    Once an action is installed for a specific signal, it remains installed until another action is explicitly requested by another call to sigaction(). -

    -Input Parameters: -

      -
    • sig. Signal of interest -
    • act. Location of new handler -
    • oact. Location to store old handler -
    +

    +Input Parameters: +

      +
    • sig. Signal of interest +
    • act. Location of new handler +
    • oact. Location to store old handler +
    -

    -Returned Values: -

      -
    • 0 (OK), or -1 (ERROR) if the signal number is invalid. -
    +

    +Returned Values: +

      +
    • 0 (OK), or -1 (ERROR) if the signal number is invalid. +
    -

    -Assumptions/Limitations: -

    - POSIX Compatibility: Comparable to the POSIX +

    +Assumptions/Limitations: +

    + POSIX Compatibility: Comparable to the POSIX interface of the same name. Differences from the POSIX implementation include: -

      -
    • Special values of sa_handler in the struct sigaction act input +
        +
      • Special values of sa_handler in the struct sigaction act input not handled (SIG_DFL, SIG_IGN). -
      • All sa_flags in struct sigaction of act input are ignored +
      • All sa_flags in struct sigaction of act input are ignored (all treated like SA_SIGINFO). -
      +

    2.8.7 sigprocmask

    -

    -Function Prototype: +

    +Function Prototype:

         #include <signal.h>
         int sigprocmask(int how, const sigset_t *set, sigset_t *oset);
     
    -

    -Description: This function allows the calling task to +

    +Description: This function allows the calling task to examine and/or change its signal mask. If the set is not NULL, then it points to a set of signals to be used to change the currently blocked set. The value of how indicates the manner in which the set is changed. -

    +

    If there are any pending unblocked signals after the call to sigprocmask(), those signals will be delivered before sigprocmask() returns. -

    +

    If sigprocmask() fails, the signal mask of the task is not changed. -

    -Input Parameters: -

      -
    • how. How the signal mast will be changed: -
        -
      • osSIG_BLOCK. The resulting set is the union of the +

        +Input Parameters: +

          +
        • how. How the signal mast will be changed: +
            +
          • osSIG_BLOCK. The resulting set is the union of the current set and the signal set pointed to by the set input parameter. -
          • osSIG_UNBLOCK. The resulting set is the intersection +
          • osSIG_UNBLOCK. The resulting set is the intersection of the current set and the complement of the signal set pointed to by the set input parameter. -
          • osSIG_SETMASK. The resulting set is the signal set +
          • osSIG_SETMASK. The resulting set is the signal set pointed to by the set input parameter. -
          +
        -
      • set. Location of the new signal mask -
      • oset. Location to store the old signal mask -
      +
    • set. Location of the new signal mask +
    • oset. Location to store the old signal mask +
    -

    -Returned Values: -

      -
    • 0 (OK), or -1 (ERROR) if how is invalid. -
    +

    +Returned Values: +

      +
    • 0 (OK), or -1 (ERROR) if how is invalid. +
    -

    -Assumptions/Limitations: -

    - POSIX Compatibility: Comparable to the POSIX +

    +Assumptions/Limitations: +

    + POSIX Compatibility: Comparable to the POSIX interface of the same name.

    2.8.8 sigpending

    -

    -Function Prototype: +

    +Function Prototype:

         #include <signal.h>
         int sigpending( sigset_t *set );
     
    -

    -Description: This function stores the returns the set of +

    +Description: This function stores the returns the set of signals that are blocked for delivery and that are pending for the calling task in the space pointed to by set. -

    +

    If the task receiving a signal has the signal blocked via its sigprocmask, the signal will pend until it is unmasked. Only one pending signal (for a given signo) is retained by the system. This is consistent with POSIX which states: "If a subsequent occurrence of a pending signal is generated, it is implementation defined as to whether the signal is delivered more than once." -

    -Input Parameters: -

      -
    • set. The location to return the pending signal set. -
    +

    +Input Parameters: +

      +
    • set. The location to return the pending signal set. +
    -

    -Returned Values: -

      -
    • 0 (OK) or -1 (ERROR) -
    +

    +Returned Values: +

      +
    • 0 (OK) or -1 (ERROR) +
    -

    -Assumptions/Limitations: -

    - POSIX Compatibility: Comparable to the POSIX +

    +Assumptions/Limitations: +

    + POSIX Compatibility: Comparable to the POSIX interface of the same name.

    2.8.9 sigsuspend

    -

    -Function Prototype: +

    +Function Prototype:

         #include <signal.h>
         int sigsuspend( const sigset_t *set );
     
    -

    -Description: The sigsuspend() function replaces the signal mask +

    +Description: The sigsuspend() function replaces the signal mask with the set of signals pointed to by the argument set and then suspends the task until delivery of a signal to the task. -

    +

    If the effect of the set argument is to unblock a pending signal, then no wait is performed. -

    +

    The original signal mask is restored when sigsuspend() returns. -

    +

    Waiting for an empty signal set stops a task without freeing any resources (a very bad idea). -

    -Input Parameters: -

      -
    • set. The value of the signal mask to use while +

      +Input Parameters: +

        +
      • set. The value of the signal mask to use while suspended. -
      +
    -

    -Returned Values: -

      -
    • -1 (ERROR) always -
    +

    +Returned Values: +

      +
    • -1 (ERROR) always +
    -

    -Assumptions/Limitations: -

    - POSIX Compatibility: Comparable to the POSIX +

    +Assumptions/Limitations: +

    + POSIX Compatibility: Comparable to the POSIX interface of the same name. Differences from the POSIX specification include: -

      -
    • POSIX does not indicate that the original signal mask is restored. -
    • POSIX states that sigsuspend() "suspends the task until +
        +
      • POSIX does not indicate that the original signal mask is restored. +
      • POSIX states that sigsuspend() "suspends the task until delivery of a signal whose action is either to execute a signal-catching function or to terminate the task." Only delivery of the signal is required in the present implementation (even if the signal is ignored). -
      +

    2.8.10 sigwaitinfo

    -

    -Function Prototype: +

    +Function Prototype:

         #include <signal.h>
         int sigwaitinfo(const sigset_t *set, struct siginfo *info);
     
    -

    -Description: This function is equivalent to sigtimedwait() +

    +Description: This function is equivalent to sigtimedwait() with a NULL timeout parameter. (see below). -

    -Input Parameters: -

      -
    • set. The set of pending signals to wait for. -
    • info. The returned signal values -
    +

    +Input Parameters: +

      +
    • set. The set of pending signals to wait for. +
    • info. The returned signal values +
    -

    -Returned Values: -

      -
    • Signal number that cause the wait to be terminated, otherwise +

      +Returned Values: +

        +
      • Signal number that cause the wait to be terminated, otherwise -1 (ERROR) is returned. -
      +
    -

    -Assumptions/Limitations: -

    - POSIX Compatibility: Comparable to the POSIX +

    +Assumptions/Limitations: +

    + POSIX Compatibility: Comparable to the POSIX interface of the same name.

    2.8.11 sigtimedwait

    -

    -Function Prototype: +

    +Function Prototype:

         #include <signal.h>
         int sigtimedwait( const sigset_t *set, struct siginfo *info,
                           const struct timespec *timeout );
     
    -

    -Description: This function selects the pending signal set +

    +Description: This function selects the pending signal set specified by the argument set. If multiple signals are pending in set, it will remove and return the lowest numbered one. If no signals in set are pending at the time of the call, the calling task will be suspended @@ -2976,85 +3010,85 @@ until one of the signals in set becomes pending OR until the task interrupted by an unblocked signal OR until the time interval specified by timeout (if any), has expired. If timeout is NULL, then the timeout interval is forever. -

    +

    If the info argument is non-NULL, the selected signal number is stored in the si_signo member and the cause of the signal is store in the si_code member. The content of si_value is only meaningful if the signal was generated by sigqueue(). The following values for si_code are defined in signal.h: -

      -
    • SI_USER. Signal sent from kill, raise, or abort -
    • SI_QUEUE. Signal sent from sigqueue -
    • SI_TIMER. Signal is result of timer expiration -
    • SI_ASYNCIO. Signal is the result of asynch IO completion -
    • SI_MESGQ. Signal generated by arrival of a message on an empty message queue. -
    +
      +
    • SI_USER. Signal sent from kill, raise, or abort +
    • SI_QUEUE. Signal sent from sigqueue +
    • SI_TIMER. Signal is result of timer expiration +
    • SI_ASYNCIO. Signal is the result of asynch IO completion +
    • SI_MESGQ. Signal generated by arrival of a message on an empty message queue. +
    -

    -Input Parameters: -

      -
    • set. The set of pending signals to wait for. -
    • info. The returned signal values -
    • timeout. The amount of time to wait -
    +

    +Input Parameters: +

      +
    • set. The set of pending signals to wait for. +
    • info. The returned signal values +
    • timeout. The amount of time to wait +
    -

    -Returned Values: -

      -
    • Signal number that cause the wait to be terminated, otherwise +

      +Returned Values: +

        +
      • Signal number that cause the wait to be terminated, otherwise -1 (ERROR) is returned. -
      +
    -

    -Assumptions/Limitations: -

    - POSIX Compatibility: Comparable to the POSIX +

    +Assumptions/Limitations: +

    + POSIX Compatibility: Comparable to the POSIX interface of the same name. Differences from the POSIX interface include: -

      -
    • Values for si_codes differ -
    • No mechanism to return cause of ERROR. (It can be inferred +
        +
      • Values for si_codes differ +
      • No mechanism to return cause of ERROR. (It can be inferred from si_code in a non-standard way). -
      • POSIX states that "If no signal is pending at the time of the +
      • POSIX states that "If no signal is pending at the time of the call, the calling task shall be suspended until one or more signals in set become pending or until it is interrupted by an unblocked, caught signal." The present implementation does not require that the unblocked signal be caught; the task will be resumed even if the unblocked signal is ignored. -
      +

    2.8.12 sigqueue

    -

    -Function Prototype: +

    +Function Prototype:

         #include <signal.h>
         int sigqueue (int tid, int signo, const union sigval value);
     
    -

    -Description: This function sends the signal specified by +

    +Description: This function sends the signal specified by signo with the signal parameter value to the task specified by tid. -

    +

    If the receiving task has the signal blocked via its sigprocmask, the signal will pend until it is unmasked. Only one pending signal (for a given signo) is retained by the system. This is consistent with POSIX which states: "If a subsequent occurrence of a pending signal is generated, it is implementation defined as to whether the signal is delivered more than once." -

    -Input Parameters: -

      -
    • tid. ID of the task to receive signal -
    • signo. Signal number -
    • value. Value to pass to task with signal -
    +

    +Input Parameters: +

      +
    • tid. ID of the task to receive signal +
    • signo. Signal number +
    • value. Value to pass to task with signal +
    -

    -Returned Values: -

      -
    • +

      +Returned Values: +

        +
      • On success (at least one signal was sent), zero (OK) is returned. On error, -1 (ERROR) is returned, and errno is set appropriately.
          @@ -3063,35 +3097,35 @@ is delivered more than once."
        • EPERM. The task does not have permission to send the signal to the receiving process.
        • ESRCH. No process has a PID matching pid.
        -
      +
    -

    -Assumptions/Limitations: -

    - POSIX Compatibility: Comparable to the POSIX +

    +Assumptions/Limitations: +

    + POSIX Compatibility: Comparable to the POSIX interface of the same name. Differences from the POSIX interface include: -

      -
    • Default action is to ignore signals. -
    • Signals are processed one at a time in order -
    • POSIX states that, "If signo is zero (the null signal), error +
        +
      • Default action is to ignore signals. +
      • Signals are processed one at a time in order +
      • POSIX states that, "If signo is zero (the null signal), error checking will be performed but no signal is actually sent." There is no null signal in the present implementation; a zero signal will be sent. -
      +

    2.8.13 kill

    -

    -Function Prototype: +

    +Function Prototype:

        #include <sys/types.h>
        #include <signal.h>
        int kill(pid_t pid, int sig);
     
    -

    -Description: +

    +Description: The kill() system call can be used to send any signal to any task.

    @@ -3111,19 +3145,19 @@ be sent. information as zero and negative pid values. Only positive, non-zero values of pid are supported by this implementation. ID of the task to receive signal -
  • signo. The signal number to send. +
  • signo. The signal number to send. If signo is zero, no signal is sent, but all error checking is performed. - +

    - Returned Values: -

      -
    • OK or ERROR -
    + Returned Values: +
      +
    • OK or ERROR +

    - Assumptions/Limitations: + Assumptions/Limitations:

    POSIX Compatibility: @@ -3136,7 +3170,7 @@ be sent.

  • Sending of signals to 'process groups' is not supported in NuttX.
  • -

    2.9 Pthread Interfaces

    +

    2.9 Pthread Interfaces

    NuttX does not support processes in the way that, say, Linux does. NuttX only supports simple threads or tasks running within the same address space. @@ -3260,437 +3294,437 @@ be sent.

  • pthread_testcancel. set cancelability state.
  • -

    2.9.1 pthread_attr_init

    -

    -Function Prototype: -

    +

    2.9.1 pthread_attr_init

    +

    +Function Prototype: +

         #include <pthread.h>
         int pthread_attr_init(pthread_attr_t *attr);
     
    -

    -Description: +

    +Description: Initializes a thread attributes object (attr) with default values for all of the individual attributes used by the implementation. -

    -Input Parameters: -

    -

      -
    • param.
    • -
    -

    -Returned Values: -

    +

    +Input Parameters: +

    +

      +
    • To be provided.
    • +
    +

    +Returned Values: +

    If successful, the pthread_attr_init() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -

    -

      -
    • Exxx.
    • -
    -Assumptions/Limitations: -

    -POSIX Compatibility: Comparable to the POSIX +

    +

      +
    • To be provided.
    • +
    +Assumptions/Limitations: +

    +POSIX Compatibility: Comparable to the POSIX interface of the same name. -

    -

    2.9.2 pthread_attr_destroy

    -

    -Function Prototype: -

    +

    +

    2.9.2 pthread_attr_destroy

    +

    +Function Prototype: +

         #include <pthread.h>
         int pthread_attr_destroy(pthread_attr_t *attr);
     
    -

    -Description: +

    +Description: An attributes object can be deleted when it is no longer needed. -

    -Input Parameters: -

    -

      -
    • param.
    • -
    -

    -Returned Values: -

    +

    +Input Parameters: +

    +

      +
    • To be provided.
    • +
    +

    +Returned Values: +

    If successful, the pthread_attr_destroy() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -

    -

      -
    • Exxx.
    • -
    -Assumptions/Limitations: -

    -POSIX Compatibility: Comparable to the POSIX +

    +

      +
    • To be provided.
    • +
    +Assumptions/Limitations: +

    +POSIX Compatibility: Comparable to the POSIX interface of the same name. -

    -

    2.9.3 pthread_attr_setschedpolicy

    -

    -Function Prototype: -

    +

    +

    2.9.3 pthread_attr_setschedpolicy

    +

    +Function Prototype: +

         #include <pthread.h>
         int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy);
     
    -

    -Description: -

    -Input Parameters: -

    -

      -
    • param.
    • -
    -

    -Returned Values: -

    +

    +Description: +

    +Input Parameters: +

    +

      +
    • To be provided.
    • +
    +

    +Returned Values: +

    If successful, the pthread_attr_setschedpolicy() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -

    -

      -
    • Exxx.
    • -
    -Assumptions/Limitations: -

    -POSIX Compatibility: Comparable to the POSIX +

    +

      +
    • To be provided.
    • +
    +Assumptions/Limitations: +

    +POSIX Compatibility: Comparable to the POSIX interface of the same name. -

    2.9.4 pthread_attr_getschedpolicy

    -

    -Function Prototype: -

    +

    2.9.4 pthread_attr_getschedpolicy

    +

    +Function Prototype: +

         #include <pthread.h>
         int pthread_attr_getschedpolicy(pthread_attr_t *attr, int *policy);
     
    -

    -Description: -

    -Input Parameters: -

    -

      -
    • param.
    • -
    -

    -Returned Values: -

    +

    +Description: +

    +Input Parameters: +

    +

      +
    • To be provided.
    • +
    +

    +Returned Values: +

    If successful, the pthread_attr_getschedpolicy() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -

    -

      -
    • Exxx.
    • -
    -Assumptions/Limitations: -

    -POSIX Compatibility: Comparable to the POSIX +

    +

      +
    • To be provided.
    • +
    +Assumptions/Limitations: +

    +POSIX Compatibility: Comparable to the POSIX interface of the same name. -

    2.9.5 pthread_attr_getschedpolicy

    -

    -Function Prototype: -

    +

    2.9.5 pthread_attr_getschedpolicy

    +

    +Function Prototype: +

        #include <pthread.h>
         int pthread_attr_setschedparam(pthread_attr_t *attr,
     				      const struct sched_param *param);
     
    -

    -Description: -

    -Input Parameters: -

    -

      -
    • param.
    • -
    -

    -Returned Values: -

    +

    +Description: +

    +Input Parameters: +

    +

      +
    • To be provided.
    • +
    +

    +Returned Values: +

    If successful, the pthread_attr_getschedpolicy() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -

    -

      -
    • Exxx.
    • -
    -Assumptions/Limitations: -

    -POSIX Compatibility: Comparable to the POSIX +

    +

      +
    • To be provided.
    • +
    +Assumptions/Limitations: +

    +POSIX Compatibility: Comparable to the POSIX interface of the same name. -

    2.9.6 pthread_attr_getschedparam

    -

    -Function Prototype: -

    +

    2.9.6 pthread_attr_getschedparam

    +

    +Function Prototype: +

        #include <pthread.h>
          int pthread_attr_getschedparam(pthread_attr_t *attr,
     				      struct sched_param *param);
     
    -

    -Description: -

    -Input Parameters: -

    -

      -
    • param.
    • -
    -

    -Returned Values: -

    +

    +Description: +

    +Input Parameters: +

    +

      +
    • To be provided.
    • +
    +

    +Returned Values: +

    If successful, the pthread_attr_getschedparam() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -

    -

      -
    • Exxx.
    • -
    -Assumptions/Limitations: -

    -POSIX Compatibility: Comparable to the POSIX +

    +

      +
    • To be provided.
    • +
    +Assumptions/Limitations: +

    +POSIX Compatibility: Comparable to the POSIX interface of the same name. -

    2.9.7 pthread_attr_setinheritsched

    -

    -Function Prototype: -

    +

    2.9.7 pthread_attr_setinheritsched

    +

    +Function Prototype: +

        #include <pthread.h>
         int pthread_attr_setinheritsched(pthread_attr_t *attr,
     					int inheritsched);
     
    -

    -Description: -

    -Input Parameters: -

    -

      -
    • param.
    • -
    -

    -Returned Values: -

    +

    +Description: +

    +Input Parameters: +

    +

      +
    • To be provided.
    • +
    +

    +Returned Values: +

    If successful, the pthread_attr_setinheritsched() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -

    -

      -
    • Exxx.
    • -
    -Assumptions/Limitations: -

    -POSIX Compatibility: Comparable to the POSIX +

    +

      +
    • To be provided.
    • +
    +Assumptions/Limitations: +

    +POSIX Compatibility: Comparable to the POSIX interface of the same name. -

    -

    2.9.8 pthread_attr_getinheritsched

    -

    -Function Prototype: -

    +

    +

    2.9.8 pthread_attr_getinheritsched

    +

    +Function Prototype: +

        #include <pthread.h>
          int pthread_attr_getinheritsched(const pthread_attr_t *attr,
     					int *inheritsched);
     
    -

    -Description: -

    -Input Parameters: -

    -

      -
    • param.
    • -
    -

    -Returned Values: -

    +

    +Description: +

    +Input Parameters: +

    +

      +
    • To be provided.
    • +
    +

    +Returned Values: +

    If successful, the pthread_attr_getinheritsched() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -

    -

      -
    • Exxx.
    • -
    -Assumptions/Limitations: -

    -POSIX Compatibility: Comparable to the POSIX +

    +

      +
    • To be provided.
    • +
    +Assumptions/Limitations: +

    +POSIX Compatibility: Comparable to the POSIX interface of the same name. -

    2.9.9 pthread_attr_setstacksize

    -

    -Function Prototype: -

    +

    2.9.9 pthread_attr_setstacksize

    +

    +Function Prototype: +

        #include <pthread.h>
         int pthread_attr_setstacksize(pthread_attr_t *attr, long stacksize);
     
    -

    -Description: -

    -Input Parameters: -

    -

      -
    • param.
    • -
    -

    -Returned Values: -

    +

    +Description: +

    +Input Parameters: +

    +

      +
    • To be provided.
    • +
    +

    +Returned Values: +

    If successful, the pthread_attr_setstacksize() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -

    -

      -
    • Exxx.
    • -
    -Assumptions/Limitations: -

    -POSIX Compatibility: Comparable to the POSIX +

    +

      +
    • To be provided.
    • +
    +Assumptions/Limitations: +

    +POSIX Compatibility: Comparable to the POSIX interface of the same name. -

    2.9.10 pthread_attr_getstacksize

    -

    -Function Prototype: -

    +

    2.9.10 pthread_attr_getstacksize

    +

    +Function Prototype: +

         #include <pthread.h>
        int pthread_attr_getstacksize(pthread_attr_t *attr, long *stackaddr);
     
    -

    -Description: -

    -Input Parameters: -

    -

      -
    • param.
    • -
    -

    -Returned Values: -

    +

    +Description: +

    +Input Parameters: +

    +

      +
    • To be provided.
    • +
    +

    +Returned Values: +

    If successful, the pthread_attr_getstacksize() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -

    -

      -
    • Exxx.
    • -
    -Assumptions/Limitations: -

    -POSIX Compatibility: Comparable to the POSIX +

    +

      +
    • To be provided.
    • +
    +Assumptions/Limitations: +

    +POSIX Compatibility: Comparable to the POSIX interface of the same name. -

    2.9.11 pthread_create

    -

    -Function Prototype: -

    +

    2.9.11 pthread_create

    +

    +Function Prototype: +

         #include <pthread.h>
         int pthread_create(pthread_t *thread, pthread_attr_t *attr,
     			  pthread_startroutine_t startRoutine,
     			  pthread_addr_t arg);
     
    -

    -Description: +

    +Description: To create a thread object and runnable thread, a routine must be specified as the new thread's start routine. An argument may be passed to this routine, as an untyped address; an untyped address may also be returned as the routine's value. An attributes object may be used to specify details about the kind of thread being created. -

    -Input Parameters: -

    -

      -
    • param.
    • -
    -

    -Returned Values: -

    +

    +Input Parameters: +

    +

      +
    • To be provided.
    • +
    +

    +Returned Values: +

    If successful, the pthread_create() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -

    -

      -
    • Exxx.
    • -
    -Assumptions/Limitations: -

    -POSIX Compatibility: Comparable to the POSIX +

    +

      +
    • To be provided.
    • +
    +Assumptions/Limitations: +

    +POSIX Compatibility: Comparable to the POSIX interface of the same name. -

    2.9.12 pthread_detach

    -

    -Function Prototype: -

    +

    2.9.12 pthread_detach

    +

    +Function Prototype: +

         #include <pthread.h>
         int pthread_detach(pthread_t thread);
     
    -

    -Description: +

    +Description: A thread object may be "detached" to specify that the return value and completion status will not be requested. -

    -Input Parameters: -

    -

      -
    • param.
    • -
    -

    -Returned Values: -

    +

    +Input Parameters: +

    +

      +
    • To be provided.
    • +
    +

    +Returned Values: +

    If successful, the pthread_detach() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -

    -

      -
    • Exxx.
    • -
    -Assumptions/Limitations: -

    -POSIX Compatibility: Comparable to the POSIX +

    +

      +
    • To be provided.
    • +
    +Assumptions/Limitations: +

    +POSIX Compatibility: Comparable to the POSIX interface of the same name. -

    2.9.13 pthread_exit

    -

    -Function Prototype: -

    +

    2.9.13 pthread_exit

    +

    +Function Prototype: +

         #include <pthread.h>
         void pthread_exit(pthread_addr_t pvValue);
     
    -

    -Description: +

    +Description: A thread may terminate it's own execution. -

    -Input Parameters: -

    -

      -
    • param.
    • -
    -

    -Returned Values: -

    +

    +Input Parameters: +

    +

      +
    • To be provided.
    • +
    +

    +Returned Values: +

    If successful, the pthread_exit() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -

    -

      -
    • Exxx.
    • -
    -Assumptions/Limitations: -

    -POSIX Compatibility: Comparable to the POSIX +

    +

      +
    • To be provided.
    • +
    +Assumptions/Limitations: +

    +POSIX Compatibility: Comparable to the POSIX interface of the same name. -

    2.9.14 pthread_cancel

    -

    -Function Prototype: -

    +

    2.9.14 pthread_cancel

    +

    +Function Prototype: +

         #include <pthread.h>
         int pthread_cancel(pthread_t thread);
     
    -

    -Description: +

    +Description:

    The pthread_cancel() function shall request that thread be canceled. The target thread's cancelability state determines @@ -3706,48 +3740,48 @@ calls pthread_testcancel().

    Cancelability is asynchronous; all cancels are acted upon immediately (when enable), interrupting the thread with its processing.

    -

    -Input Parameters: -

    -

      -
    • thread. +

      +Input Parameters: +

      +

        +
      • thread. Identifies the thread to be canceled.
      • -
      -

      -Returned Values: -

      +

    +

    +Returned Values: +

    If successful, the ptnread_cancel() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -

    -

      -
    • ESRCH. +

      +

        +
      • ESRCH. No thread could be found corresponding to that specified by the given thread ID.
      • -
      -Assumptions/Limitations: -

      -POSIX Compatibility: Comparable to the POSIX +

    +Assumptions/Limitations: +

    +POSIX Compatibility: Comparable to the POSIX interface of the same name. Except:

    -
      -
    • The thread-specific data destructor functions shall be called for thread. +
        +
      • The thread-specific data destructor functions shall be called for thread. However, these destructors are not currently supported.
      • Cancellation types are not supported. The thread will be canceled at the time that pthread_cancel() is called or, if cancelation is disabled, at the time when cancelation is re-enabled.
      • pthread_testcancel() is not supported.
      • Thread cancellation at cancellation points is not supported.
      • -
      +
    -

    2.9.15 pthread_setcancelstate

    -

    -Function Prototype: -

    +

    2.9.15 pthread_setcancelstate

    +

    +Function Prototype: +

         #include <pthread.h>
         int pthread_setcancelstate(int state, int *oldstate);
     
    -

    -Description: -

    The pthread_setcancelstate() function atomically +

    +Description: +

    The pthread_setcancelstate() function atomically sets both the calling thread's cancelability state to the indicated state and returns the previous cancelability state at the location referenced by oldstate. @@ -3756,159 +3790,159 @@ Legal values for state are PTHREAD_CANCEL_ENABLE and PTHREAD_CANCEL_DISABLE.<.li

    Any pending thread cancelation may occur at the time that the cancelation state is set to PTHREAD_CANCEL_ENABLE.

    -Input Parameters: -

    -

      -
    • state +Input Parameters: +

      +

        +
      • state New cancelation state. One of PTHREAD_CANCEL_ENABLE or PTHREAD_CANCEL_DISABLE.<.li> -
      • oldstate. +
      • oldstate. Location to return the previous cancelation state. -
      -

      -Returned Values: -

      +

    +

    +Returned Values: +

    If successful, the pthread_setcancelstate() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -

    -

      -
    • ESRCH. +

      +

        +
      • ESRCH. No thread could be found corresponding to that specified by the given thread ID.
      • -
      -Assumptions/Limitations: -

      -POSIX Compatibility: Comparable to the POSIX +

    +Assumptions/Limitations: +

    +POSIX Compatibility: Comparable to the POSIX interface of the same name. -

    2.9.16 pthread_testcancelstate

    -

    -Function Prototype: -

    +

    2.9.16 pthread_testcancelstate

    +

    +Function Prototype: +

         #include <pthread.h>
         int pthread_setcancelstate(void);
     
    -

    -Description: -

    NOT SUPPORTED -Input Parameters: -

    -

      -
    • param.
    • -
    -

    -Returned Values: -

    +

    +Description: +

    NOT SUPPORTED +Input Parameters: +

    +

      +
    • To be provided.
    • +
    +

    +Returned Values: +

    If successful, the pthread_setcancelstate() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -

    -

      -
    • Exxx.
    • -
    -Assumptions/Limitations: -

    -POSIX Compatibility: Comparable to the POSIX +

    +

      +
    • To be provided.
    • +
    +Assumptions/Limitations: +

    +POSIX Compatibility: Comparable to the POSIX interface of the same name. -

    2.9.17 pthread_join

    -

    -Function Prototype: -

    +

    2.9.17 pthread_join

    +

    +Function Prototype: +

         #include <pthread.h>
         int pthread_join(pthread_t thread, pthread_addr_t *ppvValue);
     
    -

    -Description: +

    +Description: A thread can await termination of another thread and retrieve the return value of the thread. -

    -Input Parameters: -

    -

      -
    • param.
    • -
    -

    -Returned Values: -

    +

    +Input Parameters: +

    +

      +
    • To be provided.
    • +
    +

    +Returned Values: +

    If successful, the pthread_join() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -

    -

      -
    • Exxx.
    • -
    -Assumptions/Limitations: -

    -POSIX Compatibility: Comparable to the POSIX +

    +

      +
    • To be provided.
    • +
    +Assumptions/Limitations: +

    +POSIX Compatibility: Comparable to the POSIX interface of the same name. -

    2.9.18 pthread_yield

    -

    -Function Prototype: -

    +

    2.9.18 pthread_yield

    +

    +Function Prototype: +

         #include <pthread.h>
         void pthread_yield(void);
     
    -

    -Description: +

    +Description: A thread may tell the scheduler that its processor can be made available. -

    -Input Parameters: -

    -

      -
    • param.
    • -
    -

    -Returned Values: -

    +

    +Input Parameters: +

    +

      +
    • To be provided.
    • +
    +

    +Returned Values: +

    If successful, the pthread_yield() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -

    -

      -
    • Exxx.
    • -
    -Assumptions/Limitations: -

    -POSIX Compatibility: Comparable to the POSIX +

    +

      +
    • To be provided.
    • +
    +Assumptions/Limitations: +

    +POSIX Compatibility: Comparable to the POSIX interface of the same name. -

    2.9.19 pthread_self

    -

    -Function Prototype: -

    +

    2.9.19 pthread_self

    +

    +Function Prototype: +

         #include <pthread.h>
         pthread_t pthread_self(void);
     
    -

    -Description: +

    +Description: A thread may obtain a copy of its own thread handle. -

    -Input Parameters: -

    -

      -
    • param.
    • -
    -

    -Returned Values: -

    +

    +Input Parameters: +

    +

      +
    • To be provided.
    • +
    +

    +Returned Values: +

    If successful, the pthread_self() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -

    -

      -
    • Exxx.
    • -
    -Assumptions/Limitations: -

    -POSIX Compatibility: Comparable to the POSIX +

    +

      +
    • To be provided.
    • +
    +Assumptions/Limitations: +

    +POSIX Compatibility: Comparable to the POSIX interface of the same name. -

    2.9.20 pthread_getschedparam

    +

    2.9.20 pthread_getschedparam

    Function Prototype:

    @@ -3974,7 +4008,7 @@ interface of the same name. Comparable to the POSIX interface of the same name.

    -

    2.9.21 pthread_setschedparam

    +

    2.9.21 pthread_setschedparam

    Function Prototype:

    @@ -4066,72 +4100,72 @@ interface of the same name. Comparable to the POSIX interface of the same name.

    -

    2.9.22 pthread_key_create

    -

    -Function Prototype: -

    +

    2.9.22 pthread_key_create

    +

    +Function Prototype: +

         #include <pthread.h>
         int pthread_key_create( pthread_key_t *key, void (*destructor)(void*) )
     
    -

    -Description: -

    +

    +Description: +

    This function creates a thread-specific data key visible to all threads in the system. 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 will be associated with the the new key in all active threads. Upon thread creation, the value NULL will be associated with all defined keys in the new thread. -

    -Input Parameters: -

    -

      -
    • key is a pointer to the key to create. -
    • destructor is an optional destructor() function that may +

      +Input Parameters: +

      +

        +
      • key is a pointer to the key to create. +
      • destructor is an optional destructor() function that may be associated with each key that is invoked when a thread exits. However, this argument is ignored in the current implementation. -
      -

      -Returned Values: -

      +

    +

    +Returned Values: +

    If successful, the pthread_key_create() function will store the newly created key value at *key and return zero (OK). Otherwise, an error number will be returned to indicate the error: -

    -

      -
    • EAGAIN. The system lacked sufficient resources +

      +

        +
      • EAGAIN. The system lacked sufficient resources to create another thread-specific data key, or the system-imposed limit on the total number of keys per task {PTHREAD_KEYS_MAX} has been exceeded -
      • ENONMEM Insufficient memory exists to create the key. -
      -Assumptions/Limitations: -

      -POSIX Compatibility: Comparable to the POSIX +

    • ENONMEM Insufficient memory exists to create the key. +
    +Assumptions/Limitations: +

    +POSIX Compatibility: Comparable to the POSIX interface of the same name. -

      -
    • The present implementation ignores the destructor argument. -
    +
      +
    • The present implementation ignores the destructor argument. +
    -

    2.9.23 pthread_setspecific

    -

    -Function Prototype: -

    +

    2.9.23 pthread_setspecific

    +

    +Function Prototype: +

         #include <pthread.h>
         int pthread_setspecific( pthread_key_t key, void *value )
     
    -

    -Description: -

    +

    +Description: +

    The pthread_setspecific() function associates a thread- specific value with a key obtained via a previous call to pthread_key_create(). Different threads may bind @@ -4139,611 +4173,611 @@ 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 effect of calling pthread_setspecific() with a key value not obtained from pthread_key_create() or after a key has been deleted with pthread_key_delete() is undefined. -

    -Input Parameters: -

    -

      -
    • key. The data key to set the binding for. -
    • value. The value to bind to the key. -
    -

    -Returned Values: -

    +

    +Input Parameters: +

    +

      +
    • key. The data key to set the binding for. +
    • value. The value to bind to the key. +
    +

    +Returned Values: +

    If successful, pthread_setspecific() will return zero (OK). Otherwise, an error number will be returned: -

    -

      -
    • ENOMEM. Insufficient memory exists to associate the value +

      +

        +
      • ENOMEM. Insufficient memory exists to associate the value with the key. -
      • EINVAL. The key value is invalid. -
      -

      -Assumptions/Limitations: -

      -POSIX Compatibility: Comparable to the POSIX +

    • EINVAL. The key value is invalid. +
    +

    +Assumptions/Limitations: +

    +POSIX Compatibility: Comparable to the POSIX interface of the same name. -

      -
    • pthread_setspecific() may be called from a thread-specific data +
        +
      • pthread_setspecific() may be called from a thread-specific data destructor function. -
      +
    -

    2.9.24 pthread_getspecific

    -

    -Function Prototype: -

    +

    2.9.24 pthread_getspecific

    +

    +Function Prototype: +

         #include <pthread.h>
         void *pthread_getspecific( pthread_key_t key )
     
    -

    -Description: -

    +

    +Description: +

    The pthread_getspecific() function returns the value currently bound to the specified key on behalf of the calling thread. -

    +

    The effect of calling pthread_getspecific() with a key value not obtained from pthread_key_create() or after a key has been deleted with pthread_key_delete() is undefined. -

    -Input Parameters: -

    -

      -
    • key. The data key to get the binding for. -
    -

    -Returned Values: -

    +

    +Input Parameters: +

    +

      +
    • key. The data key to get the binding for. +
    +

    +Returned Values: +

    The function pthread_getspecific() returns the thread- specific data associated with the given key. If no thread specific data is associated with the key, then the value NULL is returned. -

    -Assumptions/Limitations: -

    -POSIX Compatibility: Comparable to the POSIX +

    +Assumptions/Limitations: +

    +POSIX Compatibility: Comparable to the POSIX interface of the same name. -

      -
    • pthread_getspecific() may be called from a thread-specific data +
        +
      • pthread_getspecific() may be called from a thread-specific data destructor function. -
      +
    -

    2.9.25 pthread_key_delete

    -

    -Function Prototype: -

    +

    2.9.25 pthread_key_delete

    +

    +Function Prototype: +

         #include <pthread.h>
         int pthread_key_delete( pthread_key_t key )
     
    -

    -Description: -

    +

    +Description: +

    This POSIX function should delete a thread-specific data key previously returned by pthread_key_create(). However, this function does nothing in the present implementation. -

    -Input Parameters: -

    -

      -
    • key. The key to delete -
    -

    -Returned Values: -

    -

      -
    • Always returns EINVAL. -
    -

    -Assumptions/Limitations: -

    -POSIX Compatibility: Comparable to the POSIX +

    +Input Parameters: +

    +

      +
    • key. The key to delete +
    +

    +Returned Values: +

    +

      +
    • Always returns EINVAL. +
    +

    +Assumptions/Limitations: +

    +POSIX Compatibility: Comparable to the POSIX interface of the same name. -

    2.9.26 pthread_mutexattr_init

    -

    -Function Prototype: -

    +

    2.9.26 pthread_mutexattr_init

    +

    +Function Prototype: +

         #include <pthread.h>
         int pthread_mutexattr_init(pthread_mutexattr_t *attr);
     
    -

    -Description: -

    -Input Parameters: -

    -

      -
    • param.
    • -
    -

    -Returned Values: -

    +

    +Description: +

    +Input Parameters: +

    +

      +
    • To be provided.
    • +
    +

    +Returned Values: +

    If successful, the pthread_mutexattr_init() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -

    -

      -
    • Exxx.
    • -
    -Assumptions/Limitations: -

    -POSIX Compatibility: Comparable to the POSIX +

    +

      +
    • To be provided.
    • +
    +Assumptions/Limitations: +

    +POSIX Compatibility: Comparable to the POSIX interface of the same name. -

    2.9.27 pthread_mutexattr_destroy

    -

    -Function Protoype: -

    +

    2.9.27 pthread_mutexattr_destroy

    +

    +Function Protoype: +

         #include <pthread.h>
         int pthread_mutexattr_destroy(pthread_mutexattr_t *attr);
     
    -

    -Description: -

    -Input Parameters: -

    -

      -
    • param.
    • -
    -

    -Returned Values: -

    +

    +Description: +

    +Input Parameters: +

    +

      +
    • To be provided.
    • +
    +

    +Returned Values: +

    If successful, the pthread_mutexattr_destroy() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -

    -

      -
    • Exxx.
    • -
    -Assumptions/Limitations: -

    -POSIX Compatibility: Comparable to the POSIX +

    +

      +
    • To be provided.
    • +
    +Assumptions/Limitations: +

    +POSIX Compatibility: Comparable to the POSIX interface of the same name. -

    2.9.28 pthread_mutexattr_getpshared

    -

    -Function Prototype: -

    +

    2.9.28 pthread_mutexattr_getpshared

    +

    +Function Prototype: +

         #include <pthread.h>
         int pthread_mutexattr_getpshared(pthread_mutexattr_t *attr,
     					int *pshared);
     
    -

    -Description: -

    -Input Parameters: -

    -

      -
    • param.
    • -
    -

    -Returned Values: -

    +

    +Description: +

    +Input Parameters: +

    +

      +
    • To be provided.
    • +
    +

    +Returned Values: +

    If successful, the pthread_mutexattr_getpshared() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -

    -

      -
    • Exxx.
    • -
    -Assumptions/Limitations: -

    -POSIX Compatibility: Comparable to the POSIX +

    +

      +
    • To be provided.
    • +
    +Assumptions/Limitations: +

    +POSIX Compatibility: Comparable to the POSIX interface of the same name. -

    2.9.29 pthread_mutexattr_setpshared

    -

    -Function Prototype: -

    +

    2.9.29 pthread_mutexattr_setpshared

    +

    +Function Prototype: +

         #include <pthread.h>
        int pthread_mutexattr_setpshared(pthread_mutexattr_t *attr,
     					int pshared);
     
    -

    -Description: -

    -Input Parameters: -

    -

      -
    • param.
    • -
    -

    -Returned Values: -

    +

    +Description: +

    +Input Parameters: +

    +

      +
    • To be provided.
    • +
    +

    +Returned Values: +

    If successful, the pthread_mutexattr_setpshared() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -

    -

      -
    • Exxx.
    • -
    -Assumptions/Limitations: -

    -POSIX Compatibility: Comparable to the POSIX +

    +

      +
    • To be provided.
    • +
    +Assumptions/Limitations: +

    +POSIX Compatibility: Comparable to the POSIX interface of the same name. -

    2.9.30 pthread_mutex_init

    -

    -Function Prototype: -

    +

    2.9.30 pthread_mutex_init

    +

    +Function Prototype: +

         #include <pthread.h>
         int pthread_mutex_init(pthread_mutex_t *mutex,
     			      pthread_mutexattr_t *attr);
     
    -

    -Description: -

    -Input Parameters: -

    -

      -
    • param.
    • -
    -

    -Returned Values: -

    +

    +Description: +

    +Input Parameters: +

    +

      +
    • To be provided.
    • +
    +

    +Returned Values: +

    If successful, the pthread_mutex_init() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -

    -

      -
    • Exxx.
    • -
    -Assumptions/Limitations: -

    -POSIX Compatibility: Comparable to the POSIX +

    +

      +
    • To be provided.
    • +
    +Assumptions/Limitations: +

    +POSIX Compatibility: Comparable to the POSIX interface of the same name. -

    2.9.31 pthread_mutex_destroy

    -

    -Function Prototype: -

    +

    2.9.31 pthread_mutex_destroy

    +

    +Function Prototype: +

         #include <pthread.h>
         int pthread_mutex_destroy(pthread_mutex_t *mutex);
     
    -

    -Description: -

    -Input Parameters: -

    -

      -
    • param.
    • -
    -

    -Returned Values: -

    +

    +Description: +

    +Input Parameters: +

    +

      +
    • To be provided.
    • +
    +

    +Returned Values: +

    If successful, the pthread_mutex_destroy() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -

    -

      -
    • Exxx.
    • -
    -Assumptions/Limitations: -

    -POSIX Compatibility: Comparable to the POSIX +

    +

      +
    • To be provided.
    • +
    +Assumptions/Limitations: +

    +POSIX Compatibility: Comparable to the POSIX interface of the same name. -

    2.9.32 pthread_mutex_lock

    -

    -Function Prototype: -

    +

    2.9.32 pthread_mutex_lock

    +

    +Function Prototype: +

         #include <pthread.h>
         int pthread_mutex_lock(pthread_mutex_t *mutex);
     
    -

    -Description: -

    -Input Parameters: -

    -

      -
    • param.
    • -
    -

    -Returned Values: -

    +

    +Description: +

    +Input Parameters: +

    +

      +
    • To be provided.
    • +
    +

    +Returned Values: +

    If successful, the pthread_mutex_lock() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -

    -

      -
    • Exxx.
    • -
    -Assumptions/Limitations: -

    -POSIX Compatibility: Comparable to the POSIX +

    +

      +
    • To be provided.
    • +
    +Assumptions/Limitations: +

    +POSIX Compatibility: Comparable to the POSIX interface of the same name. -

    2.9.33 pthread_mutex_trylock

    -

    -Function Prototype: -

    +

    2.9.33 pthread_mutex_trylock

    +

    +Function Prototype: +

         #include <pthread.h>
         int pthread_mutex_trylock(pthread_mutex_t *mutex);
     
    -

    -Description: -

    -Input Parameters: -

    -

      -
    • param.
    • -
    -

    -Returned Values: -

    +

    +Description: +

    +Input Parameters: +

    +

      +
    • To be provided.
    • +
    +

    +Returned Values: +

    If successful, the pthread_mutex_trylock() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -

    -

      -
    • Exxx.
    • -
    -Assumptions/Limitations: -

    -POSIX Compatibility: Comparable to the POSIX +

    +

      +
    • To be provided.
    • +
    +Assumptions/Limitations: +

    +POSIX Compatibility: Comparable to the POSIX interface of the same name. -

    2.9.34 pthread_mutex_unlock

    -

    -Function Prototype: -

    +

    2.9.34 pthread_mutex_unlock

    +

    +Function Prototype: +

         #include <pthread.h>
         int pthread_mutex_unlock(pthread_mutex_t *mutex);
     
    -

    -Description: -

    -Input Parameters: -

    -

      +

      +Description: +

      +Input Parameters: +

      +

      • param.
      • -
      -

      -Returned Values: -

      +

    +

    +Returned Values: +

    If successful, the pthread_mutex_unlock() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -

    -

      -
    • Exxx.
    • -
    -Assumptions/Limitations: -

    -POSIX Compatibility: Comparable to the POSIX +

    +

      +
    • To be provided.
    • +
    +Assumptions/Limitations: +

    +POSIX Compatibility: Comparable to the POSIX interface of the same name. -

    2.9.35 pthread_condattr_init

    -

    -Function Prototype: -

    +

    2.9.35 pthread_condattr_init

    +

    +Function Prototype: +

         #include <pthread.h>
         int pthread_condattr_init(pthread_condattr_t *attr);
     
    -

    -Description: -

    -Input Parameters: -

    -

      -
    • param.
    • -
    -

    -Returned Values: -

    +

    +Description: +

    +Input Parameters: +

    +

      +
    • To be provided.
    • +
    +

    +Returned Values: +

    If successful, the pthread_condattr_init() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -

    -

      -
    • Exxx.
    • -
    -Assumptions/Limitations: -

    -POSIX Compatibility: Comparable to the POSIX +

    +

      +
    • To be provided.
    • +
    +Assumptions/Limitations: +

    +POSIX Compatibility: Comparable to the POSIX interface of the same name. -

    2.9.36 pthread_condattr_destroy

    -

    -Function Prototype: -

    +

    2.9.36 pthread_condattr_destroy

    +

    +Function Prototype: +

         #include <pthread.h>
         int pthread_condattr_destroy(pthread_condattr_t *attr);
     
    -

    -Description: -

    -Input Parameters: -

    -

      -
    • param.
    • -
    -

    -Returned Values: -

    +

    +Description: +

    +Input Parameters: +

    +

      +
    • To be provided.
    • +
    +

    +Returned Values: +

    If successful, the pthread_condattr_destroy() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -

    -

      -
    • Exxx.
    • -
    -Assumptions/Limitations: -

    -POSIX Compatibility: Comparable to the POSIX +

    +

      +
    • To be provided.
    • +
    +Assumptions/Limitations: +

    +POSIX Compatibility: Comparable to the POSIX interface of the same name. -

    2.9.37 pthread_cond_init

    -

    -Function Prototype: -

    +

    2.9.37 pthread_cond_init

    +

    +Function Prototype: +

         #include <pthread.h>
         int pthread_cond_init(pthread_cond_t *cond, pthread_condattr_t *attr);
     
    -

    -Description: -

    -Input Parameters: -

    -

      -
    • param.
    • -
    -

    -Returned Values: -

    +

    +Description: +

    +Input Parameters: +

    +

      +
    • To be provided.
    • +
    +

    +Returned Values: +

    If successful, the pthread_cond_init() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -

    -

      -
    • Exxx.
    • -
    -Assumptions/Limitations: -

    -POSIX Compatibility: Comparable to the POSIX +

    +

      +
    • To be provided.
    • +
    +Assumptions/Limitations: +

    +POSIX Compatibility: Comparable to the POSIX interface of the same name. -

    2.9.38 pthread_cond_destroy

    -

    -Function Prototype: -

    +

    2.9.38 pthread_cond_destroy

    +

    +Function Prototype: +

         #include <pthread.h>
         int pthread_cond_destroy(pthread_cond_t *cond);
     
    -

    -Description: -

    -Input Parameters: -

    -

      -
    • param.
    • -
    -

    -Returned Values: -

    +

    +Description: +

    +Input Parameters: +

    +

      +
    • To be provided.
    • +
    +

    +Returned Values: +

    If successful, the pthread_cond_destroy() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -

    -

      -
    • Exxx.
    • -
    -Assumptions/Limitations: -

    -POSIX Compatibility: Comparable to the POSIX +

    +

      +
    • To be provided.
    • +
    +Assumptions/Limitations: +

    +POSIX Compatibility: Comparable to the POSIX interface of the same name. -

    2.9.39 pthread_cond_broadcast

    -

    -Function Prototype: -

    +

    2.9.39 pthread_cond_broadcast

    +

    +Function Prototype: +

         #include <pthread.h>
         int pthread_cond_broadcast(pthread_cond_t *cond);
     
    -

    -Description: -

    -Input Parameters: -

    -

      -
    • param.
    • -
    -

    -Returned Values: -

    +

    +Description: +

    +Input Parameters: +

    +

      +
    • To be provided.
    • +
    +

    +Returned Values: +

    If successful, the pthread_cond_broadcast() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -

    -

      -
    • Exxx.
    • -
    -Assumptions/Limitations: -

    -POSIX Compatibility: Comparable to the POSIX +

    +

      +
    • To be provided.
    • +
    +Assumptions/Limitations: +

    +POSIX Compatibility: Comparable to the POSIX interface of the same name. -

    2.9.40 pthread_cond_signal

    -

    -Function Prototype: -

    +

    2.9.40 pthread_cond_signal

    +

    +Function Prototype: +

         #include <pthread.h>
         int pthread_cond_signal(pthread_cond_t *dond);
     
    -

    -Description: -

    -Input Parameters: -

    -

      -
    • param.
    • -
    -

    -Returned Values: -

    +

    +Description: +

    +Input Parameters: +

    +

      +
    • To be provided.
    • +
    +

    +Returned Values: +

    If successful, the pthread_cond_signal() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -

    -

      -
    • Exxx.
    • -
    -Assumptions/Limitations: -

    -POSIX Compatibility: Comparable to the POSIX +

    +

      +
    • To be provided.
    • +
    +Assumptions/Limitations: +

    +POSIX Compatibility: Comparable to the POSIX interface of the same name. -

    2.9.41 pthread_cond_wait

    -

    -Function Prototype: -

    +

    2.9.41 pthread_cond_wait

    +

    +Function Prototype: +

         #include <pthread.h>
         int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex);
     
    -

    -Description: -

    -Input Parameters: -

    -

      -
    • param.
    • -
    -

    +

    +Description: +

    +Input Parameters: +

    +

      +
    • To be provided.
    • +
    +

    Returned Values: -

    +

    If successful, the pthread_cond_wait() function will return zero (OK). Otherwise, an error number will be returned to indicate the error: -

    -

      -
    • Exxx.
    • -
    -Assumptions/Limitations: -

    -POSIX Compatibility: Comparable to the POSIX +

    +

      +
    • To be provided.
    • +
    +Assumptions/Limitations: +

    +POSIX Compatibility: Comparable to the POSIX interface of the same name. -

    2.9.42 pthread_cond_timedwait

    +

    2.9.42 pthread_cond_timedwait

    Function Prototype:

    @@ -4760,7 +4794,7 @@ interface of the same name.

      -
    • parm.
    • +
    • To be provided.

    Returned Values: @@ -4771,7 +4805,7 @@ interface of the same name. returned to indicate the error:

      -
    • Exxx.
    • +
    • To be provided.

    Assumptions/Limitations: @@ -5251,71 +5285,71 @@ interface of the same name. POSIX Compatibility: Comparable to the POSIX interface of the same name.

    -
    -

    3.0 OS Data Structures

    +
    +

    3.0 OS Data Structures

    3.1 Scalar types

    -

    +

    Many of the types used to communicate with NuttX are simple scalar types. These types are used to provide architecture independence of the OS from the application. The scalar types used at the NuttX interface include: -

      -
    • pid_t -
    • size_t -
    • sigset_t -
    • STATUS -
    • time_t -
    +
      +
    • pid_t +
    • size_t +
    • sigset_t +
    • STATUS +
    • time_t +

    3.2 Hidden Interface Structures

    -

    +

    Several of the types used to interface with NuttX are structures that are intended to be hidden from the application. From the standpoint of the application, these structures (and structure pointers) should be treated as simple handles to reference OS resources. These hidden structures include: -

      -
    • _TCB -
    • mqd_t -
    • sem_t -
    • WDOG_ID -
    • pthread_key_t -
    -

    +

      +
    • _TCB +
    • mqd_t +
    • sem_t +
    • WDOG_ID +
    • pthread_key_t +
    +

    In order to maintain portability, applications should not reference specific elements within these hidden structures. These hidden structures will not be described further in this user's manual. -

    +

    3.3. Access to the errno Variable

    -

    +

    A pointer to the thread-specific errno. value is available through a function call: -

    -Function Prototype: -

    +

    +Function Prototype: +

        int *get_errno_ptr( void )
    -

    -Description: osGetErrnorPtr() returns a pointer to +

    +Description: osGetErrnorPtr() returns a pointer to the thread-specific errno value. -

    +

    This differs somewhat from the use for errno in a multi-threaded process environment: Each pthread will have its own private copy of errno and the errno will not be shared between pthreads. -

    -Input Parameters: None -

    -Returned Values: -

    -

      -
    • A pointer to the thread-specific errno value. -
    -

    +

    +Input Parameters: None +

    +Returned Values: +

    +

      +
    • A pointer to the thread-specific errno value. +
    +

    3.4 User Interface Structures

    -

    +

    3.4.1 main_t

    -

    +

    main_t defines the type of a task entry point. main_t is declared in sys/types.h as:

    @@ -5324,7 +5358,7 @@ in sys/types.h as:
     
     

    3.4.2 struct sched_param

    -

    +

    This structure is used to pass scheduling priorities to and from NuttX;

    @@ -5336,7 +5370,7 @@ NuttX;
     
     

    3.4.3 struct timespec

    -

    +

    This structure is used to pass timing information between the NuttX and a user application:

    @@ -5349,7 +5383,7 @@ NuttX and a user application:
     
     

    3.4.4 struct mq_attr

    -

    +

    This structure is used to communicate message queue attributes between NuttX and a MoBY application:

    @@ -5363,7 +5397,7 @@ between NuttX and a MoBY application:
     
     

    3.4.5 struct sigaction

    -

    +

    The following structure defines the action to take for given signal:

         struct sigaction
    @@ -5382,7 +5416,7 @@ The following structure defines the action to take for given signal:
     
     

    3.4.6 struct siginfo/siginfo_t

    -

    +

    The following types is used to pass parameters to/from signal handlers:

    @@ -5396,7 +5430,7 @@ handlers:
     
     

    3.4.7 union sigval

    -

    +

    This defines the type of the struct siginfo si_value field and is used to pass parameters with signals.

    @@ -5409,7 +5443,7 @@ is used to pass parameters with signals.
     
     

    3.4.8 struct sigevent

    -

    +

    The following is used to attach a signal to a message queue to notify a task when a message is available on a queue.

    diff --git a/TODO b/TODO
    index c15c8d23b6..6e9bcea8e9 100644
    --- a/TODO
    +++ b/TODO
    @@ -44,8 +44,8 @@ o File system
     o Console Output
     
     o Documentation
    -- Document fs & driver logic
    -- Document filesystem, library
    +- Document fs/ & driver/ logic
    +- Document C-library APIs
     
     o Build system
     - Names under arch are incorrect.  These should hold processor architectures.
    diff --git a/arch/README.txt b/arch/README.txt
    index 3dfaa66e82..b8b1802072 100644
    --- a/arch/README.txt
    +++ b/arch/README.txt
    @@ -11,8 +11,33 @@ Table of Contents
     Architecture-Specific Code
     ^^^^^^^^^^^^^^^^^^^^^^^^^^
     
    -The file include/nuttx/arch.h identifies all of the APIs that must
    -be provided by the architecture specific logic.  (It also includes
    +The NuttX configuration consists of:
    +
    +o Processor architecture specific files.  These are the files contained
    +  in the arch// directory discussed in this README.
    +
    +o Chip/SoC specific files.  Each processor processor architecture
    +  is embedded in chip or System-on-a-Chip (SoC) architecture.  The
    +  full chip architecture includes the processor architecture plus
    +  chip-specific interrupt logic, general purpose I/O (GIO) logic, and
    +  specialized, internal peripherals (such as UARTs, USB, etc.).
    +
    +  These chip-specific files are contained within chip-specific
    +  sub-directories in the arch// directory and are selected
    +  via the CONFIG_ARCH_name selection
    +
    +o Board specific files.  In order to be usable, the chip must be
    +  contained in a board environment.  The board configuration defines
    +  additional properties of the board including such things as
    +  peripheral LEDs, external peripherals (such as network, USB, etc.).
    +
    +  These board-specific configuration files can be found in the
    +  configs// sub-directories.
    +
    +This README will address the processor architecture specific files
    +that are contained in the arch// directory. The file
    +include/nuttx/arch.h identifies all of the APIs that must
    +be provided by this architecture specific logic.  (It also includes
     arch//arch.h as described below).
     
     Directory Structure
    @@ -25,18 +50,27 @@ subdirectory).  Each architecture must provide a subdirectory 
     under arch/ with the following characteristics:
     
     
    -	
    -	|-- include
    +	/
    +	|-- include/
    +	|   |--/
    +	|   |  `-- (chip-specific header files)
    +	|   |--/
     	|   |-- arch.h
     	|   |-- irq.h
     	|   `-- types.h
    -	`-- src
    +	`-- src/
    +	    |--/
    +	    |  `-- (chip-specific source files)
    +	    |--/
     	    |-- Makefile
     	    `-- (architecture-specific source files)
     
     Summary of Files
     ^^^^^^^^^^^^^^^^
     
    +include//
    +  This sub-directory contains chip-specific header files.
    +
     include/arch.h
       This is a hook for any architecture specific definitions that may
       be needed by the system.  It is included by include/nuttx/arch.h
    @@ -76,6 +110,9 @@ include/irq.h
       This file must also define NR_IRQS, the total number of IRQs supported
       by the board.
     
    +src//
    +  This sub-directory contains chip-specific source files.
    +
     src/Makefile
       This makefile will be executed to build the targets src/libup.a and
       src/up_head.o.  The up_head.o file holds the entry point into the system
    diff --git a/configs/README.txt b/configs/README.txt
    index e15c57c36f..f09046dff3 100644
    --- a/configs/README.txt
    +++ b/configs/README.txt
    @@ -11,9 +11,33 @@ Table of Contents
     Board-Specific Configurations
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     
    +The NuttX configuration consists of:
    +
    +o Processor architecture specific files.  These are the files contained
    +  in the arch// directory.
    +
    +o Chip/SoC specific files.  Each processor processor architecture
    +  is embedded in chip or System-on-a-Chip (SoC) architecture.  The
    +  full chip architecture includes the processor architecture plus
    +  chip-specific interrupt logic, general purpose I/O (GIO) logic, and
    +  specialized, internal peripherals (such as UARTs, USB, etc.).
    +
    +  These chip-specific files are contained within chip-specific
    +  sub-directories in the arch// directory and are selected
    +  via the CONFIG_ARCH_name selection
    +
    +o Board specific files.  In order to be usable, the chip must be
    +  contained in a board environment.  The board configuration defines
    +  additional properties of the board including such things as
    +  peripheral LEDs, external peripherals (such as network, USB, etc.).
    +
    +  These board-specific configuration files can be found in the
    +  configs// sub-directories and are discussed in this
    +  README.
    +
     The configs/ subdirectory contains configuration data for each board.  These
     board-specific configurations plus the architecture-specific configurations in
    -the arch/ subdirectory complete define a customized port of NuttX.
    +the arch/ subdirectory completely define a customized port of NuttX.
     
     Directory Structure
     ^^^^^^^^^^^^^^^^^^^
    @@ -25,8 +49,10 @@ following characteristics:
     
     	
     	|-- include/
    +	|   `-- (board-specific header files)
     	|-- src/
    -	|   `-- Makefile
    +	|   |-- Makefile
    +	|   `-- (board-specific source files)
     	|-- Make.defs
     	|-- defconfig
     	`-- setenv.sh