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
chenrun1
900e713cd0
atomic:Add more interfaces
...
Summary:
1. add atomic_flag_test_and_set and atomic_flag_clear
2. add typedef memory_order
3. add atomic_flag
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-08-22 01:44:29 +08:00
chenrun1
8e1a042eef
nuttx/atomic.h:Fix missing type declarations at compile time
...
Summary:
1.Modify the conditions for entering different include header files
2.Added pre-definition for _Atomic _Bool when it is missing
3.Added nuttx for stdatomic implementation. When toolchain does not support atomic, use lib/stdatomic to implement it
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-08-22 01:44:29 +08:00
Karel Kočí
c4d8d937d5
libs/libc/obstack: correctly append null byte at the end of string
...
obstack_printf and obstack_vprintf should terminate the C string with
null byte but lib_vsprintf doesn't do it. It must be done on top of
that unless we get unterminated string.
This is fix to be consistent with GlibC behavior.
This also includes minor tweak to use obstack_1grow directly instead of
calling obstack_puts.
2024-08-21 10:21:50 -03:00
anjiahao
3fdff878bc
libc:Add macro restrictions to code that uses floating point numbers
...
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-08-21 13:33:45 +08:00
guoshichao
ddc6e31740
libc/fputwc: fix the return value truncated from stdio interface
...
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-08-21 02:57:43 +08:00
guoshichao
d74e37d9db
wchar/wcsstr: fix the variable overflow bug
...
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-08-21 02:57:43 +08:00
guoshichao
ca1e007a22
wchar/lib_ungetwc: fix the array access out of bounds error
...
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-08-21 02:57:43 +08:00
guoshichao
9876b0b615
wchar/fgetwc: fix the return value truncate error
...
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-08-21 02:57:43 +08:00
guoshichao
390275f867
wchar/putwc: fix the putwc return value truncate error
...
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-08-21 02:57:43 +08:00
chenrun1
96abb51562
lib_getcwd:Fix the Name in the function description.
...
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-08-21 02:52:45 +08:00
chenrun1
5bf24a15b5
lib_getnprocs:add #include <sys/types.h> instead of ifdef
...
Summary:
Since there is a default definition for CONFIG_SMP_NCPUS in sys/types.h, we can remove #ifdef and return CONFIG_SMP_NCPUS directly.
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-08-21 02:04:15 +08:00
chenrun1
f3cf11dcb5
libc/msic:Implement get_nprocs API
...
Summary:
1.Remove the macro definition of getnproc in sysinfo
2.New get_nprocs_conf and get_nprocs interfaces, return CONFIG_SMP_NCPUS, return 1 when not defined
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-08-21 02:04:15 +08:00
wangchen
146767a8a2
netdb:netdb code support ffmpeg rtsp(getaddrinfo & getnameinfo)
...
Related Codes:
1.ffmpeg/libavformat/ip.c
struct addrinfo *ff_ip_resolve_host(void *log_ctx,
const char *hostname, int port,
int type, int family, int flags)
{
struct addrinfo hints = { 0 }, *res = 0;
int error;
char sport[16];
const char *node = 0, *service = "0";
if (port > 0) {
snprintf(sport, sizeof(sport), "%d", port);
service = sport;
}
if ((hostname) && (hostname[0] != '\0') && (hostname[0] != '?')) {
node = hostname;
}
hints.ai_socktype = type;
hints.ai_family = family;
hints.ai_flags = flags;
if ((error = getaddrinfo(node, service, &hints, &res))) {
res = NULL;
av_log(log_ctx, AV_LOG_ERROR, "getaddrinfo(%s, %s): %s\n",
node ? node : "unknown",
service,
gai_strerror(error));
}
return res;
}
2.ffmpeg/libavformat/rtsp.c
static int sdp_read_header(AVFormatContext *s)
{
RTSPState *rt = s->priv_data;
RTSPStream *rtsp_st;
int i, err;
char url[MAX_URL_SIZE];
AVBPrint bp;
if (!ff_network_init())
return AVERROR(EIO);
if (s->max_delay < 0) /* Not set by the caller */
s->max_delay = DEFAULT_REORDERING_DELAY;
if (rt->rtsp_flags & RTSP_FLAG_CUSTOM_IO)
rt->lower_transport = RTSP_LOWER_TRANSPORT_CUSTOM;
/* read the whole sdp file */
av_bprint_init(&bp, 0, AV_BPRINT_SIZE_UNLIMITED);
err = avio_read_to_bprint(s->pb, &bp, INT_MAX);
if (err < 0 ) {
ff_network_close();
av_bprint_finalize(&bp, NULL);
return err;
}
err = ff_sdp_parse(s, bp.str);
av_bprint_finalize(&bp, NULL);
if (err) goto fail;
/* open each RTP stream */
for (i = 0; i < rt->nb_rtsp_streams; i++) {
char namebuf[50];
rtsp_st = rt->rtsp_streams[i];
if (!(rt->rtsp_flags & RTSP_FLAG_CUSTOM_IO)) {
AVDictionary *opts = map_to_opts(rt);
char buf[MAX_URL_SIZE];
const char *p;
err = getnameinfo((struct sockaddr*) &rtsp_st->sdp_ip,
sizeof(rtsp_st->sdp_ip),
namebuf, sizeof(namebuf), NULL, 0, NI_NUMERICHOST);
if (err) {
av_log(s, AV_LOG_ERROR, "getnameinfo: %s\n", gai_strerror(err));
err = AVERROR(EIO);
av_dict_free(&opts);
goto fail;
}
ff_url_join(url, sizeof(url), "rtp", NULL,
namebuf, rtsp_st->sdp_port,
"?localport=%d&ttl=%d&connect=%d&write_to_source=%d",
rtsp_st->sdp_port, rtsp_st->sdp_ttl,
rt->rtsp_flags & RTSP_FLAG_FILTER_SRC ? 1 : 0,
rt->rtsp_flags & RTSP_FLAG_RTCP_TO_SOURCE ? 1 : 0);
p = strchr(s->url, '?');
if (p && av_find_info_tag(buf, sizeof(buf), "localaddr", p))
av_strlcatf(url, sizeof(url), "&localaddr=%s", buf);
else if (rt->localaddr && rt->localaddr[0])
av_strlcatf(url, sizeof(url), "&localaddr=%s", rt->localaddr);
append_source_addrs(url, sizeof(url), "sources",
rtsp_st->nb_include_source_addrs,
rtsp_st->include_source_addrs);
append_source_addrs(url, sizeof(url), "block",
rtsp_st->nb_exclude_source_addrs,
rtsp_st->exclude_source_addrs);
err = ffurl_open_whitelist(&rtsp_st->rtp_handle, url, AVIO_FLAG_READ,
&s->interrupt_callback, &opts, s->protocol_whitelist, s->protocol_blacklist, NULL);
av_dict_free(&opts);
if (err < 0) {
err = AVERROR_INVALIDDATA;
goto fail;
}
}
if ((err = ff_rtsp_open_transport_ctx(s, rtsp_st)))
goto fail;
}
return 0;
fail:
ff_rtsp_close_streams(s);
ff_network_close();
return err;
}
Signed-off-by: wangchen <wangchen41@xiaomi.com>
2024-08-20 10:33:18 -03:00
chenrun1
e15100543f
lib_remove.c:fix code style error
...
Summary:
Warning: /home/runner/work/nuttx/nuttx/nuttx/libs/libc/stdio/lib_remove.c:59:32: warning: Wrong column position of comment right of code
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-08-20 13:50:15 +08:00