Nathan Hartman
409e2f3701
drivers/serial, libc/termios: Implement tcsendbreak
...
The TERMIOS(3) function tcsendbreak() and the IOCTLs TCSBRK and TCSBRKP
transmit a serial line Break.
Previously NuttX included an extern declaration for tcsendbreak() and
defines for TCSBRK and TCSBRKP but none of these were implemented.
Attempting to build programs that called tcsendbreak() would fail with
a linker error; attempting to use TCSBRK and TCSBRKP would result in an
error at runtime.
This changeset adds the tcsendbreak() function and handling for TCSBRK
and TCSBRKP; tcsendbreak() is implemented in terms of TCSBRK. Both
TCSBRK and TCSBRKP are implemented in terms of the BSD-compatible Break
IOCTLs TIOCSBRK and TIOCCBRK, which must be provided by the lower half
serial driver. Currently, not all lower half serial drivers in NuttX
support these IOCTLs. Those that do implement them may need one or more
Kconfig options to be set, such as `CONFIG_*_U[S]ART_BREAKS` and, on
some architectures, a separate `CONFIG_*_SERIALBRK_BSDCOMPAT`.
* drivers/serial/serial.c
(uart_tcsendbreak): New function.
(uart_ioctl): Implement TCSBRK and TCSBRKP.
* libs/libc/termios/lib_tcsendbreak.c
(): New file.
* libs/libc/termios/Make.defs
(CSRCS): Add lib_tcsendbreak.c to the build.
Thanks to Xiang Xiao for PR feedback.
Co-authored-by: Xiang Xiao <xiaoxiang781216@gmail.com>
2023-02-15 07:50:02 +08:00
Xiang Xiao
dc2e9b8771
libc: Move memfd related stuff to sys/mman.h
...
follow the freebsd definition:
https://github.com/freebsd/freebsd-src/blob/master/sys/sys/mman.h#L207-L228
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-02-13 16:00:37 +01:00
Huang Qi
a66f0a6369
stdlib: Guard fflush in exit with CONFIG_FILE_STREAM
...
If CONFIG_FILE_STREAM disabled, fflush is a undefined function.
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-02-12 00:09:29 +08:00
lilei19
23344846f6
fix some bug of strtold
...
with the test of sim:lua ,I have fixed some bug of error output
1.input: " " and error output string is "NULL"
2.input: "1.2e+", error output string is "NULL"
3.input: "." error output string is "NULL"
2023-02-10 22:45:24 +08:00
chao an
634baa5a2f
libs: workaround for Visual Studio(MSVC) Compiler Error C2124
...
D:\archer\code\nuttx\libs\libc\stdlib\lib_strtod.c: error C2124: divide or mod by zero
Windows MSVC restrictions, MSVC doesn't allow division through a
zero literal, but allows it through const variable set to zero
Reference:
https://docs.microsoft.com/en-us/cpp/error-messages/compiler-errors-1/compiler-error-c2124?view=msvc-170
Signed-off-by: chao an <anchao@xiaomi.com>
2023-02-09 20:11:55 +08:00
chao an
8761cc9bfc
libs: fix visual studio Compiler Error C2036
...
D:\code\nuttx\libs\libc\net\lib_inetpton.c(300,52): error C2036: "void *" : unknown size
Reference:
https://learn.microsoft.com/en-us/cpp/error-messages/compiler-errors-1/compiler-error-c2036?view=msvc-170
Signed-off-by: chao an <anchao@xiaomi.com>
2023-02-09 20:11:55 +08:00
chao an
e942a7c55e
build/Kconfig: fix warnings detected by kconfiglib
...
Signed-off-by: chao an <anchao@xiaomi.com>
2023-02-09 20:07:46 +08:00
chao an
3a0fdb019d
nuttx: replace all ARRAY_SIZE()/ARRAYSIZE() to nitems()
...
Signed-off-by: chao an <anchao@xiaomi.com>
2023-02-09 20:05:44 +08:00
dongjiuzhu1
14f8a6c2dd
fs: support openat/fchmodat/mkfifoat/fstatat/...at api
...
Refs to:
https://linux.die.net/man/2/openat
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-02-07 03:45:38 +08:00
lilei19
de21025702
fix a bug of strtold
...
if input is -1e308,The output should be -100000000......
but the output is -inf
2023-02-06 20:26:45 +08:00
chao an
02a9e76f73
misc/mutex: fix assertion if nxmutex_reset() before nxmutex_unlock()
...
sim/rpserver
NuttShell (NSH) NuttX-12.0.0
server> cu
_assert: Current Version: NuttX server 12.0.0 3ead669e7a-dirty Feb 2 2023 23:53:48 sim
_assert: Assertion failed : at file: libs/libc/misc/lib_mutex.c:303 task: cu 0x5662fff4
Signed-off-by: chao an <anchao@xiaomi.com>
2023-02-04 02:13:15 +08:00
chao an
7625126c91
Remove the remain MIN/MAX like macro
...
Signed-off-by: chao an <anchao@xiaomi.com>
2023-02-03 23:22:41 +08:00
yinshengkai
35ae47788b
libc: Keep printf("%pS", p) behavior consistent
...
When ALLSYMS is not turned on, %pS will be treated as %p
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-02-03 09:19:06 +02:00
chao an
4c8d244fae
sched/getpid: replace syscall getpid/tid/ppid() to kernel version
...
NuttX kernel should not use the syscall functions, especially after
enabling CONFIG_SCHED_INSTRUMENTATION_SYSCALL, all system functions
will be traced to backend, which will impact system performance.
Signed-off-by: chao an <anchao@xiaomi.com>
2023-02-02 10:33:01 +08:00
chao an
c9981036a5
nuttx/mutex: move mutex implement to libc
...
Signed-off-by: chao an <anchao@xiaomi.com>
2023-02-02 10:33:01 +08:00
Gustavo Henrique Nihei
e6b204f438
nuttx: Use MIN/MAX definitions from "sys/param.h"
...
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2023-02-01 23:47:44 +08:00
Huang Qi
4caf24a00c
libc/stdio: Minor comments fix
...
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-02-01 21:47:30 +08:00
yinshengkai
ab2b09e557
Revert "Makefile: fix redundant delimiters when using make V=1"
...
This reverts commit 64d39a8b7b
.
2023-02-01 20:39:52 +08:00
Nathan Hartman
c65a632788
libc/termios: Fix comment in cfmakeraw docstring.
2023-02-01 09:47:55 +08:00
yinshengkai
64d39a8b7b
Makefile: fix redundant delimiters when using make V=1
...
rm-none-eabi-ar rcs libc.a bin//lib_assert.o bin//lib_builtin_getname.o
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-01-31 15:12:36 -03:00
Zhe Weng
8819eeaf15
net: Implement shutdown() interface and tcp shutdown
...
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-01-31 11:15:01 +08:00
lilei19
1d8af7e105
add holder for mutex
...
Signed-off-by: lilei19 <lilei19@xiaomi.com>
2023-01-31 12:08:05 +09:00
Nathan Hartman
6b89b6f945
Remove executable permissions from source files
...
* arch/arm/src/sama5/sam_flexcom_spi.h,
arch/risc-v/src/mpfs/mpfs_ihc_sbi.c,
drivers/usbdev/adb.c,
libs/libc/math/lib_scalbn.c,
libs/libc/math/lib_scalbnf.c,
net/ipfrag/Make.defs,
net/ipfrag/ipfrag.c,
net/ipfrag/ipfrag.h,
net/ipfrag/ipv4_frag.c,
net/ipfrag/ipv6_frag.c: Remove executable permission.
2023-01-30 20:34:51 -03:00
wangxuedong
ba016eb5eb
libc/stdio: fix rounding errors for fractional values less than 1
...
Signed-off-by: wangxuedong <wangxuedong@xiaomi.com>
2023-01-30 23:39:56 +08:00
chao an
fa63da22ae
libs/netdb: add sanity check to avoid null pointer reference
...
Signed-off-by: chao an <anchao@xiaomi.com>
2023-01-30 23:37:29 +08:00
yinshengkai
2466c07aa3
libc/stream: fix syslogstream_addstring length error
...
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-01-30 14:27:04 +01:00
Xiang Xiao
631a8da1e2
sched: Map SCHED_OTHER to SCHED_FIFO or SCHED_RR
...
this behaviour is explicitly specified here:
https://pubs.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_08.html
and map SCHED_NORMAL to SCHED_OTHER like Linux:
https://man7.org/linux/man-pages/man7/sched.7.html
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-30 03:01:03 +02:00
zhanghongyu
4de0e626d0
Revert "netdb: fix access within misaligned address error"
...
This reverts commit 3f94828f6b
.
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-01-29 14:35:01 +08:00
liangchaozhong
d8777fa77d
invalid dns cache entry after ttl expires
...
Log ttl after receive dns query and invalid dns cache entry when ttl expires.
Signed-off-by: liangchaozhong <liangchaozhong@xiaomi.com>
2023-01-29 14:32:33 +08:00
anjiahao
fcdc7afcb5
libc:lib_psfa_dddup2,add return check
...
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-01-28 23:23:47 +02:00
ligd
367fa640c1
asctime_r: add param check to asctime_r()
2023-01-28 23:23:12 +02:00
Xiang Xiao
7d66a16c53
Minor style clean up
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-28 19:53:20 +02:00
anjiahao
287467b81b
netdb: Add return check in rexec_af
...
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-01-27 15:31:28 -03:00
Xiang Xiao
819fbd22cc
sched: Implement tkill/tgkill
...
https://linux.die.net/man/2/tgkill
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-26 08:11:56 +02:00
Petro Karashchenko
f952b8456c
assert: switch from ASSERT(0/false) to PANIC
...
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-01-26 10:15:34 +08:00
Xiang Xiao
c05cdd6598
libc: Move on_exit and __cxa_atexit in lib_atexit.c
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-25 14:31:37 +02:00
Xiang Xiao
5333c30d45
libc: abort should always call exit not pthread_exit
...
since pthread_exit just exit the calling thread not the whole process
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-25 14:31:37 +02:00
Xiang Xiao
bcd1ebf260
libc: Implement quick_exit and at_quick_exit
...
Defined by c11:
https://en.cppreference.com/w/c/program/quick_exit
https://en.cppreference.com/w/c/program/at_quick_exit
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-25 14:31:37 +02:00
Xiang Xiao
43e7b13697
assert: Log the assertion expression in case of fail
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-24 15:00:19 -03:00
Xiang Xiao
8bf693b362
libc/pthread: Implement pthread_condattr_[set|get]pshared
...
https://pubs.opengroup.org/onlinepubs/009696799/functions/pthread_condattr_getpshared.html
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-24 13:53:02 -03:00
Xiang Xiao
c11cd7f103
libc/pthread: Implement pthread_attr_[set|get]stackaddr
...
https://pubs.opengroup.org/onlinepubs/009696799/functions/pthread_attr_getstackaddr.html
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-24 13:53:02 -03:00
Xiang Xiao
36b74bab02
libc/pthread: Implement pthread_rwlockattr API
...
https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_rwlockattr_getpshared.html
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-24 13:53:02 -03:00
Xiang Xiao
82550887c2
c++: Change the default value of CXX_STANDARD from c++17 to gnu++17
...
since many 3rd party code use some gnu c++ extension
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-19 08:21:48 +01:00
Masayuki Ishikawa
dc454765fb
Revert "add holder for mutex"
...
This reverts commit fc176addeb
.
2023-01-19 06:04:48 +09:00
lilei19
fc176addeb
add holder for mutex
...
Signed-off-by: lilei19 <lilei19@xiaomi.com>
2023-01-18 17:40:58 +08:00
zhangyuan21
acd108a5ed
pthread: fixed pthread_cancel and pthread_exit crash in SMP mode
...
1. When pthread exit, set the default cancellability state to NONCANCELABLE state.
2. Make sure modify tcb->flags is atomic operations.
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-01-18 11:57:40 +08:00
Xiang Xiao
f64da13e9b
libxx: Add CXX_STANDARD to select -std=c++??
...
and default to "c++17"
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-16 15:41:57 +02:00
lilei19
04f15d9dc1
fix the bug of strtold
2023-01-15 19:57:56 +08:00
Xiang Xiao
ee9787a254
libc: Let _SC_PAGESIZE return 4096 when CONFIG_MM_PGSIZE isn't defined
...
since most application doesn't expect the page size equals one
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-15 08:39:19 +02:00
dongjiuzhu1
28027d0bee
libc/versionsort: support versionsort and strverscmp
...
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-01-15 11:24:40 +08:00