Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nuttx-apps
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
f4grx
nuttx-apps
Commits
186a101d
Commit
186a101d
authored
9 years ago
by
Gregory Nutt
Browse files
Options
Downloads
Patches
Plain Diff
NSHL: Format strings for nsh_output should all have IOBJ qualifier
parent
96ee3362
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
nshlib/nsh_proccmds.c
+39
-16
39 additions, 16 deletions
nshlib/nsh_proccmds.c
with
39 additions
and
16 deletions
nshlib/nsh_proccmds.c
+
39
−
16
View file @
186a101d
...
...
@@ -103,6 +103,10 @@ struct nsh_taskstatus_s
#endif
};
/****************************************************************************
* Private Data
****************************************************************************/
/* Status strings */
#if 0 /* Not used */
...
...
@@ -124,6 +128,25 @@ static const char g_scheduler[] = "Scheduler:";
static
const
char
g_sigmask
[]
=
"SigMask:"
;
#endif
/* Format strings */
#ifndef CONFIG_NSH_DISABLE_PS
static
const
IOBJ
char
g_fmtid
[]
=
"%5s "
;
static
const
IOBJ
char
g_fmtname
[]
=
"%5s "
;
#ifndef CONFIG_DISABLE_SIGNALS
static
const
IOBJ
char
g_fmtsigmask
[]
=
"%-8s "
;
#endif
#ifdef NSH_HAVE_CPULOAD
static
const
IOBJ
char
g_fmtload
[]
=
"%6s "
;
#endif
static
const
IOBJ
char
g_fmtcmdline
[]
=
"%s
\n
"
;
static
const
IOBJ
char
g_fmtcommon
[]
=
"%3s %-8s %-7s %3s %-8s %-9s "
;
#endif
#ifndef CONFIG_NSH_DISABLE_EXEC
static
const
IOBJ
char
g_fmtexec
[]
=
"Calling %p
\n
"
;
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
...
...
@@ -337,28 +360,28 @@ static int ps_callback(FAR struct nsh_vtbl_s *vtbl, FAR const char *dirpath,
/* Finally, print the status information */
nsh_output
(
vtbl
,
"%5s "
,
entryp
->
d_name
);
nsh_output
(
vtbl
,
g_fmtname
,
entryp
->
d_name
);
#ifdef CONFIG_SCHED_HAVE_PARENT
#ifdef HAVE_GROUPID
nsh_output
(
vtbl
,
"%5s "
,
status
.
td_groupid
);
nsh_output
(
vtbl
,
g_fmtid
,
status
.
td_groupid
);
#else
nsh_output
(
vtbl
,
"%5s "
,
status
.
td_ppid
);
nsh_output
(
vtbl
,
g_fmtid
,
status
.
td_ppid
);
#endif
#endif
nsh_output
(
vtbl
,
"%3s %-8s %-7s %3s %-8s %-9s "
,
nsh_output
(
vtbl
,
g_fmtcommon
,
status
.
td_priority
,
status
.
td_policy
,
status
.
td_type
,
status
.
td_flags
,
status
.
td_state
,
status
.
td_event
);
#ifndef CONFIG_DISABLE_SIGNALS
nsh_output
(
vtbl
,
"%-8s "
,
status
.
td_sigmask
);
nsh_output
(
vtbl
,
g_fmtsigmask
,
status
.
td_sigmask
);
#endif
#ifdef NSH_HAVE_CPULOAD
/* Get the CPU load */
filepath
=
NULL
;
filepath
=
NULL
;
ret
=
asprintf
(
&
filepath
,
"%s/%s/loadavg"
,
dirpath
,
entryp
->
d_name
);
if
(
ret
<
0
||
filepath
==
NULL
)
{
...
...
@@ -376,7 +399,7 @@ static int ps_callback(FAR struct nsh_vtbl_s *vtbl, FAR const char *dirpath,
}
}
nsh_output
(
vtbl
,
"%6s "
,
nsh_trimspaces
(
vtbl
->
iobuffer
));
nsh_output
(
vtbl
,
g_fmtload
,
nsh_trimspaces
(
vtbl
->
iobuffer
));
#endif
/* Read the task/tread command line */
...
...
@@ -398,7 +421,7 @@ static int ps_callback(FAR struct nsh_vtbl_s *vtbl, FAR const char *dirpath,
return
ERROR
;
}
nsh_output
(
vtbl
,
"%s
\n
"
,
nsh_trimspaces
(
vtbl
->
iobuffer
));
nsh_output
(
vtbl
,
g_fmtcmdline
,
nsh_trimspaces
(
vtbl
->
iobuffer
));
return
OK
;
}
#endif
...
...
@@ -424,7 +447,7 @@ int cmd_exec(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
return
ERROR
;
}
nsh_output
(
vtbl
,
"Calling %p
\n
"
,
(
exec_t
)
addr
);
nsh_output
(
vtbl
,
g_fmtexec
,
(
exec_t
)
addr
);
return
((
exec_t
)
addr
)();
}
#endif
...
...
@@ -436,26 +459,26 @@ int cmd_exec(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
#ifndef CONFIG_NSH_DISABLE_PS
int
cmd_ps
(
FAR
struct
nsh_vtbl_s
*
vtbl
,
int
argc
,
char
**
argv
)
{
nsh_output
(
vtbl
,
"%5s "
,
"PID"
);
nsh_output
(
vtbl
,
g_fmtid
,
"PID"
);
#ifdef CONFIG_SCHED_HAVE_PARENT
#ifdef HAVE_GROUPID
nsh_output
(
vtbl
,
"%5s "
,
"GROUP"
);
nsh_output
(
vtbl
,
g_fmtid
,
"GROUP"
);
#else
nsh_output
(
vtbl
,
"%5s "
,
"PPID"
);
nsh_output
(
vtbl
,
g_fmtid
,
"PPID"
);
#endif
#endif
nsh_output
(
vtbl
,
"%3s %-8s %-7s %3s %-8s %-9s "
,
nsh_output
(
vtbl
,
g_fmtcommon
,
"PRI"
,
"POLICY"
,
"TYPE"
,
"NPX"
,
"STATE"
,
"EVENT"
);
#ifndef CONFIG_DISABLE_SIGNALS
nsh_output
(
vtbl
,
"%-8s "
,
"SIGMASK"
);
nsh_output
(
vtbl
,
g_fmtsigmask
,
"SIGMASK"
);
#endif
#ifdef NSH_HAVE_CPULOAD
nsh_output
(
vtbl
,
"%6s "
,
"CPU"
);
nsh_output
(
vtbl
,
g_fmtload
,
"CPU"
);
#endif
nsh_output
(
vtbl
,
"%s
\n
"
,
"COMMAND"
);
nsh_output
(
vtbl
,
g_fmtcmdline
,
"COMMAND"
);
return
nsh_foreach_direntry
(
vtbl
,
"ps"
,
CONFIG_NSH_PROC_MOUNTPOINT
,
ps_callback
,
NULL
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment