Commit Graph

907 Commits

Author SHA1 Message Date
Xiang Xiao
c597721633 libc: Implement gettext function
https://www.man7.org/linux/man-pages/man3/dcgettext.3.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-08-03 12:14:07 -03:00
Xiang Xiao
4a23737016 libc: Remove include/nuttx/lib/regex.h and libs/libc/misc/lib_match.c
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-08-03 08:59:54 -03:00
Xiang Xiao
ae7fe055fc fs: Save umask to tls_task_s for non kernel mode only
since the kernel mode has the dedicated userspace

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-08-02 15:59:51 -03:00
Xiang Xiao
98de773081 libc: Support message catalog function
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/nl_types.h.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-08-02 08:24:59 -03:00
Xiang Xiao
a262eebe34 libc: Rename match to fnmatch
specified here:
https://pubs.opengroup.org/onlinepubs/007904875/functions/fnmatch.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-08-02 08:23:35 -03:00
Xiang Xiao
0e2cbe9a79 libc: Add the empty nl_langinfo implementation
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/langinfo.h.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-07-31 15:35:47 -03:00
Xiang Xiao
3c400f32fa Remove the locale fallback from libcxx
since these functions can handled by NuttX's libc now

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-07-30 09:43:26 -03:00
Abdelatif Guettouche
9b4e44842e libc/pthread_barrierattr_destory.c: Destroy shouldn't reinitialize the
attributes.

Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
2021-07-29 14:44:07 -03:00
Xiang Xiao
307cc61893 fs: Add fchstat and chstat callback into mountpt_operations
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
2021-07-29 06:33:49 -03:00
Jiuzhu Dong
23d87ff9df usrwqueue: implement order work queue
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-07-27 21:01:38 -07:00
Jiuzhu Dong
00854f0f94 userspace/wqueue: move exclusive access lock to mqueue inside
Change-Id: I885d5641bc81fedf698c241d4719cb3561700f17
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-07-27 21:01:38 -07:00
Nathan Hartman
b92aeb8209 Fix various typos
arch/arm/src/eoss3/eoss3_serial.c:
arch/arm/src/imxrt/hardware/imxrt_flexcan.h:
arch/arm/src/imxrt/imxrt_flexcan.c:
arch/arm/src/imxrt/imxrt_flexpwm.c:
arch/arm/src/imxrt/imxrt_lpi2c.c:
arch/arm/src/kinetis/kinetis_flexcan.c:
arch/arm/src/nrf52/hardware/nrf52_rtc.h:
arch/arm/src/nrf52/nrf52_clockconfig.c:
arch/arm/src/nrf52/nrf52_radio.c:
arch/arm/src/nrf52/nrf52_tim.c:
arch/arm/src/rtl8720c/amebaz_depend.c:
arch/arm/src/s32k1xx/Kconfig:
arch/arm/src/s32k1xx/s32k1xx_flexcan.c:
arch/arm/src/s32k1xx/s32k1xx_lpi2c.c:
arch/arm/src/sama5/hardware/sam_sdmmc.h:
arch/arm/src/sama5/sam_gmac.c:
arch/arm/src/samd5e5/sam_wdt.c:
arch/avr/src/avr32/up_exceptions.S:
arch/avr/src/avr32/up_fullcontextrestore.S:
arch/renesas/src/rx65n/rx65n_dtc.c:
arch/renesas/src/rx65n/rx65n_usbhost.c:
arch/risc-v/src/esp32c3/esp32c3_tickless.c:
boards/arm/stm32h7/stm32h747i-disco/include/board.h:
include/nuttx/lcd/ili9225.h:
libs/libc/stdio/lib_fgetpos.c:
libs/libc/stdio/lib_fseek.c:
libs/libc/stdio/lib_fsetpos.c:

    * Fix typos.
2021-07-25 18:36:53 -07:00
jordi
f3af6edf93 Kconfig: add quotes in source to clean warnings from setconfig
To avoid the setconfig warning "style: quotes recommended around xxx in
source xxx"
2021-07-23 02:32:19 -07:00
Xiang Xiao
af1dceb3e3 libc: Implement times function
https://pubs.opengroup.org/onlinepubs/009604599/functions/times.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: If2cccfedd532a77f86035d16d36d94ae38d8f09c
2021-07-21 13:11:54 -03:00
Xiang Xiao
df0e2a65b2 libc/sysconf: Implement the query of _SC_CLK_TCK
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I36a62d97b14ea06bbc2054ee96fd2319b2f6897c
2021-07-21 13:11:54 -03:00
SPRESENSE
25b7bdf943 libs/libxx/libcxx.defs: Fix build error on Windows platform
The libcxx-X.Y.Z.src.tar.xz contains a symbolic link to a directory
that not exist as below.

`libcxx-X.Y.Z.src/test/std/pstl -> ../../../pstl/test/std`

Linux and macOS environment have no problem, but it causes an error
when extracting tarball on Windows platform. This symbolic link is not
actually used, so exclude it from extracting the tarball.
2021-07-21 08:59:22 -07:00
Nathan Hartman
609ee6b54b Fix typos in comments and identifiers 2021-07-19 22:55:30 -03:00
Xiang Xiao
663104a2e9 fs: Simplify sendfile implementation
and avoid call nx_ file API in the kernel space

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Id951ca161df2c2ee267dc4b5a0d7dfa67df4c1e6
2021-07-17 07:39:15 -03:00
Nathan Hartman
af1fd49fb0 wqueue: Fix typos
include/nuttx/wqueue.h:
libs/libc/wqueue/work_cancel.c:
libs/libc/wqueue/work_queue.c:
sched/wqueue/kwork_cancel.c:
sched/wqueue/kwork_queue.c:

    * Fix spelling, grammar, and typos.
    * Improve wording in a few areas.
    * These changes affect comments only. No functional changes.
2021-07-16 19:54:08 -03:00
mage1
def007e2d7 add #undef for some libc function
since it's useful to redirect these functions to others
sometime(e.g. validate the memory before write).

Change-Id: I6253a9231af8809e8362f4bc5a1bd67fb094c3b0
2021-07-14 15:09:58 -03:00
Xiang Xiao
a0f2f6c362 fs: Move umask to task_info_s
and implement the related semantic correctly

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I0587341e2c505e41b5e24e55dba039ed200d65f2
2021-07-14 10:35:15 -03:00
Huang Qi
73a0c1d095 libc/string: Skip compile the c version when the optimization is enabled
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
Change-Id: Idbdea04f748243fb9baf7b39d0ed997f7e9a8e3c
2021-07-13 09:42:23 -03:00
zhouliang3
f230ba7b34 Increase the function of crc8 to use custom polynomials
N/A

Signed-off-by: zhouliang3 <zhouliang3@xiaomi.com>
Change-Id: I3c53bf25541c1811a05d025b39dfe24cb0613b72
(cherry picked from commit 07b2bd769e608d4c46f8e039d091514b1b3d3ff0)
2021-07-12 20:33:21 -07:00
Peter Bee
695935217b libc/sysconf: Add MONOTONIC_CLOCK for consistency
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>
2021-07-12 16:07:25 -03:00
zhanghu
36db69af96 nuttx net warning:cancel the conflict between weak and inline in unwind_arch_adjustment 2021-07-12 11:27:50 -03:00
zhanghu
7b0347c66c nuttx net warning:add initialization of pointer *aiocbp in lio_listio
Change-Id: I0ac7571ca27191b69acdc31f5bc07943c4d87e58
2021-07-12 11:27:50 -03:00
SPRESENSE
2e80d5e38e libs/libc/math: Fix calculation error of log function
Fix a problem where the log function would loop infinitely by
calculation error when a specific value was passed. For example,
in the following case, the log function loops infinitely and
never returns. So, this commit fixes to return the right value.

  double a = 7883961.5;
  double b = log(a);
2021-07-10 12:28:34 -07:00
SPRESENSE
012158cce8 libc/math: Add fmax and fmin functions
Add fmax and fmin functions.
- fmax, fmaxf, fmaxl
- fmin, fminf, fminl
2021-07-10 11:00:07 -03:00
Xiang Xiao
2fa1e55628 libc: Implement ttyname and ttyname_r
Note: this patch can get file path from root pseudo file handle,
but a general infrastructure is setup for other file system too.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I86cd79ebb741f2f43fdd398bb7498c40687d949b
2021-07-09 18:23:34 -03:00
Xiang Xiao
76cd9c89bb libc: Implement futimes on top of futimens
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ie54de66ca1bc26a68f2922861e1edd1fdabb8f33
2021-07-09 15:51:28 -03:00
Xiang Xiao
800acff10e libc: Implement utime on top of utimes
https://man7.org/linux/man-pages/man2/utime.2.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ia10574fdd0d07eabbc93aceeea5a0b953e30339a
2021-07-09 15:51:28 -03:00
Xiang Xiao
bae265274a libc: Move the declaration of futimens from sys/time.h to sys/stat.h
to follow the spec here:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/futimens.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Id8e418794bd43827c01af772ce704a8d3e7681c5
2021-07-09 15:51:28 -03:00
chao.an
940a07e1e5 net/socketpair: move socketpair implement into socket internal
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-07-08 03:05:43 -05:00
Nathan Hartman
ce20211357 Fix various typos in comments and documentation
Fix typos in these files:
    * Documentation/components/drivers/character/foc.rst
    * Documentation/guides/cpp_cmake.rst
    * Kconfig
    * arch/arm/src/imxrt/imxrt_lpspi.c
    * arch/arm/src/kinetis/kinetis_spi.c
    * arch/arm/src/kl/kl_spi.c
    * arch/arm/src/lpc31xx/lpc31_spi.c
    * arch/arm/src/nrf52/nrf52_radio.h
    * arch/arm/src/s32k1xx/s32k1xx_lpspi.c
    * arch/arm/src/stm32/Kconfig
    * arch/arm/src/stm32/stm32_adc.c
    * arch/arm/src/stm32/stm32_foc.c
    * arch/arm/src/stm32/stm32_foc.h
    * arch/arm/src/stm32/stm32_pwm.c
    * arch/arm/src/stm32/stm32_spi.c
    * arch/arm/src/stm32f0l0g0/stm32_spi.c
    * arch/arm/src/stm32f7/Kconfig
    * arch/arm/src/stm32f7/stm32_spi.c
    * arch/arm/src/stm32h7/Kconfig
    * arch/arm/src/stm32h7/stm32_allocateheap.c
    * arch/arm/src/stm32h7/stm32_fmc.c
    * arch/arm/src/stm32h7/stm32_fmc.h
    * arch/arm/src/stm32h7/stm32_pwm.c
    * arch/arm/src/stm32h7/stm32_qspi.c
    * arch/arm/src/stm32h7/stm32_spi.c
    * arch/arm/src/stm32l4/stm32l4_pwm.c
    * arch/arm/src/stm32l4/stm32l4_spi.c
    * arch/arm/src/stm32l5/Kconfig
    * arch/arm/src/stm32l5/stm32l5_spi.c
    * arch/renesas/src/rx65n/rx65n_dtc.c
    * arch/renesas/src/rx65n/rx65n_usbdev.c
    * arch/risc-v/src/rv32m1/rv32m1_serial.c
    * boards/arm/stm32/b-g431b-esc1/src/stm32_foc.c
    * boards/arm/stm32/nucleo-f103rb/src/stm32_foc_ihm07m1.c
    * boards/arm/stm32/nucleo-f302r8/src/stm32_foc_ihm07m1.c
    * boards/arm/stm32h7/nucleo-h743zi2/README.txt
    * boards/risc-v/rv32m1/rv32m1-vega/README.txt
    * boards/sim/sim/sim/scripts/Make.defs
    * drivers/1wire/1wire.c
    * drivers/1wire/1wire_internal.h
    * drivers/lcd/Kconfig
    * drivers/syslog/ramlog.c
    * fs/fat/Kconfig
    * libs/libc/debug/Kconfig
    * libs/libc/machine/Kconfig
    * libs/libc/stdio/lib_libvsprintf.c
    * libs/libc/stdlib/lib_div.c
    * libs/libc/stdlib/lib_ldiv.c
    * libs/libc/stdlib/lib_lldiv.c
    * libs/libdsp/lib_observer.c
2021-07-04 11:23:26 -05:00
Huang Qi
50c08bf45b libc: Move pthread_key_destructor to task_info_s
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2021-07-04 07:36:44 -05:00
SPRESENSE
f75437d3f3 libs: libnx: nxfonts: Fix prefix of generated fonts data
This commit fixes a compile error caused by the following commit.
fe9ccff libs: libnx: nxfonts: fix Mixed case identifier
Change the prefix of generated font data to lower case.
2021-07-03 23:14:19 -05:00
Xiang Xiao
e2d827cb6d libc/time: Initialize tm_zone field correctly
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ief32aedc72ec062d428f8538a25ddfe4f81d7e29
2021-07-02 09:27:23 -07:00
Xiang Xiao
d72655e74c libc/time: Fix nxstyle issue in lib_localtime.c
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I2e98d92e62b47ade375bda3f043175841d9fa1b7
2021-07-02 09:27:23 -07:00
Xiang Xiao
3e4511978a libc/time: Rename lclptr/gmtptr to g_lcl_ptr/g_gmt_ptr
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I380f28c15ffe3d98734016bfedb1618b20a5f400
2021-07-02 09:27:23 -07:00
Xiang Xiao
dcad420127 libc/time: Update g_lcl_tzname only after the success
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I0117c5b43bee3affb36d118e0b97f6dd7137080b
2021-07-02 09:27:23 -07:00
Xiang Xiao
26908f472e libc/time: Avoid modify the global variables concurrently in tzset
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I7fb6439c3a669ef07c1756ccc294cd487805a510
2021-07-02 09:27:23 -07:00
Xiang Xiao
4ecabe5fc2 libc/time: Change the type of ls_corr to int_fast32_t
since the leap correction is always four bytes in timezone file

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I2d72f5eaf37f0c86d95eaf7504a1b8b1469bf06a
2021-07-02 09:27:23 -07:00
Xiang Xiao
41409eb0bc libc/time: Update TZDEFRULESTRING to ",M3.2.0,M11.1.0"
which is the current DST plan used by US

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I50001e69ec1cb9cbf6a0b84fc87f4ad8ff41c0f0
2021-07-02 09:27:23 -07:00
Xiang Xiao
aa202adaaa libc/time: Update timezone by tzset in localtime_r
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I54d6aed8f6bc35c1a1d8156702ff71471c3f8066
2021-07-02 09:27:23 -07:00
Xiang Xiao
d2c33fc180 libc/zoneinfo: Correct the path in comment
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I4bc0490d12f8b469a1f250cd410290a51ef9640f
2021-07-02 09:27:23 -07:00
Huang Qi
65fa11634b sched: Refine tls_info_s and task_info_s
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2021-07-02 10:33:34 -05:00
ligd
179f5999d9 libs/libc/spawn: fix posix_spawn_file_actions_adddup2 alloc size error
Change-Id: I9f6f2c87b0d54c1c1a71056073a1d358b87dd1fd
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-01 12:14:50 -07:00
Xiang Xiao
187538c0b9 Move aligned_alloc, posix_memalign and valloc from mm/umm to libs/libc/stdlib
since the similar functions(e.g. strdup/strndup) put into libs/libc/string

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ifb2c0c51298b09014748e5ee8275db51213d6911
2021-07-01 11:44:38 -07:00
Xiang Xiao
1d0ade6fa2 libc: Remove the duplication lib_xxx macro
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I73c876ed40811c013dad83b8b2aeb7bdc3041913
2021-07-01 11:28:34 -07:00
McKay Ransom
863834057b Renesas/RX: add RX setjmp, ARCH_RENESAS_RX, and RX65N ioctl 2021-06-30 23:01:57 -05:00
Xiang Xiao
4ba1bafe55 libc/debug: Rename CONFIG_EABI_UNWINDER to CONFIG_UNWINDER
since the unwinder not only work with arm but also other arch(e.g. riscv)

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I56cc54f2c99560c858362ab2dfba524097385716
2021-06-30 05:08:57 -07:00
Xiang Xiao
20f5a28e49 net: Add if_nameindex and if_freenameindex API
Specified here:
https://man7.org/linux/man-pages/man3/if_nameindex.3.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ia5daed775bd11fa5978d54860632554da8f7b416
2021-06-26 22:37:12 +01:00
Xiang Xiao
6d8d5af345 libc/dirname: Handle the consecutive '/' correctly
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I8387aca067e91724fb4656cd7af59bbd626ceffa
2021-06-24 13:21:00 +01:00
Xiang Xiao
5a6e08e281 lic/libgen: Remove g_retchar from basename/dirname
to avoid the race condtion

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: If55fba8eca7b98d6a8f0fb44393cf4858b9e9ae4
2021-06-24 13:21:00 +01:00
Xiang Xiao
9cc41f44f0 libc/sched: Implement nice API
Specified here:
https://pubs.opengroup.org/onlinepubs/007904875/functions/nice.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ib25be28c8dc1c9288e8c78ad756c91ec6ef325a7
2021-06-24 08:50:48 -03:00
Xiang Xiao
3d0320f891 libc/sched: Map the nice value more correctly
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
2021-06-24 08:50:48 -03:00
Huang Qi
fe992a5b6c libc: Implement fesetround & fegetround for arm
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2021-06-24 08:47:34 -03:00
Xiang Xiao
b1cd825cac libc/time: Implement timegm function
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Id988ae077cf54597b2522546c4309b66416b8b0e
2021-06-23 13:43:32 -03:00
Abdelatif Guettouche
af5e0c620f Rename MODULE_TEXT to TEXT_HEAP as the latter is more generic.
Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
2021-06-18 07:14:17 -05:00
YAMAMOTO Takashi
4666b39f9c dns_recv_response: Fix IPv6 address in an ninfo() 2021-06-17 02:52:04 -05:00
chao.an
f3a5aee7d7 libs/libc/netdb: add dns clear interface
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-06-11 04:54:30 -05:00
Virus.V
317bd40fec net/dns:fix unaligned access in dns query 2021-06-10 02:03:31 -05:00
YAMAMOTO Takashi
b3e8535ad6 Revert "tls: Move pthread key destructor to libc"
This reverts commit cc514d7791.

* It introduced a regression.
  https://github.com/apache/incubator-nuttx/issues/3868

* It seems conceptually wrong to have per-process data in
  the main thread's stack.
2021-06-09 07:59:44 -05:00
YAMAMOTO Takashi
8079d9fac3 Revert "TLS: Correct handling of returned error values."
This reverts commit 9aaeaefa41.
2021-06-09 07:59:44 -05:00
Gregory Nutt
9aaeaefa41 TLS: Correct handling of returned error values.
I not two problems in handling of the return error values in PR #3858:

1. In KERNEL mode, the error return value of _SEM_WAIT() will be a negated errno value; in all other modes, it will be -1 (ERROR) with the errno variable set.  This must be handled in the test of the returned value:  Don't compare with -1; rather check if < 0
2. Also, conversion of the returned value to a negated errno value must be handled differently.  This is handled by replacing -get_errno() with the macro _ERRVAL(ret)

This effects only error handling (it fixes it) and no other impacts are expected.
2021-06-07 22:32:42 -03:00
Huang Qi
cc514d7791 tls: Move pthread key destructor to libc
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2021-06-06 15:25:56 -06:00
Xiang Xiao
2e54df0f35 Don't include assert.h from public header file
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-03 08:36:03 -07:00
YAMAMOTO Takashi
d6ed7464b3 Kconfig: Make NETDB_DNSCLIENT select NET_SOCKOPTS
Because it uses SO_RCVTIMEO.
2021-06-03 10:05:33 -05:00
tobias2johansson
ac32d1a68e libs/libc/audio/libsrc: update header location
update Make.defs with the correct path to the library header and
make sure it can be found
2021-06-02 02:27:36 -05:00
Xiang Xiao
ae216cf9e9 sched/task: Simplify the syscall handling of task_spawn
It's better to save one argument by returning pid directly.
This change also follow the convention of task_create.
BTW, it is reasonable to adjust the function prototype a
little bit from both implementation and consistency since
task_spawn is NuttX specific API.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-01 12:45:10 +09:00
Gregory Nutt
b991f30b82 syscall/syscall.csv: Correct ordering of entries
OS functions in syscall.csv are ordered alphabetically.  However, two recently added functions are not in the correct location.  This PR simply corrects that ordering.

The ordering of one entry was also corrected in libs/libc/libc.csv.  Same issue.

This change is only cosmetic.

Verified only by CI
2021-05-31 21:15:36 -05:00
Xiang Xiao
d7f96003cf Don't include debug.h from public header file
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-01 06:42:02 +09:00
Alin Jerpelea
aa4e80cf69 libs: libxx: update licenses to Apache
Gregory Nutt is the copyright holder for those files and he has submitted the
SGA as a result we can migrate the licenses to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-05-27 08:07:25 +09:00
Alin Jerpelea
c6252c9e32 libs: libc: update licenses to Apache
Gregory Nutt is the copyright holder for those files and he has submitted the
SGA as a result we can migrate the licenses to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-05-27 08:07:25 +09:00
YAMAMOTO Takashi
0a604d7edd libs/libc/libc.h: Fix a comment typo 2021-05-24 21:54:54 -05:00
Xiang Xiao
001e7c3e76 sched: Don't include nuttx/sched.h inside sched.h
But let nuttx/sched.h include sched.h instead to
avoid expose nuttx kernel API to userspace.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-05-24 12:11:53 +09:00
Huang Qi
d374d55926 pthread: Implement destructor of pthread_key_create
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
Change-Id: I6aafba9680257cba071bf1f72ae2ec2c475f5fb0
2021-05-21 22:46:52 -06:00
Huang Qi
f4a0b7aedd libc: Call pthread_exit in user-space by up_pthread_exit
Drop to user-space in kernel/protected build with up_pthread_exit,
now all pthread_cleanup functions executed in user mode.

* A new syscall SYS_pthread_exit added
* A new tcb flag TCB_FLAG_CANCEL_DOING added
* up_pthread_exit implemented for riscv/arm arch

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2021-05-21 22:46:52 -06:00
Huang Qi
81a01d089b libc/pthread: Fix comment and document issue
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2021-05-21 22:46:52 -06:00
Huang Qi
f1a92e9cbb libc: Move pthread_cleanup to user space
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2021-05-21 22:46:52 -06:00
Huang Qi
54eef9f639 libc: Move pthread_exit to userspace
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2021-05-21 22:46:52 -06:00
Gregory Nutt
bb9b58bdde libc: Move pthread_create to user space
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
Change-Id: I5c447d94077debc79158686935f288e4c8e51e01
2021-05-21 22:46:52 -06:00
Xiang Xiao
a81166aef6 Update libcxx to 12.0.0 release
and remove the temporary patch since all patch is in the mainline now

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-05-16 01:18:41 -07:00
Xiang Xiao
82fb188d02 sched/spawn: Support the stack address argument
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-05-13 13:23:24 -07:00
Xiang Xiao
e1ff0c4f08 libc: Implement openpty function
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I36e02af0145cd6e740766e7484cc9d5ce410e5e4
2021-05-12 21:08:23 -07:00
Xiang Xiao
60c1b64747 libc/getopt: Remove GETOPT_INIITIALIZER macro
since nobody reference it

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-05-11 16:40:44 +01:00
Nathan Hartman
8af9d39667 Documentation, comments: Minor improvements and typos fixed 2021-05-09 19:12:13 -07:00
Xiang Xiao
b8ed17b9da libc/termios: Implement TCSADRAIN and TCSAFLUSH for tcsetattr
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: If87a4931cd5a55e064f58c19a22c7ce13f538000
2021-05-07 16:35:41 -03:00
Xiang Xiao
bf733f7213 libc/pty: Make ptsname[_r] support PSEUDOTERM_BSD config too
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I82a60ded48ea3437bd5f2b4fe328294d7077b040
2021-05-07 16:35:20 -03:00
Jukka Laitinen
9b8399effe lib_modfl: Use fabsl instead of fabs for long double arguments
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-05-05 06:05:58 -07:00
Byron Ellacott
9d4742af00 Add experimental support for an eZ80 toolchain using llvm and GNU binutils.
An additional fix for the RTC driver to lock the RTC after setting values instead of unlocking it is included.
2021-04-27 21:18:48 -03:00
YAMAMOTO Takashi
418e11b8b3 modlib: Always use separate allocation for text and data
Pros:

* Reduce code differences
* Smaller allocations for !CONFIG_ARCH_USE_MODULE_TEXT

Cons:

* Likely to use more memory for !CONFIG_ARCH_USE_MODULE_TEXT in total

Tested with:

* sim:module on macOS
* esp32-devkit:nsh + CONFIG_MODULE on qemu
* lm3s6965-ek:qemu-protected + CONFIG_EXAMPLES_SOTEST on qemu
2021-04-19 22:20:20 -05:00
chao.an
b2016e85f5 libc/execinfo/dumpstack: correct the line size to avoid LF overwrite
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-04-19 04:45:04 -07:00
chao.an
137eb594cb libc/execinfo: add dump_stack support
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-04-19 04:45:04 -07:00
chao.an
27dd771336 libc/execinfo: add backtrace support based on EABI Unwinder
1. Flags < -funwind-tables > is required
2. Keep the section ".exidx" in linker script

Signed-off-by: chao.an <anchao@xiaomi.com>
2021-04-19 04:45:04 -07:00
Xiang Xiao
2335b69120 arch: Allocate the space from the beginning in up_stack_frame
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>
2021-04-16 12:41:41 +09:00
YAMAMOTO Takashi
51490bad55 modlib: Implement sh_addralign handling
I've seen a module with 16 bytes .rodata alignment for xmm operations.
It was getting SEGV on sim/Linux because of the alignment issue.
The same module binary seems working fine after applying this patch.

Also, tested on sim/macOS and esp32 on qemu,
using a module with an artificially large alignment. (64 bytes)
2021-04-14 21:17:07 -05:00
Xiang Xiao
3f9908f7d1 Remove the unnecessary math.h inclusion
or move from header file to source file since math.h doesn't always exist

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-04-12 22:58:23 -04:00
Gregory Nutt
2882551299 Correct a comment
Fix comment in libs/libc/tls/tls_getinfo.c:  The TLS data must lie at the beginning of the allocated stack memory for both push-up and push-down stacks.
2021-04-11 12:32:41 -05:00
Abdelatif Guettouche
3ac2bde85b pthread_mutexattr_setprotocol.c: Return EINVAL instead of ENOSYS.
Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
2021-04-10 22:55:03 -05:00
Alin Jerpelea
231b8518b7 NuttX: Ken Pettit: update licenses to Apache
Ken Pettit has submitted the ICLA and we can migrate the licenses
 to Apache.

Sebastien Lorquet has submitted the ICLA and we can migrate the licenses
 to Apache.

Gregory Nutt has submitted the SGA and we can migrate the licenses
 to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-04-10 06:42:19 -05:00
Alexander Vasiljev
74230c5371 lib_fgets: don't check for printability, as it doesn't allow to work with extended ASCII 2021-04-07 08:29:46 -03:00
liuhaitao
bcaf5d75e5 libc: update stream getoffset to handle write case
Change-Id: I80b01b446446d5a631d40822f220a0177a95e7e6
Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
2021-04-07 00:59:36 -05:00
liuhaitao
a21d6b884e libc: correct zoneinfo genromfs source directory
Or genromfs failed to generate the right romfs.img

Change-Id: Icbcc2e89da1ede644b994d33e70f1a48662c412b
Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
2021-04-06 08:12:00 -03:00
Xiang Xiao
39fc9325cf arch/arm: Replace "b lr" or "mov pc, lr" with "bx lr"
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-04-05 05:50:14 -07:00
Xiang Xiao
dd1d980c3a arch/sim: Move setjmp/longjmp to libc/machine/sim
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-04-05 09:00:42 -03:00
Alin Jerpelea
7c8c6785ca NuttX: NX Engineering, S.A: update licenses to Apache
NX Engineering, S.A has submitted the SGA and we can migrate the licenses
 to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-04-05 06:07:48 -05:00
Xiang Xiao
d62ae03bf8 arch: Move setjmp/longjmp to libc/machine
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-04-04 16:30:37 -07:00
Gregory Nutt
a0f9da20a2 getopt(): Update comments about missing functionality
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.
2021-04-04 22:31:47 +01:00
Gregory Nutt
7de43596da getopt_long(): Add support for required argument format
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.
2021-04-04 14:13:42 -05:00
Gregory Nutt
1b4af6e90d getopt_commont(): Add some comments
Add a trivial comment about handling in certain corner cases where I am not certain what the correct behavior should be.
2021-04-04 10:55:00 -05:00
Gregory Nutt
7e1ae24c3c getopt_common(): Correct handling of unsupported long options.
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.
2021-04-04 07:15:10 -05:00
Gregory Nutt
6c507730bd Fix Use of Variable before NULL check
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.
2021-04-03 18:23:35 +01:00
Alin Jerpelea
26fef3f6a1 NuttX: Fix nxtyle errors
Fix errors reported by nxstyle

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-04-03 04:20:31 -07:00
Alin Jerpelea
08e5378b11 NuttX: Gregory Nutt: update licenses to Apache
Several licenses were missed in the initial work

David Sidrane has submitted the ICLA and we can migrate the licenses
 to Apache.

Gregory Nutt has submitted the SGA and we can migrate the licenses
 to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-04-03 04:20:31 -07:00
Gregory Nutt
af3c76bb53 Correct some getopt() logic
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.
2021-04-02 21:31:02 +01:00
Alin Jerpelea
b7c451c5a4 libs: Gregory Nutt: update licenses to Apache
Gregory Nutt has submitted the SGA and we can migrate the licenses
 to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-04-02 11:12:25 -05:00
Alin Jerpelea
d3313eeae9 libs: libc: lib_vikmemcpy.c: Mixed case identifier fix
fix Mixed case identifier reported by nxstyle

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-04-02 11:12:25 -05:00
Alin Jerpelea
ed8e5e971b libs: fix nxstyle errors
fix erros reported by nxstyle

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-04-02 11:12:25 -05:00
wangshuo
84d4458a8a libc/uio: fix typos 2021-04-02 08:49:53 -05:00
Gregory Nutt
a930b05d22 Implement getopt_long() and getopt_long_only()
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
2021-04-01 23:06:23 -05:00
Nathan Hartman
c869bc5348 docs and comments: Update stale references to COPYING
Since 7a046358d9 the top-level COPYING
file has been deleted and replaced by DISCLAIMER, LICENSE, and NOTICE
files. However, some references to the old COPYING file remained in
Kconfig help text and documentation.

Documentation/contributing/coding_style.rst:
Documentation/introduction/about.rst:
boards/arm/lpc17xx_40xx/olimex-lpc1766stk/README.txt:
boards/arm/sam34/arduino-due/README.txt:
boards/arm/sam34/sam4l-xplained/README.txt:
boards/arm/sama5/giant-board/README.md:
boards/arm/sama5/sama5d2-xult/README.txt:
boards/arm/sama5/sama5d4-ek/README.txt:
boards/arm/samd2l2/samd20-xplained/README.txt:
boards/arm/samd2l2/samd21-xplained/README.txt:
boards/arm/samd2l2/saml21-xplained/README.txt:
boards/arm/stm32/hymini-stm32v/README.txt:
boards/arm/stm32/stm3210e-eval/README.txt:
fs/fat/Kconfig:
libs/libc/string/Kconfig:

    * Updates stale references to the old top-level COPYING file to
      either LICENSE or NOTICE (or both), as appropriate in each
      instance.
2021-04-01 21:10:56 -05:00
raiden00pl
55517a51e0 libdsp/fixed16: add openloop handler 2021-04-01 14:54:33 -03:00
Alin Jerpelea
e8f3c9441e libs: Mark Schulte: update licenses to Apache
Mark Schulte has submitted the ICLA and we can migrate the licenses
 to Apache.

Gregory Nutt has submitted the SGA and we can migrate the licenses
 to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-04-01 12:13:12 -05:00
Alin Jerpelea
0f41c3c555 NuttX: Pierre-Noel Bouteville: update licenses to Apache
Pierre-Noel Bouteville has submitted the ICLA and we can migrate the licenses
 to Apache.

David Sidrane has submitted the ICLA and we can migrate the licenses
 to Apache.

Gregory Nutt has submitted the SGA and we can migrate the licenses
 to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-04-01 12:13:12 -05:00
Alin Jerpelea
b4a33b5ec0 NuttX: Uros Platise: update licenses to Apache
Uros Platise has submitted the ICLA and we can migrate the licenses
 to Apache.

David Sidrane has submitted the ICLA and we can migrate the licenses
 to Apache.

Bob Feretich has submitted the ICLA and we can migrate the licenses
 to Apache.

Gregory Nutt has submitted the SGA and we can migrate the licenses
 to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-04-01 12:13:12 -05:00
Alin Jerpelea
ce66f7b081 NuttX: Johannes Schock: update licenses to Apache
Johannes Schock has submitted the ICLA and we can migrate the licenses
 to Apache.

Gregory Nutt has submitted the SGA and we can migrate the licenses
 to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-04-01 12:13:12 -05:00
Alan C. Assis
72bc595afb pthread: Fix pthread_rwlock_init return error
The return should be positive like in other parts of pthread code
2021-04-01 03:26:02 -05:00
raiden00pl
61389ad616 libdsp: update some comments 2021-04-01 01:24:12 -05:00
raiden00pl
f05edf1a5b libdsp: fix nxstyle errors 2021-04-01 01:24:12 -05:00
raiden00pl
255ffcf852 libdsp: add support for fixed16 libdsp 2021-04-01 01:24:12 -05:00
raiden00pl
f248207717 libdsp/Kconfig: move configuration to menuconfig, add option to include vabc in FOC data 2021-04-01 01:24:12 -05:00
raiden00pl
a2afb2daa9 libdsp: add Permanent Magnet Synchronous Motor (PMSM) model 2021-04-01 01:24:12 -05:00
raiden00pl
eeab79bd52 libdsp/lib_motor.c: remove reference to some unused data 2021-04-01 01:24:12 -05:00
raiden00pl
eadc7ebb1a libdsp/lib_observer.c: optimize and add some comments 2021-04-01 01:24:12 -05:00
raiden00pl
ee97eab4e7 libdsp/lib_foc.c: use better PI wind-up protection; add interface to run voltage controller without current controller; add separate interfaces to update base voltage and phase angle 2021-04-01 01:24:12 -05:00
raiden00pl
b34dd2d96a libdsp/lib_pid.c: add anti-windup protection with decay coefficient and add interface to select anti-windup mechanism 2021-04-01 01:24:12 -05:00
raiden00pl
15b0ae716c libs/libdsp/lib_motor.c: refactor 2021-04-01 01:24:12 -05:00
raiden00pl
c43ec4283f libdsp/lib_motor.c: remove maximum openloop speed limiter 2021-04-01 01:24:12 -05:00
raiden00pl
eea371093c libdsp/lib_svm.c: return not saturated output from modulator, the current corection now takes float as an arguments 2021-04-01 01:24:12 -05:00
raiden00pl
e0bab18b07 libs/libdsp/lib_transform.c: update descriptions 2021-04-01 01:24:12 -05:00
raiden00pl
5034e4d8ba libdsp: introduce libdsp-specific debug assertion (LIBDSP_DEBUGASSERT) 2021-04-01 01:24:12 -05:00
raiden00pl
66972d947e libdsp: add _f32_ suffix to all libdsp data structures tht use float as a numerical type.
This is an initial step to support fixed16 calculations for libdsp
2021-04-01 01:24:12 -05:00
Gregory Nutt
2ccc0da0c7 Move getopt() variables into TLS
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
2021-03-31 21:13:01 -05:00
Gustavo Henrique Nihei
0109bcad8c libs/libc: Update pthread_once according to the specification
OpenGroup specification was updated regarding the return value for
pthread_once, which after Issue 7 states that "the [EINVAL] error for an
uninitialized pthread_once_t object is removed; this condition results
in undefined behavior".
2021-03-31 21:11:22 -05:00
Alin Jerpelea
e699b6f85f misc: : Author Gregory Nutt: update licenses to Apache
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>
2021-03-28 13:34:50 -07:00
Alin Jerpelea
e8606942eb libs: libc: nxstyle fixes
nxstyle fixes to pass CI

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-03-22 19:28:38 -07:00
Alin Jerpelea
3d6185709f libs: Author David Sidrane: update licenses to Apache
David Sidrane has submitted the ICL and we can migrate the licenses
 to Apache.

Gregory Nutt has submitted the SGA and we can migrate the licenses
 to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-03-22 19:28:38 -07:00
Alin Jerpelea
8dd660ecd4 nuttx: Author David S. Alessio: update licenses to Apache
David S. Alessio has submitted the ICL and we can migrate the licenses
 to Apache.

Gregory Nutt has submitted the SGA and we can migrate the licenses
 to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-03-22 19:28:38 -07:00
chao.an
6a6ad96066 libs/libc/time/localtime: fix race condition
fix race condition on create the instance of lcl/gmt

Signed-off-by: chao.an <anchao@xiaomi.com>
2021-03-22 01:31:10 -07:00