Commit Graph

406 Commits

Author SHA1 Message Date
yinshengkai ce98f186c0 syslog: add syslog channel filtering function
support to control the opening or closing of the specified channel through the syslogmask command at runtime

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-07-13 01:04:07 +08:00
Xiang Xiao 935f43185f libc/modlib: Replace nx_stat with file_stat
to avoid searching the path twice

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-07-06 09:20:24 -03:00
liaoao 108c47c07b procfs:add armv7-m cpuinfo
Signed-off-by: liaoao <liaoao@xiaomi.com>
2023-05-27 03:29:41 +08:00
liaoao 6ea3eb3ce2 procfs:add /proc/cpuinfo
Signed-off-by: liaoao <liaoao@xiaomi.com>
2023-05-27 03:29:41 +08:00
hujun5 90387a5b41 libc/misc: add fdsan module
FD (file descriptor) is widely used in system software development,
and almost all implementations of posix os (including nuttx) use FD as an index.
the value of fd needs to be allocated starting from the minimum available value of 3, and each process has a copy,
so the same fd value is very easy to reuse in the program.

In multi threaded or multi process environments without address isolation,
If the ownership, global variables, and competition relationships of fd are not properly handled,
there may be issues with fd duplication or accidental closure.
Further leading to the following issues, which are difficult to troubleshoot.

1. Security vulnerability: the fd we wrote is not the expected fd and will be accessed by hackers to obtain data
2. Program exceptions or crashes: write or read fd failures, and program logic errors
3. The structured file XML or database is damaged: the data format written to the database is not the expected format.

The implementation principle of fdsan is based on the implementation of Android
https://android.googlesource.com/platform/bionic/+/master/docs/fdsan.md

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2023-05-17 10:24:42 +08:00
chao an 507c8145a9 sched/spawn: remove spawn proxy thread to simplify task/posix_spawn()
The spawn proxy thread is a special existence in NuttX, usually some developers
spend a lot of time on stack overflow of spawn proxy thread:

https://github.com/apache/nuttx/issues/9046
https://github.com/apache/nuttx/pull/9081

In order to avoid similar issues, this PR will remove spawn proxy thread to simplify
the process of task/posix_spawn().

1. Postpone the related processing of spawn file actions until after task_init()
2. Delete the temporary thread of spawn proxy and related global variables

Signed-off-by: chao an <anchao@xiaomi.com>
2023-04-27 17:35:58 +08:00
Xiang Xiao dd631265c4 fs: Add g_ prefix for all global mountpt_operations instances
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-04-24 16:13:29 +02:00
chao an 8b43096e28 fs/hostfs: align operation flags define with fcntl.h
follow the change: https://github.com/apache/nuttx/pull/6357

Signed-off-by: chao an <anchao@xiaomi.com>
2023-04-19 02:50:20 +08:00
Oreh 9902f39d92 Add MTD loop driver (use filemtd) 2023-02-19 19:46:48 +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
chao an ccaa625930 fs/smart: fix visual studio Compiler Error C2016
D:\archer\code\nuttx\include\nuttx/fs/smart.h(118,1):
  error C2016: C requires that a struct or union has at least one member

Compiler error C2016: C requires that a struct or union has at least one member

Reference:
https://docs.microsoft.com/en-us/cpp/error-messages/compiler-errors-1/compiler-errors-c2001-through-c2099?view=msvc-170

Signed-off-by: chao.an <anchao@xiaomi.com>
Signed-off-by: chao an <anchao@xiaomi.com>
2023-02-09 20:11:55 +08: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
Xiang Xiao 9f027208d4 fs: Add model field to geometry and mtd_geometry_s
the model is very useful to track the device info

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-31 11:50:28 -03:00
Oleksandr Oryshchenko 28f92e8238 [MTD/SmartFS] Extract register_driver call to own function 2023-01-30 11:09:40 +08:00
Petro Karashchenko 8e72b07a62 nuttx: Add missing FAR and CODE
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-01-27 13:23:25 +08:00
liushuai25 6b729487fb feat: add mipidsi support
add mipi dsi subsystem support.

reference links:
https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/drm_mipi_dsi.c
https://github.com/torvalds/linux/blob/master/include/video/mipi_display.h

Signed-off-by: liushuai25 <liushuai25@xiaomi.com>
2023-01-13 23:10:56 +08:00
田昕 587305723e drivers/pipe:add PIPEIOC_POLLTHRES to set POLLIN/POLLOUT threshold
Signed-off-by: 田昕 <tianxin7@xiaomi.com>
2023-01-10 13:33:13 +08:00
Xiang Xiao b0a0ba3ad7 fs: Move mmap callback before truncate in [file|mountpt]_operations
since mmap may exist in block_operations, but truncate may not,
moving mmap beforee truncate could make three struct more compatible

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-04 17:43:59 +02:00
Jukka Laitinen f33dc4df3f Change FIOC_MMAP into file operation call
- Add mmap into file_operations and remove it from ioctl definitions.
- Add mm_map structure definitions to support future unmapping
- Modify all drivers to initialize the operations struct accordingly

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2023-01-02 11:23:20 -03:00
Jukka Laitinen 41e9df2f3e Add ftruncate into file operation calls
- Add truncate into file_operations
- Move truncate to be common for mountpt_operations and file_operations
- Modify all drivers to initialize the operations struct accordingly

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2023-01-02 11:23:20 -03:00
Jukka Laitinen 36528eed64 Revert "fs/vfs/fs_truncate.c: Use ioctl to truncate on non-mountpoint inode"
This reverts commit dbc163f1b0.
2023-01-02 11:23:20 -03:00
Xiang Xiao fd0d6a9bf5 compiler.h: Add _ between format|printf|syslog|scanf|strftime and like
align with other macro naming style

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-12-21 01:05:19 +02:00
chao an 47fbfa215e fs/hostfs: mode_t of mkdir(2) should use the nuttx prototype
Signed-off-by: chao an <anchao@xiaomi.com>
2022-12-13 18:16:20 +08:00
tangyusong1 f454dfccb2 Adjust ioctl function of cellular
Add SIOCGCELLNETDEV
Give a uint8_t[136] for cellular to save data

Signed-off-by: tangyusong1 <tangyusong1@xiaomi.com>
2022-12-09 11:19:55 +08:00
Xiang Xiao e292200f61 video: Move _VIDIOCBASE and _VIDIOC to include/nuttx/fs/ioctl.h
to align with other drivers

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-05 06:51:53 +01:00
Xiang Xiao 488a56280a fs: Correct the comment of file_allocate
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-28 10:12:08 +02:00
Xiang Xiao 604eea453b fs/vfs: Let caller control whether add the reference count of inode in file_allocate
to simplify the caller in some special case

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-28 10:12:08 +02:00
Xiang Xiao 4d4bb458da fs/vfs: Move file_allocate from fs/inode/inode.h to include/nuttx/fs/fs.h
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-28 10:12:08 +02:00
Xiang Xiao 6940ca8677 fs: Remove the duplication umount macro
which is already defined in include/sys/mount.h

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-27 23:14:25 +02:00
Xiang Xiao 19bded4738 fs: Remove the unused nx_pipe to prefer file_pipe for kernel
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-27 23:14:25 +02:00
Xiang Xiao fc1efe2c0b fs: Remove the unused nx_fcntl to prefer file_fcntl for kernel
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-27 23:14:25 +02:00
Xiang Xiao b22cc1e2b8 fs: Remove the unused nx_dup to prefer file_dup for kernel
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-27 23:14:25 +02:00
Xiang Xiao cf21319d3a fs: Remove the unused nx_poll to prefer file_poll for kernel
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-27 23:14:25 +02:00
Xiang Xiao aa31648c9f fs: Remove the unused nx_[v]ioctl to prefer file_[v]ioctl for kernel
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-27 23:14:25 +02: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
Alin Jerpelea 06c8e43df9 drivers: modem: update altair modem
update Altair modem with the ALT1250 implementation

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2022-10-22 09:00:32 +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
Xiang Xiao db518bf0df fs: Allocate unique serial number for the root pseduo file system node
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-20 16:21:06 +08:00
chao an 8b238e0b3d net/wireless: separate command catagory of bt/pktradio from wireless ioctl
1. separate command catagory of bt/pktradio from wireless ioctl
2. Remove commoand count limit to support vendor command

Signed-off-by: chao an <anchao@xiaomi.com>
2022-09-20 01:16:22 +08:00
wangbowen6 25c2f3e042 driver: move find_mtddriver() to fs.h and add close_mtddriver.c
Rpmsg mtd need a way to find the mtd device according to the
mtd device path.

Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2022-09-09 19:27:57 +08:00
Nathan Hartman de8d54781c fs: Fix symbol name in comments 2022-09-08 09:01:55 +08:00
Xiang Xiao 5f93ae9dd2 fs/rpmsg: Move the server initialization to fs_initialize
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-08-11 02:08:42 +03:00
Jiuzhu Dong 4dbf4555eb fs/dir: support fchdir and dirfd
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-08-09 23:30:01 +08:00
Jiuzhu Dong fe17f747a7 fs/directory: move private directory information to filesystem
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-08-09 23:30:01 +08:00
Jiuzhu Dong 90db4daca9 fs/directory: update readdir interface for all filesystem
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-08-09 23:30:01 +08:00
Jiuzhu Dong 3a70962b7a fs/directory: use file mode to manage directory
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-08-09 23:30:01 +08:00
Jiuzhu Dong 094e986bbd fcntl/O_CLOEXEC: add O_CLOEXEC map for hostfs
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-08-09 23:30:01 +08:00
Jiuzhu Dong 9899dd0ec0 mm/mm_heap: change CONFIG_MM_BACKTRACE to int type
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-26 23:45:31 +08:00
Xiang Xiao 344a9bc838 fs/hostfs: Change nuttx_dev_t from uint16_t to uint32_t
Follow up the following change:
commit 008cb0d31a
Author: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
Date:   Thu Jul 14 02:27:34 2022 +0000

    sys/sysmacros.h: support sysmacros header

    Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-07-22 17:08:50 +03:00