Commit Graph

4249 Commits

Author SHA1 Message Date
anjiahao 38b138fa2c archivefs:support archivefs 2026-04-27 09:45:18 +08:00
Alin Jerpelea 8e7c8b6c82 fs: migrate to SPDX identifier
Most tools used for compliance and SBOM generation use SPDX identifiers
This change brings us a step closer to an easy SBOM generation.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2026-04-27 09:45:00 +08:00
dongjiuzhu1 691f411331 sys/socket: adjust SO_RCVTIMEO/SO_SENDTIMEO to avoid s_options overflow
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2026-04-21 01:35:56 +08:00
zhangyu117 2f31c63d76 nuttx/atomic: use toolchain builtin atomic function
The reason for using builtin atomic is that in C++, when include <atomic> in <nuttx/atomic.h> easily conflicts with third-party function libraries. We wanted to completely separate the implementation of <nuttx/atomic.h>.

There are two points:
1. use builtin function directly.
2. Without the standard library implementation, need implement "atomic_fetch_xxx", leading conflicts with the standard library used by third-party programs, introducing redefinition issues and requiring name changes.

Signed-off-by: zhangyu117 <zhangyu117@xiaomi.com>
2026-04-21 01:35:39 +08:00
dongjiuzhu1 127832d19c net: adjust the option sort of level SOL_SOCKET, to save bit of socket_conn_s:s_options
Adjust the order of all options where the level is SOL_SOCKET. If an
option occupies a bit in socket_conn_s:s_options, place it at the front.
This is to save bits for options of other levels and prevent the 32-bit
overflow of socket_conn_s:s_options.

The definition of many options for other levels uses _SO_PROTOCOL as the
base value. If _SO_PROTOCOL is relatively small, more bits will be left
for options of other levels. Before adjustment, there were 16 bits
available; after adjustment, this number has increased to 23 bits.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2026-04-21 01:35:36 +08:00
dongjiuzhu1 b8a3b13800 Revert "nuttx: __SO_PROTOCOL was moved from 16 to 21 to avoid conflict."
This reverts commit 86bce2a9d657c6dc7054dd82e5265d8f882b9008.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2026-04-21 01:35:36 +08:00
wenquan1 ca0ae45122 net/pkt: support option SO_TIMESTAMPING and MSG_ERRQUEUE
Signed-off-by: wenquan1 <wenquan1@xiaomi.com>
2026-04-21 01:35:35 +08:00
Bowen Wang 5fd7cf4dc1 syscall: remove the SYSCALL_LOOKUP1 because it's not needed
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-04-21 01:34:47 +08:00
guoshichao 5a8ccff3a9 ghs: fix the struct lifreq align build error
"/home/guoshichao/work_profile/vela_os/vela_car_dev_1/nuttx/libs/libc/net/lib_getifaddrs.c", line 215: error #1982-D:
          target stack alignment is insufficient to guarantee alignment of
          this variable
        struct lifreq req;
                      ^

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2026-04-21 01:34:27 +08:00
yaojingwei a3f7ea6dcc v4l2: add v4l2_exportbuffer struct.
Signed-off-by: yaojingwei <yaojingwei@xiaomi.com>
2026-04-21 01:34:25 +08:00
OceanfromXiaomi 8ecb353f4f nuttx: __SO_PROTOCOL was moved from 16 to 21 to avoid conflict.
Signed-off-by: OceanfromXiaomi <zhaohaiyang1@xiaomi.com>
2026-04-21 01:34:19 +08:00
xuxingliang 2de6bebd48 sched_note: add event level
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2026-04-21 01:34:12 +08:00
yangyalei 4c11cc59b6 nuttx/v4l2: add v4l2 standard define for libcamera.
Signed-off-by: yangyalei <yangyalei@xiaomi.com>
Signed-off-by: yaojingwei <yaojingwei@xiaomi.com>
2026-04-21 01:34:04 +08:00
guoshichao 2c27af036b environ: move the environ from sched/environ to libc/environ
change the environ implementation from sched/environ to
libc/environ, thus we can access the environ related API can vai libc
directl, which could improve the access speed in kernel build.
And in order to support this modification, we change the
struct task_info_s's ta_lock from nxmutex_t to nxrmutex_t,
this is because the env_*-related APIs require the ta_lock
to be reentrant.
If recursive locks are not supported, it may lead to deadlocks
in certain scenarios. For example, during initialization on the
qemu-miwear platform, it is necessary to call getenv while already
holding the ta_lock. To support such cases, we need to change
the ta_lock from nxmutex_t to nxrmutex_t.

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2026-04-21 01:34:01 +08:00
zhengyu16 89af2157b1 fs: rename PSEUDOFS_SOFTLINKS to FS_LINKS
Signed-off-by: zhengyu16 <zhengyu16@xiaomi.com>
2026-04-21 01:33:21 +08:00
v-zhangxiaomeng5 7fbfe5fa06 sys/endian.h: remove include<stdint.h> which cause loop dependency
dependency chain:
endian.h -> stdint.h -> limits.h(Smartcode) ->  float.h(libcxx) -> __config(libcxx) -> endian.h

Signed-off-by: v-zhangxiaomeng5 <v-zhangxiaomeng5@xiaomi.com>
2026-04-21 01:33:01 +08:00
hujun5 26979b88b6 sem: Avoid multiple conversions between time and tick
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-04-21 01:32:56 +08:00
zhangyu117 f6e39cc107 nuttx/libc: refine the atomic related Kconfig
The atomic implementation logic can be broken down into follow scenarios:
1. Toolchain support, which is ideal.
2. Single-core interrupt disabling, the default for non-SMP environments.
3. If atomic instructions are supported, the libc_atomic_arch version can be implemented.

Signed-off-by: zhangyu117 <zhangyu117@xiaomi.com>
2026-04-21 01:32:46 +08:00
niyinghao 2042ce085f v4l2_m2m: Add vaddr field to v4l2-buffer to interact with driver's real address
Signed-off-by: niyinghao <niyinghao@xiaomi.com>
2026-04-21 01:32:39 +08:00
guoshichao a3c4be523e header: remove the param name from function declaration
According to the PSE52 POSIX header file specification,
function prototypes declared in header files must not
include parameter names. Otherwise, the header test case
check will fail and prompt us to remove the parameter names.

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2026-04-21 01:32:35 +08:00
Xiang Xiao e5bc0d7d5d Revert "sys/endian.h: add __BYTE_ORDER__ serial macro"
This reverts commit 6bb97bac15f0aa8012be22cc21d7c9dad93f9a51.
conflict with libcxx byte order check
libs/libxx/libcxx/include/__config(444):

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2026-04-21 01:32:33 +08:00
hujun5 0357df0c93 sem: make the following interfaces inline and avoid syscall when fastpath
int nxsem_clockwait
int nxsem_tickwait
int nxsem_timedwait
int nxsem_tickwait_uninterruptible
int nxsem_clockwait_uninterruptible
int nxsem_timedwait_uninterruptible

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-04-21 01:32:30 +08:00
hujun5 93832e828f sem: remove nxsem_tickwait syscall
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-04-21 01:32:30 +08:00
anjiahao dee6d3ae0a Revert "libs/libc: Put posix_spawn into libc"
We use USERSPACE to get builtin data,so don't need this patch

This reverts commit ef1f5ba351eb4a35ea31b84be92d6ce58e072a31.

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2026-04-21 01:32:17 +08:00
anjiahao c4e769fe5b Protect:use userspace inside of BOARDIOC_BUILTINS to get built-in information
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2026-04-21 01:32:17 +08:00
wangmingrong1 9a0eca03e5 syscall: add coredump to syscall
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2026-04-21 01:31:53 +08:00
guoshichao 5863c8d868 add support for CONFIG_DISABLE_SIGNALS
1. add the DISABLE_SIGNALS build option
2. make the sleep/usleep/nanosleep function can work with signal
   function disabled
3. make the driver/fs/sched/libc kernel module can decouple from signal
   module

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2026-04-21 01:31:32 +08:00
guanyushuai1 036bc131b7 docs/doxygen: update network docs
Signed-off-by: guanyushuai1 <guanyushuai1@xiaomi.com>
2026-04-21 01:30:58 +08:00
wangshaoxin afab6db882 drivers/rptun: support rptun poweroff in notify
Signed-off-by: wangshaoxin <wangshaoxin@xiaomi.com>
2026-04-21 01:30:52 +08:00
yaojingwei f90f758981 v4l2_cap: support V4L2_PIX_FMT_ENTROPY pix fmt for private entropy
encode stream.

Signed-off-by: yaojingwei <yaojingwei@xiaomi.com>
2026-04-21 01:30:51 +08:00
Bowen Wang 89edee11de sys/boardctl: remove the macro judge to fix rptun compile error
Because these data types will be used by the rptun

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-04-21 01:30:42 +08:00
niyinghao b9e0eb8e22 sys/videoio: add more v4l2-buffer flag form linux/videodev2.h
Signed-off-by: niyinghao <niyinghao@xiaomi.com>
2026-04-21 01:29:50 +08:00
dongjiuzhu1 fe1d8f5260 timerfd: notify application of system relatime changes
refs : https://man7.org/linux/man-pages/man2/timerfd_create.2.html

If the associated clock is either CLOCK_REALTIME or
CLOCK_REALTIME_ALARM, the timer is absolute
(TFD_TIMER_ABSTIME), and the flag TFD_TIMER_CANCEL_ON_SET
was specified when calling timerfd_settime(), then read(2)
fails with the error ECANCELED if the real-time clock
undergoes a discontinuous change.  (This allows the
reading application to discover such discontinuous changes
to the clock.)

examples code:
{
    int nevents = epoll_wait(epollfd, events, N_ANDROID_TIMERFDS, -1);
    if (nevents < 0) {
        return nevents;
    }

    int result = 0;
    for (int i = 0; i < nevents; i++) {
        uint32_t alarm_idx = events[i].data.u32;
        uint64_t unused;
        ssize_t err = read(fds[alarm_idx], &unused, sizeof(unused));
        if (err < 0 && errno != EAGAIN) {
            if (errno == ECANCELED) {
                //get time changed
            } else {
                return err;
            }
        } else {
           //....
        }
    }
}

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2026-04-21 01:29:32 +08:00
zhengyu16 8bc0bcb75e archivefs: rename archivefs to zipfs
Signed-off-by: zhengyu16 <zhengyu16@xiaomi.com>
2026-04-21 01:29:30 +08:00
jiangtao16 8e595a5326 sched/timer: Fix MISRA Rule 11.6
Fix MISRA Rule 11.6 timer_t was void * can't convert to arithmetic type.
Signed-off-by: jiangtao16 <jiangtao16@xiaomi.com>
2026-04-21 01:29:09 +08:00
anjiahao 7fe3632c4f syslog:setlogmask to pre task
setlogmask for a task
nx_setlogmask for all system syslog.

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2026-04-21 01:28:46 +08:00
nuttxs d1eaae79eb sys/socket.h: Since `ss_family` is of type `uint16_t` (2-byte alignment),
packing the internal substructures will reduce the overall alignment of
`sockaddr_storage` to 2, which triggers an unaligned access warning
in 32-bit systems.
Add an overall 8-byte alignment to the outermost layer of the structure.

Related commit: 855336bf
Refer to https://datatracker.ietf.org/doc/html/rfc2553#section-3.10

Signed-off-by: nuttxs <zhaoqing.zhang@sony.com>
2026-04-21 01:28:31 +08:00
yangsong8 3f53cbe281 libs/libc: Put posix_spawn into libc
When protect building mode, posix_spawn only enters the kernel space to
find the buildin executable file, but some executable files are in user
space. So first execute posix_spawn. If it is not found in kernel
space, then execute task_spawn to start it.

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2026-04-21 01:28:02 +08:00
guoshichao 1ea50df6e6 pthread: reorganized the locations of pthread-related functions and constants
1. According to the POSIX specification, the functions `pthread_kill`
and `pthread_sigmask` have been moved from `pthread.h` to `signal.h`.
2. As required by the POSIX standard, the pthread-related constants
have been relocated from `pthread.h` to `sys/types.h`.

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2026-04-21 01:27:57 +08:00
guoshichao 4507c019f6 sys/types.h: Fixed the conflict issue with the "OK" constant definition
When cross-compiling PSE52 VSX testcases based on Vela, VSX defines its
own "OK" constant as a macro, which conflicts with the "OK" constant
defined as an enum in <sys/types.h>. To ensure compatibility, we
have undef'd the macro version of "OK" in advance.

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2026-04-21 01:27:54 +08:00
makejian 561a846749 sys/endian.h: add __BYTE_ORDER__ serial macro
Signed-off-by: makejian <makejian@xiaomi.com>
2026-04-21 01:27:38 +08:00
zhangyu117 508ece9fb2 nuttx/spinlock: define spinlock with atomic type
Signed-off-by: zhangyu117 <zhangyu117@xiaomi.com>
2026-04-21 01:27:06 +08:00
yinshengkai 1065a53393 arch: Added ARCH_PERF_EVENTS_USER_ACCESS config
Make this feature optional and only available in non-flat builds

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2026-04-21 01:26:16 +08:00
anjiahao 86bf503101 Use macro replacement function to implement up_assert
avoid two syscall in protect build and kernel build

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2026-04-21 01:26:13 +08:00
Gao Jiawei 1b7fb802c8 Support extending custom syscalls without hacking libc syscalls
Signed-off-by: Gao Jiawei <gaojiawei@xiaomi.com>
2026-04-21 01:25:22 +08:00
ligd d6582cca9c syscall: fix compile filed when use kernel mode
smartspeaker-knsh/libs/libc/libc.a(lib_mutex.c.o): in function `nxmutex_clocklock':
libs/libc/misc/lib_mutex.c:203:(.text.nxrmutex_clocklock+0x40): undefined reference to `nxsem_clockwait_uninterruptible'

Signed-off-by: ligd <liguiding1@xiaomi.com>
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2026-04-21 01:25:17 +08:00
wushenhui c68ab25d42 syscall: add clock_getres() to syscall
Signed-off-by: wushenhui <wushenhui@xiaomi.com>
2026-04-21 01:25:13 +08:00
jingfei ec2101223d [feature] Add a direct writing method for ftl
To save more space (equivalent to the size of one erase sector of
MTD device) and to achieve faster read and write speeds, a method
for direct writing was introduced at the FTL layer.
This can be accomplished simply by using the following oflags during
the open operation:

1. O_DIRECT. when this flag is passed in, ftl internally uses
   the direct write strategy and no read cache is used in ftl;
   otherwise, each write will be executed with the minimum
   granularity of flash erase sector size which means a
   "sector read back - erase sector - write sector" operation
   is performed by using a read cache buffer in heap.

2. O_SYNC. When this flag is passed in, we assume that the
   flash has been erased in advance and no erasure operation
   will be performed internally within ftl. O_SYNC will take
   effect only when both O_DIRECT and O_SYNC are passed in
   simultaneously.

3. For uniformity, we remapped the mount flag in mount.h and
   unified it with the open flag in fcntl.h. The repetitive
   parts of their definitions were reused, and the remaining
   part of the mount flag redefine to the unused bit of open
   flags.

Signed-off-by: jingfei <jingfei@xiaomi.com>
2026-04-21 01:25:10 +08:00
hujun5 e377a05820 pthread: move pthread_cond to userspace
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-04-21 01:24:18 +08:00
hujun5 4e152646d6 pthread: remove syscall for pthread
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-04-21 01:24:07 +08:00