CC: mm_heap/mm_memalign.c misc/rwbuffer.c: In function 'rwb_readbytes':
misc/rwbuffer.c:1172:2: warning: #warning Not Implemented [-Wcpp]
1172 | #warning Not Implemented
| ^~~~~~~
CC: binfmt_unloadmodule.c In file included from nsh_console.c:40:
nsh_console.c: In function 'nsh_consoleredirect':
nsh_console.h:85:30: error: 'struct serialsave_s' has no member named 'cn_confd'; did you mean 'cn_infd'?
85 | # define INFD(p) ((p)->cn_confd)
| ^~~~~~~~
nsh_console.c:344:7: note: in expansion of macro 'INFD'
344 | INFD(ssave) = INFD(pstate);
| ^~~~
nsh_console.c: In function 'nsh_consoleundirect':
nsh_console.h:85:30: error: 'struct serialsave_s' has no member named 'cn_confd'; did you mean 'cn_infd'?
85 | # define INFD(p) ((p)->cn_confd)
| ^~~~~~~~
nsh_console.c:370:18: note: in expansion of macro 'INFD'
370 | INFD(pstate) = INFD(ssave);
| ^~~~
Signed-off-by: ligd <liguiding1@xiaomi.com>
pthread & detach will still quit when parent task exit,
cause nsh_parse clone args leak. nsh should use task instead of thread
this case can reproduce the memory leak.
int main(int argc, FAR char *argv[])
{
printf("Hello, World!!\n");
system("sleep 1 &");
return 0;
}
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
Obtaining the heap usage size requires traversing all memory.
When the number of threads is large, it will become very slow.
ps -heap
PID GROUP PRI POLICY TYPE NPX STATE EVENT SIGMASK HEAP STACK USED FILLED COMMAND
0 0 0 FIFO Kthread - Ready 0000000000000000 4338432 2162672 0005196 0.2% Idle_Task
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
arm-none-eabi/bin/ld: apps/libapps.a(nsh_proccmds.c.obj): in function `cmd_pkill':
apps/nshlib/nsh_proccmds.c:861:(.text.cmd_pkill+0x38): undefined reference to `nsh_getpid'
Signed-off-by: chao an <anchao@lixiang.com>
Board/Config/Command
sim:nsh
cat < /etc/init.d/rc.sysinit
Problem
The NSH hangs after exec the test command.
`nsh_redirect()` needs to save three fd but array length is only two, stack buffer overflowed!
Related: https://github.com/apache/nuttx-apps/pull/2469
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
nsh_syscmds.c: In function ‘cmd_rpmsg_once’:
nsh_syscmds.c:567:13: error: ‘RPMSGIOC_PANIC’ undeclared (first use in this function)
567 | cmd = RPMSGIOC_PANIC;
| ^~~~~~~~~~~~~~
nsh_syscmds.c:567:13: note: each undeclared identifier is reported only once for each function it appears in
nsh_syscmds.c:571:13: error: ‘RPMSGIOC_DUMP’ undeclared (first use in this function); did you mean ‘FIOC_DUMP’?
571 | cmd = RPMSGIOC_DUMP;
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
1. struct rpmsg_ping_s ack change to cmd;
2. Update the help descrption based on the new cmd
meaning;
Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
usage like:
nsh> sleep 10 &
[5:100]
nsh>set pid1=$!
nsh>sleep 15 &
[6:100]
nsh>set pid2=$!
nsh>wait $pid1 $pid2
'wait' command will block nsh from running until pid1 and pid2 finish.
This is useful for parallel requirements to perform certain tasks
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Add newline at the end of cmd_pidof to show nsh
prompt correctly.
Before this patch:
```
nsh> pidof wifi
3 nsh>
```
After:
```
nsh> pidof wifi
3
nsh>
```
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
This command looks through the currently running processes and kills
the those that match the selection criteria. This way system can send
signal to processes by name and without knowing the IDs.
Example (kill application hello):
pkill -15 hello
The command can be turned off by NSH_DISABLE_PKILL option and depends
on FS_PROCFS.
Signed-off-by: Michal Lenc <michallenc@seznam.cz>
In below two cases "rm" command with "-f" option will return 0:
a. Bad arguments
b. File not exists
Following "rm" of GNU coreutils 8.32
GNU coreutils
$ rm --version
rm (GNU coreutils) 8.32
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Paul Rubin, David MacKenzie, Richard M. Stallman,
and Jim Meyering.
$ rm /FILE_NOT_EXISTS
rm: cannot remove '/FILE_NOT_EXISTS': No such file or directory
$ echo $?
1
$ rm -f
$ echo $?
0
$ rm -f /FILE_NOT_EXISTS
$ echo $?
0
Without this patch
nsh> rm
nsh: rm: missing required argument(s)
nsh> rm /FILE_NOT_EXISTS
nsh: rm: unlink failed: 2
nsh> echo $?
1
With this patch
nsh> rm -f
nsh> echo $?
0
nsh> rm -f /FILE_NOT_EXISTS
nsh> echo $?
0
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
In file included from nsh_ddcmd.c:44:
nsh_ddcmd.c: In function 'cmd_dd':
nsh_ddcmd.c:456:20: error: format '%llu' expects argument of type 'long long unsigned int', but argument 3 has type 'uint64_t' {aka 'long unsigned int'} [-Werror=format=]
456 | nsh_output(vtbl, "%llu bytes copied, %u usec, ",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
457 | total, (unsigned int)elapsed);
| ~~~~~
| |
| uint64_t {aka long unsigned int}
nsh_console.h:55:49: note: in definition of macro 'nsh_output'
55 | # define nsh_output(v, ...) (v)->output(v, ##__VA_ARGS__)
| ^~~~~~~~~~~
nsh_ddcmd.c:456:24: note: format string is defined here
456 | nsh_output(vtbl, "%llu bytes copied, %u usec, ",
| ~~~^
| |
| long long unsigned int
| %lu
cc1: all warnings being treated as errors
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
Summary:
do
{
nbyteswritten = write(wrfd, iobuffer, nbytesread);
if (nbyteswritten >= 0)
The write return type is ssize_t, which is different in size from the originally declared type, so the unified type is ssize_t
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
- As was merged in commit 1852731df87e5895e299b74aabdb1984b7e3f795 on
dd_main.c: lseek returns -1 on error.
Should be consistent in nsh_ddcmd.c and nsh_main.c.