fs/procfs: Process status now includes task flags. Some strings modified to improved 'ps' command output
This commit is contained in:
parent
48da5aa496
commit
2e7d139cd3
@ -303,17 +303,17 @@ static const struct proc_node_s * const g_groupinfo[] =
|
|||||||
static const char *g_statenames[] =
|
static const char *g_statenames[] =
|
||||||
{
|
{
|
||||||
"Invalid",
|
"Invalid",
|
||||||
"Pending unlock",
|
"Waiting,Unlock",
|
||||||
"Ready",
|
"Ready",
|
||||||
"Running",
|
"Running",
|
||||||
"Inactive",
|
"Inactive",
|
||||||
"Semaphore wait",
|
"Waiting,Semaphore",
|
||||||
#ifndef CONFIG_DISABLE_MQUEUE
|
#ifndef CONFIG_DISABLE_SIGNALS
|
||||||
"Signal wait",
|
"Waiting,Signal",
|
||||||
#endif
|
#endif
|
||||||
#ifndef CONFIG_DISABLE_MQUEUE
|
#ifndef CONFIG_DISABLE_MQUEUE
|
||||||
"MQ not empty wait",
|
"Waiting,MQ empty",
|
||||||
"MQ no full wait"
|
"Waiting,MQ full"
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -321,8 +321,8 @@ static const char *g_ttypenames[4] =
|
|||||||
{
|
{
|
||||||
"Task",
|
"Task",
|
||||||
"pthread",
|
"pthread",
|
||||||
"Kernel thread",
|
"Kthread",
|
||||||
"--?--"
|
"Invalid"
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -354,6 +354,21 @@ static FAR const struct proc_node_s *proc_findnode(FAR const char *relpath)
|
|||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: proc_status
|
* Name: proc_status
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Format:
|
||||||
|
*
|
||||||
|
* 111111111122222222223
|
||||||
|
* 123456789012345678901234567890
|
||||||
|
* Name: xxxx... Task/thread name (See CONFIG_TASK_NAME_SIZE)
|
||||||
|
* Type: xxxxxxx {Task, pthread, Kthread, Invalid}
|
||||||
|
* State: xxxxxxxx,xxxxxxxxx {Invalid, Waiting, Ready, Running, Inactive},
|
||||||
|
* {Unlock, Semaphore, Signal, MQ empty, MQ full}
|
||||||
|
* Flags: xxx N,P,X
|
||||||
|
* Priority: nnn Decimal, 0-255
|
||||||
|
* Scheduler: xxxxxxxxxxxxxx {SCHED_FIFO, SCHED_RR, SCHED_SPORADIC, SCHED_OTHER}
|
||||||
|
* Sigmask: nnnnnnnn Hexadecimal, 32-bit
|
||||||
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static ssize_t proc_status(FAR struct proc_file_s *procfile,
|
static ssize_t proc_status(FAR struct proc_file_s *procfile,
|
||||||
@ -416,6 +431,24 @@ static ssize_t proc_status(FAR struct proc_file_s *procfile,
|
|||||||
buffer += copysize;
|
buffer += copysize;
|
||||||
remaining -= copysize;
|
remaining -= copysize;
|
||||||
|
|
||||||
|
if (totalsize >= buflen)
|
||||||
|
{
|
||||||
|
return totalsize;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Show task flags */
|
||||||
|
|
||||||
|
linesize = snprintf(procfile->line, STATUS_LINELEN, "%-12s%c%c%c\n", "Flags:",
|
||||||
|
tcb->flags & TCB_FLAG_NONCANCELABLE ? 'N' : '-',
|
||||||
|
tcb->flags & TCB_FLAG_CANCEL_PENDING ? 'P' : '-',
|
||||||
|
tcb->flags & TCB_FLAG_EXIT_PROCESSING ? 'P' : '-');
|
||||||
|
|
||||||
|
copysize = procfs_memcpy(procfile->line, linesize, buffer, remaining, &offset);
|
||||||
|
|
||||||
|
totalsize += copysize;
|
||||||
|
buffer += copysize;
|
||||||
|
remaining -= copysize;
|
||||||
|
|
||||||
if (totalsize >= buflen)
|
if (totalsize >= buflen)
|
||||||
{
|
{
|
||||||
return totalsize;
|
return totalsize;
|
||||||
|
Loading…
Reference in New Issue
Block a user