Skip to content

Commit

Permalink
Move task control files from sched/ to sched/task
Browse files Browse the repository at this point in the history
  • Loading branch information
gregory-nutt committed Aug 8, 2014
1 parent 6683d74 commit 23a334c
Show file tree
Hide file tree
Showing 39 changed files with 240 additions and 101 deletions.
1 change: 1 addition & 0 deletions arch/8051/src/up_exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#include <8052.h>
#include <nuttx/arch.h>

#include "task/task.h"
#include "os_internal.h"
#include "up_internal.h"

Expand Down
7 changes: 4 additions & 3 deletions arch/arm/src/common/up_exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,14 @@
#include <debug.h>
#include <nuttx/arch.h>

#include "os_internal.h"
#include "up_internal.h"

#ifdef CONFIG_DUMP_ON_EXIT
#include <nuttx/fs/fs.h>
#endif

#include "task/task.h"
#include "os_internal.h"
#include "up_internal.h"

/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
Expand Down
7 changes: 4 additions & 3 deletions arch/avr/src/common/up_exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,14 @@
#include <debug.h>
#include <nuttx/arch.h>

#include "os_internal.h"
#include "up_internal.h"

#ifdef CONFIG_DUMP_ON_EXIT
#include <nuttx/fs/fs.h>
#endif

#include "task/task.h"
#include "os_internal.h"
#include "up_internal.h"

/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
Expand Down
7 changes: 4 additions & 3 deletions arch/hc/src/common/up_exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,14 @@
#include <debug.h>
#include <nuttx/arch.h>

#include "os_internal.h"
#include "up_internal.h"

#ifdef CONFIG_DUMP_ON_EXIT
#include <nuttx/fs/fs.h>
#endif

#include "task/task.h"
#include "os_internal.h"
#include "up_internal.h"

/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
Expand Down
7 changes: 4 additions & 3 deletions arch/mips/src/common/up_exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,14 @@
#include <debug.h>
#include <nuttx/arch.h>

#include "os_internal.h"
#include "up_internal.h"

#ifdef CONFIG_DUMP_ON_EXIT
#include <nuttx/fs/fs.h>
#endif

#include "task/task.h"
#include "os_internal.h"
#include "up_internal.h"

/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
Expand Down
5 changes: 3 additions & 2 deletions arch/rgmp/src/nuttx.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,11 @@
#include <stdlib.h>
#include <arch/irq.h>
#include <arch/arch.h>
#include <os_internal.h>

struct tcb_s *current_task = NULL;
#include "task/task.h"
#include "os_internal.h"

struct tcb_s *current_task = NULL;

/**
* This function is called in non-interrupt context
Expand Down
7 changes: 4 additions & 3 deletions arch/sh/src/common/up_exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,14 @@

#include <nuttx/arch.h>

#include "os_internal.h"
#include "up_internal.h"

#ifdef CONFIG_DUMP_ON_EXIT
#include <nuttx/fs/fs.h>
#endif

#include "task/task.h"
#include "os_internal.h"
#include "up_internal.h"

/****************************************************************************
* Private Definitions
****************************************************************************/
Expand Down
1 change: 1 addition & 0 deletions arch/sim/src/up_exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@

#include <nuttx/arch.h>

#include "task/task.h"
#include "os_internal.h"
#include "up_internal.h"

Expand Down
7 changes: 4 additions & 3 deletions arch/x86/src/common/up_exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,14 @@
#include <debug.h>
#include <nuttx/arch.h>

#include "os_internal.h"
#include "up_internal.h"

#ifdef CONFIG_DUMP_ON_EXIT
#include <nuttx/fs/fs.h>
#endif

#include "task/task.h"
#include "os_internal.h"
#include "up_internal.h"

/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
Expand Down
9 changes: 5 additions & 4 deletions arch/z16/src/common/up_exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,15 @@

#include <nuttx/arch.h>

#include "chip/chip.h"
#include "os_internal.h"
#include "up_internal.h"

#ifdef CONFIG_DUMP_ON_EXIT
#include <nuttx/fs/fs.h>
#endif

#include "chip/chip.h"
#include "task/task.h"
#include "os_internal.h"
#include "up_internal.h"

/****************************************************************************
* Private Definitions
****************************************************************************/
Expand Down
9 changes: 5 additions & 4 deletions arch/z80/src/common/up_exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,15 @@

#include <nuttx/arch.h>

#include "chip/chip.h"
#include "os_internal.h"
#include "up_internal.h"

#ifdef CONFIG_DUMP_ON_EXIT
#include <nuttx/fs/fs.h>
#endif

#include "chip/chip.h"
#include "task/task.h"
#include "os_internal.h"
#include "up_internal.h"

/****************************************************************************
* Private Definitions
****************************************************************************/
Expand Down
35 changes: 9 additions & 26 deletions sched/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,31 +40,10 @@ DEPPATH = --dep-path .

ASRCS =

TSK_SRCS = prctl.c exit.c getpid.c
TSK_SRCS += task_create.c task_init.c task_setup.c task_activate.c task_start.c
TSK_SRCS += task_delete.c task_exit.c task_exithook.c task_recover.c
TSK_SRCS += task_restart.c task_spawn.c task_spawnparms.c task_terminate.c
TSK_SRCS += sched_addreadytorun.c sched_removereadytorun.c sched_addprioritized.c
TSK_SRCS += sched_mergepending.c sched_addblocked.c sched_removeblocked.c
TSK_SRCS += sched_free.c sched_gettcb.c sched_verifytcb.c sched_releasetcb.c

ifeq ($(CONFIG_ARCH_HAVE_VFORK),y)
ifeq ($(CONFIG_SCHED_WAITPID),y)
TSK_SRCS += task_vfork.c
endif
endif

ifneq ($(CONFIG_BINFMT_DISABLE),y)
ifeq ($(CONFIG_LIBC_EXECFUNCS),y)
TSK_SRCS += task_posixspawn.c
endif
endif

ifeq ($(CONFIG_SCHED_STARTHOOK),y)
TSK_SRCS += task_starthook.c
endif

SCHED_SRCS = sched_garbage.c sched_getfiles.c
SCHED_SRCS += sched_addreadytorun.c sched_removereadytorun.c sched_addprioritized.c
SCHED_SRCS += sched_mergepending.c sched_addblocked.c sched_removeblocked.c
SCHED_SRCS += sched_free.c sched_gettcb.c sched_verifytcb.c sched_releasetcb.c
SCHED_SRCS += sched_getsockets.c sched_getstreams.c
SCHED_SRCS += sched_setparam.c sched_setpriority.c sched_getparam.c
SCHED_SRCS += sched_setscheduler.c sched_getscheduler.c
Expand Down Expand Up @@ -108,6 +87,7 @@ include init/Make.defs
include irq/Make.defs
include paging/Make.defs
include group/Make.defs
include task/Make.defs
include errno/Make.defs
include wdog/Make.defs
include semaphore/Make.defs
Expand All @@ -118,8 +98,11 @@ include clock/Make.defs
include timer/Make.defs
include environ/Make.defs

CSRCS = $(INIT_SRCS) $(IRQ_SRCS) $(PG_SRCS) $(GRP_SRCS) $(TSK_SRCS)
CSRCS += $(SCHED_SRCS) $(ERRNO_SRCS) $(WDOG_SRCS) $(SEM_SRCS)
# REVISIT
TSK_SRCS += prctl.c exit.c getpid.c

CSRCS = $(INIT_SRCS) $(IRQ_SRCS) $(PG_SRCS) $(GRP_SRCS) $(SCHED_SRCS)
CSRCS += $(TSK_SRCS) $(ERRNO_SRCS) $(WDOG_SRCS) $(SEM_SRCS)
CSRCS += $(SIGNAL_SRCS) $(PTHREAD_SRCS) $(MQUEUE_SRCS) $(CLOCK_SRCS)
CSRCS += $(TIMER_SRCS) $(ENV_SRCS)

Expand Down
3 changes: 2 additions & 1 deletion sched/exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@

#include <nuttx/fs/fs.h>

#include "task/task.h"
#include "os_internal.h"

/****************************************************************************
* Definitions
* Pre-processor Definitions
****************************************************************************/

/****************************************************************************
Expand Down
2 changes: 1 addition & 1 deletion sched/group/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

GRP_SRCS = group_create.c group_join.c group_leave.c group_find.c
GRP_SRCS += group_setupstreams.c group_setupidlefiles.c group_setuptaskfiles.c
GRP_SRCS += task_getgroup.c group_foreachchild.c group_killchildren.c
GRP_SRCS += group_foreachchild.c group_killchildren.c

ifeq ($(CONFIG_SCHED_HAVE_PARENT),y)
GRP_SRCS += task_reparent.c
Expand Down
5 changes: 5 additions & 0 deletions sched/group/group.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ extern FAR struct task_group_s *g_grouphead;
/****************************************************************************
* Public Function Prototypes
****************************************************************************/

#ifdef CONFIG_SCHED_CHILD_STATUS
void weak_function task_initialize(void);
#endif

/* Task group data structure management */

#ifdef HAVE_TASK_GROUP
Expand Down
7 changes: 0 additions & 7 deletions sched/init/init.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,6 @@

#include <nuttx/config.h>

#include <sys/types.h>
#include <stdbool.h>
#include <queue.h>
#include <sched.h>

#include <nuttx/kmalloc.h>

/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
Expand Down
12 changes: 0 additions & 12 deletions sched/os_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -219,18 +219,6 @@ extern volatile uint32_t g_cpuload_total;
* Public Function Prototypes
****************************************************************************/

#ifdef CONFIG_SCHED_CHILD_STATUS
void weak_function task_initialize(void);
#endif
void task_start(void);
int task_schedsetup(FAR struct task_tcb_s *tcb, int priority,
start_t start, main_t main, uint8_t ttype);
int task_argsetup(FAR struct task_tcb_s *tcb, FAR const char *name,
FAR char * const argv[]);
int task_exit(void);
int task_terminate(pid_t pid, bool nonblocking);
void task_exithook(FAR struct tcb_s *tcb, int status, bool nonblocking);
void task_recover(FAR struct tcb_s *tcb);
bool sched_addreadytorun(FAR struct tcb_s *rtrtcb);
bool sched_removereadytorun(FAR struct tcb_s *rtrtcb);
bool sched_addprioritized(FAR struct tcb_s *newTcb, DSEG dq_queue_t *list);
Expand Down
1 change: 1 addition & 0 deletions sched/pthread/pthread_exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
#include <nuttx/arch.h>

#include "os_internal.h"
#include "task/task.h"
#include "pthread/pthread.h"

/************************************************************************
Expand Down
60 changes: 60 additions & 0 deletions sched/task/Make.defs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
############################################################################
# sched/task/Make.defs
#
# Copyright (C) 2014 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <[email protected]>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# 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.
#
############################################################################

TSK_SRCS = task_create.c task_init.c task_setup.c task_activate.c
TSK_SRCS += task_start.c task_delete.c task_exit.c task_exithook.c
TSK_SRCS += task_recover.c task_restart.c task_spawn.c task_spawnparms.c
TSK_SRCS += task_terminate.c task_getgroup.c

ifeq ($(CONFIG_ARCH_HAVE_VFORK),y)
ifeq ($(CONFIG_SCHED_WAITPID),y)
TSK_SRCS += task_vfork.c
endif
endif

ifneq ($(CONFIG_BINFMT_DISABLE),y)
ifeq ($(CONFIG_LIBC_EXECFUNCS),y)
TSK_SRCS += task_posixspawn.c
endif
endif

ifeq ($(CONFIG_SCHED_STARTHOOK),y)
TSK_SRCS += task_starthook.c
endif

# Include task build support

DEPPATH += --dep-path task
VPATH += :task
8 changes: 4 additions & 4 deletions sched/spawn_internal.h → sched/task/spawn.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/****************************************************************************
* sched/spawn_internal.h
* sched/task/spawn.h
*
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <[email protected]>
Expand Down Expand Up @@ -33,8 +33,8 @@
*
****************************************************************************/

#ifndef __SCHED_SPAWN_INERNAL_H
#define __SCHED_SPAWN_INERNAL_H
#ifndef __SCHED_TASK_SPAWN_H
#define __SCHED_TASK_SPAWN_H

/****************************************************************************
* Included Files
Expand Down Expand Up @@ -159,4 +159,4 @@ int spawn_execattrs(pid_t pid, FAR const posix_spawnattr_t *attr);
int spawn_proxyattrs(FAR const posix_spawnattr_t *attr,
FAR const posix_spawn_file_actions_t *file_actions);

#endif /* __SCHED_SPAWN_INERNAL_H */
#endif /* __SCHED_TASK_SPAWN_H */
Loading

0 comments on commit 23a334c

Please sign in to comment.