Commit Graph

1615 Commits

Author SHA1 Message Date
dongjiuzhu1
7f99a15ccf libc/time: add g_lcl_lock to protect local context in localsub
0x0c1561f8 in localsub (tmp=0x3c887088, offset=0, timep=0x3c887078) at time/lib_localtime.c:1993
localtime_r (timep=0x3c887078, timep@entry=0x3c887088, tmp=0x3c887088, tmp@entry=0x3c887098) at time/lib_localtime.c:2819
0x0c1225c8 in nx_vsyslog (priority=7, fmt=0x2c6d9700 <error: Cannot access memory at address 0x2c6d9700>,
ap=0x3c887170, ap@entry=0x3c887178) at syslog/vsyslog.c:135
0x0c152068 in vsyslog (priority=priority@entry=7,
fmt=fmt@entry=0x2c6d9700 <error: Cannot access memory at address 0x2c6d9700>, ap=ap@entry=...) at syslog/lib_syslog.c:68
0x0c152098 in syslog (priority=priority@entry=7, fmt=0x2c6d9700 <error: Cannot access memory at address 0x2c6d9700>) at syslog/lib_syslog.c:100

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-16 10:35:17 +08:00
Masayuki Ishikawa
df298c186f Revert "build depend:Revert Make.dep intermediate ddc file"
This reverts commit ddc3119c4e.
2024-09-15 19:29:47 +08:00
xuxin19
a3e7fee595 cmake:add missing libc regex CMake support
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-09-15 10:29:21 +08:00
wangzhi16
129b738e6b [Bug-Fix] Resource leaks
In file "nuttx/libs/libc/modlib/modlib_bind.c", line656 not check return value of lib_malloc(), and line661 not free dyn.

Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2024-09-15 10:26:21 +08:00
wangjianyu3
ae6a7a4526 libs/libc/sscanf: Support pointer format
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-15 10:11:42 +08:00
wangjianyu3
9320638848 libc/stdlib: Refine octal check of lib_checkbase()
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-15 10:11:42 +08:00
wangjianyu3
02f1503f9f libc/stdlib: If there were no digits at all, strtoul() stores the original value of nptr in *endptr (and returns 0).
Reference: STRTOUL(3)

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-15 10:11:42 +08:00
wangjianyu3
9773fb9867 libc/stdlib: Check if there is next char before assuming octal
When *pptr/ptr is "0" and base is 0, lib_checkbase() returns the error base 8(should be 10).
e.g. `strtoul("0", &endptr, 0);`

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-15 10:11:42 +08:00
xuxin19
ddc3119c4e build depend:Revert Make.dep intermediate ddc file
Revert "Parallelize depend file generation"
This reverts commit d5b6ec450f.

parallel depend ddc does not significantly speed up compilation,
intermediately generated .ddc files can cause problems if compilation is interrupted unexpectedly

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-09-15 10:01:58 +08:00
ligd
ff1b54bff3 pthread_cleanup: move clenup down to tls
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-14 20:15:12 +08:00
hujun5
908df725ad arch: use up_current_regs/up_set_current_regs replace CURRENT_REGS
reason:
1 On different architectures, we can utilize more optimized strategies
  to implement up_current_regs/up_set_current_regs.
eg. use interrupt registersor percpu registers.

code size
before
    text    data     bss     dec     hex filename
 262848   49985   63893  376726   5bf96 nuttx

after
       text    data     bss     dec     hex filename
 262844   49985   63893  376722   5bf92 nuttx

size change -4

Configuring NuttX and compile:
$ ./tools/configure.sh -l qemu-armv8a:nsh_smp
$ make
Running with qemu
$ qemu-system-aarch64 -cpu cortex-a53 -smp 4 -nographic \
   -machine virt,virtualization=on,gic-version=3 \
   -net none -chardev stdio,id=con,mux=on -serial chardev:con \
   -mon chardev=con,mode=readline -kernel ./nuttx

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-13 23:18:58 +08:00
ouyangxiangzhen
28d943b226 sys/resource: Add RLIMIT_RTPRIO and RLIMIT_RTTIME definition
This commit add the definition of RLIMIT_RTPRIO and RLIMIT_RTTIME.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2024-09-13 16:08:25 +08:00
chao an
2b4ab6cd29 stream/syslograw: remove support for iob buffer in syslog
IOB buffer participates in the calculation of the congestion strategy
in the protocol stack, if the iob buffer is exhausted or there are
too many syslog printing tasks, the behavior of the protocol stack
and log printing will unable to determined, this PR will remove support
for iob buffer in syslog

Signed-off-by: chao an <anchao@lixiang.com>
2024-09-13 09:14:56 +08:00
buxiasen
fba0324bd7 libc/misc/crc32: crc32 add slow mode, optional decrease size
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-09-12 16:17:21 +02:00
ligd
f0d3c8ab2b usleep: use div_const to optimize the usleep
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-12 18:14:39 +08:00
ligd
6a2c03732f clock: Replace all ts and tick conversion functions
Using the ts/tick conversion functions provided in clock.h

Do this caused we want speed up the time calculation, so change:
clock_time2ticks, clock_ticks2time, clock_timespec_add,
clock_timespec_compare, clock_timespec_subtract... to MACRO

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-12 18:14:39 +08:00
ligd
f2a77bbcea clock: take clock_timespec_compare/add/subtract() as MACRO
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-12 18:14:39 +08:00
makejian
3240540952 pthread/realtime: export interfaces about pthread ceiling priority
pthread_mutex_setprioceiling and pthread_mutex_getprioceiling refers
https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_mutex_setprioceiling.html
Signed-off-by: makejian <makejian@xiaomi.com>
2024-09-10 01:26:31 +08:00
makejian
85f8677e21 nxmutex: export priority ceiling interfaces with nxsem
Signed-off-by: makejian <makejian@xiaomi.com>
2024-09-10 01:26:31 +08:00
makejian
ee78219f9c semaphore: export priority ceiling interfaces in semaphore
Signed-off-by: makejian <makejian@xiaomi.com>
2024-09-10 01:26:31 +08:00
zhanghongyu
7ba125f7cd netdb: Make NETDB_DNSSERVER_NAMESERVERS effective for NETDB_RESOLVCONF
prevent the server list in resolv.conf from increasing indefinitely
the one that is overwritten is always the one configured first.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-09-09 19:47:09 +08:00
hujun5
41e976d119 libs/libc/queue: inline queue list to improve performance
add a config CONFIG_LIBC_INLINE_QUEUE to inline the queue list

test:
We can use qemu for testing.
compiling
make distclean -j20; ./tools/configure.sh -l qemu-armv8a:nsh_smp ;make -j20
running
qemu-system-aarch64 -cpu cortex-a53 -smp 4 -nographic -machine virt,virtualization=on,gic-version=3 -net none -chardev stdio,id=con,mux=on -serial chardev:con -mon chardev=con,mode=readline -kernel ./nuttx

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-08 18:13:33 +08:00
hujun5
c45e4ac440 boardcrtl: change BOARDCTL_TESTSET to BOARDIOC_SPINLOCK
reason:
BOARDIOC_SPINLOCK can support the combined semantics
of disabling interrupts (irq), trylock, and spinlock.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-06 16:10:09 +08:00
chao an
85c39e96d6 global/variables: add g_ prefix to some global variables
Signed-off-by: chao an <anchao@lixiang.com>
2024-09-02 18:23:57 +08:00
SPRESENSE
d1c7e1816f libc/netdb: Separate IPv4 and IPv6 cache size limit
Some domains have a lot of IPv6 addresses. Because of that, it is
not possible to get the IPv4 address with getaddrinfo.

This change separate IPv4 and IPv6 cache size limit to enable to
get both IP addresses.
2024-09-02 06:16:50 -04:00
chenzhijia
1086a05e50 libc/sysconf: add _SC_GETPW_R_SIZE_MAX
pass tlpi example: https://man7.org/tlpi/code/online/dist/users_groups/t_getpwnam_r.c.html

Signed-off-by: chenzhijia <chenzhijia@xiaomi.com>
2024-08-29 09:05:45 +08:00
pangzhen1
c8e56ff63a CMake: fix CMake compile errors during the protected build mode
There are 2 CMake compile errors during the protected build mode. One is forget to add library for nuttx_user, another is the wrong macro used when compile wqueue.

Signed-off-by: pangzhen1 <pangzhen1@xiaomi.com>
2024-08-29 01:59:29 +08:00
yangguangcai
f44232b7a8 memset:optimizate speed.
Signed-off-by: yangguangcai <yangguangcai@xiaomi.com>
2024-08-27 00:21:27 +08:00
Petro Karashchenko
1528b8dcca nuttx: resolve various 'FAR' and 'CODE' issues
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2024-08-26 10:21:03 +08:00
meijian
a4b4fd16e9 netlib/route: add length for add/del route-func to reduce caller stack usage
Signed-off-by: meijian <meijian@xiaomi.com>
2024-08-26 01:54:10 +08:00
Petro Karashchenko
d499ac9d58 nuttx: fix multiple 'FAR', 'CODE' and style issues
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2024-08-25 19:22:15 +08:00
Petro Karashchenko
d252b6229f nuttx: use sizeof instead of define or number in snprintf
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2024-08-25 19:22:15 +08:00
guoshichao
cc79201c59 greenhills: fix the pointless compare warning
CC:  modlib/modlib_depend.c "modlib/modlib_bind.c", line 741: warning #186-D: pointless comparison of
          unsigned integer with zero
            if (rel->r_offset < 0)
                              ^

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-08-24 20:43:53 +08:00
guoshichao
04f5aaebfa greenhills: fix macro undefined warning
AS:  modlib/modlib_globals.S "modlib/modlib_globals.S", line 38: warning #193-D: zero used for undefined
          preprocessing identifier "__SIZEOF_POINTER__"
  #if __SIZEOF_POINTER__ == 8
      ^

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-08-24 20:43:53 +08:00
guoshichao
634159a5e6 greenhills: fix the no-lto link warning
ccarm: Warning: Unknown option "-fno-lto" passed to linker
CC:  assert/lib_stackchk.c ccarm: Warning: Unknown option "-fno-lto" passed to linker

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-08-24 18:57:40 +08:00
guoshichao
7f6fb9ce1c greenhills: add the "__sync_synchronize" func impl
we add ghs header file support using to fix the following link error:
[elxr] (error #412) unresolved symbols: 1
 __sync_synchronize 	from libopenamp.a(io.o)

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-08-24 18:07:12 +08:00
yinshengkai
6e02f3a31d sched: modify dump_stack log level
Keep the log level consistent with assert

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-08-24 11:20:59 +08:00
yinshengkai
667de7be32 mutex: add nxrmutex_is_recursive api
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-08-23 08:56:00 +08:00
yinshengkai
a2b8c83e0e mutex: align nxmutex_breaklock interface with nxrmutex_breaklock
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-08-23 08:56:00 +08:00
yinshengkai
eee7cb6efa libc: nxmutex_clocklock abstime supports NULL pointer
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-08-23 08:56:00 +08:00
yinshengkai
01864d262c sched: add mutex_holder and mutex_clocklock API
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-08-23 08:56:00 +08:00
yinshengkai
4af6db7c80 mutex: remove mutex trylock holder check
The standard describes trylock as follows, trylock should never cause the system to stop running:

The pthread_mutex_trylock() function shall be equivalent to
pthread_mutex_lock(), except that if the mutex object referenced by
mutex is currently locked (by any thread, including the current thread),
the call shall return immediately.

https://linux.die.net/man/3/pthread_mutex_trylock

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-08-23 08:56:00 +08:00
yinshengkai
272248de37 libc: compile stackchk function by default
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-08-23 08:51:54 +08:00
guohao15
c63adb5c14 hcreate: add alloc/free func hook for user to deallocate memory
Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-22 20:25:30 +08:00
Alin Jerpelea
fe642f1cfd libc/time: remove lib_strptime
This code is licensed under BSD-4-Clause license which may render the OS unusable for some products.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2024-08-22 16:45:15 +08:00
guohao15
52e5d69236 api:add lib_realpath function
FAR char *lib_realpath(FAR const char *path, FAR char *resolved, bool notfollow);

Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-22 15:24:48 +08:00
chenrun1
271f76590f fs_lock/pathbuffer:Optimize code structure
Summary:
  Adjust code logic

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-08-22 01:54:22 +08:00
chenrun1
36a8ff0540 lib_pathbuffer.c:Determine whether to malloc from the heap by CONFIG_LIBC_PATHBUFFER_MALLOC
Summary:
  If we disable LIB_PATHBUFFER_MALLOC, that when the path buffer is insufficient, NULL is returned to avoid applying for a buffer from the heap.

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-08-22 01:54:22 +08:00
guohao15
16afee6f0c notify:add path tmp buffer
Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-22 01:54:22 +08:00
guohao15
3ced80c743 basename: return path address instead of "/" when path="/"
Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-22 01:50:37 +08:00