Commit Graph

46815 Commits

Author SHA1 Message Date
YAMAMOTO Takashi 4eee9af668 file_vopen: Retry as a directory in case of EISDIR
This allows you to open() a directory without O_DIRECTORY.
2022-10-19 21:20:35 +08:00
YAMAMOTO Takashi aa67e0a0f4 inode_stat: handle INODE_IS_PSEUDODIR case
If you open() a directory and fstat() it, you come here.
This commit fixes the file type in that case.
2022-10-19 21:20:35 +08:00
SPRESENSE c48feac0e9 arch: cxd56xx: gnss: Fix compile error
Fix a compile error caused by
d1d4633 Replace nxsem API when used as a lock with nxmutex API
2022-10-19 14:10:51 +02:00
Fotis Panagiotopoulos ec93385dfa strftime: Added support for the %w format specifier. 2022-10-19 12:43:28 +08:00
Fotis Panagiotopoulos f9fd53cda1 gmtimer: Fixed range of tm_yday. 2022-10-19 12:39:04 +08:00
dongjiuzhu1 55106685fa libc/localtime: Update to consistent with mainline
https://github.com/eggert/tz

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2022-10-19 10:27:52 +08:00
dongjiuzhu1 7b2371f0ed libc/localtime: fix timegm return error when tz with isdst
testcase:
set TZ CEST
time_t t = time(NULL);
struct tm *ts = localtime(&t);
t = timegm(ts);
t will return (time_t)-1;

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2022-10-19 10:27:52 +08:00
Jiuzhu Dong 1b9ed5725b libc/time: Return failed when lock is already held to avoid deadlock
when enable LIBC_LOCALTIME and SYSLOG_TIMESTAMP_LOCALTIME
and zoneinfo/posixrulesi isn't exist

[ EMERG] [ap] backtrace:
[ EMERG] [ap] [20] [<0xc1cc3c4>] arm_switchcontext+0xc/0x10
[ EMERG] [ap] [20] [<0xc1ac67a>] sem_wait+0x5a/0xc0
[ EMERG] [ap] [20] [<0xc1c4588>] tzset.part.0+0x8/0x160
[ EMERG] [ap] [20] [<0xc1c58de>] localtime_r+0xc6/0x114
[ EMERG] [ap] [20] [<0xc1a910a>] clock_gettime+0x16/0xa8
[ EMERG] [ap] [20] [<0xc1b7622>] nx_vsyslog+0x9e/0xc0
[ EMERG] [ap] [20] [<0xc4ba7e0>] romfs_stat+0xa4/0xf4
[ EMERG] [ap] [20] [<0xc4b47bc>] inode_semtake+0x24/0x5c
[ EMERG] [ap] [20] [<0xc1c0102>] bsearch+0x26/0x6c
[ EMERG] [ap] [20] [<0xc1c265a>] vsyslog+0x16/0x24
[ EMERG] [ap] [20] [<0xc1c2676>] syslog+0xe/0x1c
[ EMERG] [ap] [20] [<0xc4bae12>] romfs_open+0xee/0x178  <--- err log
[ EMERG] [ap] [20] [<0xc4b68ae>] file_vopen+0x116/0x144
[ EMERG] [ap] [20] [<0xc4b6ac8>] open+0x20/0x60
[ EMERG] [ap] [20] [<0xc1c3df4>] tzload+0x84/0x810
[ EMERG] [ap] [20] [<0xc1c6ef4>] mm_zalloc+0x10/0x18
[ EMERG] [ap] [20] [<0xc4bb426>] romfs_checkmount+0x22/0x58
[ EMERG] [ap] [20] [<0xc4bad74>] romfs_open+0x50/0x178
[ EMERG] [ap] [20] [<0xc1c392c>] tzparse+0x2c/0x470
[ EMERG] [ap] [20] [<0xc1ac5da>] nxsem_wait_uninterruptible+0x8a/0xd0
[ EMERG] [ap] [20] [<0xc1ac690>] sem_wait+0x70/0xc0
[ EMERG] [ap] [20] [<0xc4b47bc>] inode_semtake+0x24/0x5c
[ EMERG] [ap] [20] [<0xc4b481c>] inode_semgive+0x28/0x58
[ EMERG] [ap] [20] [<0xc4b58b4>] file_close+0x18/0x44
[ EMERG] [ap] [20] [<0xc4b4690>] close+0x80/0xb4
[ EMERG] [ap] [20] [<0xc1c43f4>] tzload+0x684/0x810
[ EMERG] [ap] [20] [<0xc1c4616>] tzset.part.0+0x96/0x160
[ EMERG] [ap] [20] [<0xc1c58de>] localtime_r+0xc6/0x114
[ EMERG] [ap] [20] [<0xc1a910a>] clock_gettime+0x16/0xa8
[ EMERG] [ap] [20] [<0xc1ea692>] cmd_date+0x276/0x37c

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2022-10-19 10:27:52 +08:00
wangbowen6 8b84d19771 lib_localtime: gmtime_r should get right time in OS init process
Enable CONFIG_LIBC_LOCALTIME,CONFIG_RTC and CONFIG_SCHED_TICKLESS
In os clock init process, clock_initialize() --> ... -->
sim_rtc_rdtime() --> gmtime_r() --> gmtsub() --> return NULL
get the error rtctime.

Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2022-10-19 10:27:52 +08:00
Jiuzhu Dong 0bff62e3e8 libc/time: don't take semaphore in idle task
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2022-10-19 10:27:52 +08:00
chao an 6978446b8e net/tcp: remove debug counter of connect instance
Fixed by commit:

 | net: remove pvconn reference from all devif callback
 |
 | Do not use 'pvconn' argument to get the connection pointer since
 | pvconn is normally NULL for some events like NETDEV_DOWN.
 | Instead, the connection pointer can be reliably obtained from the
 | corresponding private pointer.

Signed-off-by: chao an <anchao@xiaomi.com>
2022-10-19 09:46:02 +08:00
Xiang Xiao dcbad62fef boards/sim: Restore ostest from https://github.com/apache/incubator-nuttx/pull/7109
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-19 08:22:56 +09:00
Xiang Xiao 9ccddde6a9 sched/spawn: Launch nxposix_spawn_proxy through nxthread_create
to ensure the caller environment variable always get copied

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-19 08:22:56 +09:00
Xiang Xiao aed85964ff sched/env: Don't need copy env variable from parent in env_dup
since caller always pass them if needed

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-19 08:22:56 +09:00
Xiang Xiao e2a18ad339 sched: Support envp argument of task_spawn and nxtask_create
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-19 08:22:56 +09:00
Xiang Xiao 9f4bb7da97 binfmt: Let binfmt_copyargv return error code
so the caller can distinguish the empty argument and out of memory quickly

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-19 08:22:56 +09:00
Xiang Xiao 774648de0f risc0v/bl602: Call kthread_create instead of nxtask_create in bl_os_task_create
since the kernel component should use the kernel thread instead the normal task

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-19 08:22:56 +09:00
Xiang Xiao edd68d8ae9 board: Change CONFIG_SYSTEM_NSH_SYMTAB to CONFIG_NSH_SYMTAB
follow the apps side change

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-18 22:18:51 +02:00
raiden00pl 27db9558de stm32/socketcan: fixes for arm_netinitialize 2022-10-18 15:35:21 -03:00
Fotis Panagiotopoulos ca9aeeec1f freopen: Added flush of the read buffers. 2022-10-18 23:29:55 +08:00
Xiang Xiao d200cacc49 arch/armv7-r: Fix typo error in commit 4fab2b9501
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-18 10:31:07 -03:00
nietingting 33b7219caa install qemu-system-arm in docker
Signed-off-by: nietingting <nietingting@xiaomi.com>
2022-10-18 21:29:25 +08:00
Fotis Panagiotopoulos 10d6de46e6 libfread: Fixed error flag when reading a write-only file. 2022-10-18 21:29:14 +08:00
Xiang Xiao 6b31918b42 Remove the unnecessary cast for main_t, NULL and argv
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-18 08:51:45 +02:00
Xiang Xiao 7923ea3bef boards: Refresh defconfig after the default value of FS_PROCFS_EXCLUDE_xxx
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-18 15:10:26 +09:00
Xiang Xiao b9a4bedc7f fs/procfs: Change FS_PROCFS_EXCLUDE_xxx default value to DEFAULT_SMALL
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-18 15:10:26 +09:00
Xiang Xiao 36c05601df fs/procfs: Fix warning when all CONFIG_FS_PROCFS_EXCLUDE_xxx are enabled
procfs/fs_procfs.c: In function 'procfs_readdir':
Error: procfs/fs_procfs.c:719:9: error: unused variable 'pid' [-Werror=unused-variable]
  719 |   pid_t pid;
      |         ^~~
Error: procfs/fs_procfs.c:716:21: error: unused variable 'tcb' [-Werror=unused-variable]
  716 |   FAR struct tcb_s *tcb;
      |                     ^~~
procfs/fs_procfs.c: At top level:
Error: procfs/fs_procfs.c:206:16: error: 'procfs_enum' declared 'static' but never defined [-Werror=unused-function]
  206 | static void    procfs_enum(FAR struct tcb_s *tcb, FAR void *arg);
      |                ^~~~~~~~~~~
procfs/fs_procfs.c: In function 'procfs_readdir':
Error: procfs/fs_procfs.c:878:35: error: array subscript <unknown> is outside array bounds of 'const struct procfs_entry_s[0]' [-Werror=array-bounds]
  878 |       if (strncmp(g_procfs_entries[level1->base.index].pathpattern,
      |                   ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
procfs/fs_procfs.c:98:36: note: while referencing 'g_procfs_entries'
   98 | static const struct procfs_entry_s g_procfs_entries[] =
      |                                    ^~~~~~~~~~~~~~~~
Error: procfs/fs_procfs.c:879:35: error: array subscript <unknown> is outside array bounds of 'const struct procfs_entry_s[0]' [-Werror=array-bounds]
  879 |                   g_procfs_entries[level1->firstindex].pathpattern,
      |                   ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
procfs/fs_procfs.c:98:36: note: while referencing 'g_procfs_entries'
   98 | static const struct procfs_entry_s g_procfs_entries[] =
      |                                    ^~~~~~~~~~~~~~~~
Error: procfs/fs_procfs.c:745:24: error: array subscript <unknown> is outside array bounds of 'const struct procfs_entry_s[0]' [-Werror=array-bounds]
  745 |               pentry = &g_procfs_entries[index - priv->nentries];
      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
procfs/fs_procfs.c:98:36: note: while referencing 'g_procfs_entries'
   98 | static const struct procfs_entry_s g_procfs_entries[] =
      |                                    ^~~~~~~~~~~~~~~~
Error: procfs/fs_procfs.c:745:41: error: array subscript <unknown> is outside array bounds of 'const struct procfs_entry_s[0]' [-Werror=array-bounds]
  745 |               pentry = &g_procfs_entries[index - priv->nentries];
      |                         ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-18 15:10:26 +09:00
Xiang Xiao befc748460 fs/procfs: Simplify the code logic and fix the style issue
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-18 15:10:26 +09:00
nietingting ecb80dd888 install qemu on docker
Signed-off-by: nietingting <nietingting@xiaomi.com>
2022-10-18 07:56:04 +02:00
Zhe Weng d8f35cf1b6 arch/sim: calling txdone callback after devif_loopback in netdriver
When devif_loopback handles a packet (like a ping targeting at this dev), it does not call the txdone callback, breaking the tx pipeline and may left some packets unhandled, delayed until next transmit on the network interface.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2022-10-18 11:16:33 +08:00
Zhe Weng cb25a9dee3 arch/sim: change g_avail_work and g_recv_work to array in netdriver
Share one worker between multiple simulated network devices may work most of the time, but sometimes breaks the tx pipeline when sending packets on more than one interface at the same time, and leaves some packets unprocessed in network stack, delayed until next transmit on the network interface. The rx process is likely delayed in packet processing under similar situation, so keep g_avail_work and g_recv_work the same number as interfaces.

dev0 tx1 avail              tx1 done
        v                      v
work dev0 tx1 -> dev0 tx1 -> empty -> dev1 tx2 -> dev1 tx3 -> empty
                    ^                    ^           ^          ^
dev1     tx2 avail (failed to queue)  tx3 avail   tx2 done   tx3 done

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2022-10-18 11:16:33 +08:00
Xiang Xiao 4fab2b9501 arch/armv7-[a|r]: Don't define fiq stack if CONFIG_ARMV7A_DECODEFIQ=n
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-18 08:01:52 +09:00
Xiang Xiao c6f3ad3da5 boards/sim: Enable CONFIG_NSH_TELNET_LOGIN for adb
to test the telnet login functionality

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-18 08:01:28 +09:00
Alan Carvalho de Assis 0e091b2486 esp32_qencoder: Fix small issues and typos reported by Tiago Medicci 2022-10-18 03:03:28 +08:00
zouboan ba2b37e23f Update arch/sparc/include/spinlock.h
Co-authored-by: Alan Carvalho de Assis <alan.carvalho@espressif.com>
2022-10-18 00:55:30 +08:00
zouboan d51d109d0a arch/sparc build CMN_SRC in common dir to keep up with other arch 2022-10-18 00:55:30 +08:00
zouboan 9b55b0af63 arch/sparc add support of spinlock for LEON3 and LEON4 2022-10-18 00:55:30 +08:00
Masayuki Ishikawa c2caccf1d0 boards: rv-virt: Update README.txt
Summary:
- This commit updates README.txt regarding how to build kernel
  and apps for BUILD_KERNEL
- Also update on parallel build for BUILD_FLAT

Impact:
- None

Testing:
- Tested with qemu-7.1.0

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2022-10-17 19:19:00 +08:00
Xiang Xiao dca5a3483f drivers: Destroy mutex and sem in the error path
also correct the order to ensure the memory free is last step

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-17 15:59:46 +09:00
anjiahao dee38ce3e8 arch: Replace critical section with nxmutex in i2c/spi/1wire initialization
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-17 15:59:46 +09: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
Alan Carvalho de Assis 0dfd1f004d esp32-devkitc: Add board support to Rotary Encoder
Reviewed-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-10-17 00:30:53 +02:00
Alan Carvalho de Assis 655faa33d4 ESP32: Add support to Quadrature Encoder
Reviewed-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-10-17 00:30:53 +02:00
Bernd Walter 947e771c41 fix typo big letter 'o' in hex value for zero. 2022-10-17 02:55:21 +08:00
Xiang Xiao 47b47e0bb7 fs/vfs: Remove the redundancy file name comparison in mountptrename
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-16 15:27:08 -03:00
Xiang Xiao 7b19a605a7 fs/vfs: Free subdir before allocate new one in pseudorename
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-16 15:27:08 -03:00
Xiang Xiao 6854cce059 sched/spawn: Add the dummy task_spawnattr_xxxstackyyy in the kernel mode
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-16 19:13:42 +02:00
Xiang Xiao b9cd0508e7 boards: Correct xxx_main prototype
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-16 19:02:44 +02:00
Xiang Xiao 78f6a02bc8 boards: Remove the duplicated prototype of CONFIG_INIT_ENTRYPOINT
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-16 19:02:44 +02:00
Hidenori Matsubayashi ffe8dd39c6 arch/arm64: update for coding style
Replace "unsigned char" with "bool".

Signed-off-by: Hidenori Matsubayashi <hidenori.matsubayashi@gmail.com>
2022-10-16 17:20:14 +08:00