Commit Graph

16 Commits

Author SHA1 Message Date
Xiang Xiao b0d197534f stdio: Move lib_stream_[initialize|release] from libc/stdio to sched/tls
both functions aren't suitable to be put into libc,
because they call the kernel internal functions directly.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-10-17 13:34:00 +08:00
Petro Karashchenko 2c346c4c89 arch/esp32: use kernel internal API for libc stubs
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-08-08 11:58:29 -03:00
Petro Karashchenko 1b0baa8337 nuttx: use lib_free for memory de-allocation after strdup or asprintf
The memory allocated with strdup and asprintf is done via lib_malloc
so we need to use lib_free to deallocate memory otherwise the assertion
"Free memory from the wrong heap" is hit with flat mode and user separated
heap enabled mode.

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-08-08 11:58:29 -03:00
Roy Feng 10251f6b6c Fix assertion of free a wrong heap 2023-06-24 16:34:53 +08:00
Huang Qi dfc70b1ddb libc/stdio: Implement lib_get_stream
Use lib_get_stream() to fetch stdin/stdout/stderr,
since is more easy to works with other language by function call
than export native C structure memory layout.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-03-02 09:56:57 +01:00
Huang Qi c4156ba4e5 lib.h: Remove forward declaration for streamlist
Since <nuttx/fs/fs.h> included already.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-03-02 13:32:44 +08:00
Ville Juven 2ed51d026c fs/streams: Move the file streams from the group structure into TLS
This is preparation for flushing streams from user space, like it should
be done.

- Move tg_streamlist (group, kernel space) ->
       ta_streamlist (TLS, user space)
- Access stream list via tg_info in kernel
- Access stream list via TLS in user space
- Remove / rename nxsched_get_streams -> lib_getstreams
- Remove system call for nxsched_get_streams
2022-12-22 20:16:11 +08:00
Miguel Herranz 819ebe7356 libc/stdio: Add stdio file locking functions
Add flockfile(), ftrylockfile() and funlockfile() functions [1].

[1] POSIX.1-2008 / System Interfaces / flockfile
    https://pubs.opengroup.org/onlinepubs/9699919799.2008edition/functions/flockfile.html

Signed-off-by: Miguel Herranz <miguel@midokura.com>
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-22 23:34:45 +08:00
anjiahao d1d46335df Replace nxsem API when used as a lock with nxmutex API
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-17 15:59:46 +09:00
Petro Karashchenko b343a42e8c nuttx/lib: remove dependency on BUILD_FLAT for library memory allocation interface
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-06-15 16:58:34 -03:00
Xiang Xiao aec01e96fa libc: Remove the empty lib_initialize
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-11-01 11:03:02 -03:00
Xiang Xiao 75bfa4584c mm: Add kmm_malloc_size and mm_malloc_size
make malloc_size implementation align with malloc

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I8d7781925f06e58a880437a16569dccbfd2ea035
2021-07-05 14:23:24 +09: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
Alin Jerpelea a8a1308240 include: nuttx: update licenses to Apache 2.0
The SGA from Gregory Nutt had been submitted and we can replace
the licenses to Apache 2.0

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-02-01 11:21:57 -03:00
Xiang Xiao b0797263ca libc/stdio: Allocate file_struct dynamically
1.Reduce the default size of task_group_s(~512B each task)
2.Scale better between simple and complex application

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ia872137504fddcf64d89c48d6f0593d76d582710
2020-09-11 17:58:17 +08:00
Gregory Nutt 7370d3171a Move include/nuttx/lib.h to include/nuttx/lib/lib.h 2016-07-21 14:05:44 -06:00