Adjust for increased size of the scheduling policy field from 1 to 2 bits to allow additional, planned scheduling policies

This commit is contained in:
Gregory Nutt 2015-07-23 10:15:57 -06:00
parent 62853218d3
commit 3a57f9e2ef
3 changed files with 26 additions and 6 deletions

View File

@ -1357,4 +1357,6 @@
anti-aliasing an option for each graphics call so you would rend the
line with anti-aliasing ON and clear it with anti-aliasing OFF. but I
don't have the wherewithal for that change today (2015-04-14)`.
* apps/nshlib and apps/examaples/thttpd: Change decoding to handle the
increased size of the scheduling policy field in the TCB (2015-07-23).

View File

@ -85,6 +85,14 @@ static const char *g_ttypenames[4] =
"--?-- "
};
static FAR const char *g_policynames[4] =
{
"FIFO",
"RR ",
"SPOR",
"OTHR"
};
/****************************************************************************
* Public Data
****************************************************************************/
@ -105,13 +113,14 @@ static const char *g_ttypenames[4] =
/* static */ void show_task(FAR struct tcb_s *tcb, FAR void *arg)
{
FAR const char *policy;
int i;
/* Show task/thread status */
policy = g_policynames[(tcb->flags & TCB_FLAG_POLICY_MASK) >> TCB_FLAG_POLICY_SHIFT];
printf("%5d %3d %4s %7s%c%c %8s ",
tcb->pid, tcb->sched_priority,
tcb->flags & TCB_FLAG_ROUND_ROBIN ? "RR " : "FIFO",
tcb->pid, tcb->sched_priority, policy,
g_ttypenames[(tcb->flags & TCB_FLAG_TTYPE_MASK) >> TCB_FLAG_TTYPE_SHIFT],
tcb->flags & TCB_FLAG_NONCANCELABLE ? 'N' : ' ',
tcb->flags & TCB_FLAG_CANCEL_PENDING ? 'P' : ' ',

View File

@ -1,7 +1,7 @@
/****************************************************************************
* apps/nshlib/nsh_proccmds.c
*
* Copyright (C) 2007-2009, 2011-2012, 2014 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009, 2011-2012, 2014-2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -108,6 +108,14 @@ static const char *g_ttypenames[4] =
};
#endif
static FAR const char *g_policynames[4] =
{
"FIFO",
"RR ",
"SPOR",
"OTHR"
};
/****************************************************************************
* Public Data
****************************************************************************/
@ -231,7 +239,8 @@ static int loadavg(pid_t pid, FAR char *buffer, size_t buflen)
#ifndef CONFIG_NSH_DISABLE_PS
static void ps_task(FAR struct tcb_s *tcb, FAR void *arg)
{
struct nsh_vtbl_s *vtbl = (struct nsh_vtbl_s*)arg;
FAR struct nsh_vtbl_s *vtbl = (FAR struct nsh_vtbl_s*)arg;
FAR const char *policy;
#ifdef HAVE_CPULOAD
char buffer[8];
int ret;
@ -240,9 +249,9 @@ static void ps_task(FAR struct tcb_s *tcb, FAR void *arg)
/* Show task status */
policy = g_policynames[(tcb->flags & TCB_FLAG_POLICY_MASK) >> TCB_FLAG_POLICY_SHIFT];
nsh_output(vtbl, "%5d %3d %4s %7s%c%c %8s ",
tcb->pid, tcb->sched_priority,
tcb->flags & TCB_FLAG_ROUND_ROBIN ? "RR " : "FIFO",
tcb->pid, tcb->sched_priority, policy,
g_ttypenames[(tcb->flags & TCB_FLAG_TTYPE_MASK) >> TCB_FLAG_TTYPE_SHIFT],
tcb->flags & TCB_FLAG_NONCANCELABLE ? 'N' : ' ',
tcb->flags & TCB_FLAG_CANCEL_PENDING ? 'P' : ' ',