Commit Graph

1696 Commits

Author SHA1 Message Date
YAMAMOTO Takashi b05320cac2 mm: Move backtrace stuff into a separate option
The functionality has too much overhead for CONFIG_DEBUG_MM.
2022-05-21 14:28:41 +08:00
YAMAMOTO Takashi 0a1ac4762a littlefs_stat: Fix directory size
lfs_info.size is only valid for LFS_TYPE_REG.
For directory, use 0 instead of stack garbage.
2022-05-20 15:37:28 +03:00
Xiang Xiao 22e4f1c59a sched: Remove start from nxsem_tickwait[_uninterruptible]
to simplify both caller and callee

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-05-15 13:55:58 +03:00
anjiahao bc998f6072 fs:fs_getfilep changes fd judgment method
if a fd was closed,need return EBADF
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2022-04-19 22:48:39 +08:00
anjiahao 7ac2d3a5ac fs:oflag need consistent with psock
if don't consistent with psock,call fcntl will have differet flag
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2022-04-19 13:58:56 +03:00
Xiang Xiao ef1a98dd00 Remove the unneeded void cast
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-04-17 23:32:05 +03:00
Petro Karashchenko ebffcdc992 semaphore: fix usage of NXSEM_INITIALIZER
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-04-17 11:38:34 +08:00
Xiang Xiao f14eed6432 vfs/fcntl: Minor style fix
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-04-14 17:21:25 +03:00
liuhaitao 05cc6fb610 fs/fcntl: add O_APPEND flag judge in fcntl
Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
2022-04-14 17:21:25 +03:00
Jukka Laitinen dbc163f1b0 fs/vfs/fs_truncate.c: Use ioctl to truncate on non-mountpoint inode
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2022-04-13 09:40:18 +08:00
YAMAMOTO Takashi c9f3b3a7f1 littelfs: deal with block devices w/o ioctl
Note: Some block devices has ioctl == NULL. eg. drivers/loop
2022-04-11 13:38:26 +03:00
yinshengkai 4b6743591a fs/vfs: fix st_mode mask check
The full mask for st_mode is 0177777
Now modify any file permissions in hostfs and all will fail
2022-04-08 15:06:41 +03:00
Xiang Xiao 9785d6606c openamp: Change the dependence from OPENAMP to RPTUN
since all rpmsg driver need the extension api exposed by rptun driver

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-04-05 10:05:41 +03:00
Petro Karashchenko d08fbca679 nuttx: unify FAR attribute usage across the code
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-04-04 21:32:58 +08:00
Jiuzhu Dong 0a111b7c96 fs/rpmsgfs: fix bug about using uninit variable "times"
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-04-01 21:02:08 +08:00
ligd 6f210655fa rpmsgfs: do NOT access the pointer when do remote ioctl
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-04-01 17:39:38 +08:00
田昕 463a437733 fs and unistd: increase OPEN_MAX by claiming a Kconfig.
Signed-off-by: 田昕 <tianxin7@xiaomi.com>
2022-04-01 12:17:47 +03:00
Jiuzhu Dong 8a80a853b7 fs/romfs: fix string overflow when the length of rn_name exceeds NAME_MAX + 1
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-04-01 12:16:14 +03:00
Jiuzhu Dong b5fb93aefb fs/procfstcbinfo: minor bug about print address
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-04-01 12:14:52 +03:00
Jiuzhu Dong a91d143944 fs/unionfs: add sanity check for parameter
if relpath is NULL, it will cause system crash:
unionfs_opendir with relpath NULL
    ->	unionfs_tryopendir
	    ->	unionfs_offsetpath
		->  strncmp(prefix, relpath, pfxlen

Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-04-01 16:35:43 +08:00
Jiuzhu Dong e4c9a491c8 fs/unionfs: check return value to avoid unused value
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-04-01 16:35:43 +08:00
Jiuzhu Dong 4631face24 fs/unionfs: fix bug about use after free about ui
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-04-01 16:35:43 +08:00
ligd 40d9e10f37 rpmsgfs: use rptun_wait/post to resolve deadlock with usrsock
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-04-01 08:33:57 +03:00
ligd 96ed33f1d8 rpmsgfs: add timeout when mount in rpmsgfs
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-04-01 08:33:57 +03:00
ligd 023c54d0a4 rpmsgfs: add wait ready to rpmsgfs
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-04-01 08:33:57 +03:00
Jiuzhu Dong ca8ce37433 fs/romfs: fix bug about compare path with same prefix
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-03-30 09:04:57 +03:00
ligd b0e0f9db68 opendir: use inode_find() instead when opendir()
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-03-30 03:33:39 +08:00
tianxin7 b53bbb15c5 fs:add _POSIX_OPEN_MAX limit to files_extend
Signed-off-by: 田昕 <tianxin7@xiaomi.com>
2022-03-29 17:51:20 +08:00
Xiang Xiao 37d7298f34 fs/littlefs: Convert the lfs_file_size error code to POSIX's
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-03-29 10:11:13 +08:00
Jiuzhu Dong 1146ff2f61 littlefs: unify lfs error code to nuttx
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-03-29 10:11:13 +08:00
Jiuzhu Dong 66d854371b fs/files_allocate: assert when fd overflow
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-03-29 00:19:13 +08:00
Jiuzhu Dong b03f2e34b8 lseek: use type:off_t for return value
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-03-28 22:49:37 +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
Petro Karashchenko 989e8ac48f fs/romfs: fix size of pointer during memory allocation
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-03-28 10:47:50 +08:00
Jiuzhu Dong a721bc8830 fs/romfs: fix bug about test:examples/romfs
Mounting ROMFS filesystem at target=/usr/local/share with source=/dev/ram1
Traversing directory: /usr/local/share
  DIRECTORY: /usr/local/share/adir/
Traversing directory: /usr/local/share/adir
  FILE: /usr/local/share/adir/anotherfile.txt/
  DIRECTORY: /usr/local/share/adir/subdir/
Traversing directory: /usr/local/share/adir/subdir
  FILE: /usr/local/share/adir/subdir/subdirfile.txt/
Continuing directory: /usr/local/share/adir
  FILE: /usr/local/share/adir/yafile.txt/
Continuing directory: /usr/local/share
  FILE: /usr/local/share/afile.txt/
  FILE: /usr/local/share/hfile/
ERROR: ldir never found
Finished with  1 errors

Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-03-27 14:24:19 +03:00
ligd 0d365f6fb9 epoll: fix epoll close error, report by kasan
-#9  0xf7abf899 in __asan::__asan_report_load2 (addr=4072681776) at ../../../../../src/libsanitizer/asan/asan_rtl.cc:117
-#10 0x5693f718 in inode_release (node=0xf2c03124) at inode/fs_inoderelease.c:69
-#11 0x568ea61b in file_close (filep=0xf55fedd0) at vfs/fs_close.c:79
-#12 0x568e7e56 in nx_close (fd=3) at inode/fs_files.c:528
-#13 0x568e7f0e in close (fd=3) at inode/fs_files.c:562
-#14 0x56e76c39 in epoll_close (epfd=3) at vfs/fs_epoll.c:252
-#15 0x56c33829 in sensor_service_delete (ctrl=0x578b8540 <control>) at src/common.c:439
-#16 0x56a0561e in sensor_middle_service_main (argc=1, argv=0xf55de820) at sensor_main.c:118
-#17 0x56878675 in nxtask_startup (entrypt=0x56a054cc <sensor_middle_service_main>, argc=1, argv=0xf55de820) at sched/task_startup.c:70
-#18 0x5684427a in nxtask_start () at task/task_start.c:133
-#19 0xdeadbeef in ?? ()

reason:
epoll_close -> close -> epoll_do_close (free inode)
                     -> inode_release  (reuse inode, crash)

fix:
use the global inode to match the fd which will return to user.
like the g_sock_inode in fs/socket/socket.c

Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-03-27 08:51:21 +03:00
Jiuzhu Dong 709207b8d3 mm/memdump: dynamic turn on backtrace in heap when enable DEBUG_MM
default turn off.
turn on: echo on > /proc/memdump
turn off: echo off > proc/memdump

Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-03-27 13:21:48 +08:00
Jiuzhu Dong 42664f4505 rpmsgfs/rename: fix bug about pathname align with 8bytes
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-03-27 05:16:13 +03:00
Xiang Xiao 4d8c92603b Fix rpmsgfs/rpmsgfs_client.c:774:3: warning: 'strcpy' writing 1 or more bytes into a region of size 0 overflows the destination
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-23 10:52:46 +02:00
Petro Karashchenko 68902d8732 pid_t: unify usage of special task IDs
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-03-22 21:22:32 +08:00
Xiang Xiao 0f2f48f8ba sys/type.h: Change pid_t from int16_t to int
to fix the following warning:
include/unistd.h:302:9: error: incompatible redeclaration of library function 'vfork' [-Werror,-Wincompatible-library-redeclaration]
pid_t   vfork(void);
        ^
include/unistd.h:302:9: note: 'vfork' is a builtin with type 'int (void)'

and change 32768 to INT_MAX to match the type change

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-21 15:48:33 +02:00
chao.an 8308f32863 fs/rpmsgfs: minor refine the return value
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-03-19 10:28:41 +02:00
chao.an 9de2818c18 fs/nfs: fix compile warning
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-03-19 02:20:20 +08:00
Xiang Xiao c2a1d0f5ae procfs: Remove mallinfo from struct procfs_meminfo_entry_s
let's call mm_mallinfo directly

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-17 13:59:03 -03:00
Xiang Xiao dfb9a763a7 fs: Initialize g_inode_sem at the definition place
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-12 15:06:39 -03:00
Xiang Xiao f1339ba479 fs/fat: Change the default value of FAT_MAXFNAME to NAME_MAX
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-10 19:46:01 +02:00
Xiang Xiao b3b48a658f fs/aio: Don't include include/nuttx/net/net.h
since it isn't really used

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-04 22:03:55 +02:00
Xiang Xiao b2c86f808d net: Remove psock_fcntl related code
since the nonblocking mode set through psock_ioctl now

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-04 22:03:55 +02:00
Xiang Xiao 19e796305a vfs: Forward fcntl(F_SETFD...) to ioctl(FIOCLEX|FIONCLEX...)
this is follow change to:
commit 37730a1fce
Author: fangzhenwei <fangzhenwei@xiaomi.com>
Date:   Thu Nov 25 13:43:10 2021 +0800

    nuttx/fcntl:pass O_NONBLOCK flag to ioctl

    1. fix pty fcntl F_SETFL(O_NONBLOCK) fail issue

    Signed-off-by: fangzhenwei <fangzhenwei@xiaomi.com>

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-04 22:03:55 +02:00
Jiuzhu Dong 2197fb2b51 fs/romfs: fix read file mismatch when the length of file name is 16
romfs: file name must end with '\0'

Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-03-01 11:44:27 -03:00