diff --git a/Documentation/NuttX.html b/Documentation/NuttX.html index 953f5eea103..330429e3b47 100644 --- a/Documentation/NuttX.html +++ b/Documentation/NuttX.html @@ -441,6 +441,11 @@ Other memory: * added pthread_barrierattr_*() APIs * added pthread_barrier_init(), pthread_barrier_destroy(), and pthread_barrier_wait(); + * Added protection so that errno cannot be modified from + interrupt handling. + * sched_setparam(), sched_setscheduler() now correctly set + errno; pthread_setscheduler() now returns the correct errno. + * Added pthread_setschedprio(). * Started m68322 diff --git a/Documentation/NuttxUserGuide.html b/Documentation/NuttxUserGuide.html index 883da65c3d8..7ebb2c13bb8 100644 --- a/Documentation/NuttxUserGuide.html +++ b/Documentation/NuttxUserGuide.html @@ -93,11 +93,11 @@ paragraphs.
Tasks. - NuttX is a flat address OS. As such it does not support "processes" + NuttX is a flat address OS. As such it does not support processes in the way that, say, Linux does. NuttX only supports simple threads running within the same address space. - However, the programming model makes a distinction between "tasks" - and pthreads: + However, the programming model makes a distinction between tasks + and pthreads:
-Function Prototype: -
+++ Function Prototype: +
#include <sched.h> - int sched_setparam( pid_t pid, const struct sched_param *param ); -+ int sched_setparam(pid_t pid, const struct sched_param *param); +
+ Description: + This function sets the priority of the task specified by pid input parameter. +
+
+ NOTE: Setting a task's priority to the same value has the similar
+ effect to sched_yield(): The task will be moved to after all
+ other tasks with the same priority.
+
+ Input Parameters: +
+pid.
+ The task ID of the task.
+ If pid is zero, the priority of the calling task is set.
+ 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.
+ + Returned Values: + On success, sched_setparam() returns 0 (OK). + On error, -1 (ERROR) is returned, and errno is set appropriately. +
+-Description: This function sets the priority of the task -specified by pid input parameter. -
-NOTE: Setting a task's priority to the same value has the similar -effect to sched_yield() -- The task will be moved to after all -other tasks with the same priority. -
-Input Parameters: -
param.-Returned Values: -
-Assumptions/Limitations: -
- POSIX Compatibility: Comparable to the POSIX -interface of the same name. -Differences from the full POSIX implementation include: -
EINVAL.
+ The parameter param is invalid or does not make sense for the current scheduling policy.
+ EPERM.
+ The calling task does not have appropriate privileges.
+ ESRCH.
+ The task whose ID is pid could not be found.
+ + Assumptions/Limitations: +
++ POSIX Compatibility: + Comparable to the POSIX interface of the same name. + Differences from the full POSIX implementation include: +
++ 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. + For the most part, threads and tasks are interchangeable and differ primarily + only in such things as the inheritance of file descriptors. + Basically, threads are initialized and uninitialized differently and share a + few more resources than tasks. +
+ The following pthread interfaces are supported in some form by NuttX: +
+ No support for the ollowing pthread interfaces is provided by NuttX: +
+pthread_atfork. register fork handlers.pthread_attr_getdetachstate. get and set the detachstate attribute.pthread_attr_getguardsize. get and set the thread guardsize attribute.pthread_attr_getinheritsched. get and set the inheritsched attribute.pthread_attr_getscope. get and set the contentionscope attribute.pthread_attr_getstack. get and set stack attributes.pthread_attr_getstackaddr. get and set the stackaddr attribute.pthread_attr_setdetachstate. get and set the detachstate attribute.pthread_attr_setguardsize. get and set the thread guardsize attribute.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. get and set the clock selection condition variable attribute.pthread_condattr_getpshared. get and set the process-shared condition variable attributes.pthread_condattr_setclock. get and set the clock selection condition variable attribute.pthread_condattr_setpshared. get and set the process-shared condition variable attributes.pthread_getconcurrency. get and set the level of concurrency.pthread_getcpuclockid. access a thread CPU-time clock.pthread_mutex_getprioceiling. get and set the priority ceiling of a mutex.pthread_mutex_setprioceiling. get and set the priority ceiling of a mutex.pthread_mutex_timedlock. lock a mutex.pthread_mutexattr_getprioceiling. get and set the prioceiling attribute of the mutex attributes object.pthread_mutexattr_getprotocol. get and set the protocol attribute of the mutex attributes object.pthread_mutexattr_gettype. get and set the mutex type attribute.pthread_mutexattr_setprioceiling. get and set the prioceiling attribute of the mutex attributes object.pthread_mutexattr_setprotocol. get and set the protocol attribute of the mutex attributes object.pthread_mutexattr_settype. get and set the mutex type attribute.pthread_rwlock_destroy. destroy and initialize a read-write lock object.pthread_rwlock_init. destroy and initialize a read-write lock object.pthread_rwlock_rdlock. lock a read-write lock object for reading.pthread_rwlock_timedrdlock. lock a read-write lock for reading.pthread_rwlock_timedwrlock. lock a read-write lock for writing.pthread_rwlock_tryrdlock. lock a read-write lock object for reading.pthread_rwlock_trywrlock. lock a read-write lock object for writing.pthread_rwlock_unlock. unlock a read-write lock object.pthread_rwlock_wrlock. lock a read-write lock object for writing.pthread_rwlockattr_destroy. destroy and initialize the read-write lock attributes object.pthread_rwlockattr_getpshared. get and set the process-shared attribute of the read-write lock attributes object.pthread_rwlockattr_init. destroy and initialize the read-write lock attributes object.pthread_rwlockattr_setpshared. get and set the process-shared attribute of the read-write lock attributes object.pthread_setcanceltype. set cancelability state.pthread_setconcurrency. get and set the level of concurrency.pthread_spin_destroy. destroy or initialize a spin lock object.pthread_spin_init. destroy or initialize a spin lock object.pthread_spin_lock. lock a spin lock object.pthread_spin_trylock. lock a spin lock object.pthread_spin_unlock. unlock a spin lock object.pthread_testcancel. set cancelability state.@@ -3825,68 +3909,162 @@ returned to indicate the error: interface of the same name.
-Function Prototype: -
-
++ Function Prototype: +
+#include <pthread.h> int pthread_getschedparam(pthread_t thread, int *policy, - struct sched_param *param); ---Description: -
-Input Parameters: -
-
param.-Returned Values: -
-If successful, the pthread_getschedparam() function will return -zero (OK). Otherwise, an error number will be -returned to indicate the error: -
-
Exxx. -POSIX Compatibility: Comparable to the POSIX -interface of the same name. + struct sched_param *param); + +
+ Description:
+ The pthread_getschedparam() functions will get the
+ scheduling policy and parameters of threads.
+ For SCHED_FIFO and SCHED_RR, the only
+ required member of the sched_param structure is the
+ priority sched_priority.
+
+ The pthread_getschedparam() function will retrieve the
+ scheduling policy and scheduling parameters for the thread whose thread
+ ID is given by thread and will store those values in
+ policy and param, respectively.
+ The priority value returned from pthread_getschedparam()
+ will be the value specified by the most recent pthread_setschedparam(),
+ pthread_setschedprio(), or pthread_create() call
+ affecting the target thread.
+ It will not reflect any temporary adjustments to its priority (such as might
+ result of any priority inheritance, for example).
+
+ The policy parameter may have the value SCHED_FIFO or SCHED_RR
+ (SCHED_OTHER and SCHED_SPORADIC, in particular, are not supported).
+ The SCHED_FIFO and SCHED_RR policies will have a single
+ scheduling parameter, sched_priority.
+
+ Input Parameters: +
+thread.
+ The ID of thread whose scheduling parameters will be queried.
+ policy.
+ The location to store the thread's scheduling policy.
+ param.
+ The location to store the thread's priority.
+
+ Returned Values:
+ 0 (OK) if successful.
+ Otherwise, the error code ESRCH if the value specified by
+ thread does not refer to an existing thread.
+
+ Assumptions/Limitations: +
++ POSIX Compatibility: + Comparable to the POSIX interface of the same name. +
-Function Prototype: -
-
++ Function Prototype: +
+#include <pthread.h> int pthread_setschedparam(pthread_t thread, int policy, - const struct sched_param *param); ---Description: -
-Input Parameters: -
-
param.-Returned Values: -
-If successful, the pthread_setschedparam() function will return -zero (OK). Otherwise, an error number will be -returned to indicate the error: -
-
Exxx. -POSIX Compatibility: Comparable to the POSIX -interface of the same name. + const struct sched_param *param); + +
+ Description:
+ The pthread_setschedparam() functions will set the scheduling policy
+ and parameters of threads.
+ For SCHED_FIFO and SCHED_RR, the only required member
+ of the sched_param structure is the priority sched_priority.
+
pthread_setschedparam() function will set the scheduling policy
+ and associated scheduling parameters for the thread whose thread ID is given by
+ thread to the policy and associated parameters provided in
+ policy and param, respectively.
+
+
+ The policy parameter may have the value SCHED_FIFO or SCHED_RR.
+ (SCHED_OTHER and SCHED_SPORADIC, in particular, are not supported).
+ The SCHED_FIFO and SCHED_RR policies will have a single
+ scheduling parameter, sched_priority.
+
+ If the pthread_setschedparam() function fails, the scheduling
+ parameters will not be changed for the target thread.
+
+ Input Parameters: +
+thread.
+ The ID of thread whose scheduling parameters will be modified.
+ policy.
+ The new scheduling policy of the thread.
+ Either SCHED_FIFO or SCHED_RR.
+ SCHED_OTHER and SCHED_SPORADIC are not supported.
+ param.
+ The location to store the thread's priority.
+ + Returned Values: +
++ If successful, the pthread_setschedparam() function will return + zero (OK). Otherwise, an error number will be + returned to indicate the error: +
+EINVAL.
+ The value specified by policy or one of the scheduling parameters
+ associated with the scheduling policy policy is invalid.
+ ENOTSUP.
+ An attempt was made to set the policy or scheduling parameters to an unsupported
+ value (SCHED_OTHER and SCHED_SPORADIC in particular are
+ not supported)
+ EPERM.
+ The caller does not have the appropriate permission to set either the scheduling
+ parameters or the scheduling policy of the specified thread.
+ Or, the implementation does not allow the application to modify one of the
+ parameters to the value specified.
+
+ ESRCH.
+ The value specified by thread does not refer to a existing thread.
+ + Assumptions/Limitations: +
++ POSIX Compatibility: + Comparable to the POSIX interface of the same name. +