From a5f9ac71eb86e7c880944cc2a9ad67ff66b5e6f4 Mon Sep 17 00:00:00 2001
From: patacongo
Binary Loaders.
The purpose of a binary loader is to load and execute modules in various binary formats that reside in a file system.
- Loading refers instiating the binary module in some fashion, usually copy all or some of the binary module into memory and then linking the module with other components.
- In most architectures, it is thebase FLASH code that is the primary component that the binary module must link with because that is where the RTOS and primary tasks reside.
+ Loading refers instantiating the binary module in some fashion, usually copy all or some of the binary module into memory and then linking the module with other components.
+ In most architectures, it is the base FLASH code that is the primary component that the binary module must link with because that is where the RTOS and primary tasks reside.
Program modules can then be executed after they have been loaded.
Executables and Libraries
The generic binary loader logic does not care what it is that it being loaded. It could load an executable program or a library.
There are no strict rules, but a library will tend to export symbols and a program will tend to import symbols: The program will use the symbols exported by the library.
- However, at this point in time, none of the supported binary formts support exporting of symbols.
+ However, at this point in time, none of the supported binary formats support exporting of symbols.
@@ -128,7 +128,7 @@ struct binfmt_s
The
diff --git a/Documentation/NuttxUserGuide.html b/Documentation/NuttxUserGuide.html
index 24dc6b6ab7..586b744c71 100644
--- a/Documentation/NuttxUserGuide.html
+++ b/Documentation/NuttxUserGuide.html
@@ -123,7 +123,7 @@ is discussed.
Input Parameters: All input parameters are listed along
with brief descriptions of each input parameter.
-Returned Values: All possible values returned by the interface
+Returned Value: All possible values returned by the interface
function are listed. Values returned as side-effects (through
pointer input parameters or through global variables) will be
addressed in the description of the interface function.
@@ -207,10 +207,10 @@ paragraphs.
Function Prototype:
-
Description:
@@ -249,18 +249,18 @@ paragraphs.
Input Parameters:
- Returned Values:
+ Returned Value:
Input Parameters:
load
method is used to load the binary format into memory.
- It returns either OK
(0) meaning that the binary object was loaded successfully, or a negater errno
indicating why the object was not loaded.
+ It returns either OK
(0) meaning that the binary object was loaded successfully, or a negated errno
indicating why the object was not loaded.
- #include <sched.h>
- int task_create(char *name, int priority, int stack_size, main_t entry, const char *argv[]);
-
+
+#include <sched.h>
+int task_create(char *name, int priority, int stack_size, main_t entry, const char *argv[]);
+
-
name
. Name of the new taskpriority
. Priority of the new taskstack_size
. size (in bytes) of the stack neededentry
. Entry point of a new taskargv
. A pointer to an array of input parameters. Up to
CONFIG_MAX_TASK_ARG
parameters may be provided.
If fewer than CONFIG_MAX_TASK_ARG
parameters are
passed, the list should be terminated with a NULL argv[] value.
If no parameters are required, argv may be NULL.
-
tcb
. Address of the new task's TCB
+ name
. Name of the new task (not used)
+ priority
. Priority of the new task
+ stack
. Start of the pre-allocated stack
+ stack_size
. size (in bytes) of the pre-allocated stack
+ entry
. Entry point of a new task
+ argv
. A pointer to an array of input parameters. Up to
CONFIG_MAX_TASK_ARG
parameters may be provided.
If fewer than CONFIG_MAX_TASK_ARG
parameters are
passed, the list should be terminated with a NULL argv[] value.
@@ -330,7 +330,7 @@ VxWorks provides the following similar interface:
-Returned Values: +Returned Value:
OK, or ERROR if the task cannot be initialized.
@@ -370,7 +370,7 @@ VxWorks provides the following similar interface: Function Prototype:#include <sched.h> - int task_activate( _TCB *tcb ); + int task_activate(_TCB *tcb);
@@ -380,12 +380,12 @@ scheduler.
Input Parameters:
tcb
. The TCB for the task for the task (same as the
task_init argument).
-Returned Values: +Returned Value:
errno
is not set).
- STATUS taskActivate( int tid ); + STATUS taskActivate(int tid);
@@ -418,50 +418,55 @@ the pointer to the WIND_TCB cast to an integer.
Function Prototype: -
- #include <sched.h> - int task_delete( pid_t pid ); -+
+#include <sched.h> +int task_delete(pid_t pid); +
-Description: This function causes a specified task to cease -to exist -- its stack and TCB will be deallocated. This function -is the companion to task_create(). + Description: + This function causes a specified task to cease to exist -- its stack and TCB will be deallocated. + This function is the companion to task_create().
Input Parameters:
pid
.
+ The task ID of the task to delete.
+ An ID of zero signifies the calling task.
+ Any attempt by the calling task will be automatically re-directed to exit()
.
-Returned Values: +Returned Value:
errno
is not set)
+ OK
, or ERROR
if the task cannot be deleted.
+ This function can fail if the provided pid does not correspond to a task (errno
is not set).
+ Assumptions/Limitations:
-task_delete() must be used with caution: If the task holds resources
-(for example, allocated memory or semaphores needed by other tasks), then
-task_delete() can strand those resources.
+ task_delete()
must be used with caution:
+ If the task holds resources (for example, allocated memory or semaphores needed by other tasks), then task_delete()
can strand those resources.
+
-POSIX Compatibility: This is a NON-POSIX interface. -VxWorks provides the following similar interface: -
- STATUS taskDelete( int tid ); -+POSIX Compatibility: + This is a NON-POSIX interface. + VxWorks provides the following similar interface: + +
+STATUS taskDelete(int tid); +
The NuttX task_delete() differs from VxWorks' taskDelete() in the following ways:
taskDeleteHookAdd()
is not supported).
+ However, if atexit()
or on_exit
support is enabled, those will be called when the task deleted.
+ task_delete()
will re-direct processing to exit()
.
#include <sched.h> - void exit( int code ); + void exit(int code); #include <nuttx/unistd.h> - void _exit( int code ); + void _exit(int code);
@@ -484,11 +489,11 @@ execute any function registered with
-Returned Values: None.
+Returned Value: None.
Assumptions/Limitations:
@@ -496,49 +501,59 @@ execute any function registered with
The NuttX exit() differs from ANSI exit() in the following ways:
-Function Prototype:
-
-Description: This function "restarts" a task.
-The task is first terminated and then reinitialized with same
-ID, priority, original entry point, stack size, and parameters
-it had when it was first started.
+ Description:
+ This function "restarts" a task.
+ The task is first terminated and then reinitialized with same ID, priority, original entry point, stack size, and parameters it had when it was first started.
-NOTE: The normal task exit clean up is not performed.
-For example, file descriptors are not closed;
-any files opened prior to the restart will remain opened after the task is restarted.
+ NOTES:
Input Parameters:
-Returned Values:
+Returned Value:
Assumptions/Limitations:
@@ -562,9 +576,13 @@ VxWorks provides the following similar interface:
The NuttX task_restart() differs from VxWorks' taskRestart() in the following ways:
@@ -583,7 +601,7 @@ level.
Input Parameters: None.
-Returned Values:
+Returned Value:
- Returned Values:
- On success, sched_setparam() returns 0 (OK).
- On error, -1 (ERROR) is returned, and
-Returned Values:
+Returned Value:
@@ -734,101 +752,90 @@ interface of the same name.
-Function Prototype:
-
Description:
- sched_setscheduler() sets both the scheduling policy
- and the priority for the task identified by pid.
- If pid equals zero, the scheduler of the calling
- thread will be set.
- The parameter 'param' holds the priority of the thread under the new policy.
+
-Input Parameters:
+ Input Parameters:
+
- Returned Values:
- On success, sched_setscheduler() returns OK (zero). On
- error, ERROR (-1) is returned, and
-Assumptions/Limitations:
+ Assumptions/Limitations:
+
- POSIX Compatibility: Comparable to the POSIX
-interface of the same name.
+ POSIX Compatibility: Comparable to the POSIX interface of the same name.
+
Function Prototype:
-
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
+
Input Parameters:
-Returned Values:
+Returned Value:
Assumptions/Limitations:
- POSIX Compatibility: Comparable to the POSIX
-interface of the same name.
-Differences from the full POSIX implementation include:
-
@@ -845,9 +852,9 @@ up the CPU (only to other tasks at the same priority).
Input Parameters: None.
-Returned Values:
+Returned Value:
@@ -871,13 +878,13 @@ possible task priority for a specified scheduling policy.
Input Parameters:
-Returned Values:
+Returned Value:
@@ -901,13 +908,13 @@ possible task priority for a specified scheduling policy.
Input Parameters:
-Returned Values:
+Returned Value:
@@ -927,9 +934,9 @@ interface of the same name.
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
+
- Returned Values:
+ Returned Value:
On success, sched_rr_get_interval() returns OK (0). On
error, ERROR (-1) is returned, and
@@ -989,7 +996,7 @@ priority of the calling task is returned.
Function Prototype:
@@ -1001,7 +1008,7 @@ number of times) or until it blocks itself.
Input Parameters: None.
-Returned Values:
+Returned Value:
@@ -1034,7 +1041,7 @@ eligible to preempt the current task will execute.
Input Parameters: None.
-Returned Values:
+Returned Value:
@@ -1065,7 +1072,7 @@ on this thread of execution.
Input Parameters: None.
-Returned Values:
+Returned Value:
- If the calling process has
If
- Returned Values:
+ Returned Value:
If
- Returned Values:
+ Returned Value:
On success, atexit()
or on_exit()
Input Parameters:
-
code
. (ignored)
atexit()
or on_exit()
POSIX Compatibility: This is equivalent to the ANSI interface:
- void exit( int code );
+ void exit(int code);
And the UNIX interface:
- void _exit( int code );
+ void _exit(int code);
-
code
parameter is ignored.
2.1.6 task_restart
-
- #include <sched.h>
- int task_restart( pid_t pid );
-
-
+Function Prototype:
+
+#include <sched.h>
+int task_restart(pid_t pid);
+
+
-
-
pid
.
+ The task ID of the task to delete.
+ An ID of zero would signify the calling task (However, support for a task to restart itself has not been implemented).
-
-
2.1.7 getpid
@@ -573,7 +591,7 @@ the value that they had when the task was terminated.
Function Prototype:
#include <unistd.h>
- pid_t getpid( void );
+ pid_t getpid(void);
@@ -663,9 +681,9 @@ Compatible with the POSIX interface of the same name.
errno
is set appropriately.
+ Returned Value:
+ On success, sched_setparam() returns 0 (OK
).
+ On error, -1 (ERROR
) is returned, and errno
is set appropriately.
@@ -721,9 +739,9 @@ of the task specified by pid.
-
OK
) if successful, otherwise -1 (ERROR
).
2.2.3 sched_setscheduler
- #include <sched.h>
- int sched_setscheduler (pid_t pid, int policy, const struct sched_param *param);
-
+ Function Prototype:
+
+#include <sched.h>
+int sched_setscheduler (pid_t pid, int policy, const struct sched_param *param);
+
sched_setscheduler()
sets both the scheduling policyand the priority for the task identified by pid
.
+ If pid
equals zero, the scheduler of the calling thread will be set.
+ The parameter param
holds the priority of the thread under the new policy.
pid
.
+ The task ID of the task.
+ If pid
is zero, the priority of the calling task is set.
SCHED_FIFO
or SCHED_RR
).
+ policy
.
+ Scheduling policy requested (either SCHED_FIFO
or SCHED_RR
).
param
. A structure whose member sched_priority is the
- integer priority. The range of valid priority numbers is from
- SCHED_PRIORITY_MIN through SCHED_PRIORITY_MAX.
+ param
.
+ A structure whose member sched_priority
is the integer priority.
+ The range of valid priority numbers is from SCHED_PRIORITY_MIN
through SCHED_PRIORITY_MAX
.
errno
is set appropriately:
+ Returned Value:
+ On success, sched_setscheduler()
returns OK
(zero). On
+ error, ERROR
(-1) is returned, and errno
is set appropriately:
-
-
EINVAL
: The scheduling policy
is not one of the recognized policies.ESRCH
: The task whose ID is pid
could not be found.2.2.4 sched_getscheduler
- #include <sched.h>
- int sched_getscheduler (pid_t pid);
-
+
+#include <sched.h>
+int sched_getscheduler (pid_t pid);
+
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
be retrieved.
- *
- * Inputs:
- *
- * Return Value:
-
- This function returns the current scheduling
-policy.
-
pid
.
The task ID of the task to query.
- If pid is zero, the calling task is queried.
+ If pid
is zero, the calling task is queried.
errno
is set appropriately:
+ 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:
-
ESRCH
: The task whose ID is pid could not be found.
-
+ POSIX Compatibility: Comparable to the POSIX interface of the same name.
errno
.
-2.2.5 sched_yield
@@ -836,7 +843,7 @@ Differences from the full POSIX implementation include:
Function Prototype:
#include <sched.h>
- int sched_yield( void );
+ int sched_yield(void);
-
OK
) or -1 (ERROR
)
-
policy
. Scheduling policy requested.
-
ERROR
).
-
policy
. Scheduling policy requested.
-
ERROR
)
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
for the calling process is written into 'interval. The
identified process should be running under the SCHED_RR
scheduling policy.'
@@ -938,21 +945,21 @@ interface of the same name.
Input Parameters:
-
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.
errno
is set to:
-
EFAULT
: Cannot copy to intervalEINVAL
: Invalid pid.ENOSYS
: The system call is not yet implemented.ESRCH
: The process whose ID is pid could not be found.
#include <sched.h>
- int sched_lock( void );
+ int sched_lock(void);
@@ -1012,7 +1019,7 @@ number of times) or until it blocks itself.
POSIX Compatibility: This is a NON-POSIX interface.
VxWorks provides the comparable interface:
- STATUS taskLock( void );
+ STATUS taskLock(void);
2.3.2 sched_unlock
@@ -1021,7 +1028,7 @@ VxWorks provides the comparable interface:
Function Prototype:
#include <sched.h>
- int sched_unlock( void );
+ int sched_unlock(void);
@@ -1045,7 +1052,7 @@ eligible to preempt the current task will execute.
POSIX Compatibility: This is a NON-POSIX interface.
VxWorks provides the comparable interface:
- STATUS taskUnlock( void );
+ STATUS taskUnlock(void);
2.3.3 sched_lockcount
@@ -1054,7 +1061,7 @@ VxWorks provides the comparable interface:
Function Prototype:
#include <sched.h>
- int32_t sched_lockcount( void )
+ int32_t sched_lockcount(void)
@@ -1152,7 +1159,7 @@ on this thread of execution.
SA_NOCLDWAIT
set or has SIGCHLD
set to SIG_IGN
, and the process has no unwaited-for children that were transformed into zombie processes, the calling thread will block until all of the children of the process containing the calling thread terminate, and waitpid()
will fail and set errno to ECHILD
.
+ If the calling process has SA_NOCLDWAIT
set or has SIGCHLD
set to SIG_IGN
, and the process has no unwaited-for children that were transformed into zombie processes, the calling thread will block until all of the children of the process containing the calling thread terminate, and waitpid()
will fail and set errno
to ECHILD
.
waitpid()
returns because the status of a child process is available, these functions will return a value equal to the process ID of the child process.
@@ -1204,7 +1211,7 @@ on this thread of execution.
waitpid()
returns because the status of a child process is available, it will return a value equal to the process ID of the child process for which status is reported.
@@ -1261,10 +1268,10 @@ on this thread of execution.
Input Parameters:
-
func
. A pointer to the function to be called when the task exits.atexit()
returns OK (0).
On error, ERROR (-1) is returned, and errno
is set to indicate the cause of the failure.
on_exit()
function when the task exits.func
. A pointer to the function to be called when the task exits.arg
. An argument that will be provided to the on_exit()
function when the task exits.
- Returned Values:
+ Returned Value:
On success, on_exit()
returns OK (0).
On error, ERROR (-1) is returned, and errno
is set to indicate the cause of the failure.
#include <mqueue.h> - mqd_t mq_open( const char *mqName, int oflags, ... ); + mqd_t mq_open(const char *mqName, int oflags, ...);
@@ -1367,27 +1374,27 @@ 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
exist.
-O_EXCL
. Name must not exist when opened.
+O_NONBLOCK
. Don't wait for data.
...
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
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.
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
@@ -1401,9 +1408,9 @@ message that can be sent or received. Other elements of attr are ignored
-Returned Values: +Returned Value:
ERROR
)
@@ -1424,7 +1431,7 @@ message size is limited at 22 bytes. Function Prototype:
#include <mqueue.h> - int mq_close( mqd_t mqdes ); + int mq_close(mqd_t mqdes);
@@ -1434,30 +1441,32 @@ 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
+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.
-Returned Values: +Returned Value:
OK
) if the message queue is closed successfully, otherwise,
+-1 (ERROR
).
Assumptions/Limitations:
mq_send()
or
-mq_receive()
is undefined when mq_close()
is called.
-mq_send()
or mq_receive()
is undefined when mq_close()
is called.
+ mq_close()
is undefined.
+ POSIX Compatibility: Comparable to the POSIX interface @@ -1469,7 +1478,7 @@ of the same name. Function Prototype:
#include <mqueue.h> - int mq_unlink( const char *mqName ); + int mq_unlink(const char *mqName);
@@ -1481,11 +1490,11 @@ closed.
Input Parameters:
mqName
. Name of the message queue
-Returned Values: None. +Returned Value: None.
Assumptions/Limitations:
@@ -1502,8 +1511,7 @@ interface of the same name.
Description:
- This function adds the specified message, msg
,
- to the message queue, mqdes
.
+ 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()
.
ERROR
is returned.
-NOTE: mq_send() may be called from an interrupt handler. -
+ NOTE:
+ mq_send()
may be called from an interrupt handler.
+ However, it behaves differently when called from the interrupt level:
+
Input Parameters:
@@ -1535,7 +1557,7 @@ interface of the same name.prio
. The priority of the message.
- Returned Values:
+ Returned Value:
On success, mq_send()
returns 0 (OK
);
on error, -1 (ERROR
) is returned, with errno
set
to indicate the error:
@@ -1618,7 +1640,7 @@ interface of the same name.
prio
. The priority of the message.
- Returned Values:
+ Returned Value:
On success, mq_send()
returns 0 (OK
);
on error, -1 (ERROR
) is returned, with errno
set
to indicate the error:
@@ -1689,7 +1711,7 @@ interface of the same name.
prio
. If not NULL, the location to store message priority.
- Returned Values:.
+ Returned Value:.
One success, the length of the selected message in bytes is returned.
On failure, -1 (ERROR
) is returned and the errno
is set appropriately:
abstime
. The absolute time to wait until a timeout is declared.
- Returned Values:.
+ Returned Value:.
One success, the length of the selected message in bytes is returned.
On failure, -1 (ERROR
) is returned and the errno
is set appropriately:
- Returned Values:
+ Returned Value:
On success mq_notify()
returns 0; on error, -1 is returned, with
errno
set to indicate the error:
mq_receive
waiting to receive a message
+ when a message arrives at the queue, the arriving message will satisfy the
+ appropriate mq_receive()
... The resulting behavior is as if the
+ message queue remains empty, and no notification will be sent."
#include <mqueue.h> - int mq_setattr( mqd_t mqdes, const struct mq_attr *mqStat, - struct mq_attr *oldMqStat); + int mq_setattr(mqd_t mqdes, const struct mq_attr *mqStat, + struct mq_attr *oldMqStat);
@@ -1910,16 +1932,16 @@ would have been returned by mq_getattr()).
Input Parameters:
mqdes
. Message queue descriptor
+mqStat
. New attributes
+oldMqState
. Old attributes
-Returned Values: +Returned Value:
OK
) if attributes are set successfully, otherwise -1
+(ERROR
).
@@ -1934,7 +1956,7 @@ interface of the same name. Function Prototype:
#include <mqueue.h> - int mq_getattr( mqd_t mqdes, struct mq_attr *mqStat); + int mq_getattr(mqd_t mqdes, struct mq_attr *mqStat);
@@ -1943,22 +1965,22 @@ attributes associated with the specified message queue.
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.
-Returned Values: +Returned Value:
OK
) if attributes provided, -1 (ERROR
) otherwise.
@@ -2121,7 +2143,7 @@ interface of the same name. Function Prototype:
#include <semaphore.h> - int sem_init ( sem_t *sem, int pshared, unsigned int value ); + int sem_init(sem_t *sem, int pshared, unsigned int value);
@@ -2130,22 +2152,22 @@ 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
+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
-Returned Values: +Returned Value:
OK
), or -1 (ERROR
) if unsuccessful.
@@ -2164,29 +2186,29 @@ Differences from the full POSIX implementation include: Function Prototype:
#include <semaphore.h> - int sem_destroy ( sem_t *sem ); + int sem_destroy(sem_t *sem);
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().
+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.
-Returned Values: +Returned Value:
OK
), or -1 (ERROR
) if unsuccessful.
@@ -2201,7 +2223,7 @@ interface of the same name. Function Prototype:
#include <semaphore.h> - sem_t *sem_open ( const char *name, int oflag, ...); + sem_t *sem_open(const char *name, int oflag, ...);
@@ -2219,35 +2241,35 @@ been no calls to sem_unlink()).
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
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
a new semaphore unless one of this name already exists.
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
+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: +Returned Value:
ERROR
) if unsuccessful.
@@ -2267,7 +2289,7 @@ just a counting semaphore. Function Prototype:
#include <semaphore.h> - int sem_close ( sem_t *sem ); + int sem_close(sem_t *sem);
@@ -2286,13 +2308,13 @@ that another calling task has already locked.
Input Parameters:
sem
. Semaphore descriptor
-Returned Values: +Returned Value:
OK
), or -1 (ERROR
) if unsuccessful.
@@ -2312,7 +2334,7 @@ interface of the same name. Function Prototype:
#include <semaphore.h> - int sem_unlink ( const char *name ); + int sem_unlink(const char *name);
@@ -2324,13 +2346,13 @@ sem_close().
Input Parameters:
name
. Semaphore name
-Returned Values: +Returned Value:
OK
), or -1 (ERROR
) if unsuccessful.
@@ -2358,7 +2380,7 @@ same name should be created after sem_unlink() is called. Function Prototype:
#include <semaphore.h> - int sem_wait ( sem_t *sem ); + int sem_wait(sem_t *sem);
@@ -2369,23 +2391,23 @@ the lock or the call is interrupted by a signal.
Input Parameters:
sem
. Semaphore descriptor.
-Returned Values: +Returned Value:
OK
), or -1 (ERROR
) is unsuccessful
-If sem_wait returns -1 (ERROR) then the cause of the failure
+If sem_wait
returns -1 (ERROR
) then the cause of the failure
will be indicated by the thread-specific errno
.
The following lists the possible values for errno
:
EINVAL
: Indicates that the sem
input parameter is
not valid.
-EINTR
: Indicates that the wait was interrupt by a signal
received by this task. In this case, the semaphore has not be acquired.
@@ -2401,7 +2423,7 @@ interface of the same name.
#include <semaphore.h> #include <time.h> - int sem_wait ( sem_t *sem, const struct timespec *abstime); + int sem_wait(sem_t *sem, const struct timespec *abstime);
@@ -2416,20 +2438,20 @@ interface of the same name. Input Parameters:
sem
. Semaphore descriptor.
abstime
. The absolute time to wait until a timeout is declared.
-Returned Values: +Returned Value:
OK
), or -1 (ERROR
) is unsuccessful
-If sem_wait returns -1 (ERROR) then the cause of the failure
+If sem_wait
returns -1 (ERROR
) then the cause of the failure
will be indicated by the thread-specific errno
.
The following lists the possible values for errno
:
@@ -2437,7 +2459,7 @@ The following lists the possible values for
@@ -2479,22 +2501,22 @@ returns without blocking.
Input Parameters:
-Returned Values:
+Returned Value:
@@ -2510,13 +2532,13 @@ interface of the same name.
Function Prototype:
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.
+by
If the semaphore value resulting from this operation is positive, then
no tasks were blocked waiting for the semaphore to become unlocked;
@@ -2524,19 +2546,19 @@ 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().
+return successfully from its call to
-NOTE: sem_post() may be called from an interrupt handler.
+NOTE:
Input Parameters:
-Returned Values:
+Returned Value:
@@ -2553,7 +2575,7 @@ interface of the same name.
Function Prototype:
@@ -2570,14 +2592,14 @@ number of tasks waiting for the semaphore.
Input Parameters:
-Returned Values:
+Returned Value:
@@ -2618,7 +2640,7 @@ interface of the same name.
Function Prototype:
@@ -2627,7 +2649,7 @@ by allocating the appropriate resources for the watchdog.
Input Parameters: None.
-Returned Values:
+Returned Value:
@@ -2666,12 +2688,12 @@ has been started.
Input Parameters:
-Returned Values:
+Returned Value:
@@ -2720,15 +2742,15 @@ wd_start() on a given watchdog ID has any effect.
Input Parameters:
-Returned Values:
+Returned Value:
@@ -2767,11 +2789,11 @@ level.
Input Parameters:
-Returned Values:
+Returned Value:
- Returned Values:
+ Returned Value:
- If successful, the clock_settime() function will return zero (OK).
+ If successful, the
- Returned Values:
+ Returned Value:
- If successful, the clock_gettime() function will return zero (OK).
+ If successful, the
- Returned Values:
+ Returned Value:
- If successful, the clock_getres() function will return zero (OK).
+ If successful, the
- Returned Values:
+ Returned Value:
- If successful, the mktime() function will return zero (OK).
+ If successful, the
- Returned Values:
+ Returned Value:
- If successful, the gmtime() function will return the pointer to a statically
+ If successful, the
- Returned Values:
+ Returned Value:
- If successful, the gmtime_r() function will return the pointer, errno
EINVAL
:
- Indicates that the sem input parameter is not valid or the
+ Indicates that the sem
input parameter is not valid or the
thread would have blocked, and the abstime parameter specified
a nanoseconds field value less than zero or greater than or
equal to 1000 million.
@@ -2469,7 +2491,7 @@ The following lists the possible values for errno
Function Prototype:
#include <semaphore.h>
- int sem_trywait ( sem_t *sem );
+ int sem_trywait(sem_t *sem);
-
sem
. The semaphore descriptor
-
-If sem_wait returns -1 (ERROR) then the cause of the failure
+If OK
) or -1 (ERROR
) if unsuccessful
sem_wait
returns -1 (ERROR
) then the cause of the failure
will be indicated by the thread-specific errno
.
The following lists the possible values for errno
:
-
EINVAL
: Indicates that the sem
input parameter is
not valid.
-EAGAIN
: Indicates that the semaphore was not acquired.
#include <semaphore.h>
- int sem_post ( sem_t *sem );
+ int sem_post(sem_t *sem);
sem
by performing the semaphore unlock operation.
sem_wait()
.
sem_post()
may be called from an interrupt handler.
-
sem
. Semaphore descriptor
-
OK
) or -1 (ERROR
) if unsuccessful.
#include <semaphore.h>
- int sem_getvalue ( sem_t *sem, int *sval );
+ int sem_getvalue(sem_t *sem, int *sval);
-
sem
. Semaphore descriptor
+sval
. Buffer by which the value is returned
-
OK
) or -1 (ERROR
) if unsuccessful.
#include <wdog.h>
- WDOG_ID wd_create (void);
+ WDOG_ID wd_create(void);
#include <wdog.h>
- int wd_delete (WDOG_ID wdog);
+ int wd_delete(WDOG_ID wdog);
-
wdog
. The watchdog ID to delete. This is actually a
pointer to a watchdog structure.
@@ -2700,8 +2722,8 @@ before deallocating it (i.e., never returns ERROR).
Function Prototype:
#include <wdog.h>
- int wd_start( WDOG_ID wdog, int delay, wdentry_t wdentry,
- intt argc, ....);
+ int wd_start(WDOG_ID wdog, int delay, wdentry_t wdentry,
+ int argc, ....);
-
wdog
. Watchdog ID
+delay
. Delay count in clock ticks
+wdentry
. Function to call on timeout
+argc
. The number of uint32_t parameters to pass to wdentry.
+...
. uint32_t size parameters to pass to wdentry
@@ -2757,7 +2779,7 @@ number of parameters is determined by
Function Prototype:
#include <wdog.h>
- int wd_cancel (WDOG_ID wdog);
+ int wd_cancel(WDOG_ID wdog);
-
wdog
. ID of the watchdog to cancel.
@@ -2852,10 +2874,10 @@ VxWorks provides the following comparable interface:
parm
. clock_settime()
function will return zero (OK
).
Otherwise, an non-zero error number will be returned to indicate the error:
@@ -2880,10 +2902,10 @@ VxWorks provides the following comparable interface:
parm
. clock_gettime()
function will return zero (OK
).
Otherwise, an non-zero error number will be returned to indicate the error:
@@ -2908,10 +2930,10 @@ VxWorks provides the following comparable interface:
parm
. clock_getres()
function will return zero (OK
).
Otherwise, an non-zero error number will be returned to indicate the error:
@@ -2936,10 +2958,10 @@ VxWorks provides the following comparable interface:
parm
. mktime()
function will return zero (OK
).
Otherwise, an non-zero error number will be returned to indicate the error:
@@ -2968,10 +2990,10 @@ VxWorks provides the following comparable interface:
gmtime()
function will return the pointer to a statically
defined instance of struct tim
.
Otherwise, a NULL will be returned to indicate the error:
result
,
+ If successful, the gmtime_r()
function will return the pointer, result
,
provided by the caller.
Otherwise, a NULL will be returned to indicate the error:
Each implementation defines a set of clocks that can be used as timing bases
- for per-thread timers. All implementations shall support a clock_id
of
+ for per-thread timers. All implementations will support a clock_id
of
CLOCK_REALTIME
.
@@ -3069,7 +3091,7 @@ VxWorks provides the following comparable interface:
timerid
. The pre-thread timer created by the call to timer_create().- Returned Values: + Returned Value:
If the call succeeds, timer_create()
will return 0 (OK
) and update the
@@ -3119,11 +3141,11 @@ VxWorks provides the following comparable interface:
The pre-thread timer, previously created by the call to timer_create(), to be deleted.
- Returned Values: + Returned Value:
- If successful, the timer_delete() function will return zero (OK).
- Otherwise, the function will return a value of -1 (ERROR) and set
+ If successful, the timer_delete()
function will return zero (OK
).
+ Otherwise, the function will return a value of -1 (ERROR
) and set
errno
to indicate the error:
ovalue
. A location in which to return the time remaining from the previous timer setting (ignored).- Returned Values: + Returned Value:
- If the timer_gettime() succeeds, a value of 0 (OK) will be returned.
- If an error occurs, the value -1 (ERROR) will be returned, and
+ If the timer_gettime() succeeds, a value of 0 (OK
) will be returned.
+ If an error occurs, the value -1 (ERROR
) will be returned, and
errno
set to indicate the error.
imer_create()
, whose remaining count will be returned.
- Returned Values: + Returned Value:
- If successful, the timer_gettime() function will return zero (OK).
+ If successful, the timer_gettime()
function will return zero (OK
).
Otherwise, an non-zero error number will be returned to indicate the error:
timer_create()
, whose overrun count will be returned.
- Returned Values:
+ Returned Value:
If the timer_getoverrun()
function succeeds, it will return the timer
expiration overrun count as explained above. timer_getoverrun()
will fail if:
tzp
. A reference to the timezone -- IGNORED.
- Returned Values:
+ Returned Value:
See clock_gettime()
.
Input Parameters:
set
. Signal set to initialize.
-Returned Values: +Returned Value:
OK
), or -1 (ERROR
) if the signal set cannot be initialized.
@@ -3444,13 +3466,13 @@ by set such that all signals are included.
Input Parameters:
set
. Signal set to initialize
-Returned Values: +Returned Value:
OK
), or -1 (ERROR
) if the signal set cannot be initialized.
@@ -3474,14 +3496,14 @@ signo to the signal set specified by set.
Input Parameters:
set
. Signal set to add signal to
+signo
. Signal to add
-Returned Values: +Returned Value:
OK
), or -1 (ERROR
) if the signal number is invalid.
@@ -3505,14 +3527,14 @@ by signo from the signal set specified by set.
Input Parameters:
set
. Signal set to delete the signal from
+signo
. Signal to delete
-Returned Values: +Returned Value:
OK
), or -1 (ERROR
) if the signal number is invalid.
@@ -3536,16 +3558,16 @@ by signo is a member of the set specified by set.
Input Parameters:
set
. Signal set to test
+signo
. Signal to test for
-Returned Values: +Returned Value:
ERROR
) if the signal number is invalid.
@@ -3560,8 +3582,8 @@ interface of the same name. Function Prototype:
#include <signal.h> - int sigaction( int signo, const struct sigaction *act, - struct sigaction *oact ); + int sigaction(int signo, const struct sigaction *act, + struct sigaction *oact);
@@ -3572,12 +3594,12 @@ 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
function.
-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.
If the argument act is not NULL, it points to a structure specifying the @@ -3603,15 +3625,15 @@ sigaction().
Input Parameters:
sig
. Signal of interest
+act
. Location of new handler
+oact
. Location to store old handler
-Returned Values: +Returned Value:
OK
), or -1 (ERROR
) if the signal number is invalid.
@@ -3650,25 +3672,25 @@ If sigprocmask() fails, the signal mask of the task is not changed.
Input Parameters:
how
. How the signal mast will be changed:
SIG_BLOCK
. The resulting set is the union of the
+current set and the signal set pointed to by the set
input parameter.
+SIG_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.
-set
input parameter.
+SIG_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
-Returned Values: +Returned Value:
OK
), or -1 (ERROR
) if how is invalid.
@@ -3683,7 +3705,7 @@ interface of the same name. Function Prototype:
#include <signal.h> - int sigpending( sigset_t *set ); + int sigpending(sigset_t *set);
@@ -3700,13 +3722,13 @@ is delivered more than once."
Input Parameters:
set
. The location to return the pending signal set.
-Returned Values: +Returned Value:
OK
) or -1 (ERROR
)
@@ -3721,7 +3743,7 @@ interface of the same name. Function Prototype:
#include <signal.h> - int sigsuspend( const sigset_t *set ); + int sigsuspend(const sigset_t *set);
@@ -3739,14 +3761,14 @@ resources (a very bad idea).
Input Parameters:
set
. The value of the signal mask to use while
suspended.
-Returned Values: +Returned Value:
ERROR
) always
@@ -3778,15 +3800,15 @@ with a NULL timeout parameter. (see below).
Input Parameters:
set
. The set of pending signals to wait for.
+info
. The returned signal values
-Returned Values: +Returned Value:
ERROR
) is returned.
@@ -3801,8 +3823,8 @@ interface of the same name. Function Prototype:
#include <signal.h> - int sigtimedwait( const sigset_t *set, struct siginfo *info, - const struct timespec *timeout ); + int sigtimedwait(const sigset_t *set, struct siginfo *info, + const struct timespec *timeout);
@@ -3821,26 +3843,26 @@ 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 asynchronous 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
-Returned Values: +Returned Value:
ERROR
) is returned.
@@ -3854,7 +3876,7 @@ Differences from the POSIX interface include:
Input Parameters:
tid
. ID of the task to receive signal
+signo
. Signal number
+value
. Value to pass to task with signal
-Returned Values: +Returned Value:
errno
is set appropriately.
+ On success (at least one signal was sent), zero (OK
) is returned.
+ On error, -1 (ERROR
) is returned, and errno
is set appropriately.
EGAIN
. The limit of signals which may be queued has been reached.EINVAL
. signo was invalid.Input Parameters:
pid
. The id of the task to receive the signal.
The POSIX kill()
specification encodes process group
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.
If signo is zero, no signal is sent, but all error checking is performed.
- Returned Values: + Returned Value:
pthread_attr_setscope
. get and set the contentionscope attribute.pthread_attr_setstack
. get and set stack attributes.pthread_attr_setstackaddr
. get and set the stackaddr attribute.pthread_barrier_destroy
. destroy and initialize a barrier object.pthread_barrier_init
. destroy and initialize a barrier object.pthread_barrier_wait
. synchronize at a barrier.pthread_cleanup_pop
. establish cancellation handlers.pthread_cleanup_push
. establish cancellation handlers.pthread_condattr_getclock
. set the clock selection condition variable attribute.To be provided
.-Returned Values: +Returned Value:
-If successful, the pthread_attr_init() function will return
-zero (OK). Otherwise, an error number will be
+If successful, the pthread_attr_init()
function will return
+zero (OK
). Otherwise, an error number will be
returned to indicate the error:
To be provided
.-Returned Values: +Returned Value:
-If successful, the pthread_attr_destroy() function will return
-zero (OK). Otherwise, an error number will be
+If successful, the pthread_attr_destroy()
function will return
+zero (OK
). Otherwise, an error number will be
returned to indicate the error:
To be provided
.-Returned Values: +Returned Value:
-If successful, the pthread_attr_setschedpolicy() function will return
-zero (OK). Otherwise, an error number will be
+If successful, the pthread_attr_setschedpolicy()
function will return
+zero (OK
). Otherwise, an error number will be
returned to indicate the error:
To be provided
.-Returned Values: +Returned Value:
-If successful, the pthread_attr_getschedpolicy() function will return
-zero (OK). Otherwise, an error number will be
+If successful, the pthread_attr_getschedpolicy()
function will return
+zero (OK
). Otherwise, an error number will be
returned to indicate the error:
- #include <pthread.h> + #include <pthread.h> int pthread_attr_setschedparam(pthread_attr_t *attr, - const struct sched_param *param); + const struct sched_param *param);
Description: @@ -4250,10 +4269,10 @@ interface of the same name.
To be provided
.-Returned Values: +Returned Value:
-If successful, the pthread_attr_getschedpolicy() function will return
-zero (OK). Otherwise, an error number will be
+If successful, the pthread_attr_getschedpolicy()
function will return
+zero (OK
). Otherwise, an error number will be
returned to indicate the error:
- #include <pthread.h> - int pthread_attr_getschedparam(pthread_attr_t *attr, - struct sched_param *param); + #include <pthread.h> + int pthread_attr_getschedparam(pthread_attr_t *attr, + struct sched_param *param);
Description: @@ -4282,10 +4301,10 @@ interface of the same name.
To be provided
.-Returned Values: +Returned Value:
-If successful, the pthread_attr_getschedparam() function will return
-zero (OK). Otherwise, an error number will be
+If successful, the pthread_attr_getschedparam()
function will return
+zero (OK
). Otherwise, an error number will be
returned to indicate the error:
#include <pthread.h> int pthread_attr_setinheritsched(pthread_attr_t *attr, - int inheritsched); + int inheritsched);
Description: @@ -4314,10 +4333,10 @@ interface of the same name.
To be provided
.-Returned Values: +Returned Value:
-If successful, the pthread_attr_setinheritsched() function will return
-zero (OK). Otherwise, an error number will be
+If successful, the pthread_attr_setinheritsched()
function will return
+zero (OK
). Otherwise, an error number will be
returned to indicate the error:
#include <pthread.h> int pthread_attr_getinheritsched(const pthread_attr_t *attr, - int *inheritsched); + int *inheritsched);
Description: @@ -4346,10 +4365,10 @@ interface of the same name.
To be provided
.-Returned Values: +Returned Value:
-If successful, the pthread_attr_getinheritsched() function will return
-zero (OK). Otherwise, an error number will be
+If successful, the pthread_attr_getinheritsched()
function will return
+zero (OK
). Otherwise, an error number will be
returned to indicate the error:
- #include <pthread.h> + #include <pthread.h> int pthread_attr_setstacksize(pthread_attr_t *attr, long stacksize);
@@ -4377,10 +4396,10 @@ interface of the same name.
To be provided
.-Returned Values: +Returned Value:
-If successful, the pthread_attr_setstacksize() function will return
-zero (OK). Otherwise, an error number will be
+If successful, the pthread_attr_setstacksize()
function will return
+zero (OK
). Otherwise, an error number will be
returned to indicate the error:
#include <pthread.h> - int pthread_attr_getstacksize(pthread_attr_t *attr, long *stackaddr); + int pthread_attr_getstacksize(pthread_attr_t *attr, long *stackaddr);
Description: @@ -4408,10 +4427,10 @@ interface of the same name.
To be provided
.-Returned Values: +Returned Value:
-If successful, the pthread_attr_getstacksize() function will return
-zero (OK). Otherwise, an error number will be
+If successful, the pthread_attr_getstacksize()
function will return
+zero (OK
). Otherwise, an error number will be
returned to indicate the error:
#include <pthread.h> int pthread_create(pthread_t *thread, pthread_attr_t *attr, - pthread_startroutine_t startRoutine, - pthread_addr_t arg); + pthread_startroutine_t startRoutine, + pthread_addr_t arg);
Description: @@ -4447,10 +4466,10 @@ specify details about the kind of thread being created.
To be provided
.-Returned Values: +Returned Value:
-If successful, the pthread_create() function will return
-zero (OK). Otherwise, an error number will be
+If successful, the pthread_create()
function will return
+zero (OK
). Otherwise, an error number will be
returned to indicate the error:
To be provided
.-Returned Values: +Returned Value:
-If successful, the pthread_detach() function will return
-zero (OK). Otherwise, an error number will be
+If successful, the pthread_detach()
function will return
+zero (OK
). Otherwise, an error number will be
returned to indicate the error:
To be provided
.-Returned Values: +Returned Value:
-If successful, the pthread_exit() function will return
-zero (OK). Otherwise, an error number will be
+If successful, the pthread_exit()
function will return
+zero (OK
). Otherwise, an error number will be
returned to indicate the error:
Description: -
The pthread_cancel() function shall request that thread +
The pthread_cancel()
function will request that thread
be canceled. The target thread's cancelability state determines
when the cancellation takes effect. When the
-cancellation is acted on, thread shall be terminated.
When cancelability is disabled, all cancels are held pending in the target thread until the thread changes the cancelability. @@ -4555,17 +4574,17 @@ immediately (when enable), interrupting the thread with its processing.
Input Parameters:
thread
.
Identifies the thread to be canceled.-Returned Values: +Returned Value:
-If successful, the pthread_cancel() function will return zero (OK).
+If successful, the pthread_cancel()
function will return zero (OK
).
Otherwise, an error number will be returned to indicate the error:
ESRCH
.
No thread could be found corresponding to that specified by the given thread ID.Description: -
The pthread_setcancelstate() function atomically +
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.
@@ -4604,19 +4623,19 @@ cancellation state is set to PTHREAD_CANCEL_ENABLE.
state
New cancellation state. One of PTHREAD_CANCEL_ENABLE or PTHREAD_CANCEL_DISABLE.<.li>
-oldstate
.
Location to return the previous cancellation state.
-Returned Values: +Returned Value:
-If successful, the pthread_setcancelstate() function will return
-zero (OK). Otherwise, an error number will be returned to indicate the error:
+If successful, the pthread_setcancelstate()
function will return
+zero (OK
). Otherwise, an error number will be returned to indicate the error:
ESRCH
.
No thread could be found corresponding to that specified by the given thread ID.To be provided
.-Returned Values: +Returned Value:
-If successful, the pthread_setcancelstate() function will return
-zero (OK). Otherwise, an error number will be
+If successful, the pthread_setcancelstate()
function will return
+zero (OK
). Otherwise, an error number will be
returned to indicate the error:
To be provided
.-Returned Values: +Returned Value:
-If successful, the pthread_join() function will return
-zero (OK). Otherwise, an error number will be
+If successful, the pthread_join()
function will return
+zero (OK
). Otherwise, an error number will be
returned to indicate the error:
To be provided
.-Returned Values: +Returned Value:
-If successful, the pthread_yield() function will return
-zero (OK). Otherwise, an error number will be
+If successful, the pthread_yield()
function will return
+zero (OK
). Otherwise, an error number will be
returned to indicate the error:
To be provided
.-Returned Values: +Returned Value:
-If successful, the pthread_self() function will return
-zero (OK). Otherwise, an error number will be
+If successful, the pthread_self()
function will return
+zero (OK
). Otherwise, an error number will be
returned to indicate the error:
- Returned Values:
+ Returned Value:
0 (OK
) if successful.
Otherwise, the error code ESRCH
if the value specified by
thread
does not refer to an existing thread.
@@ -4871,11 +4890,11 @@ interface of the same name.
- Returned Values: + Returned Value:
- If successful, the pthread_setschedparam() function will return
- zero (OK). Otherwise, an error number will be
+ If successful, the pthread_setschedparam()
function will return
+ zero (OK
). Otherwise, an error number will be
returned to indicate the error:
#include <pthread.h> - int pthread_key_create( pthread_key_t *key, void (*destructor)(void*) ) + int pthread_key_create(pthread_key_t *key, void (*destructor)(void*))
Description:
@@ -4925,38 +4944,38 @@ interface of the same name.
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
+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
+Upon key creation, the value NULL
will be associated with
the new key in all active threads. Upon thread
-creation, the value NULL will be associated with all
+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
be associated with each key that is invoked when a
thread exits. However, this argument is ignored in
the current implementation.
-Returned Values: +Returned Value:
-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
+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
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
-PTHREAD_KEYS_MAX
} has been exceeded
+ENONMEM
Insufficient memory exists to create the key.
@@ -4972,39 +4991,39 @@ interface of the same name.
#include <pthread.h> - int pthread_setspecific( pthread_key_t key, void *value ) + int pthread_setspecific(pthread_key_t key, void *value)
Description:
-The pthread_setspecific() function associates a thread-
+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
+to pthread_key_create()
. Different threads may bind
different values to the same key. These values are
typically pointers to blocks of dynamically allocated
memory that have been reserved for use by the calling
thread.
-The 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.
+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: +Returned Value:
-If successful, pthread_setspecific() will return zero (OK).
+If successful, pthread_setspecific()
will return zero (OK
).
Otherwise, an error number will be returned:
ENOMEM
. Insufficient memory exists to associate the value
with the key.
-EINVAL
. The key value is invalid.
Assumptions/Limitations: @@ -5022,31 +5041,31 @@ destructor function.
#include <pthread.h> - void *pthread_getspecific( pthread_key_t key ) + void *pthread_getspecific(pthread_key_t key)
Description:
-The pthread_getspecific() function returns the value
+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.
+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: +Returned Value:
-The function pthread_getspecific() returns the thread-
+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.
+the value NULL
is returned.
Assumptions/Limitations:
@@ -5063,25 +5082,25 @@ destructor function.
#include <pthread.h> - int pthread_key_delete( pthread_key_t key ) + int pthread_key_delete(pthread_key_t key)
Description:
This POSIX function should delete a thread-specific data
-key previously returned by pthread_key_create(). However,
+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: +Returned Value:
EINVAL
.
Assumptions/Limitations: @@ -5106,10 +5125,10 @@ interface of the same name.
To be provided
.-Returned Values: +Returned Value:
-If successful, the pthread_mutexattr_init() function will return
-zero (OK). Otherwise, an error number will be
+If successful, the pthread_mutexattr_init()
function will return
+zero (OK
). Otherwise, an error number will be
returned to indicate the error:
To be provided
.-Returned Values: +Returned Value:
-If successful, the pthread_mutexattr_destroy() function will return
-zero (OK). Otherwise, an error number will be
+If successful, the pthread_mutexattr_destroy()
function will return
+zero (OK
). Otherwise, an error number will be
returned to indicate the error:
#include <pthread.h> int pthread_mutexattr_getpshared(pthread_mutexattr_t *attr, - int *pshared); + int *pshared);
Description: @@ -5169,10 +5188,10 @@ interface of the same name.
To be provided
.-Returned Values: +Returned Value:
-If successful, the pthread_mutexattr_getpshared() function will return
-zero (OK). Otherwise, an error number will be
+If successful, the pthread_mutexattr_getpshared()
function will return
+zero (OK
). Otherwise, an error number will be
returned to indicate the error:
#include <pthread.h> int pthread_mutexattr_setpshared(pthread_mutexattr_t *attr, - int pshared); + int pshared);
Description: @@ -5201,10 +5220,10 @@ interface of the same name.
To be provided
.-Returned Values: +Returned Value:
-If successful, the pthread_mutexattr_setpshared() function will return
-zero (OK). Otherwise, an error number will be
+If successful, the pthread_mutexattr_setpshared()
function will return
+zero (OK
). Otherwise, an error number will be
returned to indicate the error:
-Returned Values: +Returned Value:
-If successful, the pthread_mutexattr_settype() function will return
-zero (OK). Otherwise, an error number will be
+If successful, the pthread_mutexattr_settype()
function will return
+zero (OK
). Otherwise, an error number will be
returned to indicate the error:
-Returned Values: +Returned Value:
-If successful, the pthread_mutexattr_settype() function will return
-zero (OK). Otherwise, an error number will be
+If successful, the pthread_mutexattr_settype()
function will return
+zero (OK
). Otherwise, an error number will be
returned to indicate the error:
#include <pthread.h> int pthread_mutex_init(pthread_mutex_t *mutex, - pthread_mutexattr_t *attr); + pthread_mutexattr_t *attr);
Description: @@ -5322,10 +5341,10 @@ returned to indicate the error:
To be provided
.-Returned Values: +Returned Value:
-If successful, the pthread_mutex_init() function will return
-zero (OK). Otherwise, an error number will be
+If successful, the pthread_mutex_init()
function will return
+zero (OK
). Otherwise, an error number will be
returned to indicate the error:
To be provided
.-Returned Values: +Returned Value:
-If successful, the pthread_mutex_destroy() function will return
-zero (OK). Otherwise, an error number will be
+If successful, the pthread_mutex_destroy()
function will return
+zero (OK
). Otherwise, an error number will be
returned to indicate the error:
mutex
. A reference to the mutex to be locked.-Returned Values: +Returned Value:
-If successful, the pthread_mutex_lock() function will return zero (OK).
+If successful, the pthread_mutex_lock()
function will return zero (OK
).
Otherwise, an error number will be returned to indicate the error:
pthread_mutex_lock()
except that if the mutex object referenced by mutex is currently locked
(by any thread, including the current thread), the call returns immediately
- with the errno EBUSY
.
+ with the errno
EBUSY
.
If a signal is delivered to a thread waiting for a mutex, upon return from the signal handler the thread resumes waiting for the mutex as if it was @@ -5459,9 +5478,9 @@ interface of the same name.
mutex
. A reference to the mutex to be locked.-Returned Values: +Returned Value:
-If successful, the pthread_mutex_trylock() function will return zero (OK).
+If successful, the pthread_mutex_trylock()
function will return zero (OK
).
Otherwise, an error number will be returned to indicate the error:
pthread_mutex_unlock()
is called, resulting in
the mutex becoming available, the scheduling policy is used to determine
- which thread shall acquire the mutex. (In the case of PTHREAD_MUTEX_RECURSIVE
+ which thread will acquire the mutex. (In the case of PTHREAD_MUTEX_RECURSIVE
mutexes, the mutex becomes available when the count reaches zero and the
calling thread no longer has any locks on this mutex).
@@ -5504,10 +5523,10 @@ interface of the same name.
mutex
.-Returned Values: +Returned Value:
-If successful, the pthread_mutex_unlock() function will return
-zero (OK). Otherwise, an error number will be
+If successful, the pthread_mutex_unlock()
function will return
+zero (OK
). Otherwise, an error number will be
returned to indicate the error:
To be provided
.-Returned Values: +Returned Value:
-If successful, the pthread_condattr_init() function will return
-zero (OK). Otherwise, an error number will be
+If successful, the pthread_condattr_init()
function will return
+zero (OK
). Otherwise, an error number will be
returned to indicate the error:
To be provided
.-Returned Values: +Returned Value:
-If successful, the pthread_condattr_destroy() function will return
-zero (OK). Otherwise, an error number will be
+If successful, the pthread_condattr_destroy()
function will return
+zero (OK
). Otherwise, an error number will be
returned to indicate the error:
To be provided
.-Returned Values: +Returned Value:
-If successful, the pthread_cond_init() function will return
-zero (OK). Otherwise, an error number will be
+If successful, the pthread_cond_init()
function will return
+zero (OK
). Otherwise, an error number will be
returned to indicate the error:
To be provided
.-Returned Values: +Returned Value:
-If successful, the pthread_cond_destroy() function will return
-zero (OK). Otherwise, an error number will be
+If successful, the pthread_cond_destroy()
function will return
+zero (OK
). Otherwise, an error number will be
returned to indicate the error:
To be provided
.-Returned Values: +Returned Value:
-If successful, the pthread_cond_broadcast() function will return
-zero (OK). Otherwise, an error number will be
+If successful, the pthread_cond_broadcast()
function will return
+zero (OK
). Otherwise, an error number will be
returned to indicate the error:
To be provided
.-Returned Values: +Returned Value:
-If successful, the pthread_cond_signal() function will return
-zero (OK). Otherwise, an error number will be
+If successful, the pthread_cond_signal()
function will return
+zero (OK
). Otherwise, an error number will be
returned to indicate the error:
To be provided
.- Returned Values: + Returned Value:
-If successful, the pthread_cond_wait() function will return
-zero (OK). Otherwise, an error number will be
+If successful, the pthread_cond_wait()
function will return
+zero (OK
). Otherwise, an error number will be
returned to indicate the error:
#include <pthread.h> int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, - const struct timespec *abstime); + const struct timespec *abstime);
Description: @@ -5756,7 +5775,7 @@ interface of the same name.
To be provided
.- Returned Values: + Returned Value:
If successful, the pthread_cond_timedwait()
function will return
@@ -5796,7 +5815,7 @@ interface of the same name.
- Returned Values:
+ Returned Value:
0 (OK
) on success or EINVAL
if attr
is invalid.
@@ -5829,7 +5848,7 @@ interface of the same name.
- Returned Values: 0 (OK) on success or EINVAL if attr is invalid.
+ Returned Value: 0 (OK
) on success or EINVAL
if attr is invalid.
Assumptions/Limitations: @@ -5865,7 +5884,7 @@ interface of the same name.
pshared
. The new value of the pshared attribute.
- Returned Values: 0 (OK
) on success or EINVAL
if either
+ Returned Value: 0 (OK
) on success or EINVAL
if either
attr
is invalid or pshared
is not one of
PTHREAD_PROCESS_SHARED
or PTHREAD_PROCESS_PRIVATE
.
pshared
. The location to stored the current value of the pshared attribute.
- Returned Values: 0 (OK
) on success or EINVAL
if
+ Returned Value: 0 (OK
) on success or EINVAL
if
either attr
or pshared
is invalid.
@@ -5950,7 +5969,7 @@ interface of the same name.
- Returned Values:0 (OK) on success or on of the following error numbers:
+ Returned Value:0 (OK
) on success or on of the following error numbers:
barrier
. The barrier to be destroyed.
- Returned Values: 0 (OK
) on success or on of the following error numbers:
+ Returned Value: 0 (OK
) on success or on of the following error numbers:
barrier
. The barrier on which to wait.
- Returned Values: 0 (OK
) on success or EINVAL
if the barrier is not valid.
+ Returned Value: 0 (OK
) on success or EINVAL
if the barrier is not valid.
Assumptions/Limitations: @@ -6116,8 +6135,8 @@ interface of the same name.
- Returned Values:
- 0 (OK) on success or EINVAL if either once_control or init_routine are invalid.
+ Returned Value:
+ 0 (OK
) on success or EINVAL
if either once_control or init_routine are invalid.
Assumptions/Limitations: @@ -6157,7 +6176,7 @@ interface of the same name.
- Returned Values: + Returned Value:
On success, the signal was sent and zero is returned. @@ -6232,11 +6251,11 @@ interface of the same name.
- Returned Values: -
-
- 0 (OK) on success or EINVAL if how
is invalid.
+ Returned Value:
OK
) on success or EINVAL
if how
is invalid.
+Assumptions/Limitations:
@@ -6314,7 +6333,7 @@ interface of the same name.- Returned Values: + Returned Value: The value of the variable (read-only) or NULL on failure.
@@ -6341,11 +6360,11 @@ interface of the same name.string
- name=value string describing the environment setting to add/modify.
+ name=value string describing the environment setting to add/modify.
- Returned Values: + Returned Value: Zero on success.
@@ -6367,7 +6386,7 @@ interface of the same name. None- Returned Values: + Returned Value: Zero on success.
@@ -6405,7 +6424,7 @@ interface of the same name.- Returned Values: + Returned Value: Zero on success.
@@ -6432,7 +6451,7 @@ interface of the same name.- Returned Values: + Returned Value: Zero on success.
@@ -6560,7 +6579,7 @@ interface of the same name.#include <poll.h> - int poll(struct pollfd *fds, nfds_t nfds, int timeout); + int poll(struct pollfd *fds, nfds_t nfds, int timeout);
Description: @@ -6607,7 +6626,7 @@ interface of the same name. timeout.
- Returned Values: + Returned Value:
On success, the number of structures that have nonzero revents
fields.
@@ -6629,11 +6648,11 @@ interface of the same name.
Function Prototype:
-- #include <sys/select.h> - int select(int nfds, FAR fd_set *readfds, FAR fd_set *writefds, - FAR fd_set *exceptfds, FAR struct timeval *timeout); -+
+#include <sys/select.h> +int select(int nfds, FAR fd_set *readfds, FAR fd_set *writefds, + FAR fd_set *exceptfds, FAR struct timeval *timeout); +
Description:
select()
allows a program to monitor multiple file descriptors, waiting
@@ -6660,7 +6679,7 @@ interface of the same name.
timeout
. Return at this time if none of these events of interest occur.- Returned Values: + Returned Value:
0:
Timer expiredFunction Prototype:
-- #include <unistd.h> - int pipe(int filedes[2]); -+
+#include <unistd.h> +int pipe(int filedes[2]); +
Description:
- Returned Values: + Returned Value:
0 is returned on success; otherwise, -1 is returned with errno
set appropriately.
@@ -6836,10 +6855,10 @@ void *memmove(void *dest, const void *src, size_t count);
Function Prototype:
-- #include <sys/stat.h> - int mkfifo(FAR const char *pathname, mode_t mode); -+
+#include <sys/stat.h> +int mkfifo(FAR const char *pathname, mode_t mode); +
Description:
- Returned Values: + Returned Value:
0 is returned on success; otherwise, -1 is returned with errno
set appropriately.
@@ -6933,7 +6952,7 @@ struct fat_format_s
- Returned Values: + Returned Value:
Zero (OK
) on success;
@@ -7189,7 +7208,7 @@ FAR void *mmap(FAR void *start, size_t length, int prot, int flags, int fd, off_
- Returned Values: + Returned Value:
On success, mmap()
returns a pointer to the mapped area.
@@ -7246,10 +7265,10 @@ Those socket APIs are discussed in the following paragraphs.
Function Prototype:
-- #include <sys/socket.h> - int socket(int domain, int type, int protocol); -+
+#include <sys/socket.h> +int socket(int domain, int type, int protocol); +
Description: socket() creates an endpoint for communication and returns a descriptor. @@ -7264,7 +7283,7 @@ Those socket APIs are discussed in the following paragraphs.
protocol
: (see sys/socket.h)
- Returned Values:
+ Returned Value:
0 on success; -1 on error with errno
set appropriately:
Function Prototype:
-- #include <sys/socket.h> - int bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen); -+
+#include <sys/socket.h> +int bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen); +
Description:
bind()
gives the socket sockfd the local address addr
.
@@ -7310,7 +7329,7 @@ Those socket APIs are discussed in the following paragraphs.
addrlen
: Length of addr
.
- Returned Values:
+ Returned Value:
0 on success; -1 on error with errno
set appropriately:
Function Prototype:
-- #include <sys/socket.h> - int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen); -+
+#include <sys/socket.h> +int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen); +
Description:
connect()
connects the socket referred to by the file descriptor
@@ -7365,7 +7384,7 @@ Those socket APIs are discussed in the following paragraphs.
addrlen
: Length of actual addr
- Returned Values:
+ Returned Value:
0 on success; -1 on error with errno
set appropriately:
EACCES
or EPERM:
@@ -7409,10 +7428,10 @@ Those socket APIs are discussed in the following paragraphs.
Function Prototype:
-- #include <sys/socket.h> - int listen(int sockfd, int backlog); -+
+#include <sys/socket.h> +int listen(int sockfd, int backlog); +
Description:
To accept connections, a socket is first created with socket()
, a
@@ -7432,7 +7451,7 @@ Those socket APIs are discussed in the following paragraphs.
- Returned Values:
+ Returned Value:
On success, zero is returned. On error, -1 is returned, and
errno
is set appropriately.
Function Prototype:
-- #include <sys/socket.h> - int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen); -+
+#include <sys/socket.h> +int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen); +
Description:
The accept()
function is used with connection-based socket types
@@ -7488,7 +7507,7 @@ Those socket APIs are discussed in the following paragraphs.
addrlen
: Input: allocated size of addr
, Return: returned size of addr
.- Returned Values: + Returned Value: Returns -1 on error. If it succeeds, it returns a non-negative integer that is a descriptor for the accepted socket.
@@ -7525,10 +7544,10 @@ Those socket APIs are discussed in the following paragraphs.Function Prototype:
-- #include <sys/socket.h> - ssize_t send(int sockfd, const void *buf, size_t len, int flags); -+
+#include <sys/socket.h> +ssize_t send(int sockfd, const void *buf, size_t len, int flags); +
Description:
The send()
call may be used only when the socket is in a connected state
@@ -7549,7 +7568,7 @@ Those socket APIs are discussed in the following paragraphs.
flags
: Send flags
- Returned Values:
+ Returned Value:
See sendto()
.
Function Prototype:
-- #include <sys/socket.h> - ssize_t sendto(int sockfd, const void *buf, size_t len, int flags, - const struct sockaddr *to, socklen_t tolen); -+
+#include <sys/socket.h> + ssize_t sendto(int sockfd, const void *buf, size_t len, int flags, + const struct sockaddr *to, socklen_t tolen); +
Description:
If sendto()
is used on a connection-mode (SOCK_STREAM, SOCK_SEQPACKET)
@@ -7582,7 +7601,7 @@ Those socket APIs are discussed in the following paragraphs.
tolen
: The length of the address structure
- Returned Values:
+ Returned Value:
On success, returns the number of characters sent. On error, -1 is returned,
and errno
is set appropriately:
Function Prototype:
-- #include <sys/socket.h> - ssize_t recv(int sockfd, void *buf, size_t len, int flags); -+
+#include <sys/socket.h> +ssize_t recv(int sockfd, void *buf, size_t len, int flags); +
Description:
The recv()
call is identical to
@@ -7652,7 +7671,7 @@ Those socket APIs are discussed in the following paragraphs.
- Returned Values:
+ Returned Value:
See recvfrom()
.
Function Prototype:
-- #include <sys/socket.h> - ssize_t recvfrom(int sockfd, void *buf, size_t len, int flags, - struct sockaddr *from, socklen_t *fromlen); -+
+#include <sys/socket.h> +ssize_t recvfrom(int sockfd, void *buf, size_t len, int flags, + struct sockaddr *from, socklen_t *fromlen); +
Description:
recvfrom()
receives messages from a socket, and may be used to receive
@@ -7688,7 +7707,7 @@ Those socket APIs are discussed in the following paragraphs.
fromlen
: The length of the address structure.
- Returned Values:
+ Returned Value:
On success, returns the number of characters sent.
If no data is available to be received and the peer has performed an orderly shutdown, recv() will return 0.
Othwerwise, on errors, -1 is returned, and errno
is set appropriately:
@@ -7723,11 +7742,11 @@ Those socket APIs are discussed in the following paragraphs.
Function Prototype:
-- #include <sys/socket.h> - int setsockopt(int sockfd, int level, int option, - const void *value, socklen_t value_len); -+
+#include <sys/socket.h> +int setsockopt(int sockfd, int level, int option, + const void *value, socklen_t value_len); +
Description:
setsockopt()
sets the option specified by the option
argument,
@@ -7753,7 +7772,7 @@ Those socket APIs are discussed in the following paragraphs.
value_len
: The length of the argument value
- Returned Values:
+ Returned Value:
On success, returns the number of characters sent.
On error, -1 is returned, and errno
is set appropriately:
Function Prototype:
-- #include <sys/socket.h> - int getsockopt(int sockfd, int level, int option, - void *value, socklen_t *value_len); -+
+#include <sys/socket.h> +int getsockopt(int sockfd, int level, int option, + void *value, socklen_t *value_len); +
Description:
getsockopt()
retrieve those value for the option specified by the
@@ -7816,7 +7835,7 @@ Those socket APIs are discussed in the following paragraphs.
value_len
: The length of the argument value
- Returned Values:
+ Returned Value:
On success, returns the number of characters sent.
On error, -1 is returned, and errno
is set appropriately:
Function Prototype:
-
#include <errno.h> - #define errno *get_errno_ptr() - int *get_errno_ptr( void )+
+#include <errno.h> +#define errno *get_errno_ptr() +int *get_errno_ptr(void); +
Description:
get_errno_ptr()
returns a pointer to the thread-specific errno
value.