Summary:
- stdin/stdout/stderr are now preallocated in libc and fs_fd
in file_struct are also initialized to -1
- So we need to call fdopen() for stdin again as we did before.
- Also, cn_outstream and cn_errstream are not needed to be set.
- See apps/nshlib/nsh_console.h as well
Impact:
- nsh_usbconsole.c only
Testing:
- Tested with stm32f4discovery:usbnsh
Signed-off-by: SUZUKI Keiji <zuki.ebetsu@gmail.com>
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
Summary:
- This commit fixes nsh_configstdio() to setup stdout and stderr
Impact:
- Affect nsh_usbconsole only
Testing:
- Tested with stm32f4discovery:usbnsh
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
since it is wrong to close the builtin stream and specially note
https://pubs.opengroup.org/onlinepubs/9699919799/functions/fclose.html:
Since after the call to fclose() any use of stream results in
undefined behavior, fclose() should not be used on stdin, stdout,
or stderr except immediately before process termination (see XBD
Process Termination), so as to avoid triggering undefined behavior
in other standard interfaces that rely on these streams. If there
are any atexit() handlers registered by the application, such a
call to fclose() should not occur until the last handler is
finishing. Once fclose() has been used to close stdin, stdout, or
stderr, there is no standard way to reopen any of these streams.
and it is also unnecessary because the stream always get flushed.
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
since these function don't depend on standard input/output function
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I320659eff933d49c4872e43320fa30696d8b8a54
Summary:
- Fix memory corruption when pthread_create() failed in nsh_execute()
Impact:
- nsh builtin command execution in background with errors
Testing:
- Tested with hifive1-revb:nsh
- Set CONFIG_MAX_TASKS=4
- Run 'sleep 1000 &' in 3 times will cause pthread_create error
- Run free, ps command
Reported-by: Yoshinori Sugino <ysgn0101@gmail.com>
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
since NuttX kernel support really support symlink not link.
Note: link equal symlink now because the hard link doesn't support yet
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I47437f5fd8bbab3a5539d0eb6f690f633b422345
This is a bad change. It has been show to cause an increase in size by around 2.3Kb in minimal configurations that cannot tolerate that massive size increase.
This reverts commit 4adb83c754.
Add some comments to nsh_parse.c emphasizing the reason that things are done in the order that they are. Perhaps such comments will avoid similar breakage in the future.
commit 9a28ccf836
Author: chao.an <anchao@xiaomi.com>
Date: Fri Feb 21 09:54:47 2020 +0800
nsh/parse: try the builtin configuration first
In the case of enable the BUILTIN_APPS/FILE_APPS at the same time,
try the builtin list first to ensure that the relevant configuration
(stacksize, priority) can be set normally.
This commit breaks the feature because it changes the order to that the built-in application is tried first. Hence, the version on the file system will never replace the built-in version.
That commit must be reverted in order to restore the correct functionality.
Revert "nsh/parse: try the builtin configuration first"
This reverts commit 9a28ccf836.
since this command change the parent environment variable and
add new '.' command which has the same functionality as 'source'
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
1.Avoid the code duplication
2.Call BOARDIOC_FINALINIT onnce and only once
3.Ensure BOARDIOC_FINALINIT get called in all case
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>