Commit Graph

761 Commits

Author SHA1 Message Date
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