sched/: Replace explict references to g_readytorun with indirect references via the this_task() macro
This commit is contained in:
parent
12f95c6f6b
commit
74db48202e
79 changed files with 114 additions and 606 deletions
|
@ -11462,4 +11462,8 @@
|
|||
* fs/procfs/fs_procfskmm.c: Add /proc/kmm entry that shows that state of
|
||||
the kernel heap. Only useful in PROTECTED and KERNEL build modes where
|
||||
there is a kernel heap (2016-02-06).
|
||||
* sched/ and arch/: Replace explicit access to the OS internal data structure
|
||||
g_readytorun() with the wrapper this_task() which hides the implementation
|
||||
and will permit such things as more scalable representations of task queues
|
||||
and SMP (2016-02-06).
|
||||
|
||||
|
|
8
TODO
8
TODO
|
@ -228,13 +228,9 @@ o Task/Scheduler (sched/)
|
|||
hidden behind simple accessor functions and so the internal
|
||||
data structures can be changed if need with very little impact.
|
||||
|
||||
The only area are the list structure is not well contained is
|
||||
in the sequence of code that finds the current running task:
|
||||
|
||||
FAR struct tcb_s *rtcb = (FAT struc tcb_s *)g_readytorun.head;
|
||||
|
||||
That needs to be hidden behind a macro (it would also be a problem
|
||||
for any SMP implementation).
|
||||
Explicity refereence to the list strucutre are hidden behnid
|
||||
the macro this_task().
|
||||
|
||||
Status: Open
|
||||
Priority: Low. Things are just the way that we want them for the way
|
||||
|
|
2
arch
2
arch
|
@ -1 +1 @@
|
|||
Subproject commit e15b5dec6a20cce69ce6bfc18c808b92638a7bd3
|
||||
Subproject commit 5c9c3dc73e2ae5e87203801c6ab82e44a3f8fbec
|
|
@ -74,7 +74,7 @@
|
|||
|
||||
int clearenv(void)
|
||||
{
|
||||
FAR struct tcb_s *tcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *tcb = this_task();
|
||||
DEBUGASSERT(tcb->group);
|
||||
|
||||
env_release(tcb->group);
|
||||
|
|
|
@ -81,7 +81,7 @@
|
|||
|
||||
int env_dup(FAR struct task_group_s *group)
|
||||
{
|
||||
FAR struct tcb_s *ptcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *ptcb = this_task();
|
||||
FAR char *envp = NULL;
|
||||
size_t envlen;
|
||||
int ret = OK;
|
||||
|
|
|
@ -94,7 +94,7 @@ FAR char *getenv(const char *name)
|
|||
/* Get a reference to the thread-private environ in the TCB. */
|
||||
|
||||
sched_lock();
|
||||
rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
rtcb = this_task();
|
||||
group = rtcb->group;
|
||||
|
||||
/* Check if the variable exists */
|
||||
|
|
|
@ -85,7 +85,7 @@ FAR char **get_environ_ptr(void)
|
|||
|
||||
/* Return a reference to the thread-private environ in the TCB. */
|
||||
|
||||
FAR struct tcb_s *ptcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *ptcb = this_task();
|
||||
if (ptcb->envp)
|
||||
{
|
||||
return &ptcb->envp->ev_env;
|
||||
|
|
|
@ -124,7 +124,7 @@ int setenv(FAR const char *name, FAR const char *value, int overwrite)
|
|||
/* Get a reference to the thread-private environ in the TCB. */
|
||||
|
||||
sched_lock();
|
||||
rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
rtcb = this_task();
|
||||
group = rtcb->group;
|
||||
DEBUGASSERT(group);
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@
|
|||
|
||||
int unsetenv(FAR const char *name)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
FAR struct task_group_s *group = rtcb->group;
|
||||
FAR char *pvar;
|
||||
FAR char *newenvp;
|
||||
|
|
|
@ -97,11 +97,11 @@ FAR int *get_errno_ptr(void)
|
|||
* logic (see, for example, task_exit.c).
|
||||
*
|
||||
* There is also a corner case early in the initialization sequence:
|
||||
* The ready to run list may not yet be initialized and g_readytorun.head
|
||||
* The ready to run list may not yet be initialized and this_task()
|
||||
* may be NULL.
|
||||
*/
|
||||
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
if (rtcb && rtcb->task_state == TSTATE_TASK_RUNNING)
|
||||
{
|
||||
/* Yes.. the task is running normally. Return a reference to the
|
||||
|
|
|
@ -114,7 +114,7 @@ int group_addrenv(FAR struct tcb_s *tcb)
|
|||
|
||||
if (!tcb)
|
||||
{
|
||||
tcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
tcb = this_task();
|
||||
}
|
||||
|
||||
DEBUGASSERT(tcb && tcb->group);
|
||||
|
|
|
@ -69,7 +69,7 @@ void group_free(FAR struct task_group_s *group, FAR void *mem)
|
|||
|
||||
if (!group)
|
||||
{
|
||||
FAR struct tcb_s *tcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *tcb = this_task();
|
||||
DEBUGASSERT(tcb && tcb->group);
|
||||
group = tcb->group;
|
||||
}
|
||||
|
|
|
@ -172,7 +172,7 @@ static inline int group_addmember(FAR struct task_group_s *group, pid_t pid)
|
|||
|
||||
int group_bind(FAR struct pthread_tcb_s *tcb)
|
||||
{
|
||||
FAR struct tcb_s *ptcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *ptcb = this_task();
|
||||
|
||||
DEBUGASSERT(ptcb && tcb && ptcb->group && !tcb->cmn.group);
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ FAR void *group_malloc(FAR struct task_group_s *group, size_t nbytes)
|
|||
|
||||
if (!group)
|
||||
{
|
||||
FAR struct tcb_s *tcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *tcb = this_task();
|
||||
DEBUGASSERT(tcb && tcb->group);
|
||||
group = tcb->group;
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ static inline void sched_dupfiles(FAR struct task_tcb_s *tcb)
|
|||
{
|
||||
/* The parent task is the one at the head of the ready-to-run list */
|
||||
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
FAR struct file *parent;
|
||||
FAR struct file *child;
|
||||
int i;
|
||||
|
@ -147,7 +147,7 @@ static inline void sched_dupsockets(FAR struct task_tcb_s *tcb)
|
|||
{
|
||||
/* The parent task is the one at the head of the ready-to-run list */
|
||||
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
FAR struct socket *parent;
|
||||
FAR struct socket *child;
|
||||
int i;
|
||||
|
|
|
@ -127,10 +127,10 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
int mq_notify(mqd_t mqdes, const struct sigevent *notification)
|
||||
int mq_notify(mqd_t mqdes, FAR const struct sigevent *notification)
|
||||
{
|
||||
struct tcb_s *rtcb;
|
||||
struct mqueue_inode_s *msgq;
|
||||
FAR struct tcb_s *rtcb;
|
||||
FAR struct mqueue_inode_s *msgq;
|
||||
int errval;
|
||||
|
||||
/* Was a valid message queue descriptor provided? */
|
||||
|
@ -150,7 +150,7 @@ int mq_notify(mqd_t mqdes, const struct sigevent *notification)
|
|||
|
||||
/* Get the current process ID */
|
||||
|
||||
rtcb = (struct tcb_s *)g_readytorun.head;
|
||||
rtcb = this_task();
|
||||
|
||||
/* Is there already a notification attached */
|
||||
|
||||
|
|
|
@ -176,7 +176,7 @@ FAR struct mqueue_msg_s *mq_waitreceive(mqd_t mqdes)
|
|||
{
|
||||
/* Yes.. Block and try again */
|
||||
|
||||
rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
rtcb = this_task();
|
||||
rtcb->msgwaitq = msgq;
|
||||
msgq->nwaitnotempty++;
|
||||
|
||||
|
|
|
@ -280,7 +280,7 @@ int mq_waitsend(mqd_t mqdes)
|
|||
* When we are unblocked, we will try again
|
||||
*/
|
||||
|
||||
rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
rtcb = this_task();
|
||||
rtcb->msgwaitq = msgq;
|
||||
msgq->nwaitnotfull++;
|
||||
|
||||
|
|
|
@ -182,7 +182,7 @@ static void mq_rcvtimeout(int argc, wdparm_t pid)
|
|||
ssize_t mq_timedreceive(mqd_t mqdes, FAR char *msg, size_t msglen,
|
||||
FAR int *prio, FAR const struct timespec *abstime)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
FAR struct mqueue_msg_s *mqmsg;
|
||||
irqstate_t saved_state;
|
||||
int ret = ERROR;
|
||||
|
|
|
@ -183,7 +183,7 @@ static void mq_sndtimeout(int argc, wdparm_t pid)
|
|||
int mq_timedsend(mqd_t mqdes, FAR const char *msg, size_t msglen, int prio,
|
||||
FAR const struct timespec *abstime)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
FAR struct mqueue_inode_s *msgq;
|
||||
FAR struct mqueue_msg_s *mqmsg = NULL;
|
||||
irqstate_t saved_state;
|
||||
|
|
|
@ -121,7 +121,7 @@
|
|||
|
||||
void pg_miss(void)
|
||||
{
|
||||
FAR struct tcb_s *ftcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *ftcb = this_task();
|
||||
FAR struct tcb_s *wtcb;
|
||||
|
||||
/* Sanity checking
|
||||
|
|
|
@ -279,7 +279,7 @@ static inline bool pg_dequeue(void)
|
|||
* if a new higher priority fill is required).
|
||||
*/
|
||||
|
||||
FAR struct tcb_s *wtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *wtcb = this_task();
|
||||
if (wtcb->sched_priority > CONFIG_PAGING_DEFPRIO &&
|
||||
wtcb->sched_priority > g_pftcb->sched_priority)
|
||||
{
|
||||
|
@ -456,7 +456,7 @@ static inline bool pg_startfill(void)
|
|||
|
||||
static inline void pg_alldone(void)
|
||||
{
|
||||
FAR struct tcb_s *wtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *wtcb = this_task();
|
||||
g_pftcb = NULL;
|
||||
pgllvdbg("New worker priority. %d->%d\n",
|
||||
wtcb->sched_priority, CONFIG_PAGING_DEFPRIO);
|
||||
|
|
|
@ -47,37 +47,13 @@
|
|||
#include "sched/sched.h"
|
||||
#include "pthread/pthread.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
int pthread_cancel(pthread_t thread)
|
||||
{
|
||||
struct tcb_s *tcb;
|
||||
FAR struct tcb_s *tcb;
|
||||
|
||||
/* First, make sure that the handle references a valid thread */
|
||||
|
||||
|
@ -132,7 +108,7 @@ int pthread_cancel(pthread_t thread)
|
|||
* same as pthread_exit(PTHREAD_CANCELED).
|
||||
*/
|
||||
|
||||
if (tcb == (struct tcb_s *)g_readytorun.head)
|
||||
if (tcb == this_task())
|
||||
{
|
||||
pthread_exit(PTHREAD_CANCELED);
|
||||
}
|
||||
|
|
|
@ -182,7 +182,7 @@ static void pthread_condtimedout(int argc, uint32_t pid, uint32_t signo)
|
|||
int pthread_cond_timedwait(FAR pthread_cond_t *cond, FAR pthread_mutex_t *mutex,
|
||||
FAR const struct timespec *abstime)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
int ticks;
|
||||
int mypid = (int)getpid();
|
||||
irqstate_t int_state;
|
||||
|
|
|
@ -165,7 +165,7 @@ static inline void pthread_addjoininfo(FAR struct task_group_s *group,
|
|||
|
||||
static void pthread_start(void)
|
||||
{
|
||||
FAR struct pthread_tcb_s *ptcb = (FAR struct pthread_tcb_s *)g_readytorun.head;
|
||||
FAR struct pthread_tcb_s *ptcb = (FAR struct pthread_tcb_s *)this_task();
|
||||
FAR struct task_group_s *group = ptcb->cmn.group;
|
||||
FAR struct join_s *pjoin = (FAR struct join_s *)ptcb->joininfo;
|
||||
pthread_addr_t exit_status;
|
||||
|
@ -269,8 +269,7 @@ int pthread_create(FAR pthread_t *thread, FAR const pthread_attr_t *attr,
|
|||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
/* Share the address environment of the parent task group. */
|
||||
|
||||
ret = up_addrenv_attach(ptcb->cmn.group,
|
||||
(FAR struct tcb_s *)g_readytorun.head);
|
||||
ret = up_addrenv_attach(ptcb->cmn.group, this_task());
|
||||
if (ret < 0)
|
||||
{
|
||||
errcode = -ret;
|
||||
|
|
|
@ -97,7 +97,7 @@
|
|||
|
||||
int pthread_detach(pthread_t thread)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
FAR struct task_group_s *group = rtcb->group;
|
||||
FAR struct join_s *pjoin;
|
||||
int ret;
|
||||
|
|
|
@ -95,7 +95,7 @@
|
|||
|
||||
void pthread_exit(FAR void *exit_value)
|
||||
{
|
||||
struct tcb_s *tcb = (struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *tcb = this_task();
|
||||
int status;
|
||||
|
||||
sdbg("exit_value=%p\n", exit_value);
|
||||
|
|
|
@ -104,7 +104,7 @@
|
|||
FAR void *pthread_getspecific(pthread_key_t key)
|
||||
{
|
||||
#if CONFIG_NPTHREAD_KEYS > 0
|
||||
FAR struct pthread_tcb_s *rtcb = (FAR struct pthread_tcb_s *)g_readytorun.head;
|
||||
FAR struct pthread_tcb_s *rtcb = (FAR struct pthread_tcb_s *)this_task();
|
||||
FAR struct task_group_s *group = rtcb->cmn.group;
|
||||
FAR void *ret = NULL;
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@
|
|||
|
||||
int pthread_join(pthread_t thread, FAR pthread_addr_t *pexit_value)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
FAR struct task_group_s *group = rtcb->group;
|
||||
FAR struct join_s *pjoin;
|
||||
int ret;
|
||||
|
|
|
@ -112,7 +112,7 @@ int pthread_key_create(FAR pthread_key_t *key,
|
|||
CODE void (*destructor)(FAR void *))
|
||||
{
|
||||
#if CONFIG_NPTHREAD_KEYS > 0
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
FAR struct task_group_s *group = rtcb->group;
|
||||
int ret = EAGAIN;
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ int pthread_kill(pthread_t thread, int signo)
|
|||
*/
|
||||
|
||||
#ifdef CONFIG_SCHED_HAVE_PARENT
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
#endif
|
||||
FAR struct tcb_s *stcb;
|
||||
siginfo_t info;
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
|
||||
int pthread_setcancelstate(int state, FAR int *oldstate)
|
||||
{
|
||||
struct tcb_s *tcb = (struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *tcb = this_task();
|
||||
int ret = OK;
|
||||
|
||||
/* Suppress context changes for a bit so that the flags are stable. (the
|
||||
|
|
|
@ -115,7 +115,7 @@
|
|||
int pthread_setspecific(pthread_key_t key, FAR const void *value)
|
||||
{
|
||||
#if CONFIG_NPTHREAD_KEYS > 0
|
||||
FAR struct pthread_tcb_s *rtcb = (FAR struct pthread_tcb_s *)g_readytorun.head;
|
||||
FAR struct pthread_tcb_s *rtcb = (FAR struct pthread_tcb_s *)this_task();
|
||||
FAR struct task_group_s *group = rtcb->cmn.group;
|
||||
int ret = EINVAL;
|
||||
|
||||
|
|
|
@ -64,6 +64,14 @@
|
|||
#define MAX_TASKS_MASK (CONFIG_MAX_TASKS-1)
|
||||
#define PIDHASH(pid) ((pid) & MAX_TASKS_MASK)
|
||||
|
||||
/* These are macros to access the current CPU and the current task on a CPU.
|
||||
* These macros are intended to support a future SMP implementation.
|
||||
*/
|
||||
|
||||
#define current_task(cpu) ((FAR struct tcb_s *)g_readytorun.head)
|
||||
#define this_cpu() (0)
|
||||
#define this_task() (current_task(this_cpu))
|
||||
|
||||
/****************************************************************************
|
||||
* Public Type Definitions
|
||||
****************************************************************************/
|
||||
|
|
|
@ -100,7 +100,7 @@
|
|||
|
||||
bool sched_addreadytorun(FAR struct tcb_s *btcb)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
bool ret;
|
||||
|
||||
/* Check if pre-emption is disabled for the current running task and if
|
||||
|
|
|
@ -111,7 +111,7 @@ volatile uint32_t g_cpuload_total;
|
|||
|
||||
void weak_function sched_process_cpuload(void)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
int hash_index;
|
||||
int i;
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
|
||||
FAR struct filelist *sched_getfiles(void)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
FAR struct task_group_s *group = rtcb->group;
|
||||
|
||||
/* The group may be NULL under certain conditions. For example, if
|
||||
|
|
|
@ -110,7 +110,7 @@ int sched_getparam (pid_t pid, FAR struct sched_param *param)
|
|||
|
||||
/* Check if the task to restart is the calling task */
|
||||
|
||||
rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
rtcb = this_task();
|
||||
if ((pid == 0) || (pid == rtcb->pid))
|
||||
{
|
||||
/* Return the priority if the calling task. */
|
||||
|
|
|
@ -107,7 +107,7 @@ int sched_getscheduler(pid_t pid)
|
|||
|
||||
if (!pid)
|
||||
{
|
||||
tcb = (struct tcb_s *)g_readytorun.head;
|
||||
tcb = this_task();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -44,10 +44,6 @@
|
|||
|
||||
#if CONFIG_NSOCKET_DESCRIPTORS > 0
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
@ -70,7 +66,7 @@
|
|||
|
||||
FAR struct socketlist *sched_getsockets(void)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
FAR struct task_group_s *group = rtcb->group;
|
||||
|
||||
DEBUGASSERT(group);
|
||||
|
|
|
@ -41,10 +41,6 @@
|
|||
#include <sched.h>
|
||||
#include "sched/sched.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
@ -69,7 +65,7 @@
|
|||
|
||||
FAR struct streamlist *sched_getstreams(void)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
FAR struct task_group_s *group = rtcb->group;
|
||||
|
||||
DEBUGASSERT(group);
|
||||
|
|
|
@ -45,30 +45,6 @@
|
|||
#include <nuttx/arch.h>
|
||||
#include "sched/sched.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Type Declarations
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functionss
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
@ -93,7 +69,7 @@
|
|||
|
||||
int sched_lock(void)
|
||||
{
|
||||
struct tcb_s *rtcb = (struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
|
||||
/* Check for some special cases: (1) rtcb may be NULL only during
|
||||
* early boot-up phases, and (2) sched_lock() should have no
|
||||
|
|
|
@ -43,30 +43,6 @@
|
|||
|
||||
#include "sched/sched.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Type Declarations
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functionss
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
@ -91,7 +67,6 @@
|
|||
|
||||
int sched_lockcount(void)
|
||||
{
|
||||
struct tcb_s *rtcb = (struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
return (int)rtcb->lockcount;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,26 +46,6 @@
|
|||
|
||||
#include "sched/sched.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Type Declarations
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
@ -102,7 +82,7 @@ bool sched_mergepending(void)
|
|||
|
||||
/* Initialize the inner search loop */
|
||||
|
||||
rtrtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
rtrtcb = this_task();
|
||||
|
||||
/* Process every TCB in the g_pendingtasks list */
|
||||
|
||||
|
|
|
@ -58,18 +58,6 @@
|
|||
# define CONFIG_SCHED_CPULOAD_TIMECONSTANT 2
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Type Declarations
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
@ -92,7 +80,7 @@
|
|||
#if CONFIG_RR_INTERVAL > 0 || defined(CONFIG_SCHED_SPORADIC)
|
||||
static inline void sched_process_scheduler(void)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
|
||||
#if CONFIG_RR_INTERVAL > 0
|
||||
/* Check if the currently executing task uses round robin scheduling. */
|
||||
|
|
|
@ -91,7 +91,7 @@ int sched_rr_get_interval(pid_t pid, struct timespec *interval)
|
|||
|
||||
if (!pid)
|
||||
{
|
||||
rrtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
rrtcb = this_task();
|
||||
}
|
||||
|
||||
/* Return a special error code on invalid PID */
|
||||
|
|
|
@ -41,26 +41,6 @@
|
|||
#include <sched.h>
|
||||
#include "sched/sched.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Type Declarations
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
@ -77,7 +57,5 @@
|
|||
|
||||
FAR struct tcb_s *sched_self(void)
|
||||
{
|
||||
return (FAR struct tcb_s *)g_readytorun.head;
|
||||
return this_task();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ int sched_setparam(pid_t pid, FAR const struct sched_param *param)
|
|||
|
||||
/* Check if the task to reprioritize is the calling task */
|
||||
|
||||
rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
rtcb = this_task();
|
||||
if (pid == 0 || pid == rtcb->pid)
|
||||
{
|
||||
tcb = rtcb;
|
||||
|
|
|
@ -103,7 +103,7 @@
|
|||
|
||||
int sched_setpriority(FAR struct tcb_s *tcb, int sched_priority)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
tstate_t task_state;
|
||||
irqstate_t saved_state;
|
||||
|
||||
|
|
|
@ -164,8 +164,8 @@ static struct timespec g_stop_time;
|
|||
#if CONFIG_RR_INTERVAL > 0 || defined(CONFIG_SCHED_SPORADIC)
|
||||
static inline uint32_t sched_process_scheduler(uint32_t ticks, bool noswitches)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *ntcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
FAR struct tcb_s *ntcb = this_task();
|
||||
uint32_t ret = 0;
|
||||
|
||||
#if CONFIG_RR_INTERVAL > 0
|
||||
|
@ -212,7 +212,7 @@ static inline uint32_t sched_process_scheduler(uint32_t ticks, bool noswitches)
|
|||
* the new task at the head of the ready to run list.
|
||||
*/
|
||||
|
||||
ntcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
ntcb = this_task();
|
||||
|
||||
/* Check if the new task at the head of the ready-to-run has changed. */
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
|
||||
int sched_unlock(void)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
|
||||
/* Check for some special cases: (1) rtcb may be NULL only during
|
||||
* early boot-up phases, and (2) sched_unlock() should have no
|
||||
|
@ -118,7 +118,7 @@ int sched_unlock(void)
|
|||
* maximum.
|
||||
*/
|
||||
|
||||
if (rtcb != (FAR struct tcb_s *)g_readytorun.head)
|
||||
if (rtcb != this_task())
|
||||
{
|
||||
rtcb->timeslice = MSEC2TICK(CONFIG_RR_INTERVAL);
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ int sched_unlock(void)
|
|||
* change the currently active task.
|
||||
*/
|
||||
|
||||
if (rtcb == (FAR struct tcb_s *)g_readytorun.head)
|
||||
if (rtcb == this_task())
|
||||
{
|
||||
sched_timer_reassess();
|
||||
}
|
||||
|
|
|
@ -154,7 +154,7 @@ static void exited_child(FAR struct tcb_s *rtcb, FAR struct child_status_s *chil
|
|||
|
||||
int waitid(idtype_t idtype, id_t id, FAR siginfo_t *info, int options)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
FAR struct tcb_s *ctcb;
|
||||
#ifdef CONFIG_SCHED_CHILD_STATUS
|
||||
FAR struct child_status_s *child;
|
||||
|
|
|
@ -294,7 +294,7 @@ errout:
|
|||
#else
|
||||
pid_t waitpid(pid_t pid, int *stat_loc, int options)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
FAR struct tcb_s *ctcb;
|
||||
#ifdef CONFIG_SCHED_CHILD_STATUS
|
||||
FAR struct child_status_s *child;
|
||||
|
|
|
@ -43,30 +43,6 @@
|
|||
|
||||
#include "sched/sched.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Type Declarations
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
@ -90,7 +66,7 @@
|
|||
|
||||
int sched_yield(void)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
|
||||
/* This equivalent to just resetting the task priority to its current value
|
||||
* since this will cause the task to be rescheduled behind any other tasks
|
||||
|
|
|
@ -565,7 +565,7 @@ static int sem_restoreholderprio(FAR struct semholder_s *pholder,
|
|||
static int sem_restoreholderprioA(FAR struct semholder_s *pholder,
|
||||
FAR sem_t *sem, FAR void *arg)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
if (pholder->htcb != rtcb)
|
||||
{
|
||||
return sem_restoreholderprio(pholder, sem, arg);
|
||||
|
@ -585,7 +585,7 @@ static int sem_restoreholderprioA(FAR struct semholder_s *pholder,
|
|||
static int sem_restoreholderprioB(FAR struct semholder_s *pholder,
|
||||
FAR sem_t *sem, FAR void *arg)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
if (pholder->htcb == rtcb)
|
||||
{
|
||||
(void)sem_restoreholderprio(pholder, sem, arg);
|
||||
|
@ -691,7 +691,7 @@ static inline void sem_restorebaseprio_irq(FAR struct tcb_s *stcb,
|
|||
static inline void sem_restorebaseprio_task(FAR struct tcb_s *stcb,
|
||||
FAR sem_t *sem)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
FAR struct semholder_s *pholder;
|
||||
|
||||
/* Perform the following actions only if a new thread was given a count.
|
||||
|
@ -850,7 +850,7 @@ void sem_destroyholder(FAR sem_t *sem)
|
|||
|
||||
void sem_addholder(FAR sem_t *sem)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
FAR struct semholder_s *pholder;
|
||||
|
||||
/* Find or allocate a container for this new holder */
|
||||
|
@ -885,7 +885,7 @@ void sem_addholder(FAR sem_t *sem)
|
|||
|
||||
void sem_boostpriority(FAR sem_t *sem)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
|
||||
/* Boost the priority of every thread holding counts on this semaphore
|
||||
* that are lower in priority than the new thread that is waiting for a
|
||||
|
@ -914,7 +914,7 @@ void sem_boostpriority(FAR sem_t *sem)
|
|||
|
||||
void sem_releaseholder(FAR sem_t *sem)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
FAR struct semholder_s *pholder;
|
||||
|
||||
/* Find the container for this holder */
|
||||
|
|
|
@ -82,7 +82,7 @@
|
|||
|
||||
int sem_tickwait(FAR sem_t *sem, systime_t start, uint32_t delay)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
irqstate_t flags;
|
||||
systime_t elapsed;
|
||||
int ret;
|
||||
|
|
|
@ -94,7 +94,7 @@
|
|||
|
||||
int sem_timedwait(FAR sem_t *sem, FAR const struct timespec *abstime)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
irqstate_t flags;
|
||||
int ticks;
|
||||
int errcode;
|
||||
|
|
|
@ -48,26 +48,6 @@
|
|||
#include "sched/sched.h"
|
||||
#include "semaphore/semaphore.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Type Declarations
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
@ -96,7 +76,7 @@
|
|||
|
||||
int sem_trywait(FAR sem_t *sem)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
irqstate_t saved_state;
|
||||
int ret = ERROR;
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@
|
|||
|
||||
int sem_wait(FAR sem_t *sem)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
irqstate_t saved_state;
|
||||
int ret = ERROR;
|
||||
|
||||
|
|
|
@ -58,18 +58,6 @@
|
|||
(t)->sa_mask = (f)->sa_mask; \
|
||||
(t)->sa_flags = (f)->sa_flags; }
|
||||
|
||||
/****************************************************************************
|
||||
* Private Type Declarations
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
@ -165,7 +153,7 @@ static FAR sigactq_t *sig_allocateaction(void)
|
|||
|
||||
int sigaction(int signo, FAR const struct sigaction *act, FAR struct sigaction *oact)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
FAR sigactq_t *sigact;
|
||||
|
||||
/* Since sigactions can only be installed from the running thread of
|
||||
|
|
|
@ -85,7 +85,7 @@
|
|||
int kill(pid_t pid, int signo)
|
||||
{
|
||||
#ifdef CONFIG_SCHED_HAVE_PARENT
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
#endif
|
||||
siginfo_t info;
|
||||
int ret;
|
||||
|
|
|
@ -48,26 +48,6 @@
|
|||
#include "sched/sched.h"
|
||||
#include "signal/signal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Type Declarations
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functionss
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
@ -90,7 +70,7 @@ int sig_mqnotempty(int pid, int signo, void *sival_ptr)
|
|||
#endif
|
||||
{
|
||||
#ifdef CONFIG_SCHED_HAVE_PARENT
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
#endif
|
||||
siginfo_t info;
|
||||
int ret;
|
||||
|
|
|
@ -45,26 +45,6 @@
|
|||
#include "sched/sched.h"
|
||||
#include "signal/signal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Type Declarations
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
@ -89,7 +69,7 @@
|
|||
|
||||
int sigpending(FAR sigset_t *set)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
int ret = ERROR;
|
||||
|
||||
if (set)
|
||||
|
|
|
@ -53,26 +53,6 @@
|
|||
#include "sched/sched.h"
|
||||
#include "signal/signal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Type Declarations
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
@ -113,7 +93,7 @@
|
|||
|
||||
int sigprocmask(int how, FAR const sigset_t *set, FAR sigset_t *oset)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
sigset_t oldsigprocmask;
|
||||
irqstate_t saved_state;
|
||||
int ret = OK;
|
||||
|
|
|
@ -48,26 +48,6 @@
|
|||
#include "sched/sched.h"
|
||||
#include "signal/signal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Type Declarations
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
@ -112,7 +92,7 @@ int sigqueue(int pid, int signo, void *sival_ptr)
|
|||
#endif
|
||||
{
|
||||
#ifdef CONFIG_SCHED_HAVE_PARENT
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
#endif
|
||||
siginfo_t info;
|
||||
int ret;
|
||||
|
|
|
@ -49,26 +49,6 @@
|
|||
#include "sched/sched.h"
|
||||
#include "signal/signal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Type Declarations
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
@ -110,7 +90,7 @@
|
|||
|
||||
int sigsuspend(FAR const sigset_t *set)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
sigset_t intersection;
|
||||
sigset_t saved_sigprocmask;
|
||||
FAR sigpendq_t *sigpend;
|
||||
|
|
|
@ -66,18 +66,6 @@
|
|||
|
||||
#define SIG_WAIT_TIMEOUT 0xff
|
||||
|
||||
/****************************************************************************
|
||||
* Private Type Declarations
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
@ -175,7 +163,7 @@ static void sig_timeout(int argc, wdparm_t itcb)
|
|||
int sigtimedwait(FAR const sigset_t *set, FAR struct siginfo *info,
|
||||
FAR const struct timespec *timeout)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
sigset_t intersection;
|
||||
FAR sigpendq_t *sigpend;
|
||||
irqstate_t saved_state;
|
||||
|
|
|
@ -44,26 +44,6 @@
|
|||
#include "sched/sched.h"
|
||||
#include "signal/signal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Type Declarations
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
@ -80,7 +60,7 @@
|
|||
|
||||
void sig_unmaskpendingsignal(void)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
sigset_t unmaskedset;
|
||||
FAR sigpendq_t *pendingsig;
|
||||
int signo;
|
||||
|
|
|
@ -49,30 +49,6 @@
|
|||
#include "task/task.h"
|
||||
#include "sched/sched.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Type Declarations
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
@ -93,7 +69,7 @@
|
|||
|
||||
void exit(int status)
|
||||
{
|
||||
struct tcb_s *tcb = (struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *tcb = this_task();
|
||||
|
||||
/* Only the lower 8-bits of status are used */
|
||||
|
||||
|
|
|
@ -52,30 +52,6 @@
|
|||
|
||||
#ifdef CONFIG_SCHED_ATEXIT
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Type Declarations
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
@ -121,7 +97,7 @@ int atexit(void (*func)(void))
|
|||
return on_exit((onexitfunc_t)func, NULL);
|
||||
|
||||
#elif defined(CONFIG_SCHED_ATEXIT_MAX) && CONFIG_SCHED_ATEXIT_MAX > 1
|
||||
FAR struct tcb_s *tcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *tcb = this_task();
|
||||
FAR struct task_group_s *group = tcb->group;
|
||||
int index;
|
||||
int ret = ERROR;
|
||||
|
@ -155,7 +131,7 @@ int atexit(void (*func)(void))
|
|||
|
||||
return ret;
|
||||
#else
|
||||
FAR struct tcb_s *tcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *tcb = this_task();
|
||||
FAR struct task_group_s *group = tcb->group;
|
||||
int ret = ERROR;
|
||||
|
||||
|
|
|
@ -46,30 +46,6 @@
|
|||
#include "sched/sched.h"
|
||||
#include "task/task.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Type Declarations
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
@ -117,7 +93,7 @@ int task_delete(pid_t pid)
|
|||
|
||||
/* Check if the task to delete is the calling task */
|
||||
|
||||
rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
rtcb = this_task();
|
||||
if (pid == 0 || pid == rtcb->pid)
|
||||
{
|
||||
/* If it is, then what we really wanted to do was exit. Note that we
|
||||
|
|
|
@ -48,30 +48,6 @@
|
|||
#endif
|
||||
#include "task/task.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Type Declarations
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
@ -106,7 +82,7 @@
|
|||
|
||||
int task_exit(void)
|
||||
{
|
||||
FAR struct tcb_s *dtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *dtcb = this_task();
|
||||
FAR struct tcb_s *rtcb;
|
||||
int ret;
|
||||
|
||||
|
@ -119,7 +95,7 @@ int task_exit(void)
|
|||
*/
|
||||
|
||||
(void)sched_removereadytorun(dtcb);
|
||||
rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
rtcb = this_task();
|
||||
|
||||
/* We are now in a bad state -- the head of the ready to run task list
|
||||
* does not correspond to the thread that is running. Disabling pre-
|
||||
|
|
|
@ -44,26 +44,6 @@
|
|||
#include "sched/sched.h"
|
||||
#include "task/task.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Type Declarations
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
@ -87,7 +67,7 @@ pid_t getpid(void)
|
|||
* with pid == 0 must be running.
|
||||
*/
|
||||
|
||||
rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
rtcb = this_task();
|
||||
if (rtcb)
|
||||
{
|
||||
/* Return the task ID from the TCB at the head of the ready-to-run
|
||||
|
|
|
@ -52,30 +52,6 @@
|
|||
|
||||
#ifdef CONFIG_SCHED_ONEXIT
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Type Declarations
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
@ -116,7 +92,7 @@
|
|||
int on_exit(CODE void (*func)(int, FAR void *), FAR void *arg)
|
||||
{
|
||||
#if defined(CONFIG_SCHED_ONEXIT_MAX) && CONFIG_SCHED_ONEXIT_MAX > 1
|
||||
FAR struct tcb_s *tcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *tcb = this_task();
|
||||
FAR struct task_group_s *group = tcb->group;
|
||||
int index;
|
||||
int ret = ENOSPC;
|
||||
|
@ -151,7 +127,7 @@ int on_exit(CODE void (*func)(int, FAR void *), FAR void *arg)
|
|||
|
||||
return ret;
|
||||
#else
|
||||
FAR struct tcb_s *tcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *tcb = this_task();
|
||||
FAR struct task_group_s *group = tcb->group;
|
||||
int ret = ENOSPC;
|
||||
|
||||
|
|
|
@ -50,10 +50,6 @@
|
|||
#include "sched/sched.h"
|
||||
#include "task/task.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
@ -102,7 +98,7 @@ int prctl(int option, ...)
|
|||
|
||||
if (!pid)
|
||||
{
|
||||
tcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
tcb = this_task();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -50,30 +50,6 @@
|
|||
#include "signal/signal.h"
|
||||
#include "task/task.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Type Declarations
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
@ -115,7 +91,7 @@ int task_restart(pid_t pid)
|
|||
|
||||
/* Check if the task to restart is the calling task */
|
||||
|
||||
rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
rtcb = this_task();
|
||||
if ((pid == 0) || (pid == rtcb->pid))
|
||||
{
|
||||
/* Not implemented */
|
||||
|
|
|
@ -63,15 +63,7 @@
|
|||
#define MAX_STACK_ARGS 256
|
||||
|
||||
/****************************************************************************
|
||||
* Private Type Declarations
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Variables
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/* This is the name for un-named tasks */
|
||||
|
@ -183,7 +175,7 @@ static int task_assignpid(FAR struct tcb_s *tcb)
|
|||
#ifdef CONFIG_SCHED_HAVE_PARENT
|
||||
static inline void task_saveparent(FAR struct tcb_s *tcb, uint8_t ttype)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
|
||||
#if defined(HAVE_GROUP_MEMBERS) || defined(CONFIG_SCHED_CHILD_STATUS)
|
||||
DEBUGASSERT(tcb && tcb->group && rtcb->group);
|
||||
|
@ -288,7 +280,7 @@ static inline void task_saveparent(FAR struct tcb_s *tcb, uint8_t ttype)
|
|||
#ifdef CONFIG_PIC
|
||||
static inline void task_dupdspace(FAR struct tcb_s *tcb)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
if (rtcb->dspace != NULL)
|
||||
{
|
||||
/* Copy the D-Space structure reference and increment the reference
|
||||
|
|
|
@ -100,7 +100,7 @@
|
|||
|
||||
void task_start(void)
|
||||
{
|
||||
FAR struct task_tcb_s *tcb = (FAR struct task_tcb_s *)g_readytorun.head;
|
||||
FAR struct task_tcb_s *tcb = (FAR struct task_tcb_s *)this_task();
|
||||
int exitcode;
|
||||
int argc;
|
||||
|
||||
|
|
|
@ -240,7 +240,7 @@ static inline int vfork_argsetup(FAR struct tcb_s *parent,
|
|||
|
||||
FAR struct task_tcb_s *task_vforksetup(start_t retaddr)
|
||||
{
|
||||
struct tcb_s *parent = (FAR struct tcb_s *)g_readytorun.head;
|
||||
struct tcb_s *parent = this_task();
|
||||
struct task_tcb_s *child;
|
||||
uint8_t ttype;
|
||||
int priority;
|
||||
|
@ -364,12 +364,12 @@ errout_with_tcb:
|
|||
|
||||
pid_t task_vforkstart(FAR struct task_tcb_s *child)
|
||||
{
|
||||
struct tcb_s *parent = (FAR struct tcb_s *)g_readytorun.head;
|
||||
struct tcb_s *parent = this_task();
|
||||
pid_t pid;
|
||||
int rc;
|
||||
int ret;
|
||||
|
||||
svdbg("Starting Child TCB=%p, parent=%p\n", child, g_readytorun.head);
|
||||
svdbg("Starting Child TCB=%p, parent=%p\n", child, this_task());
|
||||
DEBUGASSERT(child);
|
||||
|
||||
/* Duplicate the original argument list in the forked child TCB */
|
||||
|
|
Loading…
Reference in a new issue