Commit Graph

39467 Commits

Author SHA1 Message Date
Peter Bee d4080a4058 libc/pthread: return EBUSY when barrier is in use
MIRTOS-114

Add check for semcount==0 before barrier destroy and initialization

Change-Id: Ifa0cdb363714ad15eafa5ef49a025520ce836b1f
Signed-off-by: Peter Bee <bijunda1@xiaomi.com>
2021-01-25 15:03:54 +08:00
chao.an ac9251049b sim/init.d: enable fluoride
Change-Id: I91c1fb4eb9bd44bf33388383ee5a2f0136db6ab2
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-01-21 22:35:17 +08:00
ligd 0fe5ec8a48 sigdeliver: fix system block when kill signal to idle in SMP
Bug description:

CONFIG_SMP=y

Suppose we have 2 cores in SMP, here is the ps return:

PID GROUP CPU PRI POLICY TYPE    NPX STATE     STACK   USED  FILLED COMMAND
  0     0   0   0 FIFO   Kthread N-- Assigned 004076 000748  18.3%  CPU0 IDLE
  1     0   1   0 FIFO   Kthread N-- Running  004096 000540  13.1%  CPU1 IDLE

nsh> kill -4 0
or:
nsh> kill -4 1

system blocked.

Reason:

In func xx_sigdeliver() restore stage, when saved_irqcount == 0, that means
rtcb NOT in critical_section before switch to xx_sigdeliver(), then we need
reset the critical_section state before swith back.

Fix:

Add condition to cover saved_irqcount == 0.

Change-Id: I4af7f95e47f6d78a4094c3757d39b01ac9d533b3
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-01-21 16:56:44 +08:00
ligd 96d0764bbc signal/sig_kill.c: remove the limitation of kill(0, xx)
since there are situation which send singal to idle thread already,

CONFIG_SCHED_CHILD_STATUS=y
CONFIG_SCHED_HAVE_PARENT=y

Signo SIGCHLD will send to parent group, when child exit

Change-Id: Iceb2ac41948c1c3418839a3b5de70985d48c75d1
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-01-21 16:43:08 +08:00
Peter Bee c61ca4000a sched/clock: add nsec range check in clock_settime
MIRTOS-109

Return error when tv_nsec <0 or >=1000 million.

Change-Id: Iddbbcda163cb402551f619efb7486f6798859d57
Signed-off-by: Peter Bee <bijunda1@xiaomi.com>
2021-01-21 10:43:22 +08:00
ligd 387323b9b1 fs/tmpfs: fix compile error
make[2]: Entering directory '/home/ligd/platform/mirtos2/apps'
tmpfs/fs_tmpfs.c: In function 'tmpfs_rewinddir':
tmpfs/fs_tmpfs.c:2084:27: error: 'tdo' undeclared (first use in this function)
 2084 |   dir->u.tmpfs.tf_index = tdo->tdo_nentries;
      |                           ^~~
tmpfs/fs_tmpfs.c:2084:27: note: each undeclared identifier is reported only once for each function it appears in
Makefile:94: recipe for target 'fs_tmpfs.o' failed
make[1]: *** [fs_tmpfs.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: 'libwireless.a' is up to date.

Change-Id: I3846efa802fc6104bf908b8927138b9dd18f1227
2021-01-20 22:37:19 +08:00
Xiang Xiao abebd91725 fs/tmpfs: Iterate the entry reversely in readdir
MIRTOS-342

to avoid readdir return the wrong entry in the following code:
void rmdir_recursive(FAR const char *path)
{
  FAR DIR *dir = opendir(path);

  while (1)
    {
      char fullpath[MAX_PATH];
      FAR dirent *ent = readdir(dir);

      if (ent == NULL)
        {
          break;
        }

      sprintf(fullpath, "%s/%s", path, ent->d_name);
      if (DIRENT_ISDIRECTORY(ent->d_type))
        {
          rmdir_recursive(fullpath);
        }
      else
        {
          unlink(fullpath);
        }
    }
}

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ide60fe8db6aada88ad3d8e45367f11599a6f33b1
2021-01-20 21:57:31 +08:00
Peter Bee 7a72a80d2a libc/sysconf: Add MONOTONIC_CLOCK for consistency
MIRTOS-107

Add _SC_MONOTONIC_CLOCK to sysconf when CONFIG_CLOCK_MONOTONIC is set

Change-Id: I0ae57798ebe89247a10ccb517e128866d1f907de
Signed-off-by: Peter Bee <bijunda1@xiaomi.com>
2021-01-20 18:06:14 +08:00
chao.an 1cd39d813f net/dev: check the available address further
check the available address further to avoid obtain unusable device

Change-Id: Icdd91cf0c4cb158f00a49f74d054425c2aeacd14
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-01-20 16:33:43 +08:00
Jiuzhu Dong 68855c212f unistd/fpathconf: enhance fpathconf
MIRTOS-293

Change-Id: Id780d7b56b9790206d572d22aa210a8e0222108c
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-01-19 21:48:53 +08:00
chao.an 832257677f sim/hcitty: remove the poll lock to avoid invalid wait
It is unnecessary to protect pollnotify since the wakeup
source comes from idle thread

Change-Id: I99c06508029dc18aa8ded1cb672b14f77e9509a0
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-01-19 20:21:40 +08:00
chao.an b3f1c7b2d2 sched/task: setup the scheduling policy to task
Change-Id: I1cd2869a98e3418e089ac5ebe5fce648f8cb4e09
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-01-19 17:38:17 +08:00
Jiuzhu Dong 8775bd3c3b pthread/cond: fix compile break
N/A

Change-Id: Ia22d7c2039cc7b5e93646037d6072248eabcbe36
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-01-19 11:11:43 +08:00
Jiuzhu Dong 3a4e465bc3 pthread/cond: enhance pthread_cond_destroy
MIRTOS-115

follow: https://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_cond_destroy.html

Change-Id: If645120cbac72975671768159d03f211c4940cca
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-01-19 10:43:52 +08:00
chao.an 043c92fedd net/tcp: only print the error when disable the TCP_NODELAY
Since we do not have the Nagle's algorithm,
the TCP_NODELAY socket option is enabled by default.

Change-Id: I0c8619bb06cf418f7eded5bd72ac512b349cacc5
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-01-18 18:21:55 +08:00
chao.an 4e77f7cf9f net/tcp: change the log level to warning if iob_tryalloc fail
Change-Id: I544d8132ba89eebd9f29e793307010a35d9c161e
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-01-18 18:18:10 +08:00
chao.an 1a0a0e84a0 net/ipv4: bypass the udp drop and filter the packet from udp stack
Change-Id: I00055a6e930e2a0d9b1a8bd8929c5eb4e045c0d1
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-01-18 18:15:32 +08:00
Jiuzhu Dong 3ad1284b5d sched/timer: get the previous reload value correctly
MIRTOS-120

Change-Id: I312d3ee74753441793f9505e168e449af3ab2c37
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-01-18 17:20:03 +08:00
Jiuzhu Dong 2c30b91ca6 fs/readdir: Must reserve a byte for the NUL terminator
MIRTOS-270

Change-Id: I1df0c278d289b90cc54512c0ee256a95549785ca
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-01-18 16:04:34 +08:00
ligd 3a94bd3376 sched/task: fix pthread call exit() failed
Change-Id: I31cecacad65fb040bfe21a90c360a7d99f0a38f2
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-01-15 21:44:04 +08:00
chao.an ed386f09eb wireless/bluetooth: add packet read support
Change-Id: Ie4de39b36a6e21a3d2bc34edcc97e791452f76e7
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-01-15 20:12:02 +08:00
chao.an 96267fe88c wireless/bluetooth: add BT/BLE dual mode bridge driver
Change-Id: I692228fda27df1a4249f11474ff50a1049becf4b
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-01-14 23:30:48 +08:00
chao.an d4947c38eb sim/Make.defs: remove libusb dependent
Change-Id: Iba9b6ea04597e7e52514dcff7ddc7cbe38488e25
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-01-14 14:47:53 +08:00
chao.an 0cd3389459 drivers/syslog: Prepend Process ID to syslog message
Change-Id: I999045034a29acb06f39710436c06b427c543b00
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-01-14 11:56:12 +08:00
chao.an 138397fe8a sim/hcitty: SIM_HCITTY should depends on DRIVERS_BLUETOOTH
Change-Id: Icd36d54d8a8208f9df1c964800c0b2b2ea67a3e1
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-01-13 21:12:37 +08:00
chao.an 05fdb2cf49 libs/libxx: use built-in __aeabi_atexit() if LIBSUPCXX is enabled
ld error caused by multiple definition:

ld: arm-none-eabi/lib/thumb/v8-m.main+fp/hard/libsupc++.a(atexit_arm.o): in function `__aeabi_atexit':
atexit_arm.cc:(.text.__aeabi_atexit+0x0): multiple definition of `__aeabi_atexit';
nuttx/staging/libxx.a(libxx_eabi_atexit.o):nuttx/libs/libxx/libxx_eabi_atexit.cxx:75: first defined here

Change-Id: If90419093de73b184a21f755c6ea7ba577d6665a
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-01-13 21:03:06 +08:00
丁欣童 c1de1c563e Add placement new and new[] function.
N/A

Change-Id: I9f16f9c0c36f2619218a65d178100d54ced5f71b
Signed-off-by: 丁欣童 <dingxintong@xiaomi.com>
2021-01-13 17:51:58 +08:00
Xiang Xiao 32f3ddec8b fs: Remove fs_dupfd and fs_dupfd2 internal functions
let's call either nx_dup/nx_dup2 or file_dup/file_dup2
instead just like other fs api: xxx->nx_xxx->file_xxx

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I1aacfb9e25dc7b3fcb0345ff7b269b1953a01e5b
2021-01-13 17:40:52 +08:00
Xiang Xiao 4852804b08 fs: file_dup2 shouldn't hold the file list lock
the argument passed to file_dup2 doesn't always come from task file list
so it doesn't make sense to hold the file list lock and then it is better
to do the protection in the new function files_dupfd2

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ibf02cea9b0b275e7472f9c04fd66b9242285b957
2021-01-13 17:40:52 +08:00
chao.an bacc7dbc7c sim/hcitty: add send reassembly to support block write
Change-Id: I9a65e5dbe70b07aee0e22adce6b8cb698ff609eb
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-01-13 16:51:45 +08:00
chao.an 043ed0e36b wireless/bluetooth: move H4_* definition to external
Change-Id: Ie67a566857c5ed825b6dddc33832f936b5755fbe
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-01-13 16:51:35 +08:00
Xiang Xiao 5bdf084aed bt_uart_shim: Correct the prototype of bt_uart_shim_getdevice
1.Add const to the path argument
2.Return the explicit type(struct btuart_lowerhalf_s *)

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-01-13 16:12:36 +08:00
Xiang Xiao 09be85dcba Fix nxstyle warning
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Idf0acfc238d8598084b5d5c42e0a5e0045d98490
2021-01-13 16:12:22 +08:00
Xiang Xiao 514f62c790 bluetooth: Fix the typo error in BT_GETUINT16 and BT_PUTUINT16
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-01-13 16:11:53 +08:00
Xiang Xiao a2c724bd27 bluetooth: Remove the unnecessary forward reference
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-01-13 16:10:41 +08:00
Xiang Xiao 0567d9e812 bluetooth: Fix typos in comment
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-01-13 16:10:24 +08:00
Xiang Xiao 18badb068e fs: Make nx_vxxx and file_vxxx as internal functions
these functions are the implementation detail and then
don't need expose to external

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ief832391d5b42d1f1645907eb465631650490234
2021-01-13 14:02:24 +08:00
liuhaitao 8d8d823953 fs: correct typo error to fix build break
N/A

Change-Id: I5da870c0469c11d6f2dc68f87d65b7598f0827a7
Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
2021-01-12 11:47:52 +08:00
Xiang Xiao eba7216926 fs: Remove file_detach since it is unefficient to call open and file_detach
the kernel user should call file_open directly instead

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I5bf7f661006f5d43739bc8618abfb4b983fde78d
2021-01-12 11:03:36 +08:00
Xiang Xiao ac99898bc7 fs: Reimplement file_open to not depend on nx_open
on the other hand, open/nx_open call file_open instead

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I66990a77cdeb6ff18f7bf48a65bbc7b701dad552
2021-01-12 11:03:20 +08:00
ligd a5d6f1fc68 mqueue: add poll support
Change-Id: I7e908f6a6c00158c0946587dd79ae3dc5d279d37
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-01-12 10:34:43 +08:00
chao.an 999768e6f3 libc/machine/arch: fix build break if enable armv8 ELF
Change-Id: Icc213b5b5986c83b5a38f0ffd2e451ffa29386a2
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-01-12 00:10:33 +08:00
liuhaitao 35a24a7787 buildinfo.sh: use ro.build.version instead of ram.build.version
N/A

Change-Id: I88692b2069ef2d2482497a189a058be1bb67a0bd
Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
2021-01-11 19:27:58 +08:00
Jiuzhu Dong f0f09b913c vfork: support sim vfork
MIRTOS-130

Change-Id: I15920bcbacfc5ea519cfe12c39cb64dfe6365838
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-01-11 16:10:53 +08:00
ligd 5b8ca6569f fs/mount: fix mount cmd break out when meet stat error
Change-Id: I9307fe67837a6519fffa1844fcfd794f735d2fdd
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-01-11 14:05:24 +08:00
chao.an 1c33ac85f0 wireless/bluetooth: fix nxstyle warning
Change-Id: Ie7e2b535297a3ad8696dc574b768471fc44bba9e
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-01-11 13:53:11 +08:00
chao.an 60f03d2a92 wireless/bluetooth: add more hci event definitions
Change-Id: I35c034762335cf72f2d46ea383f0136361506e1e
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-01-11 10:18:11 +08:00
chao.an 8b671fd79c wireless/bluetooth: remove the host dependency
Change-Id: I2f7073731fdf920ea69d79462275468f83f2cc4c
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-01-11 10:18:01 +08:00
chao.an d6faf5707d sim/hcitty: add multi-instance support
Change-Id: I911054f52d38438b3622d7cd0c65180246117e87
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-01-10 19:34:53 +08:00
Xiang Xiao 730d7b9a8a arch/sim: Simplify SYMBOL macro definition
Change-Id: I1772b65b9bbe29917885e432056f84921b562eb0
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-01-10 00:14:06 -08:00