Commit Graph

582 Commits

Author SHA1 Message Date
minjian.tang
5ff1e85947 boardctl: add BOARDIOC_SOFTRESETCAUSE_RESTORE_FACTORY_INQUIRY
RESTORE_FACTORY used to reset the device
FACTORY_INQUIRY used to reset the device but need user confirmed.

Signed-off-by: minjian.tang <minjian.tang@aqara.com>
2023-05-10 13:40:19 +08:00
simbit18
b1404f486e include: Fix nxstyle errors
error: Long line found
2023-05-04 02:07:01 +08:00
zhangyuan21
884be2bdb9 assert: Distinguish between assert and exception
CURRENT_REGS may change during assert handling, so pass
in the 'regs' parameter at the entry point of _assert.

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-05-03 14:49:32 +08:00
Michal Lenc
360e938fa6 sched: add support for adjtime() interface
This commit adds Linux like adjtime() interface that is used to correct
the system time clock if it varies from real value. The adjustment is
done by slight adjustment of clock period and therefore the adjustment
is without time jumps (both forward and backwards)

The implementation is enabled by CONFIG_CLOCK_ADJTIME and separated from
CONFIG_CLOCK_TIMEKEEPING functions. Options CONFIG_CLOCK_ADJTIME_SLEWLIMIT
and CONFIG_CLOCK_ADJTIME_PERIOD can be used to control the adjustment
speed.

Interfaces up_get_timer_period() and up_adj_timer_period() has to be
defined by architecture level support.

This is not a POSIX interface but derives from 4.3BSD, System V.
It is also supported for Linux compatibility.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2023-04-25 14:37:50 -03:00
hujun5
d189a86a35 system: pthread_barrierwait should be moved to kernel space
The current implementation requires the use of enter_critical_section, so the source code needs to be moved to kernel space

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2023-04-25 15:34:40 +08:00
Xiang Xiao
1113746d44 Let BOARDIOC_SOFTRESETCAUSE_ASSERT equals to the default value of BOARD_ASSERT_RESET_VALUE
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-04-24 05:14:06 -04:00
Xiang Xiao
b2c8b5f674 board: define boardioc_softreset_subreason_e in CONFIG_BOARDCTL_RESET
so user could pass boardioc_softreset_subreason_e to board_reset too

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-04-06 12:44:50 +03:00
Xiang Xiao
d3f659b854 boardctl.h: Add BOARDIOC_SOFTRESETCAUSE_ENTER_BOOTLOADER reset cause
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-04-03 14:50:44 -04:00
Xiang Xiao
b43ca9fcdb boardctl.h: Move BOARDIOC_SOFTRESETCAUSE_[PANIC|ASSERT] to the last
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-04-03 14:50:44 -04:00
chao an
3c58f5db2b syscall/libc: add more syscall/libc symbols into csv file
Signed-off-by: chao an <anchao@xiaomi.com>
2023-03-31 21:56:50 +09:00
chao an
c839fc45af libc/settimeofday: correct prototype of settimeofday()
Signed-off-by: chao an <anchao@xiaomi.com>
2023-03-21 11:16:30 -03:00
Xiang Xiao
9308a72419 vfs/poll: Remove the unused ptr field from pollfd
forget in the commit:
commit 0a95c7721b
Author: Xiang Xiao <xiaoxiang@xiaomi.com>
Date:   Fri Nov 11 03:47:07 2022 +0800

    vfs/poll: Remove POLLFILE and POLLSOCK NuttX specific extension

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-03-06 13:19:42 +02:00
Xiang Xiao
92b2f1bd3d fs: Undefine CONFIG_FS_LARGEFILE if compiler doesn't support long long
to simplify the large file check in many place

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-03-02 09:37:58 +01:00
Xiang Xiao
fa3e0faffc fs: Map FD_SETSIZE to OPEN_MAX instead hardcoding 256
and change the default value of LIBC_OPEN_MAX to 256.
Here has more discussion:
https://www.mail-archive.com/dev@nuttx.apache.org/msg09095.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-02-19 19:17:20 +02:00
crafcat7
ad3def0e15 sys/resource.h:Added ru_maxrss type 2023-02-18 06:59:16 +02:00
SPRESENSE
277e0b941a include/sys/socket.h: Add SOCK_CTRL to socket type
SOCK_CTRL is added to provide special control over network drivers
and daemons. Currently, SOCK_DGRAM and SOCK_STREAM perform this control,
but these use socket resources. In the case of usersocket in particular,
this is a waste of the device's limited socket resources.
2023-02-16 12:13:01 +09:00
SPRESENSE
a9fb20039e utsname: Expand the buffer for version information slightly
The version information basically uses 20 characters for date and time,
which is small enough to specify an arbitrary version string. Therefore,
increase the buffer a little.
2023-02-14 22:35:43 +08:00
Xiang Xiao
a3a1883787 fs: Don't guard rename with CONFIG_DISABLE_MOUNTPOINT
since the pseudo root fs support rename too

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-02-14 11:24:37 +08:00
Xiang Xiao
4009cb1970 fs: Don't guard ftruncate with CONFIG_DISABLE_MOUNTPOINT
since ftruncate depends on file_operations not mountpt_operations

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-02-14 11:24:37 +08:00
Xiang Xiao
a05f9aaa85 fs: Don't guard fsync with CONFIG_DISABLE_MOUNTPOINT
since the driver can also support fsync by implementing BIOC_FLUSH

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-02-14 11:24:37 +08:00
Xiang Xiao
dc2e9b8771 libc: Move memfd related stuff to sys/mman.h
follow the freebsd definition:
https://github.com/freebsd/freebsd-src/blob/master/sys/sys/mman.h#L207-L228

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-02-13 16:00:37 +01:00
chao an
86aed87487 sys/sysinfo: align sysinfo define with linux
__reserved is a meaningful macro definition in msvc, cannot use this name

Fix visual studio Compiler Error:
https://social.msdn.microsoft.com/Forums/vstudio/en-US/d86ad86b-47b7-4677-95fb-e28b3230a009/reserved-problem?forum=vclanguage

Signed-off-by: chao an <anchao@xiaomi.com>
2023-02-09 20:11:55 +08:00
chao an
cf0769d613 include: Add nitems() definition to sys/param.h
Signed-off-by: chao an <anchao@xiaomi.com>
2023-02-09 20:05:44 +08:00
Masayuki Ishikawa
3f3e090716 Revert "include/sys/socket.h: Add SOCK_CTRL to socket type"
This reverts commit abba05a934.
2023-02-09 09:13:14 +01:00
SPRESENSE
abba05a934 include/sys/socket.h: Add SOCK_CTRL to socket type
SOCK_CTRL is added to provide special control over network drivers
and daemons. Currently, SOCK_DGRAM and SOCK_STREAM perform this control,
but these use socket resources. In the case of usersocket in particular,
this is a waste of the device's limited socket resources.
2023-02-08 20:43:33 +08:00
Xiang Xiao
97e994a1f9 Move SEEK_xxx from unistd.h to sys/types.h
so fcntl.h, stdio.h and unistd.h could get these definiton:
https://en.cppreference.com/w/c/io/fseek
https://pubs.opengroup.org/onlinepubs/7908799/xsh/fcntl.html
https://pubs.opengroup.org/onlinepubs/007904975/functions/lseek.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-02-07 12:16:22 +02:00
dongjiuzhu1
63e6f80fb0 sync: add sync api
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-02-07 12:15:05 +02:00
dongjiuzhu1
14f8a6c2dd fs: support openat/fchmodat/mkfifoat/fstatat/...at api
Refs to:
https://linux.die.net/man/2/openat

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-02-07 03:45:38 +08:00
Stuart Ianna
a2a542562f fs: Implment link as a normal function instead macro
so "using ::link;" can pass the compiling. This change also
simplify the implementation of the hard link in the future.
2023-02-04 18:31:23 -03:00
Xiang Xiao
d92dc45a80 vfs: Suppoprt F_DUPFD_CLOEXEC and MSG_CMSG_CLOEXEC
https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html
https://linux.die.net/man/2/recvmsg

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-02-02 01:00:10 +02:00
Gustavo Henrique Nihei
079e2b8c7c include: Add MIN/MAX definition to sys/param.h
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2023-02-01 23:47:44 +08:00
luojun1
8a5dc0ba12 Force sockaddr_storage to the desired alignment
First configure nuttx to support ipv4 and ipv6 dual stack,
then start two simulators and run Iperf ipv4 udp speed test,
unaligned access exception to sockaddr_in occours.

The root cause is that struct sockaddr_storage isn't set to
the desired alignment.

Signed-off-by: luojun1 <luojun1@xiaomi.com>
2023-02-01 09:46:21 -03:00
Zhe Weng
8819eeaf15 net: Implement shutdown() interface and tcp shutdown
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-01-31 11:15:01 +08:00
anjiahao
3cfd8a350b sys/queue.h: remove CONFIG_ALLOW_MIT_COMPONENTS
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-01-30 11:26:04 +08:00
dongjiuzhu1
f325ed7180 sys/epool.h: add EPOLLET (edge-triggered) flag to fix compile break
dbus/dbus/dbus-pollable-set-epoll.c:258:18: error: ‘EPOLLET’ undeclared
(first use in this function); did you mean ‘EPOLLERR’?
  258 |   event.events = EPOLLET;
      |                  ^~~~~~~
      |                  EPOLLERR

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-01-27 15:30:55 -03:00
Xiang Xiao
f9836c94fb epoll.h: Add u64 field like Linux
https://man7.org/linux/man-pages/man2/epoll_wait.2.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-26 17:11:37 +02:00
Xiang Xiao
819fbd22cc sched: Implement tkill/tgkill
https://linux.die.net/man/2/tgkill

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-26 08:11:56 +02:00
Xiang Xiao
43e7b13697 assert: Log the assertion expression in case of fail
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-24 15:00:19 -03:00
Xiang Xiao
125d090b9c fs: Map madvice to posix_madvice
https://man7.org/linux/man-pages/man2/madvise.2.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-20 11:38:41 +02:00
Jukka Laitinen
b09581f736 Add shm_open and shm_unlink to syscalls
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2023-01-18 11:01:20 +08:00
Xiang Xiao
0a95c7721b vfs/poll: Remove POLLFILE and POLLSOCK NuttX specific extension
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-17 14:02:59 +08:00
Xiang Xiao
32d0c2ce9d libc: Add sys/endian.h to improve the compatiblity with bionic libc
and move the definition from endian.h to sys/endian.h

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-15 12:26:15 -03:00
Xiang Xiao
695f42f8d2 net: Move accept to libc after https://github.com/apache/nuttx/pull/8083
since accept can simply forward to kernel accept4 function

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-13 11:23:42 +02:00
zhanghongyu
48c9d10336 net_socket: add accept4 function
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-01-11 23:28:08 +08:00
Jukka Laitinen
0a885da434 syscall: Always add munmap into syscalls
Munmap interface is always enabled just like mmap is

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2023-01-11 03:11:11 +08:00
Xiang Xiao
b7febf4e19 libc: Move tree.h from include/nuttx to include/sys
to match freebsd layout

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-03 10:34:57 +02:00
dongjiuzhu1
5d643b3bef sys/socket/scm: return NULL when cmsg_len is zero
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2022-12-29 13:25:24 +08:00
dongjiuzhu1
f85d9a9332 fs/signalfd: using file descriptor to accept signal
Reference here:
https://man7.org/linux/man-pages/man2/signalfd.2.html

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2022-12-28 23:05:58 +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
田昕
2719869ab2 Move _assert to kernel space.
Signed-off-by: 田昕 <tianxin7@xiaomi.com>
2022-12-06 18:33:21 +08:00