Commit graph

41877 commits

Author SHA1 Message Date
Xiang Xiao
800754a9be Replace mktime with timegm in rtc and fs driver
since kernel component should use UTC instead local time

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Icf939e1ab0af8e577105f539d2553bc67b3b3d10
2021-06-24 20:53:53 +08:00
Xiang Xiao
fed064f45e libc/time: Implement timegm function
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Id988ae077cf54597b2522546c4309b66416b8b0e
2021-06-24 20:53:17 +08:00
Xiang Xiao
a8cf6a6655 net: Fix: left shift of 1 by 31 places cannot be represented in type 'long int'
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Id2daa60834f7b1917b15bbad89b091b59311e988
2021-06-24 11:42:55 +08:00
Jiuzhu Dong
05d9dc5682 syslog: fix crash when print localtime by syslog
N/A

Enable
CONFIG_LIBC_LOCATIME=y
CONFIG_SYSLOG_TIMESTAMP_FORMATTED=y
CONFIG_SYSLOG_TIMESTAMP_LOCALTIME=y
CONFIG_SYSLOG_TIMESTAMP_REALTIME=y

Change-Id: I322830e0818237a7eb65a158a6a0dea8f9da9b6c
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
(cherry picked from commit 95f97277caf827e145275a1a3b6d82a4535c8c4d)
2021-06-23 10:28:35 +08:00
Xiang Xiao
298f743ea4 sched/wqueue: Remove the unused kwork_lpthread.c
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I7f525f4e9ba847f32c7777b89f7bd738b2487a9f
2021-06-18 21:03:30 +08:00
Xiang Xiao
b3bcc02a04 sched: Identify the stack need to free by TCB_FLAG_FREE_STACK
instead calling kmm_heapmember or umm_heapmember because:
1.The stack supplied by caller may allocate from heap too
2.It's hard to implement these two function in ASan case

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I196377822b7c4643ab4f29b7c1dc41dcd7c4dab1
2021-06-18 20:59:03 +08:00
chao.an
a3a0f578bc sched/wqueue: replace the notification mech from signal to semaphore
Change-Id: I57596eb661083e914c8718b7c3c1b7190bfa2863
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-06-18 20:44:04 +08:00
chao.an
96f5a5f2c0 drivers/rptun: replace the notification mech from signal to semaphore
Change-Id: Ic06b945effa876f5aff2f8ddc1fe5775c75f77b1
Signed-off-by: chao.an <anchao@xiaomi.com>
(cherry picked from commit 8df58e5675cab032da16e371c4686929a19ee897)
2021-06-18 20:37:47 +08:00
pengyiqiang
0caf78a9c7 sim: Fix posix_memalign mapping error.
N/A

Change-Id: Ie62aac122c8daa11d4118b5b3837016d0283164d
Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com>
2021-06-18 11:00:50 +08:00
Xiang Xiao
c1593c0f2f Revert "sched/init: don't check remain stack for idle task"
This reverts commit 9b4b8cb0ee.
2021-06-17 22:46:46 +08:00
Jiuzhu Dong
2e6932316e syslog/ramlog_channel: fix log confusion when multi task writing together
N/A

Change-Id: I2a17a81028862ccdd3936862e2548f93c4837ae1
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
(cherry picked from commit a96a9ef5279f50f7fb7fb262cb2b1cd5285f2d8b)
2021-06-17 22:02:39 +08:00
Jiuzhu Dong
40789e2d98 sched/idle: disable sched when idle call nx_bringup
Because idle task will call mm_malloc to create some task
and will take sem of mm. But if smp enable, the sem of mm may be
taken by other cpu, so idle may be block because take this sem and crash.

Change-Id: I22f0233ef6c59a1b81607d4389e68f8646c89395
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-06-17 22:01:57 +08:00
Jiuzhu Dong
90abae1b91 syslog/default_channel: fix log confusion when multi task writing together
N/A

Change-Id: I3ef830c437bd9631272a300e309b88c84fdaa275
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
(cherry picked from commit 74d9cb80b38109392029206f66f6b8af63229bbc)
2021-06-17 22:01:41 +08:00
Xiang Xiao
8b26671c40 syslog/ramlog: Remove the duplication of \n->\r\n conversion
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I5497f3ab40a55c5c08ba893e1186b93915cef03a
2021-06-17 21:52:54 +08:00
Xiang Xiao
95338b2139 net/local: Remove all HAVE_LOCAL_POLL reference
since HAVE_LOCAL_POLL always hardcode to 1

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-17 21:52:54 +08:00
anchao
d24b879e63 Revert "net/socketpair: move socketpair implement into socket internal"
This reverts commit a66e18bc53.

Reason for revert: <N/A>

Change-Id: I3b707a2f6f52fb4a9eb2ab649b686b955b879d65
2021-06-17 20:23:59 +08:00
ligd
200a1d51d3 arm: fix enable interrupt too earlier caused system crash
reason:
	msr	cpsr, r2   /* Set the CPSR */

    // interrupt hanppend, context switch

	pop	{r0-r2, pc}

resolve:
    use SPSR instead, and recover with ldmia ^

Change-Id: Id7cee6452997ec19919eeecf6e7616164b3a0ab3
Signed-off-by: ligd <liguiding1@xiaomi.com>
(cherry picked from commit 6fa6c1676932d7babb7ff22ef556a17bb18f1c0d)
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-06-17 14:39:22 +08:00
hujie1
3da44d798a nuttx: littlefs_close should return value bugfix
N/A

Change-Id: I5fea016fe01ac0e87ddeabdae67d36ab4125ea55
2021-06-16 22:55:14 +08:00
chao.an
37c2bc18db net/local: extern local_generate_instance_id() interface
Change-Id: I14273d11b1fe4d6bdc15b14e32da609cc7883713
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-06-16 17:28:14 +08:00
chao.an
a66e18bc53 net/socketpair: move socketpair implement into socket internal
Change-Id: I1c6d7178e2631e43d9fcc99918456eec36f730ce
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-06-16 15:19:44 +08:00
chao.an
70135e1e45 sys/poll: add POLLRDHUP definition
Change-Id: I1117279d9a620138789256d699ae32d47eab3a90
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-06-16 14:15:14 +08:00
Xiang Xiao
34f16c87c4 binfmt: Handle argv/argv[0] == NULL correctly in exec_module
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-15 21:55:30 -07:00
Xiang Xiao
f5570eac5a sched/posix_spawn: Don't insert name at the begin of argv
since the standard require the caller pass the name explicitly
https://pubs.opengroup.org/onlinepubs/009695399/functions/posix_spawn.html:
The argument argv is an array of character pointers to null-terminated strings.
The last member of this array shall be a null pointer and is not counted in argc.
These strings constitute the argument list available to the new process image.
The value in argv[0] should point to a filename that is associated with the
process image being started by the posix_spawn() or posix_spawnp() function.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-15 21:55:30 -07:00
Xiang Xiao
1c02246a78 Revert "sched/posix_spawn: Don't insert name at the begin of argv"
This reverts commit 032086870d.
2021-06-15 21:55:30 -07:00
chao.an
27aad31338 sim: add posix_memalign() to nuttx-names.in
hide the symbol definition from up_hostmemory.c:
147:  error = posix_memalign(&p, alignment, size);

Change-Id: I0bbc509c1ecf43388f6b21997a878a5f5fecf60a
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-06-15 14:59:01 +08:00
chao.an
6b1ca37048 net/accept: alloc the accept fd after accept success
Change-Id: Id879e831dcb5d25eff27cde76ca4cc59a000e02f
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-06-15 11:23:13 +08:00
chao.an
693bd87cab net/sock: move the psock calloc out of sockfd_allocate
Change-Id: I3b5373ffe9a4034c2ac2cd83389fd46c47dc9047
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-06-15 11:23:13 +08:00
chao.an
c04f6dfebe Revert "net/accept: alloc the accept fd after accept success"
This reverts commit 28363bf9a8.

Change-Id: Iafa64ca1af83afa537cd00bf0f67ac76d749b86c
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-06-15 11:23:05 +08:00
Xiang Xiao
a8ca032acc sched/posix_spawn: Don't insert name at the begin of argv
since the standard require the caller pass the name explicitly
https://pubs.opengroup.org/onlinepubs/009695399/functions/posix_spawn.html:
The argument argv is an array of character pointers to null-terminated strings.
The last member of this array shall be a null pointer and is not counted in argc.
These strings constitute the argument list available to the new process image.
The value in argv[0] should point to a filename that is associated with the
process image being started by the posix_spawn() or posix_spawnp() function.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Id79ffcc501ae9552dc4e908418ff555f498be7f1
2021-06-13 01:16:06 -07:00
Xiang Xiao
0655a39c91 binfmt: Remove filename/exports/nexports from binary_s
to simplify the life cycle management

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-13 00:31:22 -07:00
Xiang Xiao
5c55a1d7fd binfmt: Move argv copy into exec_module
and remove the related fields from struct binary_s

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-13 00:31:12 -07:00
Xiang Xiao
c997bf0f52 sched/task: Simplify the syscall handling of task_spawn
It's better to save one argument by returning pid directly.
This change also follow the convention of task_create.
BTW, it is reasonable to adjust the function prototype a
little bit from both implementation and consistency since
task_spawn is NuttX specific API.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Id74f4dd1ef26dfd8f7c473684cf1a45fbeee13cf
2021-06-13 00:30:57 -07:00
Xiang Xiao
0301992760 binfmt: Rename dump_module to binfmt_dumpmodule
follow other binfmt function naming convention

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-13 00:26:03 -07:00
Xiang Xiao
4d66266a8e sched: Don't include nuttx/sched.h inside sched.h
But let nuttx/sched.h include sched.h instead to
avoid expose nuttx kernel API to userspace.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I6fe673364be9eb1259381e6575d4c1a9fea58097
2021-06-13 00:25:26 -07:00
Xiang Xiao
2331ba972a Don't include errno.h from spawn.h
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-13 00:22:14 -07:00
Xiang Xiao
5db8fc1f3a sched/spawn: Support the stack address argument
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-13 00:04:59 -07:00
Xiang Xiao
e4143c66d9 serial/pty: Initialize the terminal setting as a console
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ie80a22b7a074d048435524d86f0ca7fc7a20e756
2021-06-11 06:28:55 -07:00
Xiang Xiao
ae28e03f1f serial/pty: Don't return -NOSYS if pollfd::events equals 0
since the caller is free not to monitor any event

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ib957be1b1b5a686faea0196bc9069e0908a492eb
2021-06-11 05:05:27 -07:00
Xiang Xiao
8ae0e1759e arch: Colorize the idle thread stack in an unified way
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Idae8da53e5a4799a8edc0e882f17fd515b70cb14
2021-06-11 11:37:32 +08:00
Xiang Xiao
35035f5c89 arch: Rename xxx_getsp to up_getsp
All modern desgin support stack pointer and it's also an
important information, so let's standardize this interface.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-11 11:37:19 +08:00
chao.an
4926a50aea arch: adjust idle stack offset to reserve space of stack info
Change-Id: I41db7765b81796b3dfaa3db44a3f67bab57a6384
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-06-09 23:22:02 +08:00
chao.an
0d960286a6 Revert "arch: adjust idle stack offset to reserve space of stack info"
This reverts commit 91dbb26153.
2021-06-09 23:21:56 +08:00
chao.an
28363bf9a8 net/accept: alloc the accept fd after accept success
Change-Id: Ib174b510e5be359197db575a9b7b5aceea97665d
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-06-09 23:09:08 +08:00
chao.an
2152a35662 net: fix build break
Change-Id: I662580ded8d1c98ddcfbcfae961978eb3512e3b9
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-06-09 22:07:45 +08:00
chao.an
af44043ec0 net: add support of FIONREAD
Change-Id: Iebfdd960f4e9b184558e390f78ec7f8369753b5b
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-06-09 09:47:59 +08:00
chao.an
600671fe86 netinet: move the byte ordering convert functions to "netinet/in.h"
Change-Id: Ida4916fe062f20258dbbcd794e59e686d4d5c35e
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-06-08 22:21:58 +08:00
chao.an
2fd5872449 mm/iob: add iob_get_queue_size() helper
Change-Id: I117530f364cbef1e011638ff6d14087b7447bde7
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-06-08 11:57:52 +08:00
Jiuzhu Dong
f0ba04eb2b syslog/ramlog: write zero for the overwrite area
N/A

Change-Id: I8f8d8c53e77ee9d916cb97ea7cd3e988fbbe9ad2
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
(cherry picked from commit 4d8124a28048ea7ba7717d999553028e5384d631)
2021-06-07 10:09:52 +08:00
Jiuzhu Dong
47f09e2a18 syslog/intbuf: output log when syslog interrupt buffer is full
N/A
instead of adding overrun memssage:"[truncated]\n" to the end.

Change-Id: Ie27cdf0ca902d9ba203619a95162f01222e371c5
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-06-04 13:46:45 +08:00
Xiang Xiao
3c33d253b4 drivers/syslog: Remove emergstream implementation and caller
since emergstream always call syslog_force, but syslog_force is designed
for the interrupt context, and then doesn't mean any emergency thing.
On the other hand, emergstream has other bad side effect:
1.Can't output to file or dev channel
2.Can't work well with the interrupt buffer

Change-Id: I1c7af74f82da93ffa4ebe0e6ac25634aeb73a890
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-06-04 13:46:41 +08:00