Juha Niskanen
449cf4d076
getrandom: fix comment contradicting code
...
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2022-06-15 11:18:04 -03:00
Petro Karashchenko
02682af759
getrandom: use _NX_XXXX interface to remove cancelation point for kernel
...
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-06-13 22:27:19 +08:00
chao.an
644283c8ff
libc/ipc: add ftok(3) support
...
https://man.openbsd.org/ftok.3
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-06-09 18:19:48 +03:00
Xiang Xiao
f1236da21c
fs: Make the binary(no process) mode as the default
...
POSIX require file system shouldn't enable the \r and \n conversion by default
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-06-07 20:22:26 +03:00
Xiang Xiao
4ae7f4c1f6
libs: Move libxx_impure.cxx from libs/libxx/ to libs/libc/misc/
...
to fix the gcov link error:
arm-none-eabi-ld: /home/xiaoxiang/vela/prebuilts/gcc/linux/arm/bin/../lib/gcc/arm-none-eabi/10.3.1/thumb/v7e-m/nofp/libgcov.a(_gcov.o): in function `gcov_error_exit':
libgcov-driver.c:(.text+0x7c): undefined reference to `_impure_ptr'
arm-none-eabi-ld: /home/xiaoxiang/vela/prebuilts/gcc/linux/arm/bin/../lib/gcc/arm-none-eabi/10.3.1/thumb/v7e-m/nofp/libgcov.a(_gcov.o): in function `get_gcov_error_file':
libgcov-driver.c:(.text+0x1e0): undefined reference to `_impure_ptr'
arm-none-eabi-ld: /home/xiaoxiang/vela/prebuilts/gcc/linux/arm/bin/../lib/gcc/arm-none-eabi/10.3.1/thumb/v7e-m/nofp/libgcov.a(_gcov.o): in function `gcov_exit_open_gcda_file.isra.0':
libgcov-driver.c:(.text+0x660): undefined reference to `_impure_ptr'
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-05-06 14:43:57 -03:00
Xiang Xiao
577f301a2c
libc: Move cxx_initialize.c from libc/sched/ to libc/misc
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-05-04 08:58:43 +02:00
Alin Jerpelea
148c4903e3
LICENSE: document missing libc files
...
add missing files to the LICENSE file.
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2022-04-20 21:05:45 +08:00
anjiahao
c30705f5f0
libc/lib_glob:use strlcpy instead of memcpy
...
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2022-04-12 21:15:45 +08:00
anjiahao
14c5f61e77
libs/libc/lib_err.c:add va_end to vwarn
...
call va_copy,after need call va_end
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2022-04-01 23:13:25 +08:00
Petro Karashchenko
98ba65c422
c89: get rid of designated initializers in common code
...
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-03-28 13:39:27 +08:00
Xiang Xiao
c8ea7a95a3
libc: Implement getrandom on top of "/dev/[u]random"
...
https://man7.org/linux/man-pages/man2/getrandom.2.html
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-25 13:48:33 +02:00
chao.an
316797a7f6
libc/err: fix unpaired va_end()
...
each invocation of va_start() must be matched by a corresponding
invocation of va_end() in the same function
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-03-19 10:13:23 +02:00
Xiang Xiao
a9e4c6ace1
libc: backtrace_malloc change sprintf to snprintf
...
since snprintf can handle NULL pointer but sprintf can't.
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-01-20 14:33:29 +01:00
Juha Niskanen
2b63b811e0
libs/libc/misc/lib_execinfo.c: fix bad memory access
...
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2022-01-20 18:58:40 +08:00
Xiang Xiao
20bbdd0997
libc: Add backtrace_symbols[_fd] functions
...
specified here:
https://linux.die.net/man/3/backtrace_symbols
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-12-29 12:09:37 +08:00
anjiahao
f9570810c0
libc/misc/err.c:add err.c to libc
...
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2021-12-07 04:01:27 -08:00
Xiang Xiao
54eabf9616
libc: Add mknod implementation
...
https://pubs.opengroup.org/onlinepubs/007904875/functions/mknod.html
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-11-28 23:31:16 +01:00
Xiang Xiao
aa9c17e93d
libc: Move lib_filesem.c and lib_stream.c to libc/stdio
...
since it make more sense to put all FILE functions in one place
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-11-02 09:00:11 +01:00
Xiang Xiao
ad2f82898a
libc/misc: Add lib_ prefix to stream_semtake and tream_semgive
...
and merge lib_streamsem.c to lib_stream.c
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-11-02 09:00:11 +01:00
Alin Jerpelea
f6c8e4368d
libs: Omni Hoverboards: update licenses to Apache
...
Gregory Nutt has submitted the SGA
Omni Hoverboards has submitted the SGA
Paul Alexander Patience has submitted the ICLA
as a result we can migrate the licenses to Apache.
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-09-28 04:37:38 -07:00
FASTSHIFT
649f99ce30
libc/misc: add lib_glob.
...
Signed-off-by: FASTSHIFT <vifextech@foxmail.com>
2021-09-25 07:54:39 -03:00
Xiang Xiao
5025fbef8d
Rename LIB_ to LIBC_ for all libc Kconfig
...
follow other libc component naming convention
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-08-05 19:45:24 +02: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
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
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
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
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
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
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
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
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
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
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
Alin Jerpelea
d66d881b87
nxstyle fixes
...
nxstyle fixes to pass CI
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-03-13 05:56:43 -08:00
Alin Jerpelea
ce28c6c06c
libs: Alan Carvalho de Assis: update licenses to Apache
...
Alan Carvalho de Assis has submitted the SGA and we can migrate the licenses
to Apache.
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-03-13 05:56:43 -08:00
Gustavo Henrique Nihei
330eff36d7
sourcefiles: Fix relative path in file header
2021-03-09 23:18:28 +08:00
Masayuki Ishikawa
44ed617ab5
Revert "Revert "libs: misc: Remove critical section in lib_filesem.c for SMP""
...
Summary:
- Previous Revert commit was done bacause spresense:rndis_smp was unstable.
- This commit revert the previous revert commit.
This reverts commit d412819160
.
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2021-03-07 19:51:12 -08:00
Masayuki Ishikawa
d412819160
Revert "libs: misc: Remove critical section in lib_filesem.c for SMP"
...
This reverts commit 191ada2296
.
2021-03-03 22:34:07 -08:00
Alin Jerpelea
b5d4a01821
libs: Author 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-03-03 18:52:53 -08:00
Masayuki Ishikawa
191ada2296
libs: misc: Remove critical section in lib_filesem.c for SMP
...
Summary:
- The code was added in Mar 2018 to stabilize the SMP kernel
- I confirmed that the code is no longer needed now.
Impact:
- SMP only
Testing:
- Tested with ostest the following configs
- esp32-devkitc:smp (QEMU), sabre-6quad:smp (QEMU)
- maix-bit:smp (QEMU), sim:smp
- spresense:smp
- Tested with nxplayer and stress test with spresense:wifi_smp
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2021-03-01 03:44:25 -08:00
Xiang Xiao
151cf49562
Fix nxstyle warning
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-03-01 09:23:09 +09:00
Xiang Xiao
9473434587
Ensure the kernel component don't call userspace API
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-03-01 09:23:09 +09:00
Xiang Xiao
4d4cba41f6
Move the declaration of nx_mkfifo/nx_pipe to nuttx/fs/fs.h
...
the new location is better than nuttx/drivers/drivers.h
since they are part of the file system api.
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-01-08 11:03:19 +08:00
chao.an
d7b004e179
libc/dumpvbuffer: update the vector ptr correctly
...
fix a bug that the vector pointer is not updated correctly.
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-29 15:42:33 -08:00
chao.an
2980792efd
libs/libc: add lib_dumpvbuffer support
...
e.g: Encapsulation Type: Bluetooth H4: add packet type dump support
From:
lib_dumpvbuffer(NULL, data, len);
[ 1.567100] 0000 03 0c 00 ...
[ 1.890100] 0000 0e 04 01 03 0c 00 ......
[ 1.890100] 0000 03 10 00 ...
[ 1.892900] 0000 0e 0c 01 03 10 00 ff ff 8f fe db ff 5b 87 ............[.
[ 1.892900] 0000 01 10 00 ...
[ 1.894900] 0000 0e 0c 01 01 10 00 06 bb 22 06 0a 00 bb 22 ........"...."
[ 1.894900] 0000 02 10 00 ...
[ 1.901900] 0000 0e 44 01 02 10 00 ff ff ff 03 fe ff ff ff ff ff .D..............
[ 1.901900] 0010 ff ff f3 0f e8 fe 3f f7 83 ff 1c 00 00 00 61 f7 ......?.......a.
[ 1.901900] 0020 ff ff 7f 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
[ 1.901900] 0030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
[ 1.901900] 0040 00 00 00 00 00 00 ......
To:
struct iovec bufs[2];
bufs[0].iov_base = &type;
bufs[0].iov_len = 1;
bufs[1].iov_base = data;
bufs[1].iov_len = len;
lib_dumpvbuffer(NULL, bufs, 2);
[ 3.711400] 0000 01 03 0c 00 ....
[ 4.035400] 0000 04 0e 04 01 03 0c 00 .......
[ 4.035400] 0000 01 03 10 00 ....
[ 4.037400] 0000 04 0e 0c 01 03 10 00 ff ff 8f fe db ff 5b 87 .............[.
[ 4.037400] 0000 01 01 10 00 ....
[ 4.039400] 0000 04 0e 0c 01 01 10 00 06 bb 22 06 0a 00 bb 22 ........."...."
[ 4.039400] 0000 01 02 10 00 ....
[ 4.046400] 0000 04 0e 44 01 02 10 00 ff ff ff 03 fe ff ff ff ff ..D.............
[ 4.046400] 0010 ff ff ff f3 0f e8 fe 3f f7 83 ff 1c 00 00 00 61 .......?.......a
[ 4.046400] 0020 f7 ff ff 7f 00 00 00 00 00 00 00 00 00 00 00 00 ................
[ 4.046400] 0030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
[ 4.046400] 0040 00 00 00 00 00 00 00 .......
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-23 00:11:38 -08:00
chao.an
826e74a13d
libs/libc/dumpbuffer: remove the unnecessary printable characters traversal
...
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-23 00:11:38 -08:00
chao.an
48db71aa24
libs/libc/dumpbuffer: fix nxstyle warning
...
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-23 00:11:38 -08:00
chao.an
e32e341886
libs/libc/dumpbuffer: add support to recognizable from wireshark
...
e.g: Encapsulation Type: Bluetooth H4
From:
[ 2.196000] 0000: 030c00 ...
[ 2.514600] 0000: 0e0401030c00 ......
[ 2.514600] 0000: 031000 ...
[ 2.517600] 0000: 0e0c01031000ffff8ffedbff5b87 ............[.
[ 2.517600] 0000: 011000 ...
[ 2.520600] 0000: 0e0c0101100006bb22060a00bb22 ........"...."
[ 2.520600] 0000: 021000 ...
[ 2.527600] 0000: 0e4401021000ffffff03feffffffffff fffff30fe8fe3ff783ff1c00000061f7 .D.............. ......?.......a.
[ 2.527600] 0020: ffff7f00000000000000000000000000 00000000000000000000000000000000 ................ ................
[ 2.527600] 0040: 000000000000 ......
To:
[ 1.567100] 0000 03 0c 00 ...
[ 1.890100] 0000 0e 04 01 03 0c 00 ......
[ 1.890100] 0000 03 10 00 ...
[ 1.892900] 0000 0e 0c 01 03 10 00 ff ff 8f fe db ff 5b 87 ............[.
[ 1.892900] 0000 01 10 00 ...
[ 1.894900] 0000 0e 0c 01 01 10 00 06 bb 22 06 0a 00 bb 22 ........"...."
[ 1.894900] 0000 02 10 00 ...
[ 1.901900] 0000 0e 44 01 02 10 00 ff ff ff 03 fe ff ff ff ff ff .D..............
[ 1.901900] 0010 ff ff f3 0f e8 fe 3f f7 83 ff 1c 00 00 00 61 f7 ......?.......a.
[ 1.901900] 0020 ff ff 7f 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
[ 1.901900] 0030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
[ 1.901900] 0040 00 00 00 00 00 00 ......
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-23 00:11:38 -08:00