For CONFIG_BUILD_KERNEL using the sched/task/task_exithook implementation
will just not work. It calls user code with kernel privileges which is
a bit of a security issue.
here is the reason:
1.clock_systime_timespec(core function) always exist regardless the setting
2.CLOCK_MONOTONIC is a foundamental clock type required by many places
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
commit e1c306f2dd added sethostname using
strncpy. This replaces it with strlcpy and uses sizeof() instead of
re-calculating the buffer size.
Rename size argument for get/sethostname to match the implementation
and implement all status related change function. the individual
file system change will provide in other upcoming patchset.
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I8fde9db8eba9586e9c8da078b67e020c26623cf4
MIRTOS-107
Add _SC_MONOTONIC_CLOCK to sysconf when CONFIG_CLOCK_MONOTONIC is set
Change-Id: I0ae57798ebe89247a10ccb517e128866d1f907de
Signed-off-by: Peter Bee <bijunda1@xiaomi.com>
from https://pubs.opengroup.org/onlinepubs/007904875/functions/setpriority.html:
1.The nice value shall in the range [-{NZERO},{NZERO} -1]
2.Lower nice value shall cause more favorable scheduling
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I5ad60d92abc3b69fbaa406da68cec2e40ca3fa6d
arch: Allocate the space from the beginning in up_stack_frame
and modify the affected portion:
1.Correct the stack dump and check
2.Allocate tls_info_s by up_stack_frame too
3.Move the stack fork allocation from arch to sched
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Per the Linux man page, "By default, getopt() permutes the contents of argv as it scans, so that eventually all the nonoptions are at the end." This behavior, however, is not implemented in the NuttX getopt() logic.
The Linux man page requires that the getopt_long() and getopt_long_only() functions accept arguments to options in a form like:
--option=argument
This PR adds that missing functionality.
This change effects only getopt_long() and getopt_long_only()
Tested on a simulator NSH configuration with a modified version of the getopt() test in apps/testing/ostest.
If an unrecognized long option is encountered, we must skip over that argv[] entry or getopt_long() will seriously misbehave.
Affects getopt_long() and getopt_long_only()
Problem found and fix verified with an updated version of the OS test.
Found a place in getopt_common() where the option string is used before it is checked if it is NULL. This can happen because the short option string is optional for getopt_long() and getopt_long_only()
If optstring is NULL, that would be an ERROR for getopt(), but not for the getopt_long() versions.
Should effect only the getopt() APIs
Tested on the simulator using apps/testing/ostest.
1. Null pointer dereference:
- for (ndx = 0; longopts[ndx].name[0] != '\0'; ndx++)
+ for (ndx = 0; longopts[ndx].name != NULL; ndx++)
2. Handle single character long options. An option like -x could be either a short option or a long option (under getopt_long_only()). This case was not being handled correctly.
3. Add missing support for optional arguments to short options (indicated with two "::"
This effects all members of the getopt() family of APIs.
Tested on the simulator using extensions to apps/testing/ostest.
Add implementations of getopt_long() and getopt_long_only()
There could be impacts to getop() since that implementation is shared withe new getopts_long() and getops_long_only() implementation.
Tested using a modified version of sim:nsh
getopt() in the FLAT build environment is not thread safe. This is because global variables that are process-specific in Unix are truly global in the FLAT build. Moving the getopt() variables into TLS resolves this issue.
No side-effects are expected other than to getopt()
Tested with sim:nsh
Gregory Nutt has submitted the SGA and we can migrate the licenses
to Apache.
Several files were missed in the past
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
When CONFIG_SYMTAB_ORDEREDBYNAME is selected most code will use
the ordered search function. When it is not selected no code will
use the ordered search function. This change merges the two
functions and varies its behaviour based on the config setting,
such that all callers can simply call the one search function
and get the best behaviour.
An additional configuration option allows leading underscores to
be stripped from symbols being relocated in loaded objects. This
allows toolchains which prefix C symbol with underscores to make
loadable ELF objects.