mirror of
https://github.com/apache/nuttx.git
synced 2026-05-30 05:16:47 +08:00
include/nuttx/sched.h: Move prototype for sched_releasetcb()
Move the prototype for the internal OS from from sched/sched/sched.h to include/nuttx/sched.h. This was done because binfmt/binfmt/excecmodule.c requires the prototype for sched_releasetcb() and was illegally including sched/sched/sched.h. That is a blatant violation of the OS modular design and the person that did this should be hung up by their thumbs. Oh... I did that back in a bad moment in 2014. Now that is made right.
This commit is contained in:
committed by
Alan Carvalho de Assis
parent
5c0e8e88b1
commit
44b8f3e467
@@ -40,7 +40,6 @@ DELIM ?= $(strip /)
|
|||||||
ifeq ($(WINTOOL),y)
|
ifeq ($(WINTOOL),y)
|
||||||
INCDIROPT = -w
|
INCDIROPT = -w
|
||||||
endif
|
endif
|
||||||
CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" "$(TOPDIR)$(DELIM)sched"}
|
|
||||||
|
|
||||||
# Basic BINFMT source files
|
# Basic BINFMT source files
|
||||||
|
|
||||||
|
|||||||
+13
-28
@@ -1,35 +1,20 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* binfmt/binfmt_execmodule.c
|
* binfmt/binfmt_execmodule.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009, 2013-2014, 2017 Gregory Nutt. All rights reserved.
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
* notice, this list of conditions and the following disclaimer in
|
* License for the specific language governing permissions and limitations
|
||||||
* the documentation and/or other materials provided with the
|
* under the License.
|
||||||
* distribution.
|
|
||||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
|
||||||
* used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
||||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
||||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
||||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@@ -48,10 +33,10 @@
|
|||||||
|
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/kmalloc.h>
|
#include <nuttx/kmalloc.h>
|
||||||
|
#include <nuttx/sched.h>
|
||||||
#include <nuttx/mm/shm.h>
|
#include <nuttx/mm/shm.h>
|
||||||
#include <nuttx/binfmt/binfmt.h>
|
#include <nuttx/binfmt/binfmt.h>
|
||||||
|
|
||||||
#include "sched/sched.h"
|
|
||||||
#include "binfmt.h"
|
#include "binfmt.h"
|
||||||
|
|
||||||
#ifndef CONFIG_BINFMT_DISABLE
|
#ifndef CONFIG_BINFMT_DISABLE
|
||||||
|
|||||||
+105
-70
@@ -1,35 +1,20 @@
|
|||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* include/nuttx/sched.h
|
* include/nuttx/sched.h
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2016, 2018-2019 Gregory Nutt. All rights reserved.
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
* notice, this list of conditions and the following disclaimer in
|
* License for the specific language governing permissions and limitations
|
||||||
* the documentation and/or other materials provided with the
|
* under the License.
|
||||||
* distribution.
|
|
||||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
|
||||||
* used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
||||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
||||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
||||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
*
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
@@ -273,7 +258,7 @@ typedef CODE void (*atexitfunc_t)(void);
|
|||||||
typedef CODE void (*onexitfunc_t)(int exitcode, FAR void *arg);
|
typedef CODE void (*onexitfunc_t)(int exitcode, FAR void *arg);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* struct sporadic_s *************************************************************/
|
/* struct sporadic_s ************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_SCHED_SPORADIC
|
#ifdef CONFIG_SCHED_SPORADIC
|
||||||
|
|
||||||
@@ -319,7 +304,7 @@ struct sporadic_s
|
|||||||
|
|
||||||
#endif /* CONFIG_SCHED_SPORADIC */
|
#endif /* CONFIG_SCHED_SPORADIC */
|
||||||
|
|
||||||
/* struct child_status_s *********************************************************/
|
/* struct child_status_s ********************************************************/
|
||||||
|
|
||||||
/* This structure is used to maintain information about child tasks. pthreads
|
/* This structure is used to maintain information about child tasks. pthreads
|
||||||
* work differently, they have join information. This is only for child tasks.
|
* work differently, they have join information. This is only for child tasks.
|
||||||
@@ -336,7 +321,7 @@ struct child_status_s
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* struct pthread_cleanup_s ******************************************************/
|
/* struct pthread_cleanup_s *****************************************************/
|
||||||
|
|
||||||
/* This structure describes one element of the pthread cleanup stack */
|
/* This structure describes one element of the pthread cleanup stack */
|
||||||
|
|
||||||
@@ -348,7 +333,7 @@ struct pthread_cleanup_s
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* type pthread_keyset_t *********************************************************/
|
/* type pthread_keyset_t ********************************************************/
|
||||||
|
|
||||||
/* Smallest addressable type that can hold the entire configured number of keys */
|
/* Smallest addressable type that can hold the entire configured number of keys */
|
||||||
|
|
||||||
@@ -364,13 +349,13 @@ struct pthread_cleanup_s
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* type grpid_t ******************************************************************/
|
/* type grpid_t *****************************************************************/
|
||||||
|
|
||||||
/* The task group ID */
|
/* The task group ID */
|
||||||
|
|
||||||
typedef int16_t grpid_t;
|
typedef int16_t grpid_t;
|
||||||
|
|
||||||
/* struct dspace_s ***************************************************************/
|
/* struct dspace_s **************************************************************/
|
||||||
|
|
||||||
/* This structure describes a reference counted D-Space region. This must be a
|
/* This structure describes a reference counted D-Space region. This must be a
|
||||||
* separately allocated "break-away" structure that can be owned by a task and
|
* separately allocated "break-away" structure that can be owned by a task and
|
||||||
@@ -397,11 +382,12 @@ struct dspace_s
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* struct task_group_s ***********************************************************/
|
/* struct task_group_s **********************************************************/
|
||||||
|
|
||||||
/* All threads created by pthread_create belong in the same task group (along with
|
/* All threads created by pthread_create belong in the same task group (along
|
||||||
* the thread of the original task). struct task_group_s is a shared structure
|
* with the thread of the original task). struct task_group_s is a shared
|
||||||
* referenced by the TCB of each thread that is a member of the task group.
|
* structure referenced by the TCB of each thread that is a member of the task
|
||||||
|
* group.
|
||||||
*
|
*
|
||||||
* This structure should contain *all* resources shared by tasks and threads that
|
* This structure should contain *all* resources shared by tasks and threads that
|
||||||
* belong to the same task group:
|
* belong to the same task group:
|
||||||
@@ -460,7 +446,7 @@ struct task_group_s
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_SCHED_ATEXIT) && !defined(CONFIG_SCHED_ONEXIT)
|
#if defined(CONFIG_SCHED_ATEXIT) && !defined(CONFIG_SCHED_ONEXIT)
|
||||||
/* atexit support ************************************************************/
|
/* atexit support *************************************************************/
|
||||||
|
|
||||||
# if defined(CONFIG_SCHED_ATEXIT_MAX) && CONFIG_SCHED_ATEXIT_MAX > 1
|
# if defined(CONFIG_SCHED_ATEXIT_MAX) && CONFIG_SCHED_ATEXIT_MAX > 1
|
||||||
atexitfunc_t tg_atexitfunc[CONFIG_SCHED_ATEXIT_MAX];
|
atexitfunc_t tg_atexitfunc[CONFIG_SCHED_ATEXIT_MAX];
|
||||||
@@ -470,7 +456,7 @@ struct task_group_s
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_SCHED_ONEXIT
|
#ifdef CONFIG_SCHED_ONEXIT
|
||||||
/* on_exit support ***********************************************************/
|
/* on_exit support ************************************************************/
|
||||||
|
|
||||||
# if defined(CONFIG_SCHED_ONEXIT_MAX) && CONFIG_SCHED_ONEXIT_MAX > 1
|
# if defined(CONFIG_SCHED_ONEXIT_MAX) && CONFIG_SCHED_ONEXIT_MAX > 1
|
||||||
onexitfunc_t tg_onexitfunc[CONFIG_SCHED_ONEXIT_MAX];
|
onexitfunc_t tg_onexitfunc[CONFIG_SCHED_ONEXIT_MAX];
|
||||||
@@ -519,6 +505,7 @@ struct task_group_s
|
|||||||
/* Pthreads *******************************************************************/
|
/* Pthreads *******************************************************************/
|
||||||
|
|
||||||
/* Pthread join Info: */
|
/* Pthread join Info: */
|
||||||
|
|
||||||
sem_t tg_joinsem; /* Mutually exclusive access to join data */
|
sem_t tg_joinsem; /* Mutually exclusive access to join data */
|
||||||
FAR struct join_s *tg_joinhead; /* Head of a list of join data */
|
FAR struct join_s *tg_joinhead; /* Head of a list of join data */
|
||||||
FAR struct join_s *tg_jointail; /* Tail of a list of join data */
|
FAR struct join_s *tg_jointail; /* Tail of a list of join data */
|
||||||
@@ -600,7 +587,7 @@ struct task_group_s
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/* struct tcb_s ******************************************************************/
|
/* struct tcb_s *****************************************************************/
|
||||||
|
|
||||||
/* This is the common part of the task control block (TCB). The TCB is the heart
|
/* This is the common part of the task control block (TCB). The TCB is the heart
|
||||||
* of the NuttX task-control logic. Each task or thread is represented by a TCB
|
* of the NuttX task-control logic. Each task or thread is represented by a TCB
|
||||||
@@ -712,6 +699,7 @@ struct tcb_s
|
|||||||
int pterrno; /* Current per-thread errno */
|
int pterrno; /* Current per-thread errno */
|
||||||
|
|
||||||
/* State save areas ***********************************************************/
|
/* State save areas ***********************************************************/
|
||||||
|
|
||||||
/* The form and content of these fields are platform-specific. */
|
/* The form and content of these fields are platform-specific. */
|
||||||
|
|
||||||
struct xcptcontext xcp; /* Interrupt register save area */
|
struct xcptcontext xcp; /* Interrupt register save area */
|
||||||
@@ -721,7 +709,7 @@ struct tcb_s
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/* struct task_tcb_s *************************************************************/
|
/* struct task_tcb_s ************************************************************/
|
||||||
|
|
||||||
/* This is the particular form of the task control block (TCB) structure used by
|
/* This is the particular form of the task control block (TCB) structure used by
|
||||||
* tasks (and kernel threads). There are two TCB forms: one for pthreads and
|
* tasks (and kernel threads). There are two TCB forms: one for pthreads and
|
||||||
@@ -750,15 +738,15 @@ struct task_tcb_s
|
|||||||
FAR char **argv; /* Name+start-up parameters */
|
FAR char **argv; /* Name+start-up parameters */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* struct pthread_tcb_s **********************************************************/
|
/* struct pthread_tcb_s *********************************************************/
|
||||||
|
|
||||||
/* This is the particular form of the task control block (TCB) structure used by
|
/* This is the particular form of the task control block (TCB) structure used by
|
||||||
* pthreads. There are two TCB forms: one for pthreads and one for tasks. Both
|
* pthreads. There are two TCB forms: one for pthreads and one for tasks. Both
|
||||||
* share the common TCB fields (which must appear at the top of the structure)
|
* share the common TCB fields (which must appear at the top of the structure)
|
||||||
* plus additional fields unique to tasks and threads. Having separate structures
|
* plus additional fields unique to tasks and threads. Having separate
|
||||||
* for tasks and pthreads adds some complexity, but saves memory in that it
|
* structures for tasks and pthreads adds some complexity, but saves memory in
|
||||||
* prevents pthreads from being burdened with the overhead required for tasks
|
* that it prevents pthreads from being burdened with the overhead required for
|
||||||
* (and vice versa).
|
* tasks (and vice versa).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef CONFIG_DISABLE_PTHREAD
|
#ifndef CONFIG_DISABLE_PTHREAD
|
||||||
@@ -828,25 +816,72 @@ EXTERN uint32_t g_crit_max[1];
|
|||||||
* Public Function Prototypes
|
* Public Function Prototypes
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
/* TCB helpers ******************************************************************/
|
/********************************************************************************
|
||||||
|
* Name: sched_self
|
||||||
/* sched_self() returns the TCB of the currently running task (i.e., the
|
*
|
||||||
* caller)
|
* Description:
|
||||||
*/
|
* Return the current threads TCB. Basically, this function just wraps the
|
||||||
|
* head of the ready-to-run list and manages access to the TCB from outside
|
||||||
|
* of the sched/ sub-directory.
|
||||||
|
*
|
||||||
|
********************************************************************************/
|
||||||
|
|
||||||
FAR struct tcb_s *sched_self(void);
|
FAR struct tcb_s *sched_self(void);
|
||||||
|
|
||||||
/* sched_foreach will enumerate over each task and provide the TCB of each task
|
/********************************************************************************
|
||||||
* or thread to a callback function. Interrupts will be disabled throughout
|
* Name: sched_foreach
|
||||||
* this enumeration!
|
*
|
||||||
*/
|
* Description:
|
||||||
|
* Enumerate over each task and provide the TCB of each task to a user
|
||||||
|
* callback functions.
|
||||||
|
*
|
||||||
|
* NOTE: This function examines the TCB and calls each handler within a
|
||||||
|
* critical section. However, that critical section is released and
|
||||||
|
* reacquired for each TCB. When it is released, there may be changes in
|
||||||
|
* tasking. If the caller requires absolute stability through the
|
||||||
|
* traversal, then the caller should establish the critical section BEFORE
|
||||||
|
* calling this function.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* handler - The function to be called with the TCB of
|
||||||
|
* each task
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
********************************************************************************/
|
||||||
|
|
||||||
void sched_foreach(sched_foreach_t handler, FAR void *arg);
|
void sched_foreach(sched_foreach_t handler, FAR void *arg);
|
||||||
|
|
||||||
/* Given a task ID, look up the corresponding TCB */
|
/********************************************************************************
|
||||||
|
* Name: sched_gettcb
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Given a task ID, this function will return the a pointer to the
|
||||||
|
* corresponding TCB (or NULL if there is no such task ID).
|
||||||
|
*
|
||||||
|
* NOTE: This function holds a critical section while examining TCB data
|
||||||
|
* data structures but releases that critical section before returning.
|
||||||
|
* When it is released, the TCB may become unstable. If the caller
|
||||||
|
* requires absolute stability while using the TCB, then the caller
|
||||||
|
* should establish the critical section BEFORE calling this function and
|
||||||
|
* hold that critical section as long as necessary.
|
||||||
|
*
|
||||||
|
********************************************************************************/
|
||||||
|
|
||||||
FAR struct tcb_s *sched_gettcb(pid_t pid);
|
FAR struct tcb_s *sched_gettcb(pid_t pid);
|
||||||
|
|
||||||
|
/********************************************************************************
|
||||||
|
* Name: nxsched_releasepid
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* When a task is destroyed, this function must be called to make its
|
||||||
|
* process ID available for re-use.
|
||||||
|
*
|
||||||
|
********************************************************************************/
|
||||||
|
|
||||||
|
int sched_releasetcb(FAR struct tcb_s *tcb, uint8_t ttype);
|
||||||
|
|
||||||
/* File system helpers **********************************************************/
|
/* File system helpers **********************************************************/
|
||||||
|
|
||||||
/* These functions all extract lists from the group structure associated with the
|
/* These functions all extract lists from the group structure associated with the
|
||||||
@@ -914,7 +949,7 @@ FAR struct task_tcb_s *nxtask_vforksetup(start_t retaddr, size_t *argsize);
|
|||||||
pid_t nxtask_vforkstart(FAR struct task_tcb_s *child);
|
pid_t nxtask_vforkstart(FAR struct task_tcb_s *child);
|
||||||
void nxtask_vforkabort(FAR struct task_tcb_s *child, int errcode);
|
void nxtask_vforkabort(FAR struct task_tcb_s *child, int errcode);
|
||||||
|
|
||||||
/****************************************************************************
|
/********************************************************************************
|
||||||
* Name: group_exitinfo
|
* Name: group_exitinfo
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
@@ -932,7 +967,7 @@ void nxtask_vforkabort(FAR struct task_tcb_s *child, int errcode);
|
|||||||
* 0 (OK) is returned on success and a negated errno is returned on
|
* 0 (OK) is returned on success and a negated errno is returned on
|
||||||
* failure.
|
* failure.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_BINFMT_LOADABLE
|
#ifdef CONFIG_BINFMT_LOADABLE
|
||||||
struct binary_s; /* Forward reference */
|
struct binary_s; /* Forward reference */
|
||||||
@@ -983,7 +1018,7 @@ void sched_suspend_scheduler(FAR struct tcb_s *tcb);
|
|||||||
# define sched_suspend_scheduler(tcb)
|
# define sched_suspend_scheduler(tcb)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/********************************************************************************
|
||||||
* Name: nxsched_getparam
|
* Name: nxsched_getparam
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
@@ -1009,12 +1044,12 @@ void sched_suspend_scheduler(FAR struct tcb_s *tcb);
|
|||||||
* This function can fail if param is null (EINVAL) or if pid does
|
* This function can fail if param is null (EINVAL) or if pid does
|
||||||
* not correspond to any task (ESRCH).
|
* not correspond to any task (ESRCH).
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
struct sched_param; /* Forward reference */
|
struct sched_param; /* Forward reference */
|
||||||
int nxsched_getparam (pid_t pid, FAR struct sched_param *param);
|
int nxsched_getparam (pid_t pid, FAR struct sched_param *param);
|
||||||
|
|
||||||
/****************************************************************************
|
/********************************************************************************
|
||||||
* Name: nxsched_setparam
|
* Name: nxsched_setparam
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
@@ -1046,12 +1081,12 @@ int nxsched_getparam (pid_t pid, FAR struct sched_param *param);
|
|||||||
* EPERM The calling task does not have appropriate privileges.
|
* EPERM The calling task does not have appropriate privileges.
|
||||||
* ESRCH The task whose ID is pid could not be found.
|
* ESRCH The task whose ID is pid could not be found.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
struct sched_param; /* Forward reference */
|
struct sched_param; /* Forward reference */
|
||||||
int nxsched_setparam(pid_t pid, FAR const struct sched_param *param);
|
int nxsched_setparam(pid_t pid, FAR const struct sched_param *param);
|
||||||
|
|
||||||
/****************************************************************************
|
/********************************************************************************
|
||||||
* Name: nxsched_getscheduler
|
* Name: nxsched_getscheduler
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
@@ -1078,11 +1113,11 @@ int nxsched_setparam(pid_t pid, FAR const struct sched_param *param);
|
|||||||
*
|
*
|
||||||
* ESRCH The task whose ID is pid could not be found.
|
* ESRCH The task whose ID is pid could not be found.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
int nxsched_getscheduler(pid_t pid);
|
int nxsched_getscheduler(pid_t pid);
|
||||||
|
|
||||||
/****************************************************************************
|
/********************************************************************************
|
||||||
* Name: nxsched_setscheduler
|
* Name: nxsched_setscheduler
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
@@ -1114,12 +1149,12 @@ int nxsched_getscheduler(pid_t pid);
|
|||||||
* EINVAL The scheduling policy is not one of the recognized policies.
|
* EINVAL The scheduling policy is not one of the recognized policies.
|
||||||
* ESRCH The task whose ID is pid could not be found.
|
* ESRCH The task whose ID is pid could not be found.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
int nxsched_setscheduler(pid_t pid, int policy,
|
int nxsched_setscheduler(pid_t pid, int policy,
|
||||||
FAR const struct sched_param *param);
|
FAR const struct sched_param *param);
|
||||||
|
|
||||||
/****************************************************************************
|
/********************************************************************************
|
||||||
* Name: nxsched_getaffinity
|
* Name: nxsched_getaffinity
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
@@ -1146,13 +1181,13 @@ int nxsched_setscheduler(pid_t pid, int policy,
|
|||||||
*
|
*
|
||||||
* ESRCH The task whose ID is pid could not be found.
|
* ESRCH The task whose ID is pid could not be found.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
int nxsched_getaffinity(pid_t pid, size_t cpusetsize, FAR cpu_set_t *mask);
|
int nxsched_getaffinity(pid_t pid, size_t cpusetsize, FAR cpu_set_t *mask);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/********************************************************************************
|
||||||
* Name: nxsched_setaffinity
|
* Name: nxsched_setaffinity
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
@@ -1182,7 +1217,7 @@ int nxsched_getaffinity(pid_t pid, size_t cpusetsize, FAR cpu_set_t *mask);
|
|||||||
*
|
*
|
||||||
* ESRCH The task whose ID is pid could not be found.
|
* ESRCH The task whose ID is pid could not be found.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
int nxsched_setaffinity(pid_t pid, size_t cpusetsize,
|
int nxsched_setaffinity(pid_t pid, size_t cpusetsize,
|
||||||
|
|||||||
+15
-31
@@ -1,35 +1,20 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* sched/sched/sched.h
|
* sched/sched/sched.h
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2014, 2016, 2018 Gregory Nutt. All rights reserved.
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
* notice, this list of conditions and the following disclaimer in
|
* License for the specific language governing permissions and limitations
|
||||||
* the documentation and/or other materials provided with the
|
* under the License.
|
||||||
* distribution.
|
|
||||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
|
||||||
* used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
||||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
||||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
||||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@@ -354,9 +339,9 @@ extern volatile uint32_t g_cpuload_total;
|
|||||||
* locked.
|
* locked.
|
||||||
* 2. Scheduling logic would set the bit associated with the cpu in
|
* 2. Scheduling logic would set the bit associated with the cpu in
|
||||||
* 'g_cpu_lockset' when the TCB at the head of the g_assignedtasks[cpu]
|
* 'g_cpu_lockset' when the TCB at the head of the g_assignedtasks[cpu]
|
||||||
* list transitions has 'lockcount' > 0. This might happen when sched_lock()
|
* list transitions has 'lockcount' > 0. This might happen when
|
||||||
* is called, or after a context switch that changes the TCB at the
|
* sched_lock() is called, or after a context switch that changes the
|
||||||
* head of the g_assignedtasks[cpu] list.
|
* TCB at the head of the g_assignedtasks[cpu] list.
|
||||||
* 3. Similarly, the cpu bit in the global 'g_cpu_lockset' would be cleared
|
* 3. Similarly, the cpu bit in the global 'g_cpu_lockset' would be cleared
|
||||||
* when the TCB at the head of the g_assignedtasks[cpu] list has
|
* when the TCB at the head of the g_assignedtasks[cpu] list has
|
||||||
* 'lockcount' == 0. This might happen when sched_unlock() is called, or
|
* 'lockcount' == 0. This might happen when sched_unlock() is called, or
|
||||||
@@ -507,6 +492,5 @@ void sched_critmon_suspend(FAR struct tcb_s *tcb);
|
|||||||
/* TCB operations */
|
/* TCB operations */
|
||||||
|
|
||||||
bool sched_verifytcb(FAR struct tcb_s *tcb);
|
bool sched_verifytcb(FAR struct tcb_s *tcb);
|
||||||
int sched_releasetcb(FAR struct tcb_s *tcb, uint8_t ttype);
|
|
||||||
|
|
||||||
#endif /* __SCHED_SCHED_SCHED_H */
|
#endif /* __SCHED_SCHED_SCHED_H */
|
||||||
|
|||||||
+13
-28
@@ -1,36 +1,20 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* sched/task/task_create.c
|
* sched/task/task_create.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2010, 2013-2014, 2016, 2018-2019 Gregory Nutt. All
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
* rights reserved.
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
* notice, this list of conditions and the following disclaimer in
|
* License for the specific language governing permissions and limitations
|
||||||
* the documentation and/or other materials provided with the
|
* under the License.
|
||||||
* distribution.
|
|
||||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
|
||||||
* used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
||||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
||||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
||||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@@ -47,6 +31,7 @@
|
|||||||
|
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/kmalloc.h>
|
#include <nuttx/kmalloc.h>
|
||||||
|
#include <nuttx/sched.h>
|
||||||
#include <nuttx/kthread.h>
|
#include <nuttx/kthread.h>
|
||||||
|
|
||||||
#include "sched/sched.h"
|
#include "sched/sched.h"
|
||||||
|
|||||||
+13
-27
@@ -1,35 +1,20 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* sched/task/task_init.c
|
* sched/task/task_init.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007, 2009, 2013-2014 Gregory Nutt. All rights reserved.
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
* notice, this list of conditions and the following disclaimer in
|
* License for the specific language governing permissions and limitations
|
||||||
* the documentation and/or other materials provided with the
|
* under the License.
|
||||||
* distribution.
|
|
||||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
|
||||||
* used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
||||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
||||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
||||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@@ -45,6 +30,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
|
#include <nuttx/sched.h>
|
||||||
|
|
||||||
#include "sched/sched.h"
|
#include "sched/sched.h"
|
||||||
#include "group/group.h"
|
#include "group/group.h"
|
||||||
|
|||||||
+13
-28
@@ -1,36 +1,20 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* sched/task/task_setup.c
|
* sched/task/task_setup.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2014, 2016-2017, 2019 Gregory Nutt. All rights
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
* reserved.
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
* notice, this list of conditions and the following disclaimer in
|
* License for the specific language governing permissions and limitations
|
||||||
* the documentation and/or other materials provided with the
|
* under the License.
|
||||||
* distribution.
|
|
||||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
|
||||||
* used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
||||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
||||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
||||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@@ -48,6 +32,7 @@
|
|||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
|
#include <nuttx/sched.h>
|
||||||
#include <nuttx/signal.h>
|
#include <nuttx/signal.h>
|
||||||
|
|
||||||
#include "sched/sched.h"
|
#include "sched/sched.h"
|
||||||
|
|||||||
Reference in New Issue
Block a user