Compare commits
341 Commits
weekly_202
...
master
Author | SHA1 | Date |
---|---|---|
|
0d1635757f | |
|
c099376d69 | |
|
63f261d239 | |
|
02abd34ad2 | |
|
20c42a9de5 | |
|
14c79fc921 | |
|
51428fb84a | |
|
31da79ec80 | |
|
88cfb3de9d | |
|
4bb465f9af | |
|
ef7610470c | |
|
8b57198526 | |
|
09bcabfaf6 | |
|
75af9e28d9 | |
|
42f79f133b | |
|
4abaa42830 | |
|
5d1caa2cfe | |
|
437c6530da | |
|
b58c6d41f3 | |
|
cab654a3fe | |
|
5e3a8f11b4 | |
|
2e642e6d9a | |
|
b22a7c266e | |
|
ef1b6f9cde | |
|
2ac53f2c00 | |
|
37162aafb6 | |
|
d958a8537c | |
|
aaf352f7f2 | |
|
3f8b270180 | |
|
cc34b8f00e | |
|
28159170be | |
|
da45d3f539 | |
|
49ad79f55e | |
|
78db02de2c | |
|
7fcec6797c | |
|
dff8682d4d | |
|
b0520a56f4 | |
|
180bf8e5cd | |
|
dbbb96c427 | |
|
e3eaae1b1c | |
|
9b5892e0a6 | |
|
6a4d0be681 | |
|
8fe4080d08 | |
|
cfa0209c14 | |
|
a235c4c106 | |
|
c2cb0435b2 | |
|
4fbb41b7d5 | |
|
04f971084b | |
|
6daecc8d26 | |
|
173cdeb077 | |
|
e28271d650 | |
|
27eb4e2334 | |
|
bd57ef7e2c | |
|
342a3eb5c1 | |
|
63885154d2 | |
|
95d1eb890a | |
|
0bc453c2cd | |
|
73bcf0ec9a | |
|
49bfc90a63 | |
|
b0708886fa | |
|
a388a3f565 | |
|
145ff76ab6 | |
|
280769ae42 | |
|
1f3a6c8143 | |
|
6c0b0dde23 | |
|
76228c3617 | |
|
5de241eb2a | |
|
5e68558280 | |
|
9c71de6a2e | |
|
243b1e26a4 | |
|
47a4fe030b | |
|
577d29aaba | |
|
d9e9631286 | |
|
2bd5b686cf | |
|
8452488bdb | |
|
a04ab13c76 | |
|
338f5d7e7d | |
|
fa68ebfcd1 | |
|
24aa6858ee | |
|
5fb9165c08 | |
|
13f68dcf9c | |
|
f332a06e4c | |
|
1ba32406bb | |
|
249ea71a11 | |
|
814f5affd0 | |
|
4ff66c7f40 | |
|
8f937c8771 | |
|
2845efe801 | |
|
8cc5209181 | |
|
f995c7c7af | |
|
a104497e08 | |
|
b5ae9e25c6 | |
|
c2b5a5897f | |
|
f924cc775b | |
|
5dc9a0f1a6 | |
|
806bd80841 | |
|
c141a92544 | |
|
10c5e2e666 | |
|
da9ce464dd | |
|
f0a435dce1 | |
|
b45cdbda3e | |
|
57455849ca | |
|
ea825345c2 | |
|
f397c63fbd | |
|
fe6ab18cd9 | |
|
c0f5d437d8 | |
|
1ef64e26a1 | |
|
77b1b208d1 | |
|
d17bc9d4ea | |
|
be50721826 | |
|
4e7d2edbe1 | |
|
58610ea87c | |
|
c6ff38edd2 | |
|
1c18c48b1e | |
|
bea394a75e | |
|
272c490618 | |
|
dd041bef5a | |
|
fd925a8163 | |
|
e8e21fcc3e | |
|
c592fe73ec | |
|
4174654bdd | |
|
f3a7a9c602 | |
|
c8dbdaeb12 | |
|
1f05c6a24d | |
|
325b4a49e4 | |
|
1d1f1b06c3 | |
|
16ed05e844 | |
|
7e0dfb79f7 | |
|
34814c58a3 | |
|
c0c9bbdfb4 | |
|
e2d903b663 | |
|
d4794ebc38 | |
|
3be7409a28 | |
|
0c7dd0f911 | |
|
41619f004d | |
|
be9cee4c21 | |
|
6c8735cb9e | |
|
8701e73c9f | |
|
c403fdf8ed | |
|
251abede16 | |
|
20782299ce | |
|
0b141e052b | |
|
46cc84331a | |
|
e816896dc4 | |
|
ebc3f30524 | |
|
3119d83a6a | |
|
8482c9d7be | |
|
248e9f7089 | |
|
f2a35262bd | |
|
794cdae65f | |
|
7975f5c8ef | |
|
fc4c694235 | |
|
ead4da80ba | |
|
8d980ded54 | |
|
07e3feb456 | |
|
b5ce4d34df | |
|
99c81c4ffa | |
|
4d1fd22b1c | |
|
efa336ab26 | |
|
0b05a46691 | |
|
177f32283f | |
|
6888193e3f | |
|
6c352a7b10 | |
|
73a9587f02 | |
|
cbd03bd7e0 | |
|
8d55bb1d8c | |
|
e7daa28200 | |
|
987a722d2d | |
|
ccdfa72431 | |
|
557a71c1c3 | |
|
569aecb6ea | |
|
8c0b7d0f38 | |
|
c488817b32 | |
|
43d47a27e3 | |
|
a83f916298 | |
|
8dbfd3846e | |
|
f34762c105 | |
|
043e84dfcb | |
|
453c376198 | |
|
204d7a4abb | |
|
f2861a84bf | |
|
96b2d557ac | |
|
ffa11535ca | |
|
b581207045 | |
|
5105249ecf | |
|
a61e2cf16e | |
|
39e25c5220 | |
|
5541965365 | |
|
edd2223083 | |
|
22392965b5 | |
|
d906bb91ea | |
|
51f6a20723 | |
|
325ea29df3 | |
|
c2f9f6705f | |
|
71e51d8813 | |
|
e0b4fcb23d | |
|
7d62d3d62b | |
|
69f3bf3a2a | |
|
2590e34346 | |
|
660b314f90 | |
|
44ec199465 | |
|
7437408f65 | |
|
1134332a58 | |
|
8099f6578d | |
|
ba23a26f95 | |
|
2dc24da826 | |
|
6302c5f767 | |
|
f0d5959576 | |
|
65790b67d5 | |
|
9eff5cff1d | |
|
99ea8d4ed2 | |
|
1568c317bb | |
|
5e70129199 | |
|
089376994a | |
|
12adfd5832 | |
|
c46c5a640d | |
|
c812b0c27b | |
|
51528ec39c | |
|
059c1c22b1 | |
|
beb03bfc81 | |
|
bbbd96784e | |
|
1c0de289ec | |
|
a3d757c8e1 | |
|
6fede4eb92 | |
|
7be302633f | |
|
0164461b33 | |
|
9bb4be5e13 | |
|
4acf1e9f8d | |
|
870221452d | |
|
30c3fb086e | |
|
9b1e0a186b | |
|
00dbf1e5d5 | |
|
16fdbdf650 | |
|
bee3d97163 | |
|
9fb176b827 | |
|
398f4a6ada | |
|
19553f73e1 | |
|
de24efadfa | |
|
0057fb0dd5 | |
|
bcf7e8ee02 | |
|
0b9cac2cd3 | |
|
9958f647f5 | |
|
fa6b2d352c | |
|
7f57e11ef9 | |
|
1097d41a40 | |
|
90d6ff9a6f | |
|
eebe85fe31 | |
|
b126f1cb5f | |
|
639160f517 | |
|
7fef6ac8d9 | |
|
2f44d18618 | |
|
fbc81cd821 | |
|
a6e17fea9b | |
|
18f7ab1380 | |
|
d205cfa65a | |
|
11b35fe795 | |
|
b086195e97 | |
|
b90531e366 | |
|
a1a6286500 | |
|
e1027b5902 | |
|
b9a445ca44 | |
|
338044cd9c | |
|
18a2fc8e8d | |
|
fa0e803ac9 | |
|
4f641cc145 | |
|
9063a45d5a | |
|
4b4e1264f5 | |
|
3f5307e7bb | |
|
eddcb840d3 | |
|
a0e205eb0a | |
|
707028dfe1 | |
|
49d72afc8e | |
|
c11ff67869 | |
|
b6a49e7c89 | |
|
e847c8b468 | |
|
faeeaf294c | |
|
b2caf46b4e | |
|
ccbc55df60 | |
|
7f4294af00 | |
|
4a63bacc47 | |
|
ee6f3f0d79 | |
|
e05300cdf0 | |
|
b8951e2cd9 | |
|
e3ce27536c | |
|
a6c5309a5f | |
|
65d5526c70 | |
|
33c4e194b8 | |
|
1b11caa45c | |
|
6ba17fc862 | |
|
f61ecd7669 | |
|
ec3c8be6ee | |
|
3cd28f32ca | |
|
4b6a6e806f | |
|
216c124854 | |
|
e26d969ca8 | |
|
45f66359cd | |
|
5b87a530f5 | |
|
5280a45434 | |
|
f7a8630584 | |
|
cb67dd5498 | |
|
6d8cef40c8 | |
|
41b80ad20a | |
|
47fac7158e | |
|
6c0e1b1f04 | |
|
b06520ac7c | |
|
e4cad073a9 | |
|
b151fa6b65 | |
|
40329e182c | |
|
0f38ecb863 | |
|
3f43438017 | |
|
bc70db58a7 | |
|
ac9399d2b7 | |
|
89850d0715 | |
|
86be540829 | |
|
0f75bf01a6 | |
|
395c0be775 | |
|
a40f8383ee | |
|
87a7df48b8 | |
|
2df39a7e51 | |
|
9f8127cc54 | |
|
2f1ed39bc1 | |
|
0770e5f972 | |
|
0fb16312dc | |
|
9a030d6930 | |
|
29dde5d752 | |
|
b797f50596 | |
|
913d22bf83 | |
|
3824d1e9e4 | |
|
7941b93d1c | |
|
d376efbe46 | |
|
64ddb1ff07 | |
|
f02d40d25d | |
|
672bc729a6 | |
|
31403e0e45 | |
|
456d255a81 | |
|
8c44c82723 | |
|
4c024f757e | |
|
59329ce7c6 | |
|
be68dc8bca | |
|
a0ad1a4333 | |
|
f504cc9145 |
|
@ -10,6 +10,12 @@
|
|||
### 测试用例(新增、改动、可能影响的功能)
|
||||
|
||||
|
||||
### 是否涉及对外变更(典型的如:对外API规格变更、新增对外接口等等)
|
||||
|
||||
必须选择一项(在MarkDown模式下用[x]替换[ ]即可勾选对应选项):
|
||||
- [ ] 是,涉及对外变更: 需要在commit message中按【[模板要求](https://gitee.com/openharmony/kernel_liteos_a/wikis/Commit%20message%20%E8%A7%84%E8%8C%83)】描述变更点
|
||||
- [ ] 否,不涉及对外变更
|
||||
|
||||
### 是否需要同步至release(如:3.0LTS ... )分支?
|
||||
|
||||
必须选择一项(在MarkDown模式下用[x]替换[ ]即可勾选对应选项):
|
||||
|
|
72
BUILD.gn
72
BUILD.gn
|
@ -34,7 +34,9 @@ LITEOS_MENUCONFIG_H = rebase_path("$root_out_dir/config.h")
|
|||
declare_args() {
|
||||
tee_enable = false
|
||||
liteos_name = "OHOS_Image"
|
||||
liteos_container_enable = false
|
||||
liteos_skip_make = false
|
||||
liteos_is_mini = false
|
||||
}
|
||||
|
||||
tee = ""
|
||||
|
@ -75,7 +77,6 @@ generate_notice_file("kernel_notice_file") {
|
|||
"$LITEOSTHIRDPARTY/musl",
|
||||
"$LITEOSTHIRDPARTY/zlib",
|
||||
"$LITEOSTHIRDPARTY/FatFs",
|
||||
"$LITEOSTHIRDPARTY/Linux_Kernel",
|
||||
"$LITEOSTHIRDPARTY/lwip",
|
||||
"$LITEOSTHIRDPARTY/NuttX",
|
||||
"$LITEOSTHIRDPARTY/mtd-utils",
|
||||
|
@ -129,7 +130,9 @@ config("stdinc_config") {
|
|||
"-isystem",
|
||||
std_include,
|
||||
]
|
||||
cflags += [ "-nostdinc" ]
|
||||
if (!defined(LOSCFG_LIBC_NEWLIB)) {
|
||||
cflags += [ "-nostdinc" ]
|
||||
}
|
||||
asmflags = cflags
|
||||
}
|
||||
|
||||
|
@ -199,6 +202,10 @@ config("warn_config") {
|
|||
]
|
||||
if (defined(LOSCFG_COMPILER_CLANG_LLVM)) {
|
||||
cflags += [ "-Wno-address-of-packed-member" ]
|
||||
cflags += [
|
||||
"-Wno-unused-but-set-variable",
|
||||
"-Wno-strict-prototypes",
|
||||
]
|
||||
}
|
||||
asmflags = cflags
|
||||
}
|
||||
|
@ -237,6 +244,28 @@ config("misc_config") {
|
|||
asmflags = cflags
|
||||
}
|
||||
|
||||
config("container_config") {
|
||||
if (liteos_container_enable) {
|
||||
cflags = [
|
||||
"-DLOSCFG_KERNEL_CONTAINER",
|
||||
"-DLOSCFG_PID_CONTAINER",
|
||||
"-DLOSCFG_UTS_CONTAINER",
|
||||
"-DLOSCFG_MNT_CONTAINER",
|
||||
"-DLOSCFG_CHROOT",
|
||||
"-DLOSCFG_IPC_CONTAINER",
|
||||
"-DLOSCFG_TIME_CONTAINER",
|
||||
"-DLOSCFG_USER_CONTAINER",
|
||||
"-DLOSCFG_NET_CONTAINER",
|
||||
"-DLOSCFG_PROC_PROCESS_DIR",
|
||||
"-DLOSCFG_KERNEL_PLIMITS",
|
||||
"-DLOSCFG_KERNEL_MEM_PLIMIT",
|
||||
"-DLOSCFG_KERNEL_IPC_PLIMIT",
|
||||
"-DLOSCFG_KERNEL_DEV_PLIMIT",
|
||||
"-DLOSCFG_KERNEL_SCHED_PLIMIT",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
config("los_config") {
|
||||
configs = [
|
||||
":arch_config",
|
||||
|
@ -247,6 +276,7 @@ config("los_config") {
|
|||
":ssp_config",
|
||||
":warn_config",
|
||||
":misc_config",
|
||||
":container_config",
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -269,7 +299,7 @@ config("public") {
|
|||
|
||||
configs += [
|
||||
"$HDFTOPDIR:public",
|
||||
"//drivers/liteos:public",
|
||||
"$DRIVERS_LITEOS_DIR:public",
|
||||
]
|
||||
|
||||
if (HAVE_DEVICE_SDK) {
|
||||
|
@ -290,11 +320,12 @@ group("modules") {
|
|||
"security",
|
||||
"shell",
|
||||
"syscall",
|
||||
"testsuites/kernel:kernel_test",
|
||||
]
|
||||
|
||||
deps += [
|
||||
"//drivers/liteos",
|
||||
HDFTOPDIR,
|
||||
"$DRIVERS_LITEOS_DIR",
|
||||
"$HDFTOPDIR",
|
||||
]
|
||||
|
||||
if (HAVE_DEVICE_SDK) {
|
||||
|
@ -315,13 +346,17 @@ group("kernel") {
|
|||
}
|
||||
|
||||
group("liteos_a") {
|
||||
deps = [
|
||||
":apps",
|
||||
":kernel",
|
||||
":make",
|
||||
":tests",
|
||||
"//prebuilts/lite/sysroot/build:strip",
|
||||
]
|
||||
deps = [ ":kernel" ]
|
||||
if (!liteos_is_mini) {
|
||||
deps += [
|
||||
":apps",
|
||||
":tests",
|
||||
"$THIRDPARTY_MUSL_DIR/scripts/build_lite:strip",
|
||||
]
|
||||
if (liteos_skip_make == false) {
|
||||
deps += [ ":make" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
executable("liteos") {
|
||||
|
@ -337,6 +372,17 @@ executable("liteos") {
|
|||
"-Wl,--no-eh-frame-hdr",
|
||||
]
|
||||
|
||||
if (defined(LOSCFG_LIBC_NEWLIB)) {
|
||||
ldflags += [
|
||||
"-Wl,--wrap=_free_r",
|
||||
"-Wl,--wrap,_malloc_usable_size_r",
|
||||
"-Wl,--wrap,_malloc_r",
|
||||
"-Wl,--wrap,_memalign_r",
|
||||
"-Wl,--wrap,_realloc_r",
|
||||
"-Wl,--wrap,_fseeko_r",
|
||||
]
|
||||
ldflags -= [ "-nostdlib" ]
|
||||
}
|
||||
libgcc = exec_script("//build/lite/run_shell_cmd.py",
|
||||
[ "$cc -print-libgcc-file-name" ],
|
||||
"trim string")
|
||||
|
@ -348,7 +394,7 @@ executable("liteos") {
|
|||
} else {
|
||||
ldflags +=
|
||||
[ "-Wl,-T" + rebase_path("tools/build/liteos.ld", root_build_dir) ]
|
||||
ldflags += [ "-Wl,-nostartfiles" ]
|
||||
ldflags += [ "-nostartfiles" ]
|
||||
inputs = [ "tools/build/liteos.ld" ]
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,338 @@
|
|||
# (2022-03-30)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
|
||||
* **arm-virt:** HW_RANDOM_ENABLE配置支持arm virt平台 ([68f9f49](https://gitee.com/openharmony/kernel_liteos_a/commits/68f9f49c2a62d3271db14ccb896c9f9fc78a60e4))
|
||||
* A核代码静态告警定期清理 ([9ba725c](https://gitee.com/openharmony/kernel_liteos_a/commits/9ba725c3d486dd28fe9b2489b0f95a65354d7d86)), closes [#I4I0O8](https://gitee.com/openharmony/kernel_liteos_a/issues/I4I0O8)
|
||||
* change default permission of procfs to 0550 ([a776c04](https://gitee.com/openharmony/kernel_liteos_a/commits/a776c04a3da414f73ef7136a543c029cc6dd75be)), closes [#I4NY49](https://gitee.com/openharmony/kernel_liteos_a/issues/I4NY49)
|
||||
* change the execFile field in TCB to execVnode ([e4a0662](https://gitee.com/openharmony/kernel_liteos_a/commits/e4a06623ceb49b5bead60d45c0534db88b9c666f)), closes [#I4CLL9](https://gitee.com/openharmony/kernel_liteos_a/issues/I4CLL9)
|
||||
* close file when process interpretor failed ([a375bf5](https://gitee.com/openharmony/kernel_liteos_a/commits/a375bf5668a5e86e082d0e124b538e423023a259)), closes [#I4ATQX](https://gitee.com/openharmony/kernel_liteos_a/issues/I4ATQX)
|
||||
* codex 清理 ([9ab3e35](https://gitee.com/openharmony/kernel_liteos_a/commits/9ab3e351d38cdae2ec083048a50a253bc2a3b604)), closes [#I4BL3S](https://gitee.com/openharmony/kernel_liteos_a/issues/I4BL3S)
|
||||
* dyload open close failed ([5e87d8c](https://gitee.com/openharmony/kernel_liteos_a/commits/5e87d8c183471166294e2caa041ab4da8570c6a1)), closes [#I452Z7](https://gitee.com/openharmony/kernel_liteos_a/issues/I452Z7)
|
||||
* fix ppoll ([a55f68f](https://gitee.com/openharmony/kernel_liteos_a/commits/a55f68f957e9f8ad74bd9e0c1b3d27775e0f8c75))
|
||||
* fix some function declarations ([63fd8bc](https://gitee.com/openharmony/kernel_liteos_a/commits/63fd8bc39b21fffb6990f74e879eefecafad6c88))
|
||||
* implicit declaration of function 'syscall' in apps/shell ([bd0c083](https://gitee.com/openharmony/kernel_liteos_a/commits/bd0c0835fc58ed5f941dbbc9adfac74253eeb874))
|
||||
* LOS_Panic和魔法键功能中的使用PRINTK打印,依赖任务调度,特殊情况下存在打印不出来的问题 ([53addea](https://gitee.com/openharmony/kernel_liteos_a/commits/53addea304de09e0df457b690403ac652bbcea72)), closes [#I4NOC7](https://gitee.com/openharmony/kernel_liteos_a/issues/I4NOC7)
|
||||
* los_stat_pri.h中缺少依赖的头文件 ([2cd03c5](https://gitee.com/openharmony/kernel_liteos_a/commits/2cd03c55b7a614c648adc965ebfe494d491fe20f)), closes [#I4KEZ1](https://gitee.com/openharmony/kernel_liteos_a/issues/I4KEZ1)
|
||||
* los_trace.h接口注释错误修正 ([6d24961](https://gitee.com/openharmony/kernel_liteos_a/commits/6d249618aecc216388f9b1a2b48fe0ac6dd19ff2)), closes [#I4CYPZ](https://gitee.com/openharmony/kernel_liteos_a/issues/I4CYPZ)
|
||||
* MMU竞态问题修复 ([748e0d8](https://gitee.com/openharmony/kernel_liteos_a/commits/748e0d8ffb6ee9c8757ed056f575e3abc6c10702)), closes [#I2WARC](https://gitee.com/openharmony/kernel_liteos_a/issues/I2WARC)
|
||||
* **mtd:** 去除mtd对hisilicon驱动的依赖 ([f7d010d](https://gitee.com/openharmony/kernel_liteos_a/commits/f7d010dfa4cb825096267528e131a9e2735d7505)), closes [#I49FKL](https://gitee.com/openharmony/kernel_liteos_a/issues/I49FKL)
|
||||
* OsFutexWaitParamCheck函数中absTime为0时,直接返回,不需要打印 ([3f71be7](https://gitee.com/openharmony/kernel_liteos_a/commits/3f71be75355f11037d9de80cc4d7da0f01905003)), closes [#I4D67E](https://gitee.com/openharmony/kernel_liteos_a/issues/I4D67E)
|
||||
* OsLockDepCheckIn异常处理中存在g_lockdepAvailable锁嵌套调用, ([bf030b6](https://gitee.com/openharmony/kernel_liteos_a/commits/bf030b6bb5843151a5b8b8736246a1376a5fb9d0)), closes [#I457ZZ](https://gitee.com/openharmony/kernel_liteos_a/issues/I457ZZ)
|
||||
* pr模板补充说明 ([e3cd485](https://gitee.com/openharmony/kernel_liteos_a/commits/e3cd485db528490a16a8932d734faab263b44bc9))
|
||||
* same file mode for procfs files ([c79bcd0](https://gitee.com/openharmony/kernel_liteos_a/commits/c79bcd028e1be34b45cba000077230fa2ef95e68)), closes [#I4ACTC](https://gitee.com/openharmony/kernel_liteos_a/issues/I4ACTC)
|
||||
* shell支持exit退出,完善帮助信息,特殊处理不可见字符 ([cc6e112](https://gitee.com/openharmony/kernel_liteos_a/commits/cc6e11281e63b6bdc9be8e5d3c39f1258eb2ceaa))
|
||||
* smp初始化中副核冗余的启动框架调用 ([5ce70a5](https://gitee.com/openharmony/kernel_liteos_a/commits/5ce70a50c3733b6ec8cc4b444837e366ec837f69)), closes [#I4F8A5](https://gitee.com/openharmony/kernel_liteos_a/issues/I4F8A5)
|
||||
* solve SIGCHLD ignored in sigsuspend() ([5a80d4e](https://gitee.com/openharmony/kernel_liteos_a/commits/5a80d4e1a34c94204a0bb01443bf25a4fdb12750)), closes [#I47CKK](https://gitee.com/openharmony/kernel_liteos_a/issues/I47CKK)
|
||||
* syscall review bugfix ([214f44e](https://gitee.com/openharmony/kernel_liteos_a/commits/214f44e935277c29d347c50b553a31ea7df36448)), closes [#149](https://gitee.com/openharmony/kernel_liteos_a/issues/149)
|
||||
* **test:** misc09用例因依赖hosts文件而失败 ([f2f5c5f](https://gitee.com/openharmony/kernel_liteos_a/commits/f2f5c5fdc3202610de173e7046adab4df5e59142)), closes [#I48IZ0](https://gitee.com/openharmony/kernel_liteos_a/issues/I48IZ0)
|
||||
* **test:** 修复sys部分用例因依赖passwd、group文件而失败 ([614cdcc](https://gitee.com/openharmony/kernel_liteos_a/commits/614cdccf91bd2d220c4c76418b53400ce714c6cb)), closes [#I48IUC](https://gitee.com/openharmony/kernel_liteos_a/issues/I48IUC)
|
||||
* 中断中调用PRINTK概率卡死,导致系统不能正常响应中断 ([9726ba1](https://gitee.com/openharmony/kernel_liteos_a/commits/9726ba11a79f3d2d1e616e12ef0bb44e4fc5cd20)), closes [#I4C9GC](https://gitee.com/openharmony/kernel_liteos_a/issues/I4C9GC)
|
||||
* 临终遗言重定向内容缺失task相关信息,对应的shell命令中申请的内存需要cacheline对齐 ([48ca854](https://gitee.com/openharmony/kernel_liteos_a/commits/48ca854bf07f8dcda9657f950601043a485a1b33)), closes [#I482S5](https://gitee.com/openharmony/kernel_liteos_a/issues/I482S5)
|
||||
* 优化liteipc任务状态,删除功能重复字段 ([5004ef4](https://gitee.com/openharmony/kernel_liteos_a/commits/5004ef4d87b54fb6d7f748ca8212ae155bcefac5)), closes [#I4FVHK](https://gitee.com/openharmony/kernel_liteos_a/issues/I4FVHK)
|
||||
* 优化trace buffer初始化,删除swtmr 桩中的无效参数 ([b551270](https://gitee.com/openharmony/kernel_liteos_a/commits/b551270ef50cb206360e2eee3dd20ace5cecccb7)), closes [#I4DQ1X](https://gitee.com/openharmony/kernel_liteos_a/issues/I4DQ1X)
|
||||
* 修复 virpart.c 不适配的格式化打印问题 ([de29140](https://gitee.com/openharmony/kernel_liteos_a/commits/de29140edf2567f4847876cb1ed5e0b6857420f3)), closes [#I4PEVP](https://gitee.com/openharmony/kernel_liteos_a/issues/I4PEVP)
|
||||
* 修复A核文档失效的问题 ([456d255](https://gitee.com/openharmony/kernel_liteos_a/commits/456d255a81c2031be8ebecc2bf897af80c3d3c7a)), closes [#I4U7TF](https://gitee.com/openharmony/kernel_liteos_a/issues/I4U7TF)
|
||||
* 修复A核测试用例失败的问题 ([59329ce](https://gitee.com/openharmony/kernel_liteos_a/commits/59329ce7c6b6a00084df427748e6283287a773c0)), closes [#I4SQDR](https://gitee.com/openharmony/kernel_liteos_a/issues/I4SQDR)
|
||||
* 修复A核测试用例失败的问题 ([be68dc8](https://gitee.com/openharmony/kernel_liteos_a/commits/be68dc8bcaf8d965039ae1d792775f00a08adfac)), closes [#I4SQDP](https://gitee.com/openharmony/kernel_liteos_a/issues/I4SQDP)
|
||||
* 修复dispatch单词拼写错误。 ([9b07aec](https://gitee.com/openharmony/kernel_liteos_a/commits/9b07aece2dfa3494cf35e8b388410341508d6224)), closes [#I4BLE8](https://gitee.com/openharmony/kernel_liteos_a/issues/I4BLE8)
|
||||
* 修复futime提示错误22的BUG ([f2861dd](https://gitee.com/openharmony/kernel_liteos_a/commits/f2861ddfb424af7b99c278273601ce0fab1f37e6))
|
||||
* 修复jffs2适配层错误释放锁的BUG ([011a55f](https://gitee.com/openharmony/kernel_liteos_a/commits/011a55ff21d95f969abac60bcff96f4c4d7a326d)), closes [#I4FH9M](https://gitee.com/openharmony/kernel_liteos_a/issues/I4FH9M)
|
||||
* 修复los_vm_scan.c中内部函数OsInactiveListIsLow冗余代码 ([bc32a1e](https://gitee.com/openharmony/kernel_liteos_a/commits/bc32a1ec0fa5d19c6d2672bcf4a01de5e1be3afb)), closes [#I4HKFF](https://gitee.com/openharmony/kernel_liteos_a/issues/I4HKFF)
|
||||
* 修复LOSCFG_FS_FAT_CACHE宏关闭后编译失败的BUG ([63e71fe](https://gitee.com/openharmony/kernel_liteos_a/commits/63e71feca05a8d46a49822c713258738740f0712)), closes [#I3T3N0](https://gitee.com/openharmony/kernel_liteos_a/issues/I3T3N0)
|
||||
* 修复OsVmPhysFreeListAdd和OsVmPhysFreeListAddUnsafe函数内容重复 ([6827bd2](https://gitee.com/openharmony/kernel_liteos_a/commits/6827bd2a22b78aa05e20d6460412fc7b2d738929)), closes [#I4FL95](https://gitee.com/openharmony/kernel_liteos_a/issues/I4FL95)
|
||||
* 修复PR520缺陷 ([4033891](https://gitee.com/openharmony/kernel_liteos_a/commits/40338918d9132399ee0494d331930a05b7a13c67)), closes [#I4DEG5](https://gitee.com/openharmony/kernel_liteos_a/issues/I4DEG5)
|
||||
* 修复shcmd.h需要用宏包起来的问题 ([6c4e4b1](https://gitee.com/openharmony/kernel_liteos_a/commits/6c4e4b16abe9c68fea43d40b2d39b4f0ed4bfc9c)), closes [#I4N50W](https://gitee.com/openharmony/kernel_liteos_a/issues/I4N50W)
|
||||
* 修复xts权限用例压测异常问题 ([b0d31cb](https://gitee.com/openharmony/kernel_liteos_a/commits/b0d31cb43f5a8d1c3da574b2b957e3b0e98b3067)), closes [#I3ZJ1D](https://gitee.com/openharmony/kernel_liteos_a/issues/I3ZJ1D)
|
||||
* 修复硬随机不可用时,地址随机化不可用问题 ([665c152](https://gitee.com/openharmony/kernel_liteos_a/commits/665c152c27bb86395ddd0395279255f6cdaf7255)), closes [#I4D4TK](https://gitee.com/openharmony/kernel_liteos_a/issues/I4D4TK)
|
||||
* 修复进程用例导致门禁概率失败 ([1ed28b4](https://gitee.com/openharmony/kernel_liteos_a/commits/1ed28b4c80cfd222be08b0c2e71e6287e52bb276)), closes [#I4FO0N](https://gitee.com/openharmony/kernel_liteos_a/issues/I4FO0N)
|
||||
* 修复进程线程不稳定用例 ([f6ac03d](https://gitee.com/openharmony/kernel_liteos_a/commits/f6ac03d3e3c56236adc5734d4c059f1fbcc9e0c1)), closes [#I4F1XL](https://gitee.com/openharmony/kernel_liteos_a/issues/I4F1XL)
|
||||
* 修复重复执行内存用例导致系统卡死问题 ([6c2b163](https://gitee.com/openharmony/kernel_liteos_a/commits/6c2b163c7d7c696ef89b17a0275f3cddb3d7cefb)), closes [#I4F7PO](https://gitee.com/openharmony/kernel_liteos_a/issues/I4F7PO)
|
||||
* 修改MMU模块的注释错误 ([1a8e22d](https://gitee.com/openharmony/kernel_liteos_a/commits/1a8e22dcf15944153e013d004fd7bbf24557a8c7)), closes [#I4KMMJ](https://gitee.com/openharmony/kernel_liteos_a/issues/I4KMMJ)
|
||||
* 共享内存问题修复 ([9fdb80f](https://gitee.com/openharmony/kernel_liteos_a/commits/9fdb80f85f92d0167a0456455a94fc6f679797ce)), closes [#I47X2Z](https://gitee.com/openharmony/kernel_liteos_a/issues/I47X2Z)
|
||||
* 内核ERR打印,无进程和线程信息,不方便问题定位。 ([cb423f8](https://gitee.com/openharmony/kernel_liteos_a/commits/cb423f845462b8cc474c3cba261dadf3943a08ef)), closes [#I4DAKM](https://gitee.com/openharmony/kernel_liteos_a/issues/I4DAKM)
|
||||
* 内核ERR级别及以上的打印输出当前进程和线程名 ([540b201](https://gitee.com/openharmony/kernel_liteos_a/commits/540b2017c5460e300365d2039a08abd5945cec6b))
|
||||
* 内源检视测试用例问题修复 ([a6ac759](https://gitee.com/openharmony/kernel_liteos_a/commits/a6ac7597f85043ba6de3a1b395ca676d85c65ea7))
|
||||
* 删除冗余的头文件 ([8e614bb](https://gitee.com/openharmony/kernel_liteos_a/commits/8e614bb1616b75bc89eee7ad7da49b7a9c285b47)), closes [#I4KN63](https://gitee.com/openharmony/kernel_liteos_a/issues/I4KN63)
|
||||
* 增加pselect SYSCALL函数及测试用例 ([f601c16](https://gitee.com/openharmony/kernel_liteos_a/commits/f601c16b9e67d531dda51fc18389a53db4360b7b)), closes [#I45SXU](https://gitee.com/openharmony/kernel_liteos_a/issues/I45SXU)
|
||||
* 增加内核epoll系统调用 ([2251b8a](https://gitee.com/openharmony/kernel_liteos_a/commits/2251b8a2d1f649422dd67f8551b085a7e0c63ec7)), closes [#I4FXPT](https://gitee.com/openharmony/kernel_liteos_a/issues/I4FXPT)
|
||||
* 实现了musl库net模块中的一些函数接口和相应的测试用例 ([3d00a7d](https://gitee.com/openharmony/kernel_liteos_a/commits/3d00a7d23a96f29c138cfc1672825b90b9e0c05e)), closes [#I4JQI1](https://gitee.com/openharmony/third_party_musl/issues/I4JQI1)
|
||||
* 添加进程线程冒烟用例 ([2be5968](https://gitee.com/openharmony/kernel_liteos_a/commits/2be59680f2fb0801b43522cd38cc387c8ff38766)), closes [#I4EOGA](https://gitee.com/openharmony/kernel_liteos_a/issues/I4EOGA)
|
||||
* 用户态进程主线程退出时,其他子线程刚好进入异常处理流程会导致系统卡死 ([d955790](https://gitee.com/openharmony/kernel_liteos_a/commits/d955790a44a679421798ec1ac2900b4d75dd75a4)), closes [#I4KGBT](https://gitee.com/openharmony/kernel_liteos_a/issues/I4KGBT)
|
||||
* 编码规范修改 ([d161a0b](https://gitee.com/openharmony/kernel_liteos_a/commits/d161a0b03de046c05fff45a2b625631b4e45a347))
|
||||
* 编码规范问题修复 ([f60bc94](https://gitee.com/openharmony/kernel_liteos_a/commits/f60bc94cf231bc615ff6603ca0393b8fe33a8c47))
|
||||
* 编译框架在做编译入口的统一 ([bdb9864](https://gitee.com/openharmony/kernel_liteos_a/commits/bdb9864436a6f128a4c3891bbd63e3c60352689f)), closes [#I4KRQN](https://gitee.com/openharmony/kernel_liteos_a/issues/I4KRQN)
|
||||
* 解决dmesg -s参数double lock问题 ([e151256](https://gitee.com/openharmony/kernel_liteos_a/commits/e1512566e322eb1fbc8f5d5997f9bfcd022feac7)), closes [#I4HIJK](https://gitee.com/openharmony/kernel_liteos_a/issues/I4HIJK)
|
||||
* 进程退出前自己回收vmspace中的所有region ([298ccea](https://gitee.com/openharmony/kernel_liteos_a/commits/298ccea3fedaccc651b38973f0455fa1ce12e516)), closes [#I4CKQC](https://gitee.com/openharmony/kernel_liteos_a/issues/I4CKQC)
|
||||
* 通过g_uart_fputc_en关闭打印后,shell进程不能正常启动 ([d21b05c](https://gitee.com/openharmony/kernel_liteos_a/commits/d21b05c0f69877130366ad37b852a0f30c11809d)), closes [#I4CTY2](https://gitee.com/openharmony/kernel_liteos_a/issues/I4CTY2)
|
||||
* 针对pr是否同步至release分支,增加原因说明规则 ([b37a7b7](https://gitee.com/openharmony/kernel_liteos_a/commits/b37a7b79292d93dae6c4914952b5f3bb509e8721))
|
||||
* 非当前进程销毁时,销毁liteipc时错误的销毁了当前进程的liteipc资源 ([0f0e85b](https://gitee.com/openharmony/kernel_liteos_a/commits/0f0e85b7a6bf76d540925fbf661c483c8dba1cba)), closes [#I4FSA7](https://gitee.com/openharmony/kernel_liteos_a/issues/I4FSA7)
|
||||
|
||||
|
||||
### Code Refactoring
|
||||
|
||||
* los_cir_buf.c中接口整合 ([0d325c5](https://gitee.com/openharmony/kernel_liteos_a/commits/0d325c56a1053043db05d53a6c8083f4d35f116b)), closes [#I4MC13](https://gitee.com/openharmony/kernel_liteos_a/issues/I4MC13)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
|
||||
* add option SIOCGIFBRDADDR for ioctl ([4ecc473](https://gitee.com/openharmony/kernel_liteos_a/commits/4ecc473843207d259613d26b8ee176d75e7f00fd)), closes [#I4DNRF](https://gitee.com/openharmony/kernel_liteos_a/issues/I4DNRF)
|
||||
* add sync() to vfs ([f67c4da](https://gitee.com/openharmony/kernel_liteos_a/commits/f67c4dae5141914df2e069dce0196b14780649d8)), closes [#I480HV](https://gitee.com/openharmony/kernel_liteos_a/issues/I480HV)
|
||||
* **build:** support gcc toolchain ([6e886d4](https://gitee.com/openharmony/kernel_liteos_a/commits/6e886d4233dec3b82a27642f174b920e5f98f6aa))
|
||||
* L0-L1 支持Perf ([6e0a3f1](https://gitee.com/openharmony/kernel_liteos_a/commits/6e0a3f10bbbfe29d110c050da927684b6d77b961)), closes [#I47I9A](https://gitee.com/openharmony/kernel_liteos_a/issues/I47I9A)
|
||||
* L0~L1 支持Lms ([e748fdb](https://gitee.com/openharmony/kernel_liteos_a/commits/e748fdbe578a1ddd8eb10b2e207042676231ba26)), closes [#I4HYAV](https://gitee.com/openharmony/kernel_liteos_a/issues/I4HYAV)
|
||||
* liteipc 静态内存优化 ([5237924](https://gitee.com/openharmony/kernel_liteos_a/commits/52379242c109e0cf442784dbe811ff9d42d5f33a)), closes [#I4G4HP](https://gitee.com/openharmony/kernel_liteos_a/issues/I4G4HP)
|
||||
* page cache backed by vnode instead of filep ([38a6b80](https://gitee.com/openharmony/kernel_liteos_a/commits/38a6b804e9291d2fdbd189825ebd7d56165ec51c)), closes [#I44TBS](https://gitee.com/openharmony/kernel_liteos_a/issues/I44TBS)
|
||||
* 提供低功耗默认处理框架 ([212d1bd](https://gitee.com/openharmony/kernel_liteos_a/commits/212d1bd1e806530fe7e7a16ea986cb2c6fb084ed)), closes [#I4KBG9](https://gitee.com/openharmony/kernel_liteos_a/issues/I4KBG9)
|
||||
* 支持AT_RANDOM以增强用户态栈保护能力 ([06ea037](https://gitee.com/openharmony/kernel_liteos_a/commits/06ea03715f0cfb8728fadd0d9c19a403dc8f6028)), closes [#I4CB8M](https://gitee.com/openharmony/kernel_liteos_a/issues/I4CB8M)
|
||||
* 支持L1 低功耗框架 ([64e49ab](https://gitee.com/openharmony/kernel_liteos_a/commits/64e49aba7c9c7d2280c5b3f29f04b17b63209855)), closes [#I4JSOT](https://gitee.com/openharmony/kernel_liteos_a/issues/I4JSOT)
|
||||
* 支持LOS_TaskJoin 和 LOS_TaskDetach ([37bc11f](https://gitee.com/openharmony/kernel_liteos_a/commits/37bc11fa8837a3019a0a56702f401ec1845f6547)), closes [#I4EENF](https://gitee.com/openharmony/kernel_liteos_a/issues/I4EENF)
|
||||
* 新增解析异常和backtrace信息脚本 ([7019fdf](https://gitee.com/openharmony/kernel_liteos_a/commits/7019fdfcbb33c660e8aa9fd399d5fccbd7e23b49)), closes [#I47EVQ](https://gitee.com/openharmony/kernel_liteos_a/issues/I47EVQ)
|
||||
* 调度tick响应时间计算优化 ([f47da44](https://gitee.com/openharmony/kernel_liteos_a/commits/f47da44b39be7fa3e9b5031d7b79b9bef1fd4fbc))
|
||||
* 调度去进程化,优化进程线程依赖关系 ([dc479fb](https://gitee.com/openharmony/kernel_liteos_a/commits/dc479fb7bd9cb8441e4e47d44b42110ea07d76a2))
|
||||
* 调度相关模块间依赖优化 ([0e3936c](https://gitee.com/openharmony/kernel_liteos_a/commits/0e3936c4f8b8bcfc48d283a6d53413e0fc0619b3)), closes [#I4RPRW](https://gitee.com/openharmony/kernel_liteos_a/issues/I4RPRW)
|
||||
* 进程cpup占用率结构优化为动态分配 ([f06e090](https://gitee.com/openharmony/kernel_liteos_a/commits/f06e090a1085a654fd726fbc3c3a1c2bc703d663)), closes [#I4GLNT](https://gitee.com/openharmony/kernel_liteos_a/issues/I4GLNT)
|
||||
* 进程rlimit修改为动态分配,减少静态内存占用 ([cf8446c](https://gitee.com/openharmony/kernel_liteos_a/commits/cf8446c94112ed6993a2e6e71e793d83a72689d5)), closes [#I4EZY5](https://gitee.com/openharmony/kernel_liteos_a/issues/I4EZY5)
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* 1. 删除 LOS_CirBufLock(),LOS_CirBufUnlock()内核对外接口
|
||||
2. LOS_CirBufWrite(),LOS_CirBufRead()由原先内部不进行上/解锁操作,变为默认已包含上/解锁操作。
|
||||
* 新增支持API:
|
||||
|
||||
LOS_LmsCheckPoolAdd使能检测指定内存池
|
||||
LOS_LmsCheckPoolDel不检测指定内存池
|
||||
LOS_LmsAddrProtect为指定内存段上锁,不允许访问
|
||||
LOS_LmsAddrDisableProtect去能指定内存段的访问保护
|
||||
* 1.新增一系列perf的对外API,位于los_perf.h中.
|
||||
LOS_PerfInit配置采样数据缓冲区
|
||||
LOS_PerfStart开启Perf采样
|
||||
LOS_PerfStop停止Perf采样
|
||||
LOS_PerfConfig配置Perf采样事件
|
||||
LOS_PerfDataRead读取采样数据
|
||||
LOS_PerfNotifyHookReg 注册采样数据缓冲区的钩子函数
|
||||
LOS_PerfFlushHookReg 注册缓冲区刷cache的钩子
|
||||
|
||||
2. 用户态新增perf命令
|
||||
【Usage】:
|
||||
./perf [start] /[start id] Start perf.
|
||||
./perf [stop] Stop perf.
|
||||
./perf [read nBytes] Read nBytes raw data from perf buffer and print out.
|
||||
./perf [list] List events to be used in -e.
|
||||
./perf [stat] or [record] <option> <command>
|
||||
-e, event selector. use './perf list' to list available events.
|
||||
-p, event period.
|
||||
-o, perf data output filename.
|
||||
-t, taskId filter(whiltelist), if not set perf will sample all tasks.
|
||||
-s, type of data to sample defined in PerfSampleType los_perf.h.
|
||||
-P, processId filter(whiltelist), if not set perf will sample all processes.
|
||||
-d, whether to prescaler (once every 64 counts), which only take effect on cpu cycle hardware event.
|
||||
|
||||
|
||||
# (2021-09-30)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* A核代码告警清零 ([698756d](https://gitee.com/openharmony/kernel_liteos_a/commits/698756d1e6dfb11b9f874c02ce6a1496646f2c27)), closes [#I4378T](https://gitee.com/openharmony/kernel_liteos_a/issues/I4378T)
|
||||
* A核告警消除 ([d16bfd0](https://gitee.com/openharmony/kernel_liteos_a/commits/d16bfd005a6dae78df2df3ad55cf21e0716dfae9)), closes [#I46KF6](https://gitee.com/openharmony/kernel_liteos_a/issues/I46KF6)
|
||||
* 3518平台, 异常测试进程无法正常退出 ([23937a2](https://gitee.com/openharmony/kernel_liteos_a/commits/23937a239f50d1487e89f3184e4f4b933d6842c6)), closes [#I3V8R5](https://gitee.com/openharmony/kernel_liteos_a/issues/I3V8R5)
|
||||
* add (void) to GetFileMappingList method ([56b8eca](https://gitee.com/openharmony/kernel_liteos_a/commits/56b8ecaf171671c0fe97f1dd1f191bebb7812a51)), closes [#I3XPXY](https://gitee.com/openharmony/kernel_liteos_a/issues/I3XPXY)
|
||||
* add capability and amend smoke testcase ([c9d69e2](https://gitee.com/openharmony/kernel_liteos_a/commits/c9d69e2d1bde57c67068cc36f6a79327d5db5daf))
|
||||
* add fchdir api ([e828cbd](https://gitee.com/openharmony/kernel_liteos_a/commits/e828cbdeac7d60bfd6ed98c75a9958ee8ec7b672))
|
||||
* add fchmod api ([2f214bf](https://gitee.com/openharmony/kernel_liteos_a/commits/2f214bf4de6c31875c77e84b1763e96bc5ceb669))
|
||||
* add fststfs api and unitest ([4c57aa2](https://gitee.com/openharmony/kernel_liteos_a/commits/4c57aa26ad3644ce2429effc8e8fe7fd3c52ebc2))
|
||||
* add product_path parameter for driver build ([88fe4eb](https://gitee.com/openharmony/kernel_liteos_a/commits/88fe4eb3e1eafa6d1e32c7b96579a07f5a8c6e35)), closes [#I3PQ10](https://gitee.com/openharmony/drivers_adapter/issues/I3PQ10)
|
||||
* add syscall for ppoll & add 2 testcases ([defedb6](https://gitee.com/openharmony/kernel_liteos_a/commits/defedb6fdf0806da4a39e22408544cdfb405f2ff))
|
||||
* avoid compile warning ignored ([eca711b](https://gitee.com/openharmony/kernel_liteos_a/commits/eca711bb64a7c806ae34c8483cac73fe22b0104f)), closes [#I3VOAO](https://gitee.com/openharmony/kernel_liteos_a/issues/I3VOAO)
|
||||
* A核codex修改 ([ec977a1](https://gitee.com/openharmony/kernel_liteos_a/commits/ec977a1c7e9ba4ea6621ceb1d0d10e586148208d)), closes [#I40B1S](https://gitee.com/openharmony/kernel_liteos_a/issues/I40B1S)
|
||||
* BBOX使用预留物理内存缓存故障日志 ([2ad176e](https://gitee.com/openharmony/kernel_liteos_a/commits/2ad176e587d5ed7106831a25d386a88e26192e2b)), closes [#I41YIZ](https://gitee.com/openharmony/kernel_liteos_a/issues/I41YIZ)
|
||||
* bootargs解析与rootfs挂载解耦,并支持自定义bootargs参数 ([80473f0](https://gitee.com/openharmony/kernel_liteos_a/commits/80473f0975fe6fd4c4eae3a8a473674ad2dd1293)), closes [#I41CL8](https://gitee.com/openharmony/kernel_liteos_a/issues/I41CL8)
|
||||
* **build:** clang10.0.1支持lto,去掉冗余判断 ([73223ae](https://gitee.com/openharmony/kernel_liteos_a/commits/73223ae7e652b7cd9f1e1848c32b2b2573d07b2a))
|
||||
* **build:** fix rootfsdir.sh target directory not exist ([21bf2b8](https://gitee.com/openharmony/kernel_liteos_a/commits/21bf2b889931787fb18ca7ea238291fd57e76d51)), closes [#I3NHQ0](https://gitee.com/openharmony/kernel_liteos_a/issues/I3NHQ0)
|
||||
* **build:** 去除冗余单板相关的宏配置 ([471de36](https://gitee.com/openharmony/kernel_liteos_a/commits/471de3663ea8b63f7448162edc0293b8723dcefc))
|
||||
* clang10 lld could not recognized Oz ([87a0006](https://gitee.com/openharmony/kernel_liteos_a/commits/87a0006d5e1976fdf5efe4be383921610eb04ec6))
|
||||
* clang相关编译选项隔离 ([77dcef4](https://gitee.com/openharmony/kernel_liteos_a/commits/77dcef4bc0c92d0141f7a3be0addd4d5cb533b0b)), closes [#I444AV](https://gitee.com/openharmony/kernel_liteos_a/issues/I444AV)
|
||||
* codex ([101a55d](https://gitee.com/openharmony/kernel_liteos_a/commits/101a55d1199530d621f809976f0024aa8295cce8))
|
||||
* codex clean ([b5370af](https://gitee.com/openharmony/kernel_liteos_a/commits/b5370af822c8e81ed2248ac8aa3bb479a0db9dae)), closes [#I3UOFN](https://gitee.com/openharmony/kernel_liteos_a/issues/I3UOFN)
|
||||
* compile error when fatfs disabled ([fd3f407](https://gitee.com/openharmony/kernel_liteos_a/commits/fd3f4072b5c3dff710013ccdaddf114b0e13f435))
|
||||
* console compile bug fix ([f8441a0](https://gitee.com/openharmony/kernel_liteos_a/commits/f8441a0cdea301449416b0c0477dc48a05b6ab4e))
|
||||
* correct spelling ([c66fe03](https://gitee.com/openharmony/kernel_liteos_a/commits/c66fe0313f76ba41992b4864c93cf82934378ad3))
|
||||
* Correctly handle the return value of LOS_EventRead in QuickstartListen. ([0e0ab81](https://gitee.com/openharmony/kernel_liteos_a/commits/0e0ab81ff9474cffd5e60a8ee741840eac5d737b)), closes [#I3PSLZ](https://gitee.com/openharmony/kernel_liteos_a/issues/I3PSLZ)
|
||||
* Ctrl-C move out of LOS_MAGIC_KEY_ENABLE ([40f239a](https://gitee.com/openharmony/kernel_liteos_a/commits/40f239a7d4673dc740c853b1011b5072e48385b7))
|
||||
* Delete useless 'exc interaction' macros and function declarations. ([d2f2679](https://gitee.com/openharmony/kernel_liteos_a/commits/d2f26790716c9f76589c4a7d6fa5518f9ccd743c)), closes [#I3SDKY](https://gitee.com/openharmony/kernel_liteos_a/issues/I3SDKY)
|
||||
* dereference NULL point bug fix ([deaa564](https://gitee.com/openharmony/kernel_liteos_a/commits/deaa564a66b83c9fe19a37b8a061ec9064ece354))
|
||||
* do not build toybox temporarily ([044f2c7](https://gitee.com/openharmony/kernel_liteos_a/commits/044f2c7c17c68e10aeccc3af0c222cfc722d194c))
|
||||
* do not override existing libs ([8118408](https://gitee.com/openharmony/kernel_liteos_a/commits/8118408123e75f7f5a4ab9101e388be6bba0dcda))
|
||||
* **doc:** 修复README_zh-HK.md的链接错误 ([f1b4c87](https://gitee.com/openharmony/kernel_liteos_a/commits/f1b4c87bc44650348504bc00b3f6f94491c341a0))
|
||||
* fatfs memory leak ([fbfd71d](https://gitee.com/openharmony/kernel_liteos_a/commits/fbfd71dfe3b5555ef09e542d96a630dfba636daa))
|
||||
* fix function name OsSchedSetIdleTaskSchedParam ([8f8c038](https://gitee.com/openharmony/kernel_liteos_a/commits/8f8c038b217d5ba2518413bfc1ba857587d47442))
|
||||
* Fix kernel page fault exception handling causing system exception. ([a89fb57](https://gitee.com/openharmony/kernel_liteos_a/commits/a89fb57f5795236b93fd19ee2d7a059cae1b2b1b)), closes [#I3RAN4](https://gitee.com/openharmony/kernel_liteos_a/issues/I3RAN4)
|
||||
* fix length typo ([12d98b1](https://gitee.com/openharmony/kernel_liteos_a/commits/12d98b144b70e726d3fd31ddc9d17ed855d0ec1b))
|
||||
* fix mq function by enable mq_notify api ([4427142](https://gitee.com/openharmony/kernel_liteos_a/commits/4427142d734df8f95f4599093392904abacc5c93))
|
||||
* Fix quickstart codingstyle ([2e011b6](https://gitee.com/openharmony/kernel_liteos_a/commits/2e011b672f6b96ea7e0db066a07e3f9fb6ba5df3)), closes [#I3OPOM](https://gitee.com/openharmony/kernel_liteos_a/issues/I3OPOM)
|
||||
* fix stored typo ([d25560f](https://gitee.com/openharmony/kernel_liteos_a/commits/d25560f8ac3216670d198cbbb25891c394e0b3c2))
|
||||
* fix syscall faccessat,fstatfs,fstatat & add 6 testcases ([aa1cd24](https://gitee.com/openharmony/kernel_liteos_a/commits/aa1cd245a5711e5b53c328b688da5ddc2e783d5f))
|
||||
* fix the inappropriate errno in FatFs ([af61187](https://gitee.com/openharmony/kernel_liteos_a/commits/af61187587411dca38ff62e720451f08f19c1c82)), closes [#I3O8IF](https://gitee.com/openharmony/kernel_liteos_a/issues/I3O8IF)
|
||||
* fix typo in quickstart ([3b2ff4b](https://gitee.com/openharmony/kernel_liteos_a/commits/3b2ff4b71fc5ae1dc74180c33fd66f69da0059d1)), closes [#I3M1S8](https://gitee.com/openharmony/kernel_liteos_a/issues/I3M1S8)
|
||||
* Fix wrong judgment in los_trace.c to avoid null pointer access. ([4d863e9](https://gitee.com/openharmony/kernel_liteos_a/commits/4d863e985b6372f7895db57b602b662dba5cadd0)), closes [#I3RT9F](https://gitee.com/openharmony/kernel_liteos_a/issues/I3RT9F)
|
||||
* Identical condition 'ret<0', second condition is always false. :bug: ([1348809](https://gitee.com/openharmony/kernel_liteos_a/commits/1348809807548dd481286a55a6677a9169fcd705))
|
||||
* init进程收到子进程退出信号后,调用fork重新拉起进程,会导致系统卡死 ([35a2f3a](https://gitee.com/openharmony/kernel_liteos_a/commits/35a2f3af33a5dba1e0ba36587efced8fead97223)), closes [#I41HOY](https://gitee.com/openharmony/kernel_liteos_a/issues/I41HOY)
|
||||
* kernel crashed after rmdir the umounted folder ([ac0d083](https://gitee.com/openharmony/kernel_liteos_a/commits/ac0d083b1c89c4ad3fdaab0347d11f174d0185cb))
|
||||
* kernel crashed when delete a umounted folder ([f305d1f](https://gitee.com/openharmony/kernel_liteos_a/commits/f305d1f702a770010125a0f4f0152ffefeeec5c4))
|
||||
* kernel crashed when delete a umounted folder ([c6e9212](https://gitee.com/openharmony/kernel_liteos_a/commits/c6e921241b1cf26bcbfeea44e20f6b596512e259))
|
||||
* **kernel_test:** 内核mem/shm冒烟用例重复运行失败 ([0676578](https://gitee.com/openharmony/kernel_liteos_a/commits/0676578aae09c101d79e7a276823e849df293e29)), closes [#I3TH4W](https://gitee.com/openharmony/kernel_liteos_a/issues/I3TH4W)
|
||||
* L1 toybox 命令功能实现 ([2ff44c4](https://gitee.com/openharmony/kernel_liteos_a/commits/2ff44c4938d2e66ce60e9497c505eb6e97efc8c2)), closes [#I41N2A](https://gitee.com/openharmony/third_party_toybox/issues/I41N2A)
|
||||
* liteipc max data size too small ([4dc421e](https://gitee.com/openharmony/kernel_liteos_a/commits/4dc421e3decdaae60219d533c4a93dbc9334e35f))
|
||||
* LiteOS_A BBOX Codex整改 ([6a5a032](https://gitee.com/openharmony/kernel_liteos_a/commits/6a5a0326d2b18ffacce5d38fb351530973c2f245)), closes [#I43RQU](https://gitee.com/openharmony/kernel_liteos_a/issues/I43RQU)
|
||||
* Liteos-a创建的文件夹在Ubuntu中不可见 ([a9fc1e0](https://gitee.com/openharmony/kernel_liteos_a/commits/a9fc1e0e5d3e5eb8a34c568a8d147320a9afebe1)), closes [#I3XMY6](https://gitee.com/openharmony/kernel_liteos_a/issues/I3XMY6)
|
||||
* lookup new vnode may cause parent vnode freeing ([902a11d](https://gitee.com/openharmony/kernel_liteos_a/commits/902a11de9a4b08e799820fb87942cb2171b9e095)), closes [#I3MYP4](https://gitee.com/openharmony/kernel_liteos_a/issues/I3MYP4)
|
||||
* **mini:** fix compile error in mini liteos_a ([e13cb3b](https://gitee.com/openharmony/kernel_liteos_a/commits/e13cb3bcc4e74d4c49c31d290d686f99a4e81e3f))
|
||||
* minimal compile ([ac8c2c6](https://gitee.com/openharmony/kernel_liteos_a/commits/ac8c2c6d5b9ede0e46b48212f0b3447605a613c4))
|
||||
* misspell ([08980ea](https://gitee.com/openharmony/kernel_liteos_a/commits/08980eac3c249ec6a6717d8a04fb0be7716053a1))
|
||||
* mkdir -p is more robust ([e38f9a9](https://gitee.com/openharmony/kernel_liteos_a/commits/e38f9a98c9d373db8381af707c5996d1fefef64e))
|
||||
* mksh compile bug fix ([d8263b1](https://gitee.com/openharmony/kernel_liteos_a/commits/d8263b1e91d76706d52df321ef642c1c8297e8e4)), closes [#I3ZMR7](https://gitee.com/openharmony/kernel_liteos_a/issues/I3ZMR7)
|
||||
* modify event API description ([937734b](https://gitee.com/openharmony/kernel_liteos_a/commits/937734b1e9f5fc52e0ac727549bd2e4b4c864e3c))
|
||||
* move nuttx head file back ([4c8a86e](https://gitee.com/openharmony/kernel_liteos_a/commits/4c8a86ece7cafa8f74441bacc74c7788c0a1b780)), closes [#I4443Q](https://gitee.com/openharmony/kernel_liteos_a/issues/I4443Q)
|
||||
* nanosleep 接口的rmtp参数被错误清零 ([9458de9](https://gitee.com/openharmony/kernel_liteos_a/commits/9458de9ac664cd75540c8b638b9a6caf82812fc8)), closes [#I41U0R](https://gitee.com/openharmony/kernel_liteos_a/issues/I41U0R)
|
||||
* no exception information output, when the system is abnormal ([5bf4d1c](https://gitee.com/openharmony/kernel_liteos_a/commits/5bf4d1c7128e6718611bbec23cb4373bcb3bfe55))
|
||||
* no exception information output, when the system is abnormal ([28aa777](https://gitee.com/openharmony/kernel_liteos_a/commits/28aa777191e7b41e4f1f346ab79f8688edc59c6d))
|
||||
* no exception information output, when the system is abnormal after holding ([0ed8adf](https://gitee.com/openharmony/kernel_liteos_a/commits/0ed8adfe3ae59672e284331d40ef3b9e0bc8e094))
|
||||
* Optimiz macro of quickstart cmd ([cb140a4](https://gitee.com/openharmony/kernel_liteos_a/commits/cb140a4442c02dd0b1925cc58deecbf4da36dcea)), closes [#I3OSYT](https://gitee.com/openharmony/kernel_liteos_a/issues/I3OSYT)
|
||||
* Optimize /dev/quickstart permissions. ([4e24b57](https://gitee.com/openharmony/kernel_liteos_a/commits/4e24b572897c33e1b2723122c0e13d3931096bae)), closes [#I3OYUQ](https://gitee.com/openharmony/kernel_liteos_a/issues/I3OYUQ)
|
||||
* Optimize quickstart node implementation ([4abd2e0](https://gitee.com/openharmony/kernel_liteos_a/commits/4abd2e0247b14718bb21756fb446142140d30a88)), closes [#I3R8O8](https://gitee.com/openharmony/kernel_liteos_a/issues/I3R8O8)
|
||||
* OsGerCurrSchedTimeCycle 函数存在拼写错误 ([53ced1a](https://gitee.com/openharmony/kernel_liteos_a/commits/53ced1a85edc3d06230225ced3916772f432243f)), closes [#I446CX](https://gitee.com/openharmony/kernel_liteos_a/issues/I446CX)
|
||||
* OsGetArgsAddr声明所在头文件不正确 ([14bd753](https://gitee.com/openharmony/kernel_liteos_a/commits/14bd753aa8beb49af887c8d0aedaefa446409760)), closes [#I41MWM](https://gitee.com/openharmony/kernel_liteos_a/issues/I41MWM)
|
||||
* parent point of vnode found by VfsHashGet should be updated ([f32caa5](https://gitee.com/openharmony/kernel_liteos_a/commits/f32caa52c67eca20d58676be4e0439acbb4c5ac3)), closes [#I3NNFA](https://gitee.com/openharmony/kernel_liteos_a/issues/I3NNFA)
|
||||
* PathCacheFree try to free name field in struct PathCache ([9f47faf](https://gitee.com/openharmony/kernel_liteos_a/commits/9f47faff732609cf2249f104b94ed55f3ef133bb)), closes [#I3NTH9](https://gitee.com/openharmony/kernel_liteos_a/issues/I3NTH9)
|
||||
* PathCacheMemoryDump miscalculate the RAM usage of PathCache ([87da7c7](https://gitee.com/openharmony/kernel_liteos_a/commits/87da7c794c9bc8e311ae5242820fbf8aefd8d558)), closes [#I3OBXY](https://gitee.com/openharmony/kernel_liteos_a/issues/I3OBXY)
|
||||
* Provide a separate configuration macro for boot environment in RAM. ([e28e06b](https://gitee.com/openharmony/kernel_liteos_a/commits/e28e06b08f5b28091153e584cb9d93014a9f2b10))
|
||||
* Provide a separate configuration macro for boot environment in RAM. ([bc67393](https://gitee.com/openharmony/kernel_liteos_a/commits/bc67393a67f714e0a8165b6103e53699c676341c))
|
||||
* Provide a separate configuration macro for boot environment in RAM. ([f13b90e](https://gitee.com/openharmony/kernel_liteos_a/commits/f13b90e4308ba3d60683799b9ce62fb3705ac277)), closes [#I3OADR](https://gitee.com/openharmony/kernel_liteos_a/issues/I3OADR)
|
||||
* race condition in liteipc ([7e2aef2](https://gitee.com/openharmony/kernel_liteos_a/commits/7e2aef2480b15f71ee0e089cef4443f578e03dbb)), closes [#I3PW5Y](https://gitee.com/openharmony/kernel_liteos_a/issues/I3PW5Y)
|
||||
* rebuild mksh depends on rebuild.sh script ([bef4ab9](https://gitee.com/openharmony/kernel_liteos_a/commits/bef4ab9835dec865898c74337dfb7154718b94aa))
|
||||
* remove redundant headfile ([73a7777](https://gitee.com/openharmony/kernel_liteos_a/commits/73a777777e1b834192f6bb2c0e8bd03c69765c11)), closes [#I3RTNR](https://gitee.com/openharmony/kernel_liteos_a/issues/I3RTNR)
|
||||
* Remove redundant invalid codes ([fe05df4](https://gitee.com/openharmony/kernel_liteos_a/commits/fe05df40ae710632adb1bd54fb04ad4a8e0c1429)), closes [#I3R70T](https://gitee.com/openharmony/kernel_liteos_a/issues/I3R70T)
|
||||
* Show conflicting files for git apply or patch -p command ([35f7957](https://gitee.com/openharmony/kernel_liteos_a/commits/35f79579758644cbcac6005f894be21f34f42b99)), closes [#I3NNUS](https://gitee.com/openharmony/kernel_liteos_a/issues/I3NNUS)
|
||||
* SIOCGIFCONF ioctl malloc size error in kernel ([bfd27e7](https://gitee.com/openharmony/kernel_liteos_a/commits/bfd27e78b259eedbd4c30548e80c9b4d789d26e1)), closes [#I3XEZ3](https://gitee.com/openharmony/kernel_liteos_a/issues/I3XEZ3)
|
||||
* smp启动代码解耦及内存映射关系解耦 ([3bb3173](https://gitee.com/openharmony/kernel_liteos_a/commits/3bb3173604dc4dea09301f61da402974185dc112)), closes [#I41P8Y](https://gitee.com/openharmony/kernel_liteos_a/issues/I41P8Y)
|
||||
* some branch in format does not release the vnode mutex properly ([9b2b700](https://gitee.com/openharmony/kernel_liteos_a/commits/9b2b700fa0e3a8edadb38f09c917a3e3f013347f)), closes [#I3OFAY](https://gitee.com/openharmony/kernel_liteos_a/issues/I3OFAY)
|
||||
* Sortlink, the response time to insert the node should be inserted into the back of the existing node. ([1323874](https://gitee.com/openharmony/kernel_liteos_a/commits/1323874389030c55fb053fead12ca1c6654d8851)), closes [#I3PSJ8](https://gitee.com/openharmony/kernel_liteos_a/issues/I3PSJ8)
|
||||
* statfs can't get f_bfree and f_bavail of a FAT12/FAT16 partition ([9503c4a](https://gitee.com/openharmony/kernel_liteos_a/commits/9503c4a9fc30aaa8ea2031d4fb794436f3c98055)), closes [#I3Q0VS](https://gitee.com/openharmony/kernel_liteos_a/issues/I3Q0VS)
|
||||
* SysOpenat返回值应该为进程fd,而非系统全局fd。 ([3457c0b](https://gitee.com/openharmony/kernel_liteos_a/commits/3457c0b11debb2cf5d4abe325c2510a750654512)), closes [#I3TNAK](https://gitee.com/openharmony/kernel_liteos_a/issues/I3TNAK)
|
||||
* the total used vnode number not increased after unlink a file under ([4f514a1](https://gitee.com/openharmony/kernel_liteos_a/commits/4f514a16af5a3f3b9c4ea182de774297afb17f66)), closes [#I3TS1Y](https://gitee.com/openharmony/kernel_liteos_a/issues/I3TS1Y)
|
||||
* tick 动态化计算优化,消除中断执行时间对系统总体时间的影响,保证软件定时器的响应精度。 ([8df3e8c](https://gitee.com/openharmony/kernel_liteos_a/commits/8df3e8c96515a1907455a9bbc61426f43c803c62)), closes [#I43UQJ](https://gitee.com/openharmony/kernel_liteos_a/issues/I43UQJ)
|
||||
* toybox update ([c3245b3](https://gitee.com/openharmony/kernel_liteos_a/commits/c3245b3ce317eb58c8dad58fdfc7f094b9b9794b))
|
||||
* toybox命令升级 ([76f45b3](https://gitee.com/openharmony/kernel_liteos_a/commits/76f45b3fb2783d1cab45a6ba08787c29dfa2c948)), closes [#I41N2A](https://gitee.com/openharmony/third_party_toybox/issues/I41N2A)
|
||||
* update LOS_DL_LIST_IS_END comment ([900269b](https://gitee.com/openharmony/kernel_liteos_a/commits/900269bd4645252d898f6d3b73de01d8548c960c))
|
||||
* userfs分区的起始地址与大小改为通过bootargs配置 ([2e2b142](https://gitee.com/openharmony/kernel_liteos_a/commits/2e2b14205f4b81c7483ab42d62f144487097e9a4)), closes [#I3XNEY](https://gitee.com/openharmony/kernel_liteos_a/issues/I3XNEY)
|
||||
* VnodeInUseIter and VnodeFreeAll used to be recursive ([5f6656c](https://gitee.com/openharmony/kernel_liteos_a/commits/5f6656cb36a2ffb0b290aeb53981aba7501e80b2)), closes [#I3NN3U](https://gitee.com/openharmony/kernel_liteos_a/issues/I3NN3U)
|
||||
* 以g_sysSchedStartTime是否为0判断时间轴是否生效存在极限场景导致调度时间不生效 ([67ac8c4](https://gitee.com/openharmony/kernel_liteos_a/commits/67ac8c4c586adc371ece56700fd42371ca7fc885)), closes [#I45HP5](https://gitee.com/openharmony/kernel_liteos_m/issues/I45HP5)
|
||||
* 修复FATFS中不同内部接口不支持FAT12/FAT16 FAT表结束标志 ([33f5c70](https://gitee.com/openharmony/kernel_liteos_a/commits/33f5c70e6c8781758d2bfde0f60ca3d6ec7d543f)), closes [#I409R6](https://gitee.com/openharmony/kernel_liteos_a/issues/I409R6)
|
||||
* 修复kill进程时,因liteipc阻塞的进程概率无法退出问题 ([7de43bb](https://gitee.com/openharmony/kernel_liteos_a/commits/7de43bb004a12f926550f0b36ca3c2fa610feb27)), closes [#I3XX7K](https://gitee.com/openharmony/kernel_liteos_a/issues/I3XX7K)
|
||||
* 修复MagicKey数组越界访问 ([071cd62](https://gitee.com/openharmony/kernel_liteos_a/commits/071cd6268aeaaef702387dacaf4ef1ffbb7618fc)), closes [#I3U4N9](https://gitee.com/openharmony/kernel_liteos_a/issues/I3U4N9)
|
||||
* 修复mprotect修改地址区间的权限后,相应的区间名丢失问题 ([e425187](https://gitee.com/openharmony/kernel_liteos_a/commits/e425187d176a5e09bc5253faefc9cfc8454da0a3)), closes [#I43R40](https://gitee.com/openharmony/kernel_liteos_a/issues/I43R40)
|
||||
* 修复mq_close关闭后仍然占用文件描述符的问题 ([590c7b4](https://gitee.com/openharmony/kernel_liteos_a/commits/590c7b4e22662781d05ad035a785e985d573ec33)), closes [#I3ZQDA](https://gitee.com/openharmony/kernel_liteos_a/issues/I3ZQDA)
|
||||
* 修复mqueue问题 ([26ee8b8](https://gitee.com/openharmony/kernel_liteos_a/commits/26ee8b836e346e641de4ecd72284f5d377bca6f8)), closes [#I43P4T](https://gitee.com/openharmony/kernel_liteos_a/issues/I43P4T)
|
||||
* 修复sigwait等待到的信号值与获取的siginfo中的值不一致 ([ed7defb](https://gitee.com/openharmony/kernel_liteos_a/commits/ed7defbd439c345a07159d40eb04433afd530004)), closes [#I3M12H](https://gitee.com/openharmony/kernel_liteos_a/issues/I3M12H)
|
||||
* 修复了LOSCFG_FS_FAT_VIRTUAL_PARTITION宏开关错误作用域引起的功能错误 ([acda419](https://gitee.com/openharmony/kernel_liteos_a/commits/acda419a2d773ea890052a16ee66b4872f941fbb)), closes [#I3W1IW](https://gitee.com/openharmony/kernel_liteos_a/issues/I3W1IW)
|
||||
* 修复了内核的VFAT测试用例 ([a8384b5](https://gitee.com/openharmony/kernel_liteos_a/commits/a8384b5db2274d50a350910d7cfd3fc36b4f4103)), closes [#I3XF3R](https://gitee.com/openharmony/kernel_liteos_a/issues/I3XF3R)
|
||||
* 修复内核access chmod chown接口 ([56a95b9](https://gitee.com/openharmony/kernel_liteos_a/commits/56a95b9ec903f815f9199ac65ca318e00a83b2ed)), closes [#I3Z5L6](https://gitee.com/openharmony/kernel_liteos_a/issues/I3Z5L6)
|
||||
* 修复内核c库的makefile中被优化函数替换的高频函数依然参与了编译的问题 ([6f6dc4f](https://gitee.com/openharmony/kernel_liteos_a/commits/6f6dc4f24c8ab05a6d42da46a9fa41d74a477bd7)), closes [#I3XGM8](https://gitee.com/openharmony/kernel_liteos_a/issues/I3XGM8)
|
||||
* 修复内核堆完整性检查逻辑中访问非法指针导致系统异常问题。 ([30f5ab8](https://gitee.com/openharmony/kernel_liteos_a/commits/30f5ab89b72d45f596b15af82a8e8e01add7977d)), closes [#I3VJZT](https://gitee.com/openharmony/kernel_liteos_a/issues/I3VJZT)
|
||||
* 修复启动框架debug模式下-Werror=maybe-uninitialized告警以及符号链接不进镜像的隐患 ([4c02415](https://gitee.com/openharmony/kernel_liteos_a/commits/4c024159a9600745863e49ee955308470a5b657b)), closes [#I3T5HR](https://gitee.com/openharmony/kernel_liteos_a/issues/I3T5HR)
|
||||
* 修复开机概率挂死 ([2e82c36](https://gitee.com/openharmony/kernel_liteos_a/commits/2e82c361f73b2119613c3571c48faae8ec41d4eb)), closes [#I3SWY2](https://gitee.com/openharmony/kernel_liteos_a/issues/I3SWY2)
|
||||
* 修复文档链接失效问题 ([42a3a6c](https://gitee.com/openharmony/kernel_liteos_a/commits/42a3a6c51bfca4ade8ce94084ea2f8eb1c86a137)), closes [#I45297](https://gitee.com/openharmony/kernel_liteos_a/issues/I45297)
|
||||
* 修改/proc/mounts显示格式 ([6860246](https://gitee.com/openharmony/kernel_liteos_a/commits/6860246cfaac6f540665e79bbc4c3d54c419b092)), closes [#I3XGCS](https://gitee.com/openharmony/kernel_liteos_a/issues/I3XGCS)
|
||||
* 修改clock_gettime接口适配posix标准测试用例011输入clk_id错误时返回值ESRCH为EINVAL. ([f8cf6e6](https://gitee.com/openharmony/kernel_liteos_a/commits/f8cf6e6439ee017fe8e0d4ecfc9949c28fa6775f)), closes [#I3OUHI](https://gitee.com/openharmony/kernel_liteos_a/issues/I3OUHI)
|
||||
* 修改DoNanoSleep 以纳秒为单位 ([6917e08](https://gitee.com/openharmony/kernel_liteos_a/commits/6917e08431689ccbd5a30e9a39b67016ffb64d0a)), closes [#I3Z9DP](https://gitee.com/openharmony/kernel_liteos_a/issues/I3Z9DP)
|
||||
* 修改某些平台保存bbox日志失败的问题 ([8f6a1dd](https://gitee.com/openharmony/kernel_liteos_a/commits/8f6a1dd33c59164070e8d2fb5abbd3e76ef8ac8e)), closes [#I41UTP](https://gitee.com/openharmony/kernel_liteos_a/issues/I41UTP)
|
||||
* 修改默认窗口宽度到400 ([09c491c](https://gitee.com/openharmony/kernel_liteos_a/commits/09c491ca1fd6d3110eafb0d07e45b25bdc3bd5d0)), closes [#I40LQX](https://gitee.com/openharmony/kernel_liteos_a/issues/I40LQX)
|
||||
* 关闭jffs和fat后,rootfs配置也被相应关闭,导致nand介质的rootfs不可用。 ([0ea476b](https://gitee.com/openharmony/kernel_liteos_a/commits/0ea476b9741fabd3c255c2770688f587920cf509)), closes [#I3SBYN](https://gitee.com/openharmony/kernel_liteos_a/issues/I3SBYN)
|
||||
* 内核态在console初始化完成后,使用printf无法正常打印 ([44ce696](https://gitee.com/openharmony/kernel_liteos_a/commits/44ce6969048c2e252f3f9d66fa485c77bdab8ae7)), closes [#I3UG00](https://gitee.com/openharmony/kernel_liteos_a/issues/I3UG00)
|
||||
* 去掉冗余的strip操作 ([7819d15](https://gitee.com/openharmony/kernel_liteos_a/commits/7819d15b3619681ae37a1349a6bec2440c829ae9)), closes [#I43767](https://gitee.com/openharmony/kernel_liteos_a/issues/I43767)
|
||||
* 合并进程栈两个地址连续的region ([42f374d](https://gitee.com/openharmony/kernel_liteos_a/commits/42f374dd7a353f1c8227e92fa92827c1c7b32424)), closes [#I43QYJ](https://gitee.com/openharmony/kernel_liteos_a/issues/I43QYJ)
|
||||
* 在内核提示No idle TCB时,增加打印当前系统任务信息,以方便问题定位。 ([11a9b00](https://gitee.com/openharmony/kernel_liteos_a/commits/11a9b00d43a6dbe9fba9f6eb07d78a9d226c28f8)), closes [#I434UC](https://gitee.com/openharmony/kernel_liteos_a/issues/I434UC)
|
||||
* 增加表头,内容以制表符分栏。 ([e9ad6b7](https://gitee.com/openharmony/kernel_liteos_a/commits/e9ad6b71c3b1136414672cd21b339ded7a02dfb9)), closes [#I3W2M9](https://gitee.com/openharmony/kernel_liteos_a/issues/I3W2M9)
|
||||
* 将用户态内存调测解析脚本移至tools目录下 ([85b4cb7](https://gitee.com/openharmony/kernel_liteos_a/commits/85b4cb7a67b717984d3ebf68115c7139cc61d690)), closes [#I42T9A](https://gitee.com/openharmony/kernel_liteos_a/issues/I42T9A)
|
||||
* 恢复了FATFS设置卷标的功能 ([9515d53](https://gitee.com/openharmony/kernel_liteos_a/commits/9515d53dccc9a6458bfbaf8e15143928f05cb660)), closes [#I3Y5G8](https://gitee.com/openharmony/kernel_liteos_a/issues/I3Y5G8)
|
||||
* 解决kill进程时无法保证进程的已持有的内核资源合理释放. ([cf89f01](https://gitee.com/openharmony/kernel_liteos_a/commits/cf89f016e93f28f8d72e6f5de08640d08a155908)), closes [#I3S0N0](https://gitee.com/openharmony/kernel_liteos_a/issues/I3S0N0)
|
||||
* 解决不同环境下计算的rootfs的size偏小,导致mcopy造成的disk full错误 ([c54879b](https://gitee.com/openharmony/kernel_liteos_a/commits/c54879b54875abece53b1f64072cfacbd2e1970e)), closes [#I3IA06](https://gitee.com/openharmony/kernel_liteos_a/issues/I3IA06)
|
||||
* 设置qemu默认userfs大小/修改qemu驱动目录 ([1d952a2](https://gitee.com/openharmony/kernel_liteos_a/commits/1d952a254a6e7ec2f70f7112eb27355cfd01ba4d)), closes [#I3XW96](https://gitee.com/openharmony/kernel_liteos_a/issues/I3XW96)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* active mksh & toybox ([cacb4f0](https://gitee.com/openharmony/kernel_liteos_a/commits/cacb4f0103ecb2d1b7af54d84957f88d3e9443d2)), closes [#I3VEOG](https://gitee.com/openharmony/kernel_liteos_a/issues/I3VEOG)
|
||||
* Add /dev/quickstart to support synchronous communication between processes in user mode startup. ([46b63f7](https://gitee.com/openharmony/kernel_liteos_a/commits/46b63f71537789743ed2f3f337c1809ee4900d71)), closes [#I3OHO5](https://gitee.com/openharmony/kernel_liteos_a/issues/I3OHO5)
|
||||
* add /proc/fd file to dump the pid/fd/path information ([600dded](https://gitee.com/openharmony/kernel_liteos_a/commits/600dded31e80df275ed08c326c0ce3d1857d8dd8)), closes [#I3WB5U](https://gitee.com/openharmony/kernel_liteos_a/issues/I3WB5U)
|
||||
* add /proc/fs_cache to display cache info ([231cb6b](https://gitee.com/openharmony/kernel_liteos_a/commits/231cb6be27380948bc48136ae2e02c28450f47a8)), closes [#I3WWBD](https://gitee.com/openharmony/kernel_liteos_a/issues/I3WWBD)
|
||||
* add /proc/fs_cache to display cache info ([53c6d96](https://gitee.com/openharmony/kernel_liteos_a/commits/53c6d96c6f97cb006216769f8b73f50fba3bc325)), closes [#I3WESD](https://gitee.com/openharmony/kernel_liteos_a/issues/I3WESD)
|
||||
* add and fix some syscall ([ce849f2](https://gitee.com/openharmony/kernel_liteos_a/commits/ce849f2145e1569517c5244c9ffcaebed53f3a66))
|
||||
* add blackbox for liteos_a ([a195aac](https://gitee.com/openharmony/kernel_liteos_a/commits/a195aac9fb60b0163f9eebb29084287d226bd14c)), closes [#I406NP](https://gitee.com/openharmony/kernel_liteos_a/issues/I406NP)
|
||||
* add blackbox for liteos_a ([425975e](https://gitee.com/openharmony/kernel_liteos_a/commits/425975e4811023e31a520979c20ea2562224d9d0))
|
||||
* add clear cache cmd to /proc/fs_cache ([3d1cf68](https://gitee.com/openharmony/kernel_liteos_a/commits/3d1cf683f37a6f75e9db2ce1f11ec93159b77663)), closes [#I3XLPH](https://gitee.com/openharmony/kernel_liteos_a/issues/I3XLPH)
|
||||
* add liteos patch ability ([98ca844](https://gitee.com/openharmony/kernel_liteos_a/commits/98ca8441fe75ee1c3318a6a09376fd72f5a51350))
|
||||
* add support for gn build system ([a8805a6](https://gitee.com/openharmony/kernel_liteos_a/commits/a8805a65aab9109b915364fccf36c8328f636e48))
|
||||
* add uid/gid for ProcFs ([6780659](https://gitee.com/openharmony/kernel_liteos_a/commits/67806596a3c0df9a54893d8c74ebe9da98d7fb06)), closes [#I3WGVP](https://gitee.com/openharmony/kernel_liteos_a/issues/I3WGVP)
|
||||
* A核proc文件系统在echo模式下新增write的功能 ([f10dd7c](https://gitee.com/openharmony/kernel_liteos_a/commits/f10dd7c135d37a5fb0d78610d5ece5807d01eb1f)), closes [#I3T6MZ](https://gitee.com/openharmony/kernel_liteos_a/issues/I3T6MZ)
|
||||
* build OHOS_Image from kernel ([abf4d8f](https://gitee.com/openharmony/kernel_liteos_a/commits/abf4d8fb252631aca9d46211762880a23be2a0b1))
|
||||
* **build:** make liteos_config_file available as gn argument ([f9a9077](https://gitee.com/openharmony/kernel_liteos_a/commits/f9a907772f506ca7e2d84e96d4d17cffc7dae50f))
|
||||
* **build:** 使用xts -notest选项时,内核用例不参与编译构建和用例编译配置方式调整 ([9bdf716](https://gitee.com/openharmony/kernel_liteos_a/commits/9bdf716407c125c9877b6f49c2133112c18cdabc))
|
||||
* don't apply module_swith on configs of config ([f3beb4b](https://gitee.com/openharmony/kernel_liteos_a/commits/f3beb4b273c9a76fbfaffe57302f27d2a74cd2ba))
|
||||
* enable gn build for toybox and mksh ([c54bfa1](https://gitee.com/openharmony/kernel_liteos_a/commits/c54bfa16e3907482c252e9738192df869c63326e))
|
||||
* fatfs支持符号链接功能 ([e50cf0b](https://gitee.com/openharmony/kernel_liteos_a/commits/e50cf0be6f6d118022b6d79c5177aece574ba150)), closes [#I3V8D1](https://gitee.com/openharmony/kernel_liteos_a/issues/I3V8D1)
|
||||
* **file system:** add memory-based romfs ([c4595d2](https://gitee.com/openharmony/kernel_liteos_a/commits/c4595d25042b188570d991a815009764c37f3cb3)), closes [#I3S0CP](https://gitee.com/openharmony/kernel_liteos_a/issues/I3S0CP)
|
||||
* introduce mksh toybox to rootfs ([41c7689](https://gitee.com/openharmony/kernel_liteos_a/commits/41c7689dfa49c52fb15705ce15ef22a278fbf2ef))
|
||||
* L0-L1 支持Trace ([dc9ec68](https://gitee.com/openharmony/kernel_liteos_a/commits/dc9ec6856fe14aa604f037f55f17a3ba2bafb098)), closes [#I46WA0](https://gitee.com/openharmony/kernel_liteos_a/issues/I46WA0)
|
||||
* L1支持低功耗投票框架 ([21d8ac8](https://gitee.com/openharmony/kernel_liteos_a/commits/21d8ac8752469f6e0dc2d50d28b75421f665385a)), closes [#I3VS5N](https://gitee.com/openharmony/kernel_liteos_a/issues/I3VS5N)
|
||||
* **libc:** upgrade optimized-routines to v21.02 ([1ec8d5a](https://gitee.com/openharmony/kernel_liteos_a/commits/1ec8d5a454658e95c4acb821d0878f357f4e82ad))
|
||||
* **make:** optimize makefiles and remove some unused files ([0e26094](https://gitee.com/openharmony/kernel_liteos_a/commits/0e260949c962158a263d4b0ad45fe9f6843d6e30))
|
||||
* Open macro for ADC moudule ([c71ec9d](https://gitee.com/openharmony/kernel_liteos_a/commits/c71ec9d7e8574078a9dc2a8463f3141cca3d625a))
|
||||
* **QEMU_ARM_VIRT_CA7:** 使能FAT文件系统编译选项 ([49856dc](https://gitee.com/openharmony/kernel_liteos_a/commits/49856dc1e0de1c5e92346c83eda641dfb1bb16be))
|
||||
* support .mkshrc ([51a50c9](https://gitee.com/openharmony/kernel_liteos_a/commits/51a50c95b4cd47b6931523926b728d1c0ff8988b)), closes [#I3Y5KE](https://gitee.com/openharmony/third_party_mksh/issues/I3Y5KE)
|
||||
* support link/symlink/readlink ([6eddc86](https://gitee.com/openharmony/kernel_liteos_a/commits/6eddc869d349be59860bfd84ff10b7579a9b00a9)), closes [#I3Q0OD](https://gitee.com/openharmony/kernel_liteos_a/issues/I3Q0OD)
|
||||
* support toybox in qemu ([5618319](https://gitee.com/openharmony/kernel_liteos_a/commits/561831928bb1ad1871b2d60d2bba2d67488cea5f)), closes [#I3V17D](https://gitee.com/openharmony/kernel_liteos_a/issues/I3V17D)
|
||||
* timer_create支持以SIGEV_THREAD方式创建定时器 ([e5f6bf0](https://gitee.com/openharmony/kernel_liteos_a/commits/e5f6bf05567c2d193f3746caca502199e7b81e92)), closes [#I3SRFI](https://gitee.com/openharmony/kernel_liteos_a/issues/I3SRFI)
|
||||
* using kconfiglib instead of kconfig ([8784694](https://gitee.com/openharmony/kernel_liteos_a/commits/878469468647a19f704e7ee2af696b0ba8ab775a))
|
||||
* vfs support sdcard hotplug ([2db80ec](https://gitee.com/openharmony/kernel_liteos_a/commits/2db80ecb389176b53c77807567895470bb180a06)), closes [#I44WH1](https://gitee.com/openharmony/kernel_liteos_a/issues/I44WH1)
|
||||
* **vfs:** vfs支持FD_CLOEXEC标记 ([27dca4d](https://gitee.com/openharmony/kernel_liteos_a/commits/27dca4d857ef8de6b4bb9302e0dd435be7e3284f)), closes [#I3U81W](https://gitee.com/openharmony/kernel_liteos_a/issues/I3U81W)
|
||||
* 删除zpfs冗余代码 ([3393479](https://gitee.com/openharmony/kernel_liteos_a/commits/3393479c52f4a9dfe2394bb32beb4b98fca8e171))
|
||||
* 基于汇编实现内核对用户态内存清零的功能 ([9db3407](https://gitee.com/openharmony/kernel_liteos_a/commits/9db3407589bb0b2d4a5772faac3130032bc0b8a9)), closes [#I3XXT0](https://gitee.com/openharmony/kernel_liteos_a/issues/I3XXT0)
|
||||
* 增加mount的MS_RDONLY标志的支持 ([8729f6e](https://gitee.com/openharmony/kernel_liteos_a/commits/8729f6ee57ea57bc664d076ff112c8726fedded9)), closes [#I3Z1W6](https://gitee.com/openharmony/kernel_liteos_a/issues/I3Z1W6)
|
||||
* 支持killpg和waitid ([dc3cc09](https://gitee.com/openharmony/kernel_liteos_a/commits/dc3cc094a75c6da65d87522930afea06106d3933))
|
||||
* 新增toybox reboot命令 ([e567a10](https://gitee.com/openharmony/kernel_liteos_a/commits/e567a10d021c3e0fe02d6911dbe8687255c67ffa)), closes [#I3YQ7S](https://gitee.com/openharmony/third_party_toybox/issues/I3YQ7S)
|
||||
* 给开发者提供系统信息导出Hidumper工具。 ([cb17fa5](https://gitee.com/openharmony/kernel_liteos_a/commits/cb17fa50ed28e6e8f59b7d68ede13c759b983311))
|
||||
* 自研shell命令回补 ([7bc68f4](https://gitee.com/openharmony/kernel_liteos_a/commits/7bc68f454ff5fbf415712c9b8479b8c832f68417)), closes [#I44U0H](https://gitee.com/openharmony/third_party_toybox/issues/I44U0H)
|
||||
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
* assign '-1' to uninitialized variable: ret ([e0a27ba](https://gitee.com/openharmony/kernel_liteos_a/commits/e0a27badde20868cf3a5b4a44305b90af00e4f3f))
|
||||
|
||||
|
||||
### Reverts
|
||||
|
||||
* Revert "fix: 修改默认窗口宽度到400" ([1878849](https://gitee.com/openharmony/kernel_liteos_a/commits/187884937cd087e39a28c033c41033163d6b4766)), closes [#I42X9V](https://gitee.com/openharmony/kernel_liteos_a/issues/I42X9V)
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* 1.新增一系列trace的对外API,位于los_trace.h中.
|
||||
LOS_TRACE_EASY简易插桩
|
||||
LOS_TRACE标准插桩
|
||||
LOS_TraceInit配置Trace缓冲区的地址和大小
|
||||
LOS_TraceStart开启事件记录
|
||||
LOS_TraceStop停止事件记录
|
||||
LOS_TraceRecordDump输出Trace缓冲区数据
|
||||
LOS_TraceRecordGet获取Trace缓冲区的首地址
|
||||
LOS_TraceReset清除Trace缓冲区中的事件
|
||||
LOS_TraceEventMaskSet设置事件掩码,仅记录某些模块的事件
|
||||
LOS_TraceHwiFilterHookReg注册过滤特定中断号事件的钩子函数
|
||||
* **vfs:** 执行exec类函数后,进程拥有的文件描述符情况发生变化:修改前,默认关闭所有的进程文件描述符,0,1,2重新打开;修改后,除非文件描述符拥有FD_CLOEXEC标记,否则该描述符不会被关闭。
|
||||
|
||||
|
||||
|
13
Kconfig
13
Kconfig
|
@ -189,7 +189,7 @@ config DEBUG_VERSION
|
|||
It also means you do not want to use debug modules, like shell,telnet,tftp,nfs and
|
||||
memory check, etc.
|
||||
If you select this option that means you enable a debug version for LiteOS.
|
||||
That means you want a opposite behaviour compared to release version.
|
||||
That means you want an opposite behaviour compared to release version.
|
||||
|
||||
config DEBUG_KERNEL
|
||||
bool "Enable Debug LiteOS Kernel Resource"
|
||||
|
@ -198,7 +198,7 @@ config DEBUG_KERNEL
|
|||
help
|
||||
If you select this option that means you enable debugging kernel resource.
|
||||
It also means you want to get queue, mutex, semaphore, memory debug information.
|
||||
That means you want a opposite behaviour compared to release version.
|
||||
That means you want an opposite behaviour compared to release version.
|
||||
|
||||
config DEBUG_QUEUE
|
||||
bool "Enable Queue Debugging"
|
||||
|
@ -235,7 +235,12 @@ config SCHED_DEBUG
|
|||
depends on DEBUG_VERSION
|
||||
help
|
||||
If you wish to build LiteOS with support for sched debug.
|
||||
|
||||
config SCHED_EDF_DEBUG
|
||||
bool "Enable sched EDF debug Feature"
|
||||
default n
|
||||
depends on SCHED_DEBUG
|
||||
help
|
||||
If you wish to build LiteOS with support for sched debug.
|
||||
config USER_INIT_DEBUG
|
||||
bool "Enable user init Debug"
|
||||
default n
|
||||
|
@ -265,7 +270,7 @@ config MEM_LEAKCHECK
|
|||
default n
|
||||
depends on DEBUG_VERSION && MEM_DEBUG
|
||||
help
|
||||
Answer Y to enable record the LR of Function call stack of Mem operation, it can check the mem leak through the infomations of mem node.
|
||||
Answer Y to enable record the LR of Function call stack of Mem operation, it can check the mem leak through the information of mem node.
|
||||
config BASE_MEM_NODE_INTEGRITY_CHECK
|
||||
bool "Enable integrity check or not"
|
||||
default n
|
||||
|
|
7
Makefile
7
Makefile
|
@ -82,9 +82,6 @@ endif
|
|||
ifeq ($(LOSCFG_STORAGE_SPINAND), y)
|
||||
FSTYPE = yaffs2
|
||||
endif
|
||||
ifeq ($(LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7), y)
|
||||
FSTYPE = jffs2
|
||||
endif
|
||||
ROOTFS_DIR = $(OUT)/rootfs
|
||||
ROOTFS_ZIP = $(OUT)/rootfs.zip
|
||||
|
||||
|
@ -97,7 +94,7 @@ Targets:
|
|||
cleanall: clean all build outputs
|
||||
all: make liteos kernel image and rootfs image (Default target)
|
||||
$(APPS): build all apps
|
||||
$(ROOTFS): make a original rootfs image
|
||||
$(ROOTFS): make an original rootfs image
|
||||
$(LITEOS_LIBS_TARGET): compile all kernel modules (libraries)
|
||||
$(LITEOS_TARGET): make liteos kernel image
|
||||
update_config: update product kernel config (use menuconfig)
|
||||
|
@ -121,7 +118,7 @@ sysroot:
|
|||
$(HIDE)echo "sysroot:" $(abspath $(SYSROOT_PATH))
|
||||
ifeq ($(origin SYSROOT_PATH),file)
|
||||
$(HIDE)mkdir -p $(SYSROOT_PATH)/build && cd $(SYSROOT_PATH)/build && \
|
||||
ln -snf $(LITEOSTOPDIR)/../../prebuilts/lite/sysroot/build/Makefile && \
|
||||
ln -snf $(LITEOSTOPDIR)/../../third_party/musl/scripts/build_lite/Makefile && \
|
||||
$(MAKE) TARGETS=liteos_a_user \
|
||||
ARCH=$(ARCH) \
|
||||
TARGET=$(LOSCFG_LLVM_TARGET) \
|
||||
|
|
10
OAT.xml
10
OAT.xml
|
@ -12,9 +12,10 @@
|
|||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
This is the configuration file template for OpenHarmony OSS Audit Tool, please copy it to your project root dir and modify it refer to OpenHarmony/tools_oat/README.
|
||||
|
||||
<!--
|
||||
This is the configuration file template for OpenHarmony OSS Audit Tool. Please copy it to your project root dir and modify it by referring to OpenHarmony/tools_oat/README.
|
||||
-->
|
||||
|
||||
<configuration>
|
||||
|
@ -23,6 +24,7 @@
|
|||
<policylist>
|
||||
<policy name="projectPolicy" desc="">
|
||||
<policyitem type="copyright" name="Huawei Technologies Co., Ltd. All rights reserved." path=".*" desc="original liteos copyright"/>
|
||||
<policyitem type="copyright" name="Huawei Device Co., Ltd. All rights reserved." path=".*" desc="original liteos copyright"/>
|
||||
<policyitem type="license" name="BSD-3-Clause" path=".*" desc="Liteos kernel use bsd3 license"/>
|
||||
</policy>
|
||||
</policylist>
|
||||
|
@ -37,7 +39,7 @@
|
|||
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
|
||||
</filefilter>
|
||||
<filefilter name="defaultPolicyFilter" desc="Filters for compatibility,license header policies">
|
||||
<filefilter name="defaultPolicyFilter" desc="Filters for license header policies">
|
||||
<!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
|
||||
|
@ -63,6 +65,8 @@
|
|||
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
|
||||
</filefilter>
|
||||
<filefilter name="binaryFileTypePolicyFilter" desc="Filters for binary file policies">
|
||||
<filteritem type="filepath" name="figures/architecture-of-the-openharmony-liteos-cortex-a-kernel.png" desc="architecture-of-the-openharmony-liteos-cortex-a-kernel"/>
|
||||
<filteritem type="filepath" name="figures/OpenHarmony-LiteOS-A内核架构图.png" desc="LiteOS-A内核架构图"/>
|
||||
<!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
|
||||
|
|
38
README.md
38
README.md
|
@ -4,10 +4,10 @@
|
|||
- [Directory Structure](#section161941989596)
|
||||
- [Constraints](#section119744591305)
|
||||
- [Usage](#section741617511812)
|
||||
- [Preparations](#section1579912573329)
|
||||
- [Source Code Acquisition](#section11443189655)
|
||||
- [Compilation and Building](#section2081013992812)
|
||||
|
||||
- [Preparations](#section1579912573329)
|
||||
- [Source Code Acquisition](#section11443189655)
|
||||
- [Compilation and Building](#section2081013992812)
|
||||
- [Contribution](#section1371123476304)
|
||||
- [Repositories Involved](#section1371113476307)
|
||||
|
||||
## Introduction<a name="section11660541593"></a>
|
||||
|
@ -62,32 +62,38 @@ The OpenHarmony LiteOS Cortex-A is a new-generation kernel developed based on th
|
|||
## Constraints<a name="section119744591305"></a>
|
||||
|
||||
- Programming languages: C and C++
|
||||
- Applicable development boards: Hi3518E V300 and Hi3516D V300
|
||||
- Hi3518E V300 uses the JFFS2 file system by default, and Hi3516D V300 uses the FAT file system by default.
|
||||
- Applicable development boards: Hi3516D V300
|
||||
- Hi3516D V300 uses the FAT file system by default.
|
||||
|
||||
## Usage<a name="section741617511812"></a>
|
||||
|
||||
OpenHarmony LiteOS Cortex-A supports the [Hi3518E V300](https://gitee.com/openharmony/docs/blob/master/en/device-dev/quick-start/quickstart-lite-introduction-hi3518.md) and [Hi3516D V300](https://gitee.com/openharmony/docs/blob/master/en/device-dev/quick-start/quickstart-lite-introduction-hi3516.md). You can develop and run your applications based on both development boards.
|
||||
OpenHarmony LiteOS Cortex-A supports the [Hi3516D V300](https://gitee.com/openharmony/docs/blob/master/en/device-dev/quick-start/quickstart-appendix-hi3516.md). You can develop and run your applications based on this development board.
|
||||
|
||||
### Preparations<a name="section1579912573329"></a>
|
||||
|
||||
You need to set up the compilation environment on Linux.
|
||||
You need to set up the compilation environment on Ubuntu.
|
||||
|
||||
- [Compilation environment on Linux](https://gitee.com/openharmony/docs/blob/master/en/device-dev/quick-start/quickstart-lite-env-setup-lin.md)
|
||||
- For Hi3518E V300, see [Setting Up the Hi3518 Development Environment](https://gitee.com/openharmony/docs/blob/master/en/device-dev/quick-start/quickstart-lite-steps-board3518-setting.md).
|
||||
- For Hi3516D V300, see [Setting Up the Hi3516 Development Environment](https://gitee.com/openharmony/docs/blob/master/en/device-dev/quick-start/quickstart-lite-steps-board3516-setting.md).
|
||||
- [Setting Up Ubuntu Development Environment](https://gitee.com/openharmony/docs/blob/master/en/device-dev/quick-start/Readme-EN.md)
|
||||
|
||||
### Source Code Acquisition<a name="section11443189655"></a>
|
||||
|
||||
Download and decompress a set of source code on a Linux server to acquire the [source code](https://gitee.com/openharmony/docs/blob/master/en/device-dev/get-code/sourcecode-acquire.md).
|
||||
Download and decompress a set of source code on a Ubuntu server to acquire the [source code](https://gitee.com/openharmony/docs/blob/master/en/device-dev/get-code/sourcecode-acquire.md).
|
||||
|
||||
### Compilation and Building<a name="section2081013992812"></a>
|
||||
|
||||
For details about how to develop the first application, see:
|
||||
For details about how to develop the first application, see: [Developing the First Example Program Running on Hi3516](https://gitee.com/openharmony/docs/blob/master/en/device-dev/quick-start/quickstart-pkg-3516-helloworld.md)
|
||||
|
||||
- [Developing the First Example Program Running on Hi3518](https://gitee.com/openharmony/docs/blob/master/en/device-dev/quick-start/quickstart-lite-steps-board3518-running.md)
|
||||
For compilation, please refer to the [compilation instructions](https://gitee.com/openharmony/docs/blob/master/en/device-dev/quick-start/quickstart-pkg-3516-build.md).
|
||||
|
||||
- [Developing the First Example Program Running on Hi3516](https://gitee.com/openharmony/docs/blob/master/en/device-dev/quick-start/quickstart-lite-steps-board3516-running.md)
|
||||
## Contribution<a name="section1371123476304"></a>
|
||||
|
||||
[How to involve](https://gitee.com/openharmony/docs/blob/HEAD/en/contribute/contribution-guide.md)
|
||||
|
||||
[Commit message spec](https://gitee.com/openharmony/kernel_liteos_a/wikis/Commit%20message%20%E8%A7%84%E8%8C%83)
|
||||
|
||||
[C&C++ Secure Coding Guide](https://gitee.com/openharmony/docs/blob/master/en/contribute/OpenHarmony-c-cpp-secure-coding-guide.md)
|
||||
|
||||
[LiteOS-A Kernel Coding Style Guide](https://gitee.com/openharmony/kernel_liteos_a/wikis/LiteOS-A%20%E5%86%85%E6%A0%B8%E7%BC%96%E7%A0%81%E8%A7%84%E8%8C%83%E6%8C%87%E5%8D%97)
|
||||
|
||||
## Repositories Involved<a name="section1371113476307"></a>
|
||||
|
||||
|
@ -95,5 +101,5 @@ For details about how to develop the first application, see:
|
|||
|
||||
[drivers\_liteos](https://gitee.com/openharmony/drivers_liteos/blob/master/README.md)
|
||||
|
||||
**kernel\_liteos\_a**
|
||||
[kernel\_liteos\_a](https://gitee.com/openharmony/kernel_liteos_a/blob/master/README.md)
|
||||
|
||||
|
|
|
@ -4,10 +4,10 @@
|
|||
- [目錄](#section161941989596)
|
||||
- [約束](#section119744591305)
|
||||
- [使用說明](#section741617511812)
|
||||
- [準備](#section1579912573329)
|
||||
- [獲取源碼](#section11443189655)
|
||||
- [編譯構建](#section2081013992812)
|
||||
|
||||
- [準備](#section1579912573329)
|
||||
- [獲取源碼](#section11443189655)
|
||||
- [編譯構建](#section2081013992812)
|
||||
- [貢獻](#section1371123476304)
|
||||
- [相關倉](#section1371113476307)
|
||||
|
||||
## 簡介<a name="section11660541593"></a>
|
||||
|
@ -54,7 +54,6 @@ OpenHarmony LiteOS-A內核是基於Huawei LiteOS內核演進發展的新一代
|
|||
│ ├── hw # 時鐘與中斷相關邏輯代碼
|
||||
│ ├── include # 對外暴露頭文件存放目錄
|
||||
│ └── uart # 串口相關邏輯代碼
|
||||
├── platform # 支持不同的芯片平台代碼,如Hi3516DV300等
|
||||
├── security # 安全特性相關的代碼,包括進程權限管理和虛擬id映射管理
|
||||
├── syscall # 系統調用
|
||||
└── tools # 構建工具及相關配置和代碼
|
||||
|
@ -63,32 +62,38 @@ OpenHarmony LiteOS-A內核是基於Huawei LiteOS內核演進發展的新一代
|
|||
## 約束<a name="section119744591305"></a>
|
||||
|
||||
- 開發語言:C/C++;
|
||||
- 適用於Hi3518EV300、Hi3516DV300單板;
|
||||
- Hi3518EV300默認使用jffs2文件系統,Hi3516DV300默認使用FAT文件系統。
|
||||
- 適用於Hi3516DV300單板;
|
||||
- Hi3516DV300默認使用FAT文件系統。
|
||||
|
||||
## 使用說明<a name="section741617511812"></a>
|
||||
|
||||
OpenHarmony LiteOS-A內核支持Hi3518EV300([介紹](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/oem_minitinier_des_3518.md))、Hi3516DV300([介紹](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/oem_minitinier_des_3516.md))單板,開發者可基於兩種單板開發運行自己的應用程序。
|
||||
OpenHarmony LiteOS-A內核支持[Hi3516DV300](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-appendix-hi3516.md)單板,開發者可基於此單板開發運行自己的應用程序。
|
||||
|
||||
### 準備<a name="section1579912573329"></a>
|
||||
|
||||
開發者需要在Linux上搭建編譯環境:
|
||||
開發者需要在Ubuntu上搭建編譯環境:
|
||||
|
||||
- [Ubuntu編譯環境凖備](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-env-setup-linux.md);
|
||||
- Hi3518EV300單板:參考[環境搭建](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3518-setting.md);
|
||||
- Hi3516DV300單板:參考[環境搭建](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3516-setting.md)。
|
||||
- [編譯環境凖備](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/Readme-CN.md);
|
||||
|
||||
### 獲取源碼<a name="section11443189655"></a>
|
||||
|
||||
在Linux服務器上下載並解壓一套源代碼,源碼獲取方式參考[源碼獲取](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/get-code/sourcecode-acquire.md)。
|
||||
在Ubuntu服務器上下載並解壓一套源代碼,源碼獲取方式參考[源碼獲取](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/get-code/sourcecode-acquire.md)。
|
||||
|
||||
### 編譯構建<a name="section2081013992812"></a>
|
||||
|
||||
開發者開發第一個應用程序可參考:
|
||||
開發者開發第一個應用程序可參考:[helloworld for Hi3516DV300](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-pkg-3516-helloworld.md)。
|
||||
|
||||
- [helloworld for Hi3518EV300](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3518-running.md);
|
||||
編譯可以參考:[編譯指導](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-pkg-3516-build.md)
|
||||
|
||||
- [helloworld for Hi3516DV300](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3516-running.md)。
|
||||
## 貢獻<a name="section1371123476304"></a>
|
||||
|
||||
[如何貢獻](https://gitee.com/openharmony/docs/blob/HEAD/zh-cn/contribute/%E5%8F%82%E4%B8%8E%E8%B4%A1%E7%8C%AE.md)
|
||||
|
||||
[Commit message規範](https://gitee.com/openharmony/kernel_liteos_a/wikis/Commit%20message%20%E8%A7%84%E8%8C%83)
|
||||
|
||||
[OpenHarmony C&C++ 安全編程指南](https://gitee.com/openharmony/docs/blob/master/zh-cn/contribute/OpenHarmony-c-cpp-secure-coding-guide.md)
|
||||
|
||||
[LiteOS-A 內核編碼規範指南](https://gitee.com/openharmony/kernel_liteos_a/wikis/LiteOS-A%20%E5%86%85%E6%A0%B8%E7%BC%96%E7%A0%81%E8%A7%84%E8%8C%83%E6%8C%87%E5%8D%97)
|
||||
|
||||
## 相關倉<a name="section1371113476307"></a>
|
||||
|
||||
|
@ -96,4 +101,4 @@ OpenHarmony LiteOS-A內核支持Hi3518EV300([介紹](https://gitee.com/openhar
|
|||
|
||||
[drivers\_liteos](https://gitee.com/openharmony/drivers_liteos/blob/master/README_zh.md)
|
||||
|
||||
**kernel\_liteos\_a**
|
||||
[kernel\_liteos\_a](https://gitee.com/openharmony/kernel_liteos_a/blob/master/README_zh-HK.md)
|
||||
|
|
44
README_zh.md
44
README_zh.md
|
@ -4,10 +4,10 @@
|
|||
- [目录](#section161941989596)
|
||||
- [约束](#section119744591305)
|
||||
- [使用说明](#section741617511812)
|
||||
- [准备](#section1579912573329)
|
||||
- [获取源码](#section11443189655)
|
||||
- [编译构建](#section2081013992812)
|
||||
|
||||
- [准备](#section1579912573329)
|
||||
- [获取源码](#section11443189655)
|
||||
- [编译构建](#section2081013992812)
|
||||
- [贡献](#section1371123476304)
|
||||
- [相关仓](#section1371113476307)
|
||||
|
||||
## 简介<a name="section11660541593"></a>
|
||||
|
@ -33,6 +33,7 @@ OpenHarmony LiteOS-A内核是基于Huawei LiteOS内核演进发展的新一代
|
|||
│ ├── quickstart # 系统快速启动接口目录
|
||||
│ ├── random # 随机数设备驱动
|
||||
│ └── video # framebuffer驱动框架
|
||||
├── figures # 内核架构图
|
||||
├── fs # 文件系统模块,主要来源于NuttX开源项目
|
||||
│ ├── fat # fat文件系统
|
||||
│ ├── jffs2 # jffs2文件系统
|
||||
|
@ -53,41 +54,50 @@ OpenHarmony LiteOS-A内核是基于Huawei LiteOS内核演进发展的新一代
|
|||
│ ├── hw # 时钟与中断相关逻辑代码
|
||||
│ ├── include # 对外暴露头文件存放目录
|
||||
│ └── uart # 串口相关逻辑代码
|
||||
├── platform # 支持不同的芯片平台代码,如Hi3516DV300等
|
||||
├── security # 安全特性相关的代码,包括进程权限管理和虚拟id映射管理
|
||||
├── shell # 接收用户输入的命令,内核去执行
|
||||
├── syscall # 系统调用
|
||||
├── testsuilts # 测试套件
|
||||
└── tools # 构建工具及相关配置和代码
|
||||
```
|
||||
|
||||
## 约束<a name="section119744591305"></a>
|
||||
|
||||
- 开发语言:C/C++;
|
||||
- 适用于Hi3518EV300、Hi3516DV300单板;
|
||||
- Hi3518EV300默认使用jffs2文件系统,Hi3516DV300默认使用FAT文件系统。
|
||||
- 适用于Hi3516DV300单板;
|
||||
- Hi3516DV300默认使用FAT文件系统。
|
||||
|
||||
## 使用说明<a name="section741617511812"></a>
|
||||
|
||||
OpenHarmony LiteOS-A内核支持Hi3518EV300([介绍](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/oem_minitinier_des_3518.md))、Hi3516DV300([介绍](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/oem_minitinier_des_3516.md))单板,开发者可基于两种单板开发运行自己的应用程序。
|
||||
OpenHarmony LiteOS-A内核支持[Hi3516DV300](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-appendix-hi3516.md)单板。开发者可基于此单板开发运行自己的应用程序。
|
||||
|
||||
### 准备<a name="section1579912573329"></a>
|
||||
|
||||
开发者需要在Linux上搭建编译环境:
|
||||
开发者需要在Ubuntu上搭建编译环境:
|
||||
|
||||
- [Ubuntu编译环境准备](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-env-setup-linux.md);
|
||||
- Hi3518EV300单板:参考[环境搭建](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3518-setting.md);
|
||||
- Hi3516DV300单板:参考[环境搭建](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3516-setting.md)。
|
||||
- [编译环境准备](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/Readme-CN.md);
|
||||
|
||||
### 获取源码<a name="section11443189655"></a>
|
||||
|
||||
在Linux服务器上下载并解压一套源代码,源码获取方式参考[源码获取](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/get-code/sourcecode-acquire.md)。
|
||||
在Ubuntu服务器源码获取方式参考: [源码获取](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/get-code/sourcecode-acquire.md)。
|
||||
|
||||
### 编译构建<a name="section2081013992812"></a>
|
||||
|
||||
开发者开发第一个应用程序可参考:
|
||||
如果这是您的首次应用程序开发,可参考:[helloworld for Hi3516DV300](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-pkg-3516-helloworld.md)。
|
||||
|
||||
- [helloworld for Hi3518EV300](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3518-running.md);
|
||||
编译可以参考:[编译指导](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-pkg-3516-build.md)
|
||||
|
||||
- [helloworld for Hi3516DV300](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3516-running.md)。
|
||||
测试参考:[单元测试](testsuites/unittest/tools/README.md)
|
||||
|
||||
## 贡献<a name="section1371123476304"></a>
|
||||
|
||||
[如何贡献](https://gitee.com/openharmony/docs/blob/HEAD/zh-cn/contribute/%E5%8F%82%E4%B8%8E%E8%B4%A1%E7%8C%AE.md)
|
||||
|
||||
[Commit message规范](https://gitee.com/openharmony/kernel_liteos_a/wikis/Commit%20message%20%E8%A7%84%E8%8C%83)
|
||||
|
||||
[OpenHarmony C&C++ 安全编程指南](https://gitee.com/openharmony/docs/blob/master/zh-cn/contribute/OpenHarmony-c-cpp-secure-coding-guide.md)
|
||||
|
||||
[LiteOS-A 内核编码规范指南](https://gitee.com/openharmony/kernel_liteos_a/wikis/LiteOS-A%20%E5%86%85%E6%A0%B8%E7%BC%96%E7%A0%81%E8%A7%84%E8%8C%83%E6%8C%87%E5%8D%97)
|
||||
|
||||
## 相关仓<a name="section1371113476307"></a>
|
||||
|
||||
|
@ -95,5 +105,5 @@ OpenHarmony LiteOS-A内核支持Hi3518EV300([介绍](https://gitee.com/openhar
|
|||
|
||||
[drivers\_liteos](https://gitee.com/openharmony/drivers_liteos/blob/master/README_zh.md)
|
||||
|
||||
**kernel\_liteos\_a**
|
||||
[kernel\_liteos\_a](https://gitee.com/openharmony/kernel_liteos_a/blob/master/README_zh.md)
|
||||
|
||||
|
|
|
@ -58,6 +58,10 @@ APP_SUBDIRS += mksh
|
|||
APP_SUBDIRS += toybox
|
||||
endif
|
||||
|
||||
ifeq ($(LOSCFG_KERNEL_LMS), y)
|
||||
APP_SUBDIRS += lms
|
||||
endif
|
||||
|
||||
ifeq ($(LOSCFG_USER_INIT_DEBUG), y)
|
||||
APP_SUBDIRS += init
|
||||
endif
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
#endif
|
||||
int main(int argc, char * const *argv)
|
||||
{
|
||||
(void)argv;
|
||||
int ret;
|
||||
pid_t gid;
|
||||
const char *shellPath = "/bin/mksh";
|
||||
|
|
|
@ -73,5 +73,5 @@ executable("sample_usr_lms") {
|
|||
"-Wl,--wrap=strcpy",
|
||||
"-Wl,--wrap=strcat",
|
||||
]
|
||||
deps = [ "//kernel/liteos_a/kernel/extended/lms/usr:usrlmslib" ]
|
||||
deps = [ "$LITEOSTOPDIR/kernel/extended/lms/usr:usrlmslib" ]
|
||||
}
|
||||
|
|
|
@ -50,14 +50,16 @@ static void BufReadTest(void *buf, int start, int end)
|
|||
|
||||
static void LmsMallocTest(void)
|
||||
{
|
||||
#define TEST_SIZE 16
|
||||
printf("\n-------- LmsMallocTest Start --------\n");
|
||||
char *buf = (char *)malloc(16);
|
||||
printf("[LmsMallocTest] malloc addr:%p size:%d\n", buf, 16);
|
||||
|
||||
printf("[LmsMallocTest] read overflow & underflow error should be triggered, read range[-1,16]\n");
|
||||
BufReadTest(buf, -1, 16);
|
||||
printf("[LmsMallocTest] write overflow error should be triggered, write range[0,16]\n");
|
||||
BufWriteTest(buf, 0, 16);
|
||||
char *buf = (char *)malloc(TEST_SIZE);
|
||||
if (buf == NULL) {
|
||||
return;
|
||||
}
|
||||
printf("[LmsMallocTest] read overflow & underflow error should be triggered, read range[-1, TEST_SIZE]\n");
|
||||
BufReadTest(buf, -1, TEST_SIZE);
|
||||
printf("[LmsMallocTest] write overflow error should be triggered, write range[0, TEST_SIZE]\n");
|
||||
BufWriteTest(buf, 0, TEST_SIZE);
|
||||
|
||||
free(buf);
|
||||
printf("\n-------- LmsMallocTest End --------\n");
|
||||
|
@ -65,46 +67,61 @@ static void LmsMallocTest(void)
|
|||
|
||||
static void LmsReallocTest(void)
|
||||
{
|
||||
#define TEST_SIZE 64
|
||||
#define TEST_SIZE_MIN 32
|
||||
printf("\n-------- LmsReallocTest Start --------\n");
|
||||
char *buf = (char *)malloc(64);
|
||||
printf("[LmsReallocTest] malloc addr:%p size:%d\n", buf, 64);
|
||||
printf("[LmsReallocTest] read overflow & underflow error should be triggered, read range[-1,64]\n");
|
||||
BufReadTest(buf, -1, 64);
|
||||
buf = (char *)realloc(buf, 32);
|
||||
printf("[LmsReallocTest] realloc addr:%p size:%d\n", buf, 32);
|
||||
printf("[LmsReallocTest] read overflow & underflow error should be triggered, read range[-1,32]\n");
|
||||
BufReadTest(buf, -1, 32);
|
||||
free(buf);
|
||||
char *buf = (char *)malloc(TEST_SIZE);
|
||||
printf("[LmsReallocTest] read overflow & underflow error should be triggered, read range[-1, TEST_SIZE]\n");
|
||||
BufReadTest(buf, -1, TEST_SIZE);
|
||||
char *buf1 = (char *)realloc(buf, TEST_SIZE_MIN);
|
||||
if (buf1 == NULL) {
|
||||
free(buf);
|
||||
return;
|
||||
}
|
||||
buf = NULL;
|
||||
printf("[LmsReallocTest] read overflow & underflow error should be triggered, read range[-1, TEST_SIZE_MIN]\n");
|
||||
BufReadTest(buf1, -1, TEST_SIZE_MIN);
|
||||
free(buf1);
|
||||
printf("\n-------- LmsReallocTest End --------\n");
|
||||
}
|
||||
|
||||
static void LmsCallocTest(void)
|
||||
{
|
||||
#define TEST_SIZE 16
|
||||
printf("\n-------- LmsCallocTest Start --------\n");
|
||||
char *buf = (char *)calloc(4, 4);
|
||||
printf("[LmsCallocTest] calloc addr:%p size:%d\n", buf, 16);
|
||||
printf("[LmsCallocTest] read overflow & underflow error should be triggered, read range[-1,16]\n");
|
||||
BufReadTest(buf, -1, 16);
|
||||
char *buf = (char *)calloc(4, 4); /* 4: test size */
|
||||
if (buf == NULL) {
|
||||
return;
|
||||
}
|
||||
printf("[LmsCallocTest] read overflow & underflow error should be triggered, read range[-1, TEST_SIZE]\n");
|
||||
BufReadTest(buf, -1, TEST_SIZE);
|
||||
free(buf);
|
||||
printf("\n-------- LmsCallocTest End --------\n");
|
||||
}
|
||||
|
||||
static void LmsVallocTest(void)
|
||||
{
|
||||
#define TEST_SIZE 4096
|
||||
printf("\n-------- LmsVallocTest Start --------\n");
|
||||
char *buf = (char *)valloc(4096);
|
||||
printf("[LmsVallocTest] valloc addr:%p size:%d\n", buf, 4096);
|
||||
printf("[LmsVallocTest] read overflow & underflow error should be triggered, read range[-1,4096]\n");
|
||||
BufReadTest(buf, -1, 4096);
|
||||
char *buf = (char *)valloc(TEST_SIZE);
|
||||
if (buf == NULL) {
|
||||
return;
|
||||
}
|
||||
printf("[LmsVallocTest] read overflow & underflow error should be triggered, read range[-1, TEST_SIZE]\n");
|
||||
BufReadTest(buf, -1, TEST_SIZE);
|
||||
free(buf);
|
||||
printf("\n-------- LmsVallocTest End --------\n");
|
||||
}
|
||||
|
||||
static void LmsAlignedAllocTest(void)
|
||||
{
|
||||
#define TEST_ALIGN_SIZE 64
|
||||
#define TEST_SIZE 128
|
||||
printf("\n-------- LmsAlignedAllocTest Start --------\n");
|
||||
char *buf = (char *)aligned_alloc(64, 128);
|
||||
printf("[LmsAlignedAllocTest] aligned_alloc boundsize:%d addr:%p size:%d\n", 64, buf, 128);
|
||||
char *buf = (char *)aligned_alloc(TEST_ALIGN_SIZE, TEST_SIZE);
|
||||
if (buf == NULL) {
|
||||
return;
|
||||
}
|
||||
printf("[LmsAlignedAllocTest] read overflow & underflow error should be triggered, read range[-1,128]\n");
|
||||
BufReadTest(buf, -1, 128);
|
||||
free(buf);
|
||||
|
@ -113,46 +130,58 @@ static void LmsAlignedAllocTest(void)
|
|||
|
||||
static void LmsMemsetTest(void)
|
||||
{
|
||||
#define TEST_SIZE 32
|
||||
printf("\n-------- LmsMemsetTest Start --------\n");
|
||||
char *buf = (char *)malloc(32);
|
||||
printf("[LmsMemsetTest] malloc addr:%p size:%d\n", buf, 32);
|
||||
printf("[LmsMemsetTest] memset overflow & underflow error should be triggered, memset size:%d\n", 33);
|
||||
memset(buf, 0, 33);
|
||||
char *buf = (char *)malloc(TEST_SIZE);
|
||||
if (buf == NULL) {
|
||||
return;
|
||||
}
|
||||
printf("[LmsMemsetTest] memset overflow & underflow error should be triggered, memset size:%d\n", TEST_SIZE + 1);
|
||||
memset(buf, 0, TEST_SIZE + 1);
|
||||
free(buf);
|
||||
printf("\n-------- LmsMemsetTest End --------\n");
|
||||
}
|
||||
|
||||
static void LmsMemcpyTest(void)
|
||||
{
|
||||
#define TEST_SIZE 20
|
||||
printf("\n-------- LmsMemcpyTest Start --------\n");
|
||||
char *buf = (char *)malloc(20);
|
||||
printf("[LmsMemcpyTest] malloc addr:%p size:%d\n", buf, 20);
|
||||
char localBuf[32] = {0};
|
||||
printf("[LmsMemcpyTest] memcpy overflow error should be triggered, memcpy size:%d\n", 21);
|
||||
memcpy(buf, localBuf, 21);
|
||||
char *buf = (char *)malloc(TEST_SIZE);
|
||||
if (buf == NULL) {
|
||||
return;
|
||||
}
|
||||
char localBuf[32] = {0}; /* 32: test size */
|
||||
printf("[LmsMemcpyTest] memcpy overflow error should be triggered, memcpy size:%d\n", TEST_SIZE + 1);
|
||||
memcpy(buf, localBuf, TEST_SIZE + 1);
|
||||
free(buf);
|
||||
printf("\n-------- LmsMemcpyTest End --------\n");
|
||||
}
|
||||
|
||||
static void LmsMemmoveTest(void)
|
||||
{
|
||||
#define TEST_SIZE 20
|
||||
printf("\n-------- LmsMemmoveTest Start --------\n");
|
||||
char *buf = (char *)malloc(20);
|
||||
printf("[LmsMemmoveTest] malloc addr:%p size:%d\n", buf, 20);
|
||||
printf("[LmsMemmoveTest] memmove overflow error should be triggered, dest addr:%p src addr:%p size:%d\n", buf + 12,
|
||||
buf, 10);
|
||||
memmove(buf + 12, buf, 10);
|
||||
char *buf = (char *)malloc(TEST_SIZE);
|
||||
if (buf == NULL) {
|
||||
return;
|
||||
}
|
||||
printf("[LmsMemmoveTest] memmove overflow error should be triggered\n");
|
||||
memmove(buf + 12, buf, 10); /* 12 and 10: test size */
|
||||
free(buf);
|
||||
printf("\n-------- LmsMemmoveTest End --------\n");
|
||||
}
|
||||
|
||||
static void LmsStrcpyTest(void)
|
||||
{
|
||||
#define TEST_SIZE 16
|
||||
printf("\n-------- LmsStrcpyTest Start --------\n");
|
||||
char *buf = (char *)malloc(16);
|
||||
printf("[LmsStrcpyTest] malloc addr:%p size:%d\n", buf, 16);
|
||||
char *buf = (char *)malloc(TEST_SIZE);
|
||||
if (buf == NULL) {
|
||||
return;
|
||||
}
|
||||
char *testStr = "bbbbbbbbbbbbbbbbb";
|
||||
printf("[LmsStrcpyTest] strcpy overflow error should be triggered, src string buf size:%d\n", strlen(testStr) + 1);
|
||||
printf("[LmsStrcpyTest] strcpy overflow error should be triggered, src string buf size:%d\n",
|
||||
(int)strlen(testStr) + 1);
|
||||
strcpy(buf, testStr);
|
||||
free(buf);
|
||||
printf("\n-------- LmsStrcpyTest End --------\n");
|
||||
|
@ -160,9 +189,12 @@ static void LmsStrcpyTest(void)
|
|||
|
||||
static void LmsStrcatTest(void)
|
||||
{
|
||||
#define TEST_SIZE 16
|
||||
printf("\n-------- LmsStrcatTest Start --------\n");
|
||||
char *buf = (char *)malloc(16);
|
||||
printf("[LmsStrcatTest] malloc addr:%p size:%d\n", buf, 16);
|
||||
char *buf = (char *)malloc(TEST_SIZE);
|
||||
if (buf == NULL) {
|
||||
return;
|
||||
}
|
||||
buf[0] = 'a';
|
||||
buf[1] = 'b';
|
||||
buf[2] = 0;
|
||||
|
@ -177,22 +209,30 @@ static void LmsStrcatTest(void)
|
|||
|
||||
static void LmsFreeTest(void)
|
||||
{
|
||||
#define TEST_SIZE 16
|
||||
printf("\n-------- LmsFreeTest Start --------\n");
|
||||
char *buf = (char *)malloc(16);
|
||||
printf("[LmsFreeTest] malloc addr:%p size:%d\n", buf, 16);
|
||||
printf("[LmsFreeTest] free addr:%p\n", buf, 16);
|
||||
char *buf = (char *)malloc(TEST_SIZE);
|
||||
if (buf == NULL) {
|
||||
return;
|
||||
}
|
||||
printf("[LmsFreeTest] free size:%d\n", TEST_SIZE);
|
||||
free(buf);
|
||||
printf("[LmsFreeTest] Use after free error should be triggered, read addr:%p range[1,1]\n", buf);
|
||||
printf("[LmsFreeTest] Use after free error should be triggered, read range[1,1]\n");
|
||||
BufReadTest(buf, 1, 1);
|
||||
printf("[LmsFreeTest] double free error should be triggered, free addr:%p\n", buf);
|
||||
printf("[LmsFreeTest] double free error should be triggered\n");
|
||||
free(buf);
|
||||
printf("\n-------- LmsFreeTest End --------\n");
|
||||
}
|
||||
|
||||
int main(int argc, char * const * argv)
|
||||
int main(int argc, char * const *argv)
|
||||
{
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
printf("\n############### Lms Test start ###############\n");
|
||||
char *tmp = (char *)malloc(5000);
|
||||
char *tmp = (char *)malloc(5000); /* 5000: test mem size */
|
||||
if (tmp == NULL) {
|
||||
return -1;
|
||||
}
|
||||
LmsMallocTest();
|
||||
LmsReallocTest();
|
||||
LmsCallocTest();
|
||||
|
@ -204,5 +244,7 @@ int main(int argc, char * const * argv)
|
|||
LmsStrcpyTest();
|
||||
LmsStrcatTest();
|
||||
LmsFreeTest();
|
||||
free(tmp);
|
||||
printf("\n############### Lms Test End ###############\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
import("//build/lite/config/component/lite_component.gni")
|
||||
import("//kernel/liteos_a/liteos.gni")
|
||||
import("//third_party/mksh/mksh.gni")
|
||||
import("$THIRDPARTY_MKSH_DIR/mksh.gni")
|
||||
|
||||
group("mksh") {
|
||||
deps = [ ":build_mksh" ]
|
||||
|
@ -42,7 +42,7 @@ copy("copy_mksh_src") {
|
|||
|
||||
build_ext_component("build_mksh") {
|
||||
deps = [ ":copy_mksh_src" ]
|
||||
deps += [ "//prebuilts/lite/sysroot" ]
|
||||
deps += [ "$THIRDPARTY_MUSL_DIR:sysroot_lite" ]
|
||||
exec_path = rebase_path("$target_out_dir/mksh_build")
|
||||
|
||||
cflags = [
|
||||
|
|
|
@ -62,10 +62,17 @@ int main(int argc, char **argv)
|
|||
PerfStop(fd);
|
||||
} else if ((argc == THREE_ARGS) && strcmp(argv[1], "read") == 0) {
|
||||
size_t size = strtoul(argv[THREE_ARGS - 1], NULL, 0);
|
||||
if (size == 0) {
|
||||
goto EXIT:
|
||||
}
|
||||
|
||||
char *buf = (char *)malloc(size);
|
||||
int len = PerfRead(fd, buf, size);
|
||||
PerfPrintBuffer(buf, len);
|
||||
free(buf);
|
||||
if (buf != NULL) {
|
||||
int len = PerfRead(fd, buf, size);
|
||||
PerfPrintBuffer(buf, len);
|
||||
free(buf);
|
||||
buf = NULL;
|
||||
}
|
||||
} else if ((argc == TWO_ARGS) && strcmp(argv[1], "list") == 0) {
|
||||
PerfList();
|
||||
} else if ((argc >= THREE_ARGS) && strcmp(argv[1], "stat") == 0) {
|
||||
|
@ -77,6 +84,7 @@ int main(int argc, char **argv)
|
|||
PerfUsage();
|
||||
}
|
||||
|
||||
EXIT:
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -113,7 +113,6 @@ ssize_t PerfWriteFile(const char *filePath, const char *buf, ssize_t bufSize)
|
|||
ssize_t totalWrite = 0;
|
||||
|
||||
if (filePath == NULL || buf == NULL || bufSize == 0) {
|
||||
printf("filePath: %p, buf: %p, bufSize: %u!\n", filePath, buf, bufSize);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,13 +32,15 @@
|
|||
#ifndef _SHELL_PRI_H
|
||||
#define _SHELL_PRI_H
|
||||
|
||||
#include "shell.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
extern void *ShellEntry(void *argv);
|
||||
extern void ShellEntry(ShellCB *shellCB);
|
||||
extern void *ShellTask(void *argv);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#ifndef _SHMSG_H
|
||||
#define _SHMSG_H
|
||||
|
||||
#include "shell_list.h"
|
||||
#include "shell.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -61,8 +62,7 @@ extern "C" {
|
|||
|
||||
typedef void (* OutputFunc)(const char *fmt, ...);
|
||||
extern int ShellTaskInit(ShellCB *shellCB);
|
||||
extern int ShellEntryInit(ShellCB *shellCB);
|
||||
extern void ChildExec(const char *cmdName, char *const paramArray[]);
|
||||
extern void ChildExec(const char *cmdName, char *const paramArray[], bool foreground);
|
||||
extern void ShellCmdLineParse(char c, OutputFunc outputFunc, ShellCB *shellCB);
|
||||
extern int ShellNotify(ShellCB *shellCB);
|
||||
|
||||
|
|
|
@ -31,22 +31,25 @@
|
|||
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include <signal.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/syscall.h>
|
||||
#include "show.h"
|
||||
#include "shmsg.h"
|
||||
#include "shcmd.h"
|
||||
#include "shell_pri.h"
|
||||
#include "semaphore.h"
|
||||
#include "securec.h"
|
||||
#include "unistd.h"
|
||||
#include <sys/syscall.h>
|
||||
|
||||
ShellCB *g_shellCB = NULL;
|
||||
|
||||
ShellCB *OsGetShellCb()
|
||||
ShellCB *OsGetShellCb(void)
|
||||
{
|
||||
return g_shellCB;
|
||||
}
|
||||
|
||||
void ShellDeinit(ShellCB *shellCB)
|
||||
static void ShellDeinit(ShellCB *shellCB)
|
||||
{
|
||||
(void)pthread_mutex_destroy(&shellCB->historyMutex);
|
||||
(void)pthread_mutex_destroy(&shellCB->keyMutex);
|
||||
|
@ -62,32 +65,23 @@ static int OsShellCreateTask(ShellCB *shellCB)
|
|||
|
||||
ret = sched_getparam(getpid(), ¶m);
|
||||
if (ret != SH_OK) {
|
||||
goto OUT;
|
||||
return ret;
|
||||
}
|
||||
|
||||
param.sched_priority = SHELL_PROCESS_PRIORITY_INIT;
|
||||
|
||||
ret = sched_setparam(getpid(), ¶m);
|
||||
if (ret != SH_OK) {
|
||||
goto OUT;
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = ShellTaskInit(shellCB);
|
||||
if (ret != SH_OK) {
|
||||
goto OUT;
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = ShellEntryInit(shellCB);
|
||||
if (ret != SH_OK) {
|
||||
goto OUT;
|
||||
}
|
||||
|
||||
(void)pthread_join(shellCB->shellTaskHandle, NULL);
|
||||
(void)pthread_join(shellCB->shellEntryHandle, NULL);
|
||||
|
||||
OUT:
|
||||
ShellDeinit(shellCB);
|
||||
return ret;
|
||||
shellCB->shellEntryHandle = pthread_self();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int DoShellExec(char **argv)
|
||||
|
@ -98,7 +92,7 @@ static int DoShellExec(char **argv)
|
|||
char *cmdLine = NULL;
|
||||
|
||||
if (strncmp(argv[0], SHELL_EXEC_COMMAND, SHELL_EXEC_COMMAND_BYTES) == 0) {
|
||||
ChildExec(argv[1], argv + 1);
|
||||
ChildExec(argv[1], argv + 1, FALSE);
|
||||
}
|
||||
for (i = 0; argv[i]; i++) {
|
||||
len += strlen(argv[i]);
|
||||
|
@ -108,11 +102,15 @@ static int DoShellExec(char **argv)
|
|||
if (!cmdLine) {
|
||||
return ret;
|
||||
}
|
||||
memset_s(cmdLine, len, 0, len);
|
||||
errno_t ret1 = memset_s(cmdLine, len, 0, len);
|
||||
if (ret1 != EOK) {
|
||||
free(cmdLine);
|
||||
return ret1;
|
||||
}
|
||||
|
||||
for (j = 0; j < i; j++) {
|
||||
strcat_s(cmdLine, len, argv[j]);
|
||||
strcat_s(cmdLine, len, " ");
|
||||
(void)strcat_s(cmdLine, len, argv[j]);
|
||||
(void)strcat_s(cmdLine, len, " ");
|
||||
}
|
||||
|
||||
cmdLine[len - 2] = '\0'; /* 2, (len - 2) is the end of cmdline buf */
|
||||
|
@ -121,11 +119,22 @@ static int DoShellExec(char **argv)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static void ShellSigChildHook(int sig)
|
||||
{
|
||||
(void)sig;
|
||||
|
||||
while (waitpid(-1, NULL, WNOHANG) > 0) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int ret = SH_NOK;
|
||||
ShellCB *shellCB = NULL;
|
||||
|
||||
(void)signal(SIGCHLD, ShellSigChildHook);
|
||||
|
||||
if (argc > 1) {
|
||||
ret = DoShellExec(argv + 1);
|
||||
return ret;
|
||||
|
@ -135,7 +144,7 @@ int main(int argc, char **argv)
|
|||
|
||||
shellCB = (ShellCB *)malloc(sizeof(ShellCB));
|
||||
if (shellCB == NULL) {
|
||||
goto ERR_OUT1;
|
||||
return SH_NOK;
|
||||
}
|
||||
ret = memset_s(shellCB, sizeof(ShellCB), 0, sizeof(ShellCB));
|
||||
if (ret != SH_OK) {
|
||||
|
@ -161,7 +170,14 @@ int main(int argc, char **argv)
|
|||
sem_init(&shellCB->shellSem, 0, 0);
|
||||
|
||||
g_shellCB = shellCB;
|
||||
return OsShellCreateTask(shellCB);
|
||||
ret = OsShellCreateTask(shellCB);
|
||||
if (ret != SH_OK) {
|
||||
ShellDeinit(shellCB);
|
||||
g_shellCB = NULL;
|
||||
return ret;
|
||||
}
|
||||
|
||||
ShellEntry(shellCB);
|
||||
|
||||
ERR_OUT3:
|
||||
(void)pthread_mutex_destroy(&shellCB->historyMutex);
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
#include "dirent.h"
|
||||
#include "securec.h"
|
||||
|
||||
|
||||
#define SHELL_INIT_MAGIC_FLAG 0xABABABAB
|
||||
#define CTRL_C 0x03 /* 0x03: ctrl+c ASCII */
|
||||
|
||||
|
@ -378,7 +377,7 @@ static int OsTabMatchFile(char *cmdKey, unsigned int *len)
|
|||
* Description: Pass in the string and clear useless space ,which include:
|
||||
* 1) The overmatch space which is not be marked by Quote's area
|
||||
* Squeeze the overmatch space into one space
|
||||
* 2) Clear all space before first valid charatctor
|
||||
* 2) Clear all space before first valid character
|
||||
* Input: cmdKey : Pass in the buff string, which is ready to be operated
|
||||
* cmdOut : Pass out the buffer string ,which has already been operated
|
||||
* size : cmdKey length
|
||||
|
@ -407,17 +406,17 @@ unsigned int OsCmdKeyShift(const char *cmdKey, char *cmdOut, unsigned int size)
|
|||
|
||||
/* Backup the 'output' start address */
|
||||
outputBak = output;
|
||||
/* Scan each charactor in 'cmdKey',and squeeze the overmuch space and ignore invalid charactor */
|
||||
/* Scan each character in 'cmdKey',and squeeze the overmuch space and ignore invalid character */
|
||||
for (; *cmdKey != '\0'; cmdKey++) {
|
||||
/* Detected a Double Quotes, switch the matching status */
|
||||
if (*(cmdKey) == '\"') {
|
||||
SWITCH_QUOTES_STATUS(quotes);
|
||||
}
|
||||
/* Ignore the current charactor in following situation */
|
||||
/* Ignore the current character in following situation */
|
||||
/* 1) Quotes matching status is FALSE (which said that the space is not been marked by double quotes) */
|
||||
/* 2) Current charactor is a space */
|
||||
/* 3) Next charactor is a space too, or the string is been seeked to the end already(\0) */
|
||||
/* 4) Invalid charactor, such as single quotes */
|
||||
/* 2) Current character is a space */
|
||||
/* 3) Next character is a space too, or the string is been seeked to the end already(\0) */
|
||||
/* 4) Invalid character, such as single quotes */
|
||||
if ((*cmdKey == ' ') && ((*(cmdKey + 1) == ' ') || (*(cmdKey + 1) == '\0')) && QUOTES_STATUS_CLOSE(quotes)) {
|
||||
continue;
|
||||
}
|
||||
|
@ -431,7 +430,7 @@ unsigned int OsCmdKeyShift(const char *cmdKey, char *cmdOut, unsigned int size)
|
|||
/* Restore the 'output' start address */
|
||||
output = outputBak;
|
||||
len = strlen(output);
|
||||
/* Clear the space which is located at the first charactor in buffer */
|
||||
/* Clear the space which is located at the first character in buffer */
|
||||
if (*output == ' ') {
|
||||
output++;
|
||||
len--;
|
||||
|
@ -585,7 +584,6 @@ END:
|
|||
|
||||
unsigned int OsCmdExec(CmdParsed *cmdParsed, char *cmdStr)
|
||||
{
|
||||
/* TODO: complete the usrspace command */
|
||||
unsigned int ret = SH_OK;
|
||||
if (cmdParsed && cmdStr) {
|
||||
ret = SH_NOK;
|
||||
|
|
|
@ -334,12 +334,12 @@ char *GetCmdName(const char *cmdline, unsigned int len)
|
|||
/* If reach a double quotes, switch the quotes matching status */
|
||||
if (*tmpStr == '\"') {
|
||||
SWITCH_QUOTES_STATUS(quotes);
|
||||
/* Ignore the double quote charactor itself */
|
||||
/* Ignore the double quote character itself */
|
||||
tmpStr++;
|
||||
continue;
|
||||
}
|
||||
/* If detected a space which the quotes matching status is false */
|
||||
/* which said has detected the first space for seperator, finish this scan operation */
|
||||
/* which said has detected the first space for separator, finish this scan operation */
|
||||
if ((*tmpStr == ' ') && (QUOTES_STATUS_CLOSE(quotes))) {
|
||||
break;
|
||||
}
|
||||
|
@ -351,7 +351,7 @@ char *GetCmdName(const char *cmdline, unsigned int len)
|
|||
return cmdName;
|
||||
}
|
||||
|
||||
void ChildExec(const char *cmdName, char *const paramArray[])
|
||||
void ChildExec(const char *cmdName, char *const paramArray[], bool foreground)
|
||||
{
|
||||
int ret;
|
||||
pid_t gid;
|
||||
|
@ -367,10 +367,12 @@ void ChildExec(const char *cmdName, char *const paramArray[])
|
|||
exit(1);
|
||||
}
|
||||
|
||||
ret = tcsetpgrp(STDIN_FILENO, gid);
|
||||
if (ret != 0) {
|
||||
printf("tcsetpgrp failed, errno %d\n", errno);
|
||||
exit(1);
|
||||
if (!foreground) {
|
||||
ret = tcsetpgrp(STDIN_FILENO, gid);
|
||||
if (ret != 0) {
|
||||
printf("tcsetpgrp failed, errno %d\n", errno);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
ret = execve(cmdName, paramArray, NULL);
|
||||
|
@ -404,20 +406,30 @@ int CheckExit(const char *cmdName, const CmdParsed *cmdParsed)
|
|||
exit(ret);
|
||||
}
|
||||
|
||||
static void DoCmdExec(const char *cmdName, const char *cmdline, unsigned int len, const CmdParsed *cmdParsed)
|
||||
static void DoCmdExec(const char *cmdName, const char *cmdline, unsigned int len, CmdParsed *cmdParsed)
|
||||
{
|
||||
bool foreground = FALSE;
|
||||
int ret;
|
||||
pid_t forkPid;
|
||||
|
||||
if (strncmp(cmdline, CMD_EXEC_COMMAND, CMD_EXEC_COMMAND_BYTES) == 0) {
|
||||
if ((cmdParsed->paramCnt > 1) && (strcmp(cmdParsed->paramArray[cmdParsed->paramCnt - 1], "&") == 0)) {
|
||||
free(cmdParsed->paramArray[cmdParsed->paramCnt - 1]);
|
||||
cmdParsed->paramArray[cmdParsed->paramCnt - 1] = NULL;
|
||||
cmdParsed->paramCnt--;
|
||||
foreground = TRUE;
|
||||
}
|
||||
|
||||
forkPid = fork();
|
||||
if (forkPid < 0) {
|
||||
printf("Faild to fork from shell\n");
|
||||
printf("Failed to fork from shell\n");
|
||||
return;
|
||||
} else if (forkPid == 0) {
|
||||
ChildExec(cmdParsed->paramArray[0], cmdParsed->paramArray);
|
||||
ChildExec(cmdParsed->paramArray[0], cmdParsed->paramArray, foreground);
|
||||
} else {
|
||||
waitpid(forkPid, 0, 0);
|
||||
if (!foreground) {
|
||||
(void)waitpid(forkPid, 0, 0);
|
||||
}
|
||||
ret = tcsetpgrp(STDIN_FILENO, getpid());
|
||||
if (ret != 0) {
|
||||
printf("tcsetpgrp failed, errno %d\n", errno);
|
||||
|
@ -503,7 +515,7 @@ unsigned int PreHandleCmdline(const char *input, char **output, unsigned int *ou
|
|||
*output = shiftStr;
|
||||
*outputlen = shiftLen;
|
||||
|
||||
/* Check and parse "./", located at the first two charaters of the cmd */
|
||||
/* Check and parse "./", located at the first two characters of the cmd */
|
||||
if ((shiftLen > removeLen) && (shiftStr[0] == '.') && (shiftStr[1] == '/')) {
|
||||
execLen = strlen(execCmd);
|
||||
newLen = execLen + shiftLen - removeLen; /* i.e., newLen - execLen == shiftLen - removeLen */
|
||||
|
@ -567,20 +579,10 @@ static void ExecCmdline(const char *cmdline)
|
|||
free(output);
|
||||
}
|
||||
|
||||
void RecycleZombieChild(void)
|
||||
{
|
||||
while (waitpid(-1, NULL, WNOHANG) > 0) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
static void ShellCmdProcess(ShellCB *shellCB)
|
||||
{
|
||||
char *buf = NULL;
|
||||
while (1) {
|
||||
/* recycle zombine child process */
|
||||
RecycleZombieChild();
|
||||
buf = GetCmdline(shellCB);
|
||||
char *buf = GetCmdline(shellCB);
|
||||
if (buf == NULL) {
|
||||
break;
|
||||
}
|
||||
|
@ -654,25 +656,19 @@ static int ShellKernelReg(unsigned int shellHandle)
|
|||
return ioctl(STDIN_FILENO, CONSOLE_CONTROL_REG_USERTASK, shellHandle);
|
||||
}
|
||||
|
||||
void *ShellEntry(void *argv)
|
||||
void ShellEntry(ShellCB *shellCB)
|
||||
{
|
||||
char ch;
|
||||
int ret;
|
||||
int n;
|
||||
pid_t tid = syscall(__NR_gettid);
|
||||
ShellCB *shellCB = (ShellCB *)argv;
|
||||
|
||||
if (shellCB == NULL) {
|
||||
return NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
(void)memset_s(shellCB->shellBuf, SHOW_MAX_LEN, 0, SHOW_MAX_LEN);
|
||||
|
||||
ret = prctl(PR_SET_NAME, "ShellEntry");
|
||||
if (ret != SH_OK) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ret = ShellKernelReg((int)tid);
|
||||
if (ret != 0) {
|
||||
printf("another shell is already running!\n");
|
||||
|
@ -685,32 +681,5 @@ void *ShellEntry(void *argv)
|
|||
ShellCmdLineParse(ch, (OutputFunc)printf, shellCB);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
int ShellEntryInit(ShellCB *shellCB)
|
||||
{
|
||||
int ret;
|
||||
size_t stackSize = SHELL_ENTRY_STACKSIZE;
|
||||
void *arg = NULL;
|
||||
pthread_attr_t attr;
|
||||
|
||||
if (shellCB == NULL) {
|
||||
return SH_NOK;
|
||||
}
|
||||
|
||||
ret = pthread_attr_init(&attr);
|
||||
if (ret != SH_OK) {
|
||||
return SH_NOK;
|
||||
}
|
||||
|
||||
pthread_attr_setstacksize(&attr, stackSize);
|
||||
arg = (void *)shellCB;
|
||||
ret = pthread_create(&shellCB->shellEntryHandle, &attr, &ShellEntry, arg);
|
||||
if (ret != SH_OK) {
|
||||
return SH_NOK;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ extern "C" {
|
|||
|
||||
#define TFTP_NULL_UINT32 ((u32_t)0xffffffffUL)
|
||||
|
||||
#define TFTP_NULL_INT32 -1
|
||||
#define TFTP_NULL_INT32 (-1)
|
||||
|
||||
/** @cond liteos
|
||||
* @defgroup TFTP_Interfaces
|
||||
|
@ -114,7 +114,7 @@ typedef enum tagTFTPC_OpCode {
|
|||
TFTPC_OP_RRQ = 1, /* read request */
|
||||
TFTPC_OP_WRQ, /* write request */
|
||||
TFTPC_OP_DATA, /* data packet */
|
||||
TFTPC_OP_ACK, /* acknowledgement */
|
||||
TFTPC_OP_ACK, /* acknowledgment */
|
||||
TFTPC_OP_ERROR, /* error code */
|
||||
TFTPC_OP_OPT /* option code */
|
||||
} TFTPC_OPCODE_E;
|
||||
|
|
|
@ -50,11 +50,11 @@ static char *TftpError[] = {
|
|||
"Error while sending data to the peer\n",
|
||||
"Requested file is not found\n",
|
||||
"This is the error sent by the server when hostname cannot be resolved\n",
|
||||
"Input paramters passed to TFTP interfaces are invalid\n",
|
||||
"Input parameters passed to TFTP interfaces are invalid\n",
|
||||
"Error detected in TFTP packet or the error received from the TFTP server\n",
|
||||
"Error during packet synhronization while sending or unexpected packet is received\n",
|
||||
"File size limit crossed, Max block can be 0xFFFF, each block containing 512 bytes\n",
|
||||
"File name lenght greater than 256\n",
|
||||
"File name length greater than 256\n",
|
||||
"Hostname IP is not valid\n",
|
||||
"TFTP server returned file access error\n",
|
||||
"TFTP server returned error signifying that the DISK is full to write\n",
|
||||
|
@ -66,11 +66,11 @@ static char *TftpError[] = {
|
|||
"File create error\n",
|
||||
"File write error\n",
|
||||
"Max time expired while waiting for file to be recived\n",
|
||||
"Error when the received packet is less than 4bytes(error lenght) or greater than 512bytes\n",
|
||||
"Error when the received packet is less than 4bytes(error length) or greater than 512bytes\n",
|
||||
"Returned by TFTP server for protocol user error\n",
|
||||
"The destination file path length greater than 256\n",
|
||||
"Returned by TFTP server for undefined transfer ID\n",
|
||||
"IOCTL fucntion failed at TFTP client while setting the socket to non-block\n",
|
||||
"IOCTL function failed at TFTP client while setting the socket to non-block\n",
|
||||
};
|
||||
|
||||
#ifndef ARRAY_SIZE
|
||||
|
|
|
@ -189,7 +189,7 @@ u32_t lwip_tftp_recv_from_server(s32_t iSockNum, u32_t *pulSize, TFTPC_PACKET_S
|
|||
if (iRet == -1) {
|
||||
return TFTPC_SELECT_ERROR;
|
||||
} else if (iRet == 0) {
|
||||
return TFTPC_TIMEOUT_ERROR; /* Select timeout occured */
|
||||
return TFTPC_TIMEOUT_ERROR; /* Select timeout occurred */
|
||||
}
|
||||
|
||||
if (!FD_ISSET(iSockNum, &stReadfds)) {
|
||||
|
@ -218,7 +218,7 @@ u32_t lwip_tftp_recv_from_server(s32_t iSockNum, u32_t *pulSize, TFTPC_PACKET_S
|
|||
usOpcode = ntohs(pstRecvBuf->usOpcode);
|
||||
/* if this packet is ERROR packet */
|
||||
if (usOpcode == TFTPC_OP_ERROR) {
|
||||
ulError = ntohs (pstRecvBuf->u.stTFTP_Err.usErrNum);
|
||||
ulError = ntohs(pstRecvBuf->u.stTFTP_Err.usErrNum);
|
||||
|
||||
/*If the error is according to RFC,then convert to lwip error codes.
|
||||
Constant values are used in the cases as these error codes are as per
|
||||
|
@ -268,7 +268,7 @@ u32_t lwip_tftp_recv_from_server(s32_t iSockNum, u32_t *pulSize, TFTPC_PACKET_S
|
|||
*pulSize = (u32_t)iRet;
|
||||
|
||||
/* If received packet is first block of data(for get operation) or if
|
||||
received packet is acknowledgement for write request (put operation)
|
||||
received packet is acknowledgment for write request (put operation)
|
||||
store the received port number */
|
||||
if (((usOpcode == TFTPC_OP_DATA) &&
|
||||
(ntohs(pstRecvBuf->u.stTFTP_Data.usBlknum) == 1)) ||
|
||||
|
@ -500,7 +500,7 @@ static void lwip_tftp_send_error(s32_t iSockNum, u32_t ulError, const char *szEr
|
|||
}
|
||||
}
|
||||
|
||||
/* INTEFACE to get a file using filename
|
||||
/* INTERFACE to get a file using filename
|
||||
ulHostAddr - IP address of Host
|
||||
szSrcFileName - Source file
|
||||
szDestDirPath - Destination file path
|
||||
|
@ -687,7 +687,7 @@ u32_t lwip_tftp_get_file_by_filename(u32_t ulHostAddr,
|
|||
|
||||
ulErrCode = lwip_tftp_recv_from_server(iSockNum, &ulRecvSize, pstRecvBuf,
|
||||
&ulIgnorePkt, &stServerAddr, pstSendBuf);
|
||||
/* If select timeout occured */
|
||||
/* If select timeout occurred */
|
||||
if (ulErrCode == TFTPC_TIMEOUT_ERROR) {
|
||||
ulTotalTime++;
|
||||
if (ulTotalTime < TFTPC_MAX_SEND_REQ_ATTEMPTS) {
|
||||
|
@ -727,7 +727,7 @@ u32_t lwip_tftp_get_file_by_filename(u32_t ulHostAddr,
|
|||
}
|
||||
|
||||
/* if this packet is unkonwn or incorrect packet */
|
||||
if (ntohs (pstRecvBuf->usOpcode) != TFTPC_OP_DATA) {
|
||||
if (ntohs(pstRecvBuf->usOpcode) != TFTPC_OP_DATA) {
|
||||
/* Send error packet to server */
|
||||
lwip_tftp_send_error(iSockNum,
|
||||
TFTPC_PROTOCOL_PROTO_ERROR,
|
||||
|
@ -982,7 +982,7 @@ u32_t lwip_tftp_put_file_by_filename(u32_t ulHostAddr, u16_t usTftpServPort, u8_
|
|||
return TFTPC_MEMALLOC_ERROR;
|
||||
}
|
||||
|
||||
/* First time intialize the buffer */
|
||||
/* First time initialize the buffer */
|
||||
(void)memset_s((void *)pstSendBuf, sizeof(TFTPC_PACKET_S), 0, sizeof(TFTPC_PACKET_S));
|
||||
|
||||
/* The destination path can only be one of the following:
|
||||
|
@ -1221,7 +1221,7 @@ u32_t lwip_tftp_inner_put_file(s32_t iSockNum,
|
|||
return TFTPC_MEMALLOC_ERROR;
|
||||
}
|
||||
|
||||
/* First time intialize the buffer */
|
||||
/* First time initialize the buffer */
|
||||
(void)memset_s((void *)pstRecvBuf, sizeof(TFTPC_PACKET_S), 0, sizeof(TFTPC_PACKET_S));
|
||||
|
||||
/* Initialize from address to the server address at first */
|
||||
|
@ -1235,7 +1235,7 @@ u32_t lwip_tftp_inner_put_file(s32_t iSockNum,
|
|||
ulError = lwip_tftp_recv_from_server(iSockNum, &ulPktSize,
|
||||
pstRecvBuf, &ulIgnorePkt,
|
||||
pstServerAddr, pstSendBuf);
|
||||
/* If select timeout occured */
|
||||
/* If select timeout occurred */
|
||||
if (ulError == TFTPC_TIMEOUT_ERROR) {
|
||||
ulTotalTime++;
|
||||
if (ulTotalTime < TFTPC_MAX_SEND_REQ_ATTEMPTS) {
|
||||
|
@ -1419,7 +1419,7 @@ err_handler:
|
|||
}
|
||||
|
||||
#ifdef TFTP_TO_RAWMEM
|
||||
/* INTEFACE to get a file using filename
|
||||
/* INTERFACE to get a file using filename
|
||||
ulHostAddr - IP address of Host
|
||||
szSrcFileName - Source file
|
||||
szDestMemAddr - The target memory address in the client
|
||||
|
@ -1437,10 +1437,8 @@ u32_t lwip_tftp_get_file_by_filename_to_rawmem(u32_t ulHostAddr,
|
|||
{
|
||||
s32_t iSockNum = TFTP_NULL_INT32;
|
||||
u32_t ulSrcStrLen;
|
||||
u32_t lDestStrLen;
|
||||
u32_t ulSize;
|
||||
u32_t ulRecvSize = TFTP_NULL_UINT32;
|
||||
s32_t iErrCode;
|
||||
u32_t ulErrCode;
|
||||
u16_t usReadReq;
|
||||
u16_t usTempServPort;
|
||||
|
@ -1526,7 +1524,7 @@ u32_t lwip_tftp_get_file_by_filename_to_rawmem(u32_t ulHostAddr,
|
|||
|
||||
ulErrCode = lwip_tftp_recv_from_server(iSockNum, &ulRecvSize, pstRecvBuf, &ulIgnorePkt,
|
||||
&stServerAddr, pstSendBuf);
|
||||
/* If select timeout occured */
|
||||
/* If select timeout occurred */
|
||||
if (ulErrCode == TFTPC_TIMEOUT_ERROR) {
|
||||
ulTotalTime++;
|
||||
if (ulTotalTime < TFTPC_MAX_SEND_REQ_ATTEMPTS) {
|
||||
|
@ -1557,7 +1555,7 @@ u32_t lwip_tftp_get_file_by_filename_to_rawmem(u32_t ulHostAddr,
|
|||
}
|
||||
|
||||
/* if this packet is unkonwn or incorrect packet */
|
||||
if (ntohs (pstRecvBuf->usOpcode) != TFTPC_OP_DATA) {
|
||||
if (ntohs(pstRecvBuf->usOpcode) != TFTPC_OP_DATA) {
|
||||
/* Send error packet to server */
|
||||
lwip_tftp_send_error(iSockNum,
|
||||
TFTPC_PROTOCOL_PROTO_ERROR,
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
import("//build/lite/config/component/lite_component.gni")
|
||||
import("//kernel/liteos_a/liteos.gni")
|
||||
import("//third_party/toybox/toybox.gni")
|
||||
import("$THIRDPARTY_TOYBOX_DIR/toybox.gni")
|
||||
|
||||
group("toybox") {
|
||||
deps = [ ":build_toybox" ]
|
||||
|
@ -51,7 +51,7 @@ build_ext_component("build_toybox") {
|
|||
":copy_toybox_config",
|
||||
":copy_toybox_src",
|
||||
]
|
||||
deps += [ "//prebuilts/lite/sysroot" ]
|
||||
deps += [ "$THIRDPARTY_MUSL_DIR:sysroot_lite" ]
|
||||
exec_path = rebase_path("$target_out_dir/toybox_build")
|
||||
|
||||
cflags = [
|
||||
|
|
|
@ -70,6 +70,10 @@ static void TraceRead(int fd, size_t size)
|
|||
{
|
||||
ssize_t i;
|
||||
ssize_t len;
|
||||
if (size == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
char *buffer = (char *)malloc(size);
|
||||
if (buffer == NULL) {
|
||||
printf("Read buffer malloc failed.\n");
|
||||
|
|
|
@ -246,7 +246,7 @@ STATIC INLINE INT32 LOS_AtomicIncRet(Atomic *v)
|
|||
* @brief Atomic auto-decrement.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to implementating the atomic auto-decrement.
|
||||
* This API is used to implement the atomic auto-decrement.
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>The pointer v must not be NULL.</li>
|
||||
|
@ -280,7 +280,7 @@ STATIC INLINE VOID LOS_AtomicDec(Atomic *v)
|
|||
* @brief Atomic auto-decrement.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to implementating the atomic auto-decrement and return the result of auto-decrement.
|
||||
* This API is used to implement the atomic auto-decrement and return the result of auto-decrement.
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>The pointer v must not be NULL.</li>
|
||||
|
@ -531,7 +531,7 @@ STATIC INLINE INT64 LOS_Atomic64IncRet(Atomic64 *v)
|
|||
* @brief Atomic64 auto-decrement.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to implementating the atomic64 auto-decrement.
|
||||
* This API is used to implement the atomic64 auto-decrement.
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>The pointer v must not be NULL.</li>
|
||||
|
@ -566,7 +566,7 @@ STATIC INLINE VOID LOS_Atomic64Dec(Atomic64 *v)
|
|||
* @brief Atomic64 auto-decrement.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to implementating the atomic64 auto-decrement and return the result of auto-decrement.
|
||||
* This API is used to implement the atomic64 auto-decrement and return the result of auto-decrement.
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>The pointer v must not be NULL.</li>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2023 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
|
@ -102,7 +102,7 @@ typedef struct {
|
|||
* Return : pointer to the task context
|
||||
*/
|
||||
extern VOID *OsTaskStackInit(UINT32 taskID, UINT32 stackSize, VOID *topStack, BOOL initFlag);
|
||||
extern VOID OsUserCloneParentStack(VOID *childStack, UINTPTR parentTopOfStask, UINT32 parentStackSize);
|
||||
extern VOID OsUserCloneParentStack(VOID *childStack, UINTPTR sp, UINTPTR parentTopOfStask, UINT32 parentStackSize);
|
||||
extern VOID OsUserTaskStackInit(TaskContext *context, UINTPTR taskEntry, UINTPTR stack);
|
||||
extern VOID OsInitSignalContext(const VOID *sp, VOID *signalContext, UINTPTR sigHandler, UINT32 signo, UINT32 param);
|
||||
extern void arm_clean_cache_range(UINTPTR start, UINTPTR end);
|
||||
|
|
|
@ -55,8 +55,8 @@ extern "C" {
|
|||
#define HWI_IS_REGISTED(num) ((&g_hwiForm[num])->pstNext != NULL)
|
||||
#endif
|
||||
extern VOID OsHwiInit(VOID);
|
||||
extern VOID OsIncHwiFormCnt(UINT32 index);
|
||||
extern UINT32 OsGetHwiFormCnt(UINT32 index);
|
||||
extern VOID OsIncHwiFormCnt(UINT16 cpuid, UINT32 index);
|
||||
extern UINT32 OsGetHwiFormCnt(UINT16 cpuid, UINT32 index);
|
||||
extern CHAR *OsGetHwiFormName(UINT32 index);
|
||||
extern VOID OsInterrupt(UINT32 intNum);
|
||||
extern VOID OsSyscallHandleInit(VOID);
|
||||
|
|
|
@ -74,7 +74,7 @@
|
|||
|
||||
STATIC UINTPTR g_minAddr;
|
||||
STATIC UINTPTR g_maxAddr;
|
||||
STATIC UINT32 g_currHandleExcCpuID = INVALID_CPUID;
|
||||
STATIC UINT32 g_currHandleExcCpuid = INVALID_CPUID;
|
||||
VOID OsExcHook(UINT32 excType, ExcContext *excBufAddr, UINT32 far, UINT32 fsr);
|
||||
UINT32 g_curNestCount[LOSCFG_KERNEL_CORE_NUM] = { 0 };
|
||||
BOOL g_excFromUserMode[LOSCFG_KERNEL_CORE_NUM];
|
||||
|
@ -88,6 +88,7 @@ STATIC UINT32 g_nextExcWaitCpu = INVALID_CPUID;
|
|||
#define OS_MAX_BACKTRACE 15U
|
||||
#define DUMPSIZE 128U
|
||||
#define DUMPREGS 12U
|
||||
#define COM_REGS 4U
|
||||
#define INSTR_SET_MASK 0x01000020U
|
||||
#define THUMB_INSTR_LEN 2U
|
||||
#define ARM_INSTR_LEN 4U
|
||||
|
@ -112,11 +113,11 @@ STATIC const StackInfo g_excStack[] = {
|
|||
UINT32 OsGetSystemStatus(VOID)
|
||||
{
|
||||
UINT32 flag;
|
||||
UINT32 cpuID = g_currHandleExcCpuID;
|
||||
UINT32 cpuid = g_currHandleExcCpuid;
|
||||
|
||||
if (cpuID == INVALID_CPUID) {
|
||||
if (cpuid == INVALID_CPUID) {
|
||||
flag = OS_SYSTEM_NORMAL;
|
||||
} else if (cpuID == ArchCurrCpuid()) {
|
||||
} else if (cpuid == ArchCurrCpuid()) {
|
||||
flag = OS_SYSTEM_EXC_CURR_CPU;
|
||||
} else {
|
||||
flag = OS_SYSTEM_EXC_OTHER_CPU;
|
||||
|
@ -516,13 +517,22 @@ VOID OsDumpContextMem(const ExcContext *excBufAddr)
|
|||
return;
|
||||
}
|
||||
|
||||
for (excReg = &(excBufAddr->R0); count <= DUMPREGS; excReg++, count++) {
|
||||
for (excReg = &(excBufAddr->R0); count < COM_REGS; excReg++, count++) {
|
||||
if (IS_VALID_ADDR(*excReg)) {
|
||||
PrintExcInfo("\ndump mem around R%u:%p", count, (*excReg));
|
||||
OsDumpMemByte(DUMPSIZE, ((*excReg) - (DUMPSIZE >> 1)));
|
||||
}
|
||||
}
|
||||
|
||||
for (excReg = &(excBufAddr->R4); count < DUMPREGS; excReg++, count++) {
|
||||
if (IS_VALID_ADDR(*excReg)) {
|
||||
PrintExcInfo("\ndump mem around R%u:%p", count, (*excReg));
|
||||
OsDumpMemByte(DUMPSIZE, ((*excReg) - (DUMPSIZE >> 1)));
|
||||
}
|
||||
}
|
||||
if (IS_VALID_ADDR(excBufAddr->R12)) {
|
||||
PrintExcInfo("\ndump mem around R12:%p", excBufAddr->R12);
|
||||
OsDumpMemByte(DUMPSIZE, (excBufAddr->R12 - (DUMPSIZE >> 1)));
|
||||
}
|
||||
if (IS_VALID_ADDR(excBufAddr->SP)) {
|
||||
PrintExcInfo("\ndump mem around SP:%p", excBufAddr->SP);
|
||||
OsDumpMemByte(DUMPSIZE, (excBufAddr->SP - (DUMPSIZE >> 1)));
|
||||
|
@ -531,11 +541,11 @@ VOID OsDumpContextMem(const ExcContext *excBufAddr)
|
|||
|
||||
STATIC VOID OsExcRestore(VOID)
|
||||
{
|
||||
UINT32 currCpuID = ArchCurrCpuid();
|
||||
UINT32 currCpuid = ArchCurrCpuid();
|
||||
|
||||
g_excFromUserMode[currCpuID] = FALSE;
|
||||
g_intCount[currCpuID] = 0;
|
||||
g_curNestCount[currCpuID] = 0;
|
||||
g_excFromUserMode[currCpuid] = FALSE;
|
||||
g_intCount[currCpuid] = 0;
|
||||
g_curNestCount[currCpuid] = 0;
|
||||
#ifdef LOSCFG_KERNEL_SMP
|
||||
OsCpuStatusSet(CPU_RUNNING);
|
||||
#endif
|
||||
|
@ -556,15 +566,15 @@ STATIC VOID OsUserExcHandle(ExcContext *excBufAddr)
|
|||
#ifdef LOSCFG_KERNEL_SMP
|
||||
LOS_SpinLock(&g_excSerializerSpin);
|
||||
if (g_nextExcWaitCpu != INVALID_CPUID) {
|
||||
g_currHandleExcCpuID = g_nextExcWaitCpu;
|
||||
g_currHandleExcCpuid = g_nextExcWaitCpu;
|
||||
g_nextExcWaitCpu = INVALID_CPUID;
|
||||
} else {
|
||||
g_currHandleExcCpuID = INVALID_CPUID;
|
||||
g_currHandleExcCpuid = INVALID_CPUID;
|
||||
}
|
||||
g_currHandleExcPID = OS_INVALID_VALUE;
|
||||
LOS_SpinUnlock(&g_excSerializerSpin);
|
||||
#else
|
||||
g_currHandleExcCpuID = INVALID_CPUID;
|
||||
g_currHandleExcCpuid = INVALID_CPUID;
|
||||
#endif
|
||||
|
||||
#ifdef LOSCFG_KERNEL_SMP
|
||||
|
@ -645,6 +655,7 @@ STATIC INLINE BOOL FindSuitableStack(UINTPTR regFP, UINTPTR *start, UINTPTR *end
|
|||
const StackInfo *stack = NULL;
|
||||
vaddr_t kvaddr;
|
||||
|
||||
#ifdef LOSCFG_KERNEL_VM
|
||||
if (g_excFromUserMode[ArchCurrCpuid()] == TRUE) {
|
||||
taskCB = OsCurrTaskGet();
|
||||
stackStart = taskCB->userMapBase;
|
||||
|
@ -655,6 +666,7 @@ STATIC INLINE BOOL FindSuitableStack(UINTPTR regFP, UINTPTR *start, UINTPTR *end
|
|||
}
|
||||
return found;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Search in the task stacks */
|
||||
for (index = 0; index < g_taskMaxNum; index++) {
|
||||
|
@ -979,14 +991,14 @@ VOID OsDataAbortExcHandleEntry(ExcContext *excBufAddr)
|
|||
#define EXC_WAIT_INTER 50U
|
||||
#define EXC_WAIT_TIME 2000U
|
||||
|
||||
STATIC VOID WaitAllCpuStop(UINT32 cpuID)
|
||||
STATIC VOID WaitAllCpuStop(UINT32 cpuid)
|
||||
{
|
||||
UINT32 i;
|
||||
UINT32 time = 0;
|
||||
|
||||
while (time < EXC_WAIT_TIME) {
|
||||
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
|
||||
if ((i != cpuID) && !OsCpuStatusIsHalt(i)) {
|
||||
if ((i != cpuid) && !OsCpuStatusIsHalt(i)) {
|
||||
LOS_Mdelay(EXC_WAIT_INTER);
|
||||
time += EXC_WAIT_INTER;
|
||||
break;
|
||||
|
@ -1000,19 +1012,19 @@ STATIC VOID WaitAllCpuStop(UINT32 cpuID)
|
|||
return;
|
||||
}
|
||||
|
||||
STATIC VOID OsWaitOtherCoresHandleExcEnd(UINT32 currCpuID)
|
||||
STATIC VOID OsWaitOtherCoresHandleExcEnd(UINT32 currCpuid)
|
||||
{
|
||||
while (1) {
|
||||
LOS_SpinLock(&g_excSerializerSpin);
|
||||
if ((g_currHandleExcCpuID == INVALID_CPUID) || (g_currHandleExcCpuID == currCpuID)) {
|
||||
g_currHandleExcCpuID = currCpuID;
|
||||
if ((g_currHandleExcCpuid == INVALID_CPUID) || (g_currHandleExcCpuid == currCpuid)) {
|
||||
g_currHandleExcCpuid = currCpuid;
|
||||
g_currHandleExcPID = OsCurrProcessGet()->processID;
|
||||
LOS_SpinUnlock(&g_excSerializerSpin);
|
||||
break;
|
||||
}
|
||||
|
||||
if (g_nextExcWaitCpu == INVALID_CPUID) {
|
||||
g_nextExcWaitCpu = currCpuID;
|
||||
g_nextExcWaitCpu = currCpuid;
|
||||
}
|
||||
LOS_SpinUnlock(&g_excSerializerSpin);
|
||||
LOS_Mdelay(EXC_WAIT_INTER);
|
||||
|
@ -1021,7 +1033,7 @@ STATIC VOID OsWaitOtherCoresHandleExcEnd(UINT32 currCpuID)
|
|||
|
||||
STATIC VOID OsCheckAllCpuStatus(VOID)
|
||||
{
|
||||
UINT32 currCpuID = ArchCurrCpuid();
|
||||
UINT32 currCpuid = ArchCurrCpuid();
|
||||
UINT32 ret, target;
|
||||
|
||||
OsCpuStatusSet(CPU_EXC);
|
||||
|
@ -1029,17 +1041,17 @@ STATIC VOID OsCheckAllCpuStatus(VOID)
|
|||
|
||||
LOS_SpinLock(&g_excSerializerSpin);
|
||||
/* Only the current CPU anomaly */
|
||||
if (g_currHandleExcCpuID == INVALID_CPUID) {
|
||||
g_currHandleExcCpuID = currCpuID;
|
||||
if (g_currHandleExcCpuid == INVALID_CPUID) {
|
||||
g_currHandleExcCpuid = currCpuid;
|
||||
g_currHandleExcPID = OsCurrProcessGet()->processID;
|
||||
LOS_SpinUnlock(&g_excSerializerSpin);
|
||||
#ifndef LOSCFG_SAVE_EXCINFO
|
||||
if (g_excFromUserMode[currCpuID] == FALSE) {
|
||||
target = (UINT32)(OS_MP_CPU_ALL & ~CPUID_TO_AFFI_MASK(currCpuID));
|
||||
if (g_excFromUserMode[currCpuid] == FALSE) {
|
||||
target = (UINT32)(OS_MP_CPU_ALL & ~CPUID_TO_AFFI_MASK(currCpuid));
|
||||
HalIrqSendIpi(target, LOS_MP_IPI_HALT);
|
||||
}
|
||||
#endif
|
||||
} else if (g_excFromUserMode[currCpuID] == TRUE) {
|
||||
} else if (g_excFromUserMode[currCpuid] == TRUE) {
|
||||
/* Both cores raise exceptions, and the current core is a user-mode exception.
|
||||
* Both cores are abnormal and come from the same process
|
||||
*/
|
||||
|
@ -1051,12 +1063,12 @@ STATIC VOID OsCheckAllCpuStatus(VOID)
|
|||
}
|
||||
LOS_SpinUnlock(&g_excSerializerSpin);
|
||||
|
||||
OsWaitOtherCoresHandleExcEnd(currCpuID);
|
||||
OsWaitOtherCoresHandleExcEnd(currCpuid);
|
||||
} else {
|
||||
if ((g_currHandleExcCpuID < LOSCFG_KERNEL_CORE_NUM) && (g_excFromUserMode[g_currHandleExcCpuID] == TRUE)) {
|
||||
g_currHandleExcCpuID = currCpuID;
|
||||
if ((g_currHandleExcCpuid < LOSCFG_KERNEL_CORE_NUM) && (g_excFromUserMode[g_currHandleExcCpuid] == TRUE)) {
|
||||
g_currHandleExcCpuid = currCpuid;
|
||||
LOS_SpinUnlock(&g_excSerializerSpin);
|
||||
target = (UINT32)(OS_MP_CPU_ALL & ~CPUID_TO_AFFI_MASK(currCpuID));
|
||||
target = (UINT32)(OS_MP_CPU_ALL & ~CPUID_TO_AFFI_MASK(currCpuid));
|
||||
HalIrqSendIpi(target, LOS_MP_IPI_HALT);
|
||||
} else {
|
||||
LOS_SpinUnlock(&g_excSerializerSpin);
|
||||
|
@ -1066,7 +1078,7 @@ STATIC VOID OsCheckAllCpuStatus(VOID)
|
|||
#ifndef LOSCFG_SAVE_EXCINFO
|
||||
/* use halt ipi to stop other active cores */
|
||||
if (g_excFromUserMode[ArchCurrCpuid()] == FALSE) {
|
||||
WaitAllCpuStop(currCpuID);
|
||||
WaitAllCpuStop(currCpuid);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -1077,7 +1089,7 @@ STATIC VOID OsCheckCpuStatus(VOID)
|
|||
#ifdef LOSCFG_KERNEL_SMP
|
||||
OsCheckAllCpuStatus();
|
||||
#else
|
||||
g_currHandleExcCpuID = ArchCurrCpuid();
|
||||
g_currHandleExcCpuid = ArchCurrCpuid();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2023 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
|
@ -103,7 +103,7 @@ LITE_OS_SEC_TEXT_INIT VOID *OsTaskStackInit(UINT32 taskID, UINT32 stackSize, VOI
|
|||
return (VOID *)taskContext;
|
||||
}
|
||||
|
||||
LITE_OS_SEC_TEXT VOID OsUserCloneParentStack(VOID *childStack, UINTPTR parentTopOfStack, UINT32 parentStackSize)
|
||||
VOID OsUserCloneParentStack(VOID *childStack, UINTPTR sp, UINTPTR parentTopOfStack, UINT32 parentStackSize)
|
||||
{
|
||||
LosTaskCB *task = OsCurrTaskGet();
|
||||
sig_cb *sigcb = &task->sig;
|
||||
|
@ -117,6 +117,10 @@ LITE_OS_SEC_TEXT VOID OsUserCloneParentStack(VOID *childStack, UINTPTR parentTop
|
|||
|
||||
(VOID)memcpy_s(childStack, sizeof(TaskContext), cloneStack, sizeof(TaskContext));
|
||||
((TaskContext *)childStack)->R0 = 0;
|
||||
if (sp != 0) {
|
||||
((TaskContext *)childStack)->USP = TRUNCATE(sp, LOSCFG_STACK_POINT_ALIGN_SIZE);
|
||||
((TaskContext *)childStack)->ULR = 0;
|
||||
}
|
||||
}
|
||||
|
||||
LITE_OS_SEC_TEXT_INIT VOID OsUserTaskStackInit(TaskContext *context, UINTPTR taskEntry, UINTPTR stack)
|
||||
|
|
|
@ -46,16 +46,11 @@ LITE_OS_SEC_BSS SPIN_LOCK_INIT(g_hwiSpin);
|
|||
size_t g_intCount[LOSCFG_KERNEL_CORE_NUM] = {0};
|
||||
HwiHandleForm g_hwiForm[OS_HWI_MAX_NUM];
|
||||
STATIC CHAR *g_hwiFormName[OS_HWI_MAX_NUM] = {0};
|
||||
STATIC UINT32 g_hwiFormCnt[OS_HWI_MAX_NUM] = {0};
|
||||
STATIC UINT32 g_hwiFormCnt[LOSCFG_KERNEL_CORE_NUM][OS_HWI_MAX_NUM] = {0};
|
||||
|
||||
VOID OsIncHwiFormCnt(UINT32 index)
|
||||
UINT32 OsGetHwiFormCnt(UINT16 cpuid, UINT32 index)
|
||||
{
|
||||
g_hwiFormCnt[index]++;
|
||||
}
|
||||
|
||||
UINT32 OsGetHwiFormCnt(UINT32 index)
|
||||
{
|
||||
return g_hwiFormCnt[index];
|
||||
return g_hwiFormCnt[cpuid][index];
|
||||
}
|
||||
|
||||
CHAR *OsGetHwiFormName(UINT32 index)
|
||||
|
@ -74,16 +69,17 @@ VOID OsInterrupt(UINT32 intNum)
|
|||
{
|
||||
HwiHandleForm *hwiForm = NULL;
|
||||
UINT32 *intCnt = NULL;
|
||||
UINT16 cpuid = ArchCurrCpuid();
|
||||
|
||||
/* Must keep the operation at the beginning of the interface */
|
||||
intCnt = &g_intCount[ArchCurrCpuid()];
|
||||
intCnt = &g_intCount[cpuid];
|
||||
*intCnt = *intCnt + 1;
|
||||
|
||||
OsSchedIrqStartTime();
|
||||
|
||||
#ifdef LOSCFG_CPUP_INCLUDE_IRQ
|
||||
OsCpupIrqStart();
|
||||
OsCpupIrqStart(cpuid);
|
||||
#endif
|
||||
|
||||
OsSchedIrqStartTime();
|
||||
OsHookCall(LOS_HOOK_TYPE_ISR_ENTER, intNum);
|
||||
hwiForm = (&g_hwiForm[intNum]);
|
||||
#ifndef LOSCFG_NO_SHARED_IRQ
|
||||
|
@ -105,14 +101,14 @@ VOID OsInterrupt(UINT32 intNum)
|
|||
#ifndef LOSCFG_NO_SHARED_IRQ
|
||||
}
|
||||
#endif
|
||||
++g_hwiFormCnt[intNum];
|
||||
++g_hwiFormCnt[cpuid][intNum];
|
||||
|
||||
OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, intNum);
|
||||
#ifdef LOSCFG_CPUP_INCLUDE_IRQ
|
||||
OsCpupIrqEnd(intNum);
|
||||
#endif
|
||||
OsSchedIrqUpdateUsedTime();
|
||||
OsSchedIrqUsedTimeUpdate();
|
||||
|
||||
#ifdef LOSCFG_CPUP_INCLUDE_IRQ
|
||||
OsCpupIrqEnd(cpuid, intNum);
|
||||
#endif
|
||||
/* Must keep the operation at the end of the interface */
|
||||
*intCnt = *intCnt - 1;
|
||||
}
|
||||
|
|
|
@ -121,8 +121,9 @@ reset_vector:
|
|||
mcr p15, 0, r0, c13, c0, 4
|
||||
/* do some early cpu setup: i/d cache disable, mmu disabled */
|
||||
mrc p15, 0, r0, c1, c0, 0
|
||||
bic r0, #(1<<12)
|
||||
bic r0, #(1<<2 | 1<<0)
|
||||
bic r0, #(1 << 12) /* i cache */
|
||||
bic r0, #(1 << 2) /* d cache */
|
||||
bic r0, #(1 << 0) /* mmu */
|
||||
mcr p15, 0, r0, c1, c0, 0
|
||||
|
||||
/* enable fpu+neon */
|
||||
|
@ -275,18 +276,18 @@ mmu_setup:
|
|||
mov r12, #0x7 /* 0b0111 */
|
||||
mcr p15, 0, r12, c3, c0, 0 /* Set DACR with 0b0111, client and manager domian */
|
||||
isb
|
||||
mrc p15, 0, r12, c1, c0, 1 /* ACTLR, Auxlliary Control Register */
|
||||
mrc p15, 0, r12, c1, c0, 1 /* ACTLR, Auxiliary Control Register */
|
||||
orr r12, r12, #(1 << 6) /* SMP, Enables coherent requests to the processor. */
|
||||
orr r12, r12, #(1 << 2) /* Enable D-side prefetch */
|
||||
orr r12, r12, #(1 << 11) /* Global BP Enable bit */
|
||||
mcr p15, 0, r12, c1, c0, 1 /* ACTLR, Auxlliary Control Register */
|
||||
mcr p15, 0, r12, c1, c0, 1 /* ACTLR, Auxiliary Control Register */
|
||||
dsb
|
||||
mrc p15, 0, r12, c1, c0, 0
|
||||
bic r12, #(1 << 29 | 1 << 28)
|
||||
orr r12, #(1 << 0)
|
||||
bic r12, #(1 << 29 | 1 << 28) /* Disable TRE/AFE */
|
||||
orr r12, #(1 << 0) /* mmu enable */
|
||||
bic r12, #(1 << 1)
|
||||
orr r12, #(1 << 2)
|
||||
orr r12, #(1 << 12)
|
||||
orr r12, #(1 << 2) /* D cache enable */
|
||||
orr r12, #(1 << 12) /* I cache enable */
|
||||
mcr p15, 0, r12, c1, c0, 0 /* Set SCTLR with r12: Turn on the MMU, I/D cache Disable TRE/AFE */
|
||||
isb
|
||||
ldr pc, =1f /* Convert to VA */
|
||||
|
|
|
@ -101,8 +101,9 @@ __exception_handlers:
|
|||
reset_vector:
|
||||
/* do some early cpu setup: i/d cache disable, mmu disabled */
|
||||
mrc p15, 0, r0, c1, c0, 0
|
||||
bic r0, #(1<<12)
|
||||
bic r0, #(1<<2 | 1<<0)
|
||||
bic r0, #(1 << 12) /* i cache */
|
||||
bic r0, #(1 << 2) /* d cache */
|
||||
bic r0, #(1 << 0) /* mmu */
|
||||
mcr p15, 0, r0, c1, c0, 0
|
||||
|
||||
/* enable fpu+neon */
|
||||
|
@ -269,11 +270,11 @@ mmu_setup:
|
|||
isb
|
||||
|
||||
mrc p15, 0, r12, c1, c0, 0
|
||||
bic r12, #(1 << 29 | 1 << 28)
|
||||
orr r12, #(1 << 0)
|
||||
bic r12, #(1 << 29 | 1 << 28) /* Disable TRE/AFE */
|
||||
orr r12, #(1 << 0) /* mmu enable */
|
||||
bic r12, #(1 << 1)
|
||||
orr r12, #(1 << 2)
|
||||
orr r12, #(1 << 12)
|
||||
orr r12, #(1 << 2) /* D cache enable */
|
||||
orr r12, #(1 << 12) /* I cache enable */
|
||||
mcr p15, 0, r12, c1, c0, 0 /* Set SCTLR with r12: Turn on the MMU, I/D cache Disable TRE/AFE */
|
||||
isb
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ INT32 LOS_StrncpyFromUser(CHAR *dst, const CHAR *src, INT32 count)
|
|||
}
|
||||
|
||||
maxCount = (LOS_IsUserAddressRange((VADDR_T)(UINTPTR)src, (size_t)count)) ? \
|
||||
count : (USER_ASPACE_TOP_MAX - (UINTPTR)src);
|
||||
count : (INT32)(USER_ASPACE_TOP_MAX - (UINTPTR)src);
|
||||
|
||||
for (i = 0; i < maxCount; ++i) {
|
||||
if (LOS_GetUser(&character, src + offset) != LOS_OK) {
|
||||
|
|
|
@ -49,7 +49,7 @@ STATIC UINT32 g_curIrqNum = 0;
|
|||
*/
|
||||
STATIC VOID GicWriteSgi(UINT32 vector, UINT32 cpuMask, UINT32 filter)
|
||||
{
|
||||
UINT32 val = ((filter & 0x3) << 24) | ((cpuMask & 0xFF) << 16) |
|
||||
UINT32 val = ((filter & 0x3) << 24) | ((cpuMask & 0xFF) << 16) | /* 24, 16: Register bit offset */
|
||||
(vector & 0xF);
|
||||
|
||||
GIC_REG_32(GICD_SGIR) = val;
|
||||
|
@ -62,7 +62,7 @@ VOID HalIrqSendIpi(UINT32 target, UINT32 ipi)
|
|||
|
||||
VOID HalIrqSetAffinity(UINT32 vector, UINT32 cpuMask)
|
||||
{
|
||||
UINT32 offset = vector / 4;
|
||||
UINT32 offset = vector / 4; /* 4: Interrupt bit width */
|
||||
UINT32 index = vector & 0x3;
|
||||
|
||||
GIC_REG_8(GICD_ITARGETSR(offset) + index) = cpuMask;
|
||||
|
@ -80,7 +80,7 @@ VOID HalIrqMask(UINT32 vector)
|
|||
return;
|
||||
}
|
||||
|
||||
GIC_REG_32(GICD_ICENABLER(vector / 32)) = 1U << (vector % 32);
|
||||
GIC_REG_32(GICD_ICENABLER(vector / 32)) = 1U << (vector % 32); /* 32: Interrupt bit width */
|
||||
}
|
||||
|
||||
VOID HalIrqUnmask(UINT32 vector)
|
||||
|
@ -89,7 +89,7 @@ VOID HalIrqUnmask(UINT32 vector)
|
|||
return;
|
||||
}
|
||||
|
||||
GIC_REG_32(GICD_ISENABLER(vector >> 5)) = 1U << (vector % 32);
|
||||
GIC_REG_32(GICD_ISENABLER(vector >> 5)) = 1U << (vector % 32); /* 5, 32: Register bit offset */
|
||||
}
|
||||
|
||||
VOID HalIrqPending(UINT32 vector)
|
||||
|
@ -98,7 +98,7 @@ VOID HalIrqPending(UINT32 vector)
|
|||
return;
|
||||
}
|
||||
|
||||
GIC_REG_32(GICD_ISPENDR(vector >> 5)) = 1U << (vector % 32);
|
||||
GIC_REG_32(GICD_ISPENDR(vector >> 5)) = 1U << (vector % 32); /* 5, 32: Register bit offset */
|
||||
}
|
||||
|
||||
VOID HalIrqClear(UINT32 vector)
|
||||
|
@ -119,24 +119,24 @@ VOID HalIrqInit(VOID)
|
|||
{
|
||||
UINT32 i;
|
||||
|
||||
/* set externel interrupts to be level triggered, active low. */
|
||||
for (i = 32; i < OS_HWI_MAX_NUM; i += 16) {
|
||||
GIC_REG_32(GICD_ICFGR(i / 16)) = 0;
|
||||
/* set external interrupts to be level triggered, active low. */
|
||||
for (i = 32; i < OS_HWI_MAX_NUM; i += 16) { /* 32: Start interrupt number, 16: Interrupt bit width */
|
||||
GIC_REG_32(GICD_ICFGR(i / 16)) = 0; /* 16: Register bit offset */
|
||||
}
|
||||
|
||||
/* set externel interrupts to CPU 0 */
|
||||
for (i = 32; i < OS_HWI_MAX_NUM; i += 4) {
|
||||
/* set external interrupts to CPU 0 */
|
||||
for (i = 32; i < OS_HWI_MAX_NUM; i += 4) { /* 32: Start interrupt number, 4: Interrupt bit width */
|
||||
GIC_REG_32(GICD_ITARGETSR(i / 4)) = 0x01010101;
|
||||
}
|
||||
|
||||
/* set priority on all interrupts */
|
||||
for (i = 0; i < OS_HWI_MAX_NUM; i += 4) {
|
||||
for (i = 0; i < OS_HWI_MAX_NUM; i += 4) { /* 4: Interrupt bit width */
|
||||
GIC_REG_32(GICD_IPRIORITYR(i / 4)) = GICD_INT_DEF_PRI_X4;
|
||||
}
|
||||
|
||||
/* disable all interrupts. */
|
||||
for (i = 0; i < OS_HWI_MAX_NUM; i += 32) {
|
||||
GIC_REG_32(GICD_ICENABLER(i / 32)) = ~0;
|
||||
for (i = 0; i < OS_HWI_MAX_NUM; i += 32) { /* 32: Interrupt bit width */
|
||||
GIC_REG_32(GICD_ICENABLER(i / 32)) = ~0; /* 32: Interrupt bit width */
|
||||
}
|
||||
|
||||
HalIrqInitPercpu();
|
||||
|
|
|
@ -42,9 +42,9 @@ STATIC UINT32 g_curIrqNum = 0;
|
|||
|
||||
STATIC INLINE UINT64 MpidrToAffinity(UINT64 mpidr)
|
||||
{
|
||||
return ((MPIDR_AFF_LEVEL(mpidr, 3) << 32) |
|
||||
(MPIDR_AFF_LEVEL(mpidr, 2) << 16) |
|
||||
(MPIDR_AFF_LEVEL(mpidr, 1) << 8) |
|
||||
return ((MPIDR_AFF_LEVEL(mpidr, 3) << 32) | /* 3: Serial number, 32: Register bit offset */
|
||||
(MPIDR_AFF_LEVEL(mpidr, 2) << 16) | /* 2: Serial number, 16: Register bit offset */
|
||||
(MPIDR_AFF_LEVEL(mpidr, 1) << 8) | /* 1: Serial number, 8: Register bit offset */
|
||||
(MPIDR_AFF_LEVEL(mpidr, 0)));
|
||||
}
|
||||
|
||||
|
@ -106,10 +106,10 @@ STATIC VOID GicSgi(UINT32 irq, UINT32 cpuMask)
|
|||
tList = GicTargetList(&cpu, cpuMask, cluster);
|
||||
|
||||
/* Generates a Group 1 interrupt for the current security state */
|
||||
val = ((MPIDR_AFF_LEVEL(cluster, 3) << 48) |
|
||||
(MPIDR_AFF_LEVEL(cluster, 2) << 32) |
|
||||
(MPIDR_AFF_LEVEL(cluster, 1) << 16) |
|
||||
(irq << 24) | tList);
|
||||
val = ((MPIDR_AFF_LEVEL(cluster, 3) << 48) | /* 3: Serial number, 48: Register bit offset */
|
||||
(MPIDR_AFF_LEVEL(cluster, 2) << 32) | /* 2: Serial number, 32: Register bit offset */
|
||||
(MPIDR_AFF_LEVEL(cluster, 1) << 16) | /* 1: Serial number, 16: Register bit offset */
|
||||
(irq << 24) | tList); /* 24: Register bit offset */
|
||||
|
||||
GiccSetSgi1r(val);
|
||||
}
|
||||
|
@ -150,9 +150,9 @@ STATIC INLINE VOID GicdSetGroup(UINT32 irq)
|
|||
{
|
||||
/* configure spi as group 0 on secure mode and group 1 on unsecure mode */
|
||||
#ifdef LOSCFG_ARCH_SECURE_MONITOR_MODE
|
||||
GIC_REG_32(GICD_IGROUPR(irq / 32)) = 0;
|
||||
GIC_REG_32(GICD_IGROUPR(irq / 32)) = 0; /* 32: Interrupt bit width */
|
||||
#else
|
||||
GIC_REG_32(GICD_IGROUPR(irq / 32)) = 0xffffffff;
|
||||
GIC_REG_32(GICD_IGROUPR(irq / 32)) = 0xffffffff; /* 32: Interrupt bit width */
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -248,13 +248,13 @@ UINT32 HalCurIrqGet(VOID)
|
|||
VOID HalIrqMask(UINT32 vector)
|
||||
{
|
||||
INT32 i;
|
||||
const UINT32 mask = 1U << (vector % 32);
|
||||
const UINT32 mask = 1U << (vector % 32); /* 32: Interrupt bit width */
|
||||
|
||||
if ((vector > OS_USER_HWI_MAX) || (vector < OS_USER_HWI_MIN)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (vector < 32) {
|
||||
if (vector < 32) { /* 32: Interrupt bit width */
|
||||
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
|
||||
GIC_REG_32(GICR_ICENABLER0(i)) = mask;
|
||||
GicWaitForRwp(GICR_CTLR(i));
|
||||
|
@ -268,19 +268,19 @@ VOID HalIrqMask(UINT32 vector)
|
|||
VOID HalIrqUnmask(UINT32 vector)
|
||||
{
|
||||
INT32 i;
|
||||
const UINT32 mask = 1U << (vector % 32);
|
||||
const UINT32 mask = 1U << (vector % 32); /* 32: Interrupt bit width */
|
||||
|
||||
if ((vector > OS_USER_HWI_MAX) || (vector < OS_USER_HWI_MIN)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (vector < 32) {
|
||||
if (vector < 32) { /* 32: Interrupt bit width */
|
||||
for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
|
||||
GIC_REG_32(GICR_ISENABLER0(i)) = mask;
|
||||
GicWaitForRwp(GICR_CTLR(i));
|
||||
}
|
||||
} else {
|
||||
GIC_REG_32(GICD_ISENABLER(vector >> 5)) = mask;
|
||||
GIC_REG_32(GICD_ISENABLER(vector >> 5)) = mask; /* 5: Register bit offset */
|
||||
GicWaitForRwp(GICD_CTLR);
|
||||
}
|
||||
}
|
||||
|
@ -291,7 +291,7 @@ VOID HalIrqPending(UINT32 vector)
|
|||
return;
|
||||
}
|
||||
|
||||
GIC_REG_32(GICD_ISPENDR(vector >> 5)) = 1U << (vector % 32);
|
||||
GIC_REG_32(GICD_ISPENDR(vector >> 5)) = 1U << (vector % 32); /* 5: Register bit offset, 32: Interrupt bit width */
|
||||
}
|
||||
|
||||
VOID HalIrqClear(UINT32 vector)
|
||||
|
@ -362,30 +362,30 @@ VOID HalIrqInit(VOID)
|
|||
GicWaitForRwp(GICD_CTLR);
|
||||
ISB;
|
||||
|
||||
/* set externel interrupts to be level triggered, active low. */
|
||||
for (i = 32; i < OS_HWI_MAX_NUM; i += 16) {
|
||||
/* set external interrupts to be level triggered, active low. */
|
||||
for (i = 32; i < OS_HWI_MAX_NUM; i += 16) { /* 32: Start interrupt number, 16: Interrupt bit width */
|
||||
GIC_REG_32(GICD_ICFGR(i / 16)) = 0;
|
||||
}
|
||||
|
||||
/* config distributer, mask and clear all spis, set group x */
|
||||
for (i = 32; i < OS_HWI_MAX_NUM; i += 32) {
|
||||
GIC_REG_32(GICD_ICENABLER(i / 32)) = 0xffffffff;
|
||||
GIC_REG_32(GICD_ICPENDR(i / 32)) = 0xffffffff;
|
||||
GIC_REG_32(GICD_IGRPMODR(i / 32)) = 0;
|
||||
for (i = 32; i < OS_HWI_MAX_NUM; i += 32) { /* 32: Start interrupt number, 32: Interrupt bit width */
|
||||
GIC_REG_32(GICD_ICENABLER(i / 32)) = 0xffffffff; /* 32: Interrupt bit width */
|
||||
GIC_REG_32(GICD_ICPENDR(i / 32)) = 0xffffffff; /* 32: Interrupt bit width */
|
||||
GIC_REG_32(GICD_IGRPMODR(i / 32)) = 0; /* 32: Interrupt bit width */
|
||||
|
||||
GicdSetGroup(i);
|
||||
}
|
||||
|
||||
/* set spi priority as default */
|
||||
for (i = 32; i < OS_HWI_MAX_NUM; i++) {
|
||||
for (i = 32; i < OS_HWI_MAX_NUM; i++) { /* 32: Start interrupt number */
|
||||
GicdSetPmr(i, MIN_INTERRUPT_PRIORITY);
|
||||
}
|
||||
|
||||
GicWaitForRwp(GICD_CTLR);
|
||||
|
||||
/* disable all interrupts. */
|
||||
for (i = 0; i < OS_HWI_MAX_NUM; i += 32) {
|
||||
GIC_REG_32(GICD_ICENABLER(i / 32)) = 0xffffffff;
|
||||
for (i = 0; i < OS_HWI_MAX_NUM; i += 32) { /* 32: Interrupt bit width */
|
||||
GIC_REG_32(GICD_ICENABLER(i / 32)) = 0xffffffff; /* 32: Interrupt bit width */
|
||||
}
|
||||
|
||||
/* enable distributor with ARE, group 1 enabled */
|
||||
|
@ -393,7 +393,7 @@ VOID HalIrqInit(VOID)
|
|||
|
||||
/* set spi to boot cpu only. ARE must be enabled */
|
||||
affinity = MpidrToAffinity(AARCH64_SYSREG_READ(mpidr_el1));
|
||||
for (i = 32; i < OS_HWI_MAX_NUM; i++) {
|
||||
for (i = 32; i < OS_HWI_MAX_NUM; i++) { /* 32: Start interrupt number */
|
||||
GIC_REG_64(GICD_IROUTER(i)) = affinity;
|
||||
}
|
||||
|
||||
|
|
|
@ -77,8 +77,8 @@ enum {
|
|||
#define GICD_PIDR2V3 (GICD_OFFSET + 0xffe8)
|
||||
|
||||
#ifdef LOSCFG_ARCH_GIC_V3
|
||||
#define GICD_IGRPMODR(n) (GICD_OFFSET + 0x0d00 + (n) * 4) /* Interrupt Group Mode Reisters */
|
||||
#define GICD_IROUTER(n) (GICD_OFFSET + 0x6000 + (n) * 8) /* Interrupt Rounter Reisters */
|
||||
#define GICD_IGRPMODR(n) (GICD_OFFSET + 0x0d00 + (n) * 4) /* Interrupt Group Mode Registers */
|
||||
#define GICD_IROUTER(n) (GICD_OFFSET + 0x6000 + (n) * 8) /* Interrupt Rounter Registers */
|
||||
#endif
|
||||
|
||||
#define GIC_REG_8(reg) (*(volatile UINT8 *)((UINTPTR)(GIC_BASE_ADDR + (reg))))
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
include $(LITEOSTOPDIR)/config.mk
|
||||
include $(LITEOSTOPDIR)/../../drivers/adapter/khdf/liteos/lite.mk
|
||||
include $(LITEOSTOPDIR)/../../drivers/hdf_core/adapter/khdf/liteos/lite.mk
|
||||
|
||||
MODULE_NAME := usb_base
|
||||
|
||||
|
@ -122,13 +122,13 @@ LOCAL_SRCS += $(STORAGE_SRC)/umass.c
|
|||
endif
|
||||
|
||||
ifeq ($(LOSCFG_DRIVERS_USB_HID_CLASS)_$(LOSCFG_DRIVERS_HDF_INPUT), y_y)
|
||||
LOCAL_FLAGS += -I$(LITEOSTOPDIR)/../../drivers/framework/model/input/driver \
|
||||
-I$(LITEOSTOPDIR)/../../drivers/framework/include/core \
|
||||
-I$(LITEOSTOPDIR)/../../drivers/framework/core/common/include/host \
|
||||
-I$(LITEOSTOPDIR)/../../drivers/framework/utils \
|
||||
-I$(LITEOSTOPDIR)/../../drivers/framework/osal \
|
||||
-I$(LITEOSTOPDIR)/../../drivers/framework/ability/sbuf/include \
|
||||
-I$(LITEOSTOPDIR)/../../drivers/framework/include/osal \
|
||||
LOCAL_FLAGS += -I$(LITEOSTOPDIR)/../../drivers/hdf_core/framework/model/input/driver \
|
||||
-I$(LITEOSTOPDIR)/../../drivers/hdf_core/framework/include/core \
|
||||
-I$(LITEOSTOPDIR)/../../drivers/hdf_core/framework/core/common/include/host \
|
||||
-I$(LITEOSTOPDIR)/../../drivers/hdf_core/framework/utils \
|
||||
-I$(LITEOSTOPDIR)/../../drivers/hdf_core/framework/osal \
|
||||
-I$(LITEOSTOPDIR)/../../drivers/hdf_core/framework/ability/sbuf/include \
|
||||
-I$(LITEOSTOPDIR)/../../drivers/hdf_core/framework/include/osal \
|
||||
-I$(LITEOSTOPDIR)/../../third_party/FreeBSD/sys/dev/evdev
|
||||
|
||||
LOCAL_SRCS += $(INPUT_SRC)/uhid.c \
|
||||
|
|
|
@ -27,11 +27,8 @@
|
|||
"component": {
|
||||
"name": "liteos_a",
|
||||
"subsystem": "kernel",
|
||||
"syscap": [
|
||||
"SystemCapability.Kernel.liteos-a"
|
||||
],
|
||||
"features": [],
|
||||
"adated_system_type": [
|
||||
"adapted_system_type": [
|
||||
"small"
|
||||
],
|
||||
"rom": "1.5MB",
|
||||
|
@ -43,7 +40,6 @@
|
|||
"bounds_checking_function",
|
||||
"toybox",
|
||||
"NuttX",
|
||||
"Linux_Kernel",
|
||||
"FatFs",
|
||||
"mksh",
|
||||
"musl",
|
||||
|
@ -63,4 +59,4 @@
|
|||
"test": []
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2023 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
|
@ -71,9 +71,13 @@ extern "C" {
|
|||
/* CONSTANTS */
|
||||
|
||||
#define MQ_USE_MAGIC 0x89abcdef
|
||||
/* not suppurt prio */
|
||||
/* not support prio */
|
||||
#define MQ_PRIO_MAX 1
|
||||
|
||||
#ifndef MAX_MQ_FD
|
||||
#define MAX_MQ_FD CONFIG_NQUEUE_DESCRIPTORS
|
||||
#endif
|
||||
|
||||
typedef union send_receive_t {
|
||||
unsigned oth : 3;
|
||||
unsigned grp : 6;
|
||||
|
@ -297,7 +301,7 @@ extern int mq_send(mqd_t personal, const char *msg, size_t msgLen, unsigned int
|
|||
* <li><b>EAGAIN</b>: The message queue is empty.</li>
|
||||
* <li><b>EINVAL</b>: invalid parameter.</li>
|
||||
* <li><b>EMSGSIZE</b>: The message to be received is too long.</li>
|
||||
* <li><b>ETIMEDOUT</b>: The operaton times out.</li>
|
||||
* <li><b>ETIMEDOUT</b>: The operation times out.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @par Dependency:
|
||||
|
@ -424,6 +428,7 @@ extern ssize_t mq_timedreceive(mqd_t personal, char *msg, size_t msgLen,
|
|||
|
||||
extern void MqueueRefer(int sysFd);
|
||||
extern int OsMqNotify(mqd_t personal, const struct sigevent *sigev);
|
||||
extern VOID OsMqueueCBDestroy(struct mqarray *queueTable);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
*/
|
||||
|
||||
void *calloc(size_t nitems, size_t size)
|
||||
{ /*lint !e578*/
|
||||
{
|
||||
size_t real_size;
|
||||
void *ptr = NULL;
|
||||
|
||||
|
@ -78,7 +78,7 @@ void free(void *ptr)
|
|||
*/
|
||||
|
||||
void *malloc(size_t size)
|
||||
{ /*lint !e31 !e10*/
|
||||
{
|
||||
if (size == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ void *malloc(size_t size)
|
|||
}
|
||||
|
||||
void *zalloc(size_t size)
|
||||
{ /*lint !e10*/
|
||||
{
|
||||
void *ptr = NULL;
|
||||
|
||||
if (size == 0) {
|
||||
|
@ -142,4 +142,4 @@ void *realloc(void *ptr, size_t size)
|
|||
}
|
||||
|
||||
return LOS_KernelRealloc(ptr, (UINT32) size);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,21 +53,27 @@
|
|||
|
||||
int uname(struct utsname *name)
|
||||
{
|
||||
INT32 ret;
|
||||
const char *cpuInfo = NULL;
|
||||
|
||||
if (name == NULL) {
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
#ifdef LOSCFG_UTS_CONTAINER
|
||||
struct utsname *currentUtsName = OsGetCurrUtsName();
|
||||
if (currentUtsName == NULL) {
|
||||
return -EFAULT;
|
||||
}
|
||||
(VOID)memcpy_s(name, sizeof(struct utsname), currentUtsName, sizeof(struct utsname));
|
||||
#else
|
||||
|
||||
(VOID)strcpy_s(name->sysname, sizeof(name->sysname), KERNEL_NAME);
|
||||
(VOID)strcpy_s(name->nodename, sizeof(name->nodename), "hisilicon");
|
||||
ret = sprintf_s(name->version, sizeof(name->version), "%s %u.%u.%u.%u %s %s",
|
||||
KERNEL_NAME, KERNEL_MAJOR, KERNEL_MINOR, KERNEL_PATCH, KERNEL_ITRE, __DATE__, __TIME__);
|
||||
(VOID)strcpy_s(name->nodename, sizeof(name->nodename), KERNEL_NODE_NAME);
|
||||
INT32 ret = sprintf_s(name->version, sizeof(name->version), "%s %u.%u.%u.%u %s %s",
|
||||
KERNEL_NAME, KERNEL_MAJOR, KERNEL_MINOR, KERNEL_PATCH, KERNEL_ITRE, __DATE__, __TIME__);
|
||||
if (ret < 0) {
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
cpuInfo = LOS_CpuInfo();
|
||||
const char *cpuInfo = LOS_CpuInfo();
|
||||
(VOID)strcpy_s(name->machine, sizeof(name->machine), cpuInfo);
|
||||
ret = sprintf_s(name->release, sizeof(name->release), "%u.%u.%u.%u",
|
||||
KERNEL_MAJOR, KERNEL_MINOR, KERNEL_PATCH, KERNEL_ITRE);
|
||||
|
@ -76,6 +82,7 @@ int uname(struct utsname *name)
|
|||
}
|
||||
|
||||
name->domainname[0] = '\0';
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2023 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
|
@ -44,16 +44,19 @@
|
|||
|
||||
#define FNONBLOCK O_NONBLOCK
|
||||
|
||||
#ifndef MAX_MQ_FD
|
||||
#define MAX_MQ_FD CONFIG_NQUEUE_DESCRIPTORS
|
||||
#endif
|
||||
|
||||
#ifndef LOSCFG_IPC_CONTAINER
|
||||
/* GLOBALS */
|
||||
STATIC fd_set g_queueFdSet;
|
||||
STATIC struct mqarray g_queueTable[LOSCFG_BASE_IPC_QUEUE_LIMIT];
|
||||
STATIC pthread_mutex_t g_mqueueMutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
|
||||
STATIC struct mqpersonal *g_mqPrivBuf[MAX_MQ_FD];
|
||||
|
||||
#define IPC_QUEUE_FD_SET g_queueFdSet
|
||||
#define IPC_QUEUE_TABLE g_queueTable
|
||||
#define IPC_QUEUE_MUTEX g_mqueueMutex
|
||||
#define IPC_QUEUE_MQ_PRIV_BUF g_mqPrivBuf
|
||||
#endif
|
||||
|
||||
/* LOCAL FUNCTIONS */
|
||||
STATIC INLINE INT32 MqNameCheck(const CHAR *mqName)
|
||||
{
|
||||
|
@ -96,12 +99,12 @@ STATIC INLINE struct mqarray *GetMqueueCBByName(const CHAR *name)
|
|||
UINT32 mylen = strlen(name);
|
||||
|
||||
for (index = 0; index < LOSCFG_BASE_IPC_QUEUE_LIMIT; index++) {
|
||||
if ((g_queueTable[index].mq_name == NULL) || (strlen(g_queueTable[index].mq_name) != mylen)) {
|
||||
if ((IPC_QUEUE_TABLE[index].mq_name == NULL) || (strlen(IPC_QUEUE_TABLE[index].mq_name) != mylen)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strncmp(name, (const CHAR *)(g_queueTable[index].mq_name), mylen) == 0) {
|
||||
return &(g_queueTable[index]);
|
||||
if (strncmp(name, (const CHAR *)(IPC_QUEUE_TABLE[index].mq_name), mylen) == 0) {
|
||||
return &(IPC_QUEUE_TABLE[index]);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
|
@ -110,7 +113,9 @@ STATIC INLINE struct mqarray *GetMqueueCBByName(const CHAR *name)
|
|||
STATIC INT32 DoMqueueDelete(struct mqarray *mqueueCB)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
#ifdef LOSCFG_KERNEL_IPC_PLIMIT
|
||||
OsIPCLimitMqFree();
|
||||
#endif
|
||||
if (mqueueCB->mq_name != NULL) {
|
||||
LOS_MemFree(OS_SYS_MEM_ADDR, mqueueCB->mq_name);
|
||||
mqueueCB->mq_name = NULL;
|
||||
|
@ -160,18 +165,36 @@ STATIC int SaveMqueueName(const CHAR *mqName, struct mqarray *mqueueCB)
|
|||
return LOS_OK;
|
||||
}
|
||||
|
||||
STATIC VOID MqueueCBInit(struct mqarray *mqueueCB, const struct mq_attr *attr, INT32 openFlag, UINT32 mode)
|
||||
{
|
||||
mqueueCB->unlinkflag = FALSE;
|
||||
mqueueCB->unlink_ref = 0;
|
||||
mqueueCB->mq_personal->mq_status = MQ_USE_MAGIC;
|
||||
mqueueCB->mq_personal->mq_next = NULL;
|
||||
mqueueCB->mq_personal->mq_posixdes = mqueueCB;
|
||||
mqueueCB->mq_personal->mq_flags = (INT32)((UINT32)openFlag | ((UINT32)attr->mq_flags & (UINT32)FNONBLOCK));
|
||||
mqueueCB->mq_personal->mq_mode = mode;
|
||||
mqueueCB->mq_personal->mq_refcount = 0;
|
||||
mqueueCB->mq_notify.pid = 0;
|
||||
}
|
||||
|
||||
STATIC struct mqpersonal *DoMqueueCreate(const struct mq_attr *attr, const CHAR *mqName, INT32 openFlag, UINT32 mode)
|
||||
{
|
||||
struct mqarray *mqueueCB = NULL;
|
||||
UINT32 mqueueID;
|
||||
|
||||
#ifdef LOSCFG_KERNEL_IPC_PLIMIT
|
||||
if (OsIPCLimitMqAlloc() != LOS_OK) {
|
||||
return (struct mqpersonal *)-1;
|
||||
}
|
||||
#endif
|
||||
UINT32 err = LOS_QueueCreate(NULL, attr->mq_maxmsg, &mqueueID, 0, attr->mq_msgsize);
|
||||
if (map_errno(err) != ENOERR) {
|
||||
goto ERROUT;
|
||||
}
|
||||
|
||||
if (g_queueTable[GET_QUEUE_INDEX(mqueueID)].mqcb == NULL) {
|
||||
mqueueCB = &(g_queueTable[GET_QUEUE_INDEX(mqueueID)]);
|
||||
if (IPC_QUEUE_TABLE[GET_QUEUE_INDEX(mqueueID)].mqcb == NULL) {
|
||||
mqueueCB = &(IPC_QUEUE_TABLE[GET_QUEUE_INDEX(mqueueID)]);
|
||||
mqueueCB->mq_id = mqueueID;
|
||||
}
|
||||
|
||||
|
@ -198,15 +221,7 @@ STATIC struct mqpersonal *DoMqueueCreate(const struct mq_attr *attr, const CHAR
|
|||
goto ERROUT;
|
||||
}
|
||||
|
||||
mqueueCB->unlinkflag = FALSE;
|
||||
mqueueCB->unlink_ref = 0;
|
||||
mqueueCB->mq_personal->mq_status = MQ_USE_MAGIC;
|
||||
mqueueCB->mq_personal->mq_next = NULL;
|
||||
mqueueCB->mq_personal->mq_posixdes = mqueueCB;
|
||||
mqueueCB->mq_personal->mq_flags = (INT32)((UINT32)openFlag | ((UINT32)attr->mq_flags & (UINT32)FNONBLOCK));
|
||||
mqueueCB->mq_personal->mq_mode = mode;
|
||||
mqueueCB->mq_personal->mq_refcount = 0;
|
||||
mqueueCB->mq_notify.pid = 0;
|
||||
MqueueCBInit(mqueueCB, attr, openFlag, mode);
|
||||
|
||||
return mqueueCB->mq_personal;
|
||||
ERROUT:
|
||||
|
@ -215,6 +230,9 @@ ERROUT:
|
|||
LOS_MemFree(OS_SYS_MEM_ADDR, mqueueCB->mq_name);
|
||||
mqueueCB->mq_name = NULL;
|
||||
}
|
||||
#ifdef LOSCFG_KERNEL_IPC_PLIMIT
|
||||
OsIPCLimitMqFree();
|
||||
#endif
|
||||
return (struct mqpersonal *)-1;
|
||||
}
|
||||
|
||||
|
@ -252,6 +270,7 @@ STATIC INT32 DoMqueueClose(struct mqpersonal *privateMqPersonal)
|
|||
{
|
||||
struct mqarray *mqueueCB = NULL;
|
||||
struct mqpersonal *tmp = NULL;
|
||||
INT32 ret;
|
||||
|
||||
mqueueCB = privateMqPersonal->mq_posixdes;
|
||||
if (mqueueCB == NULL || mqueueCB->mq_personal == NULL) {
|
||||
|
@ -259,6 +278,12 @@ STATIC INT32 DoMqueueClose(struct mqpersonal *privateMqPersonal)
|
|||
return LOS_NOK;
|
||||
}
|
||||
|
||||
if ((mqueueCB->unlinkflag == TRUE) && (privateMqPersonal->mq_next == NULL)) {
|
||||
ret = DoMqueueDelete(mqueueCB);
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
/* find the personal and remove */
|
||||
if (mqueueCB->mq_personal == privateMqPersonal) {
|
||||
mqueueCB->mq_personal = privateMqPersonal->mq_next;
|
||||
|
@ -280,9 +305,6 @@ STATIC INT32 DoMqueueClose(struct mqpersonal *privateMqPersonal)
|
|||
/* free the personal */
|
||||
(VOID)LOS_MemFree(OS_SYS_MEM_ADDR, privateMqPersonal);
|
||||
|
||||
if ((mqueueCB->unlinkflag == TRUE) && (mqueueCB->mq_personal == NULL)) {
|
||||
return DoMqueueDelete(mqueueCB);
|
||||
}
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
|
@ -297,7 +319,7 @@ STATIC struct mqpersonal *MqGetPrivDataBuff(mqd_t personal)
|
|||
errno = EBADF;
|
||||
return NULL;
|
||||
}
|
||||
return g_mqPrivBuf[id];
|
||||
return IPC_QUEUE_MQ_PRIV_BUF[id];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -311,13 +333,13 @@ STATIC struct mqpersonal *MqGetPrivDataBuff(mqd_t personal)
|
|||
STATIC INT32 MqAllocSysFd(int maxfdp, struct mqpersonal *privateMqPersonal)
|
||||
{
|
||||
INT32 i;
|
||||
fd_set *fdset = &g_queueFdSet;
|
||||
fd_set *fdset = &IPC_QUEUE_FD_SET;
|
||||
for (i = 0; i < maxfdp; i++) {
|
||||
/* sysFd: used bit setting, and get the index of swtmrID buffer */
|
||||
if (fdset && !(FD_ISSET(i + MQUEUE_FD_OFFSET, fdset))) {
|
||||
FD_SET(i + MQUEUE_FD_OFFSET, fdset);
|
||||
if (!g_mqPrivBuf[i]) {
|
||||
g_mqPrivBuf[i] = privateMqPersonal;
|
||||
if (!IPC_QUEUE_MQ_PRIV_BUF[i]) {
|
||||
IPC_QUEUE_MQ_PRIV_BUF[i] = privateMqPersonal;
|
||||
return i + MQUEUE_FD_OFFSET;
|
||||
}
|
||||
}
|
||||
|
@ -328,10 +350,10 @@ STATIC INT32 MqAllocSysFd(int maxfdp, struct mqpersonal *privateMqPersonal)
|
|||
STATIC VOID MqFreeSysFd(mqd_t personal)
|
||||
{
|
||||
INT32 sysFd = (INT32)personal;
|
||||
fd_set *fdset = &g_queueFdSet;
|
||||
fd_set *fdset = &IPC_QUEUE_FD_SET;
|
||||
if (fdset && FD_ISSET(sysFd, fdset)) {
|
||||
FD_CLR(sysFd, fdset);
|
||||
g_mqPrivBuf[sysFd - MQUEUE_FD_OFFSET] = NULL;
|
||||
IPC_QUEUE_MQ_PRIV_BUF[sysFd - MQUEUE_FD_OFFSET] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -341,7 +363,7 @@ void MqueueRefer(int sysFd)
|
|||
struct mqarray *mqueueCB = NULL;
|
||||
struct mqpersonal *privateMqPersonal = NULL;
|
||||
|
||||
(VOID)pthread_mutex_lock(&g_mqueueMutex);
|
||||
(VOID)pthread_mutex_lock(&IPC_QUEUE_MUTEX);
|
||||
/* Get the personal sysFd and reset personal fd -1 */
|
||||
privateMqPersonal = MqGetPrivDataBuff((mqd_t)sysFd);
|
||||
if (privateMqPersonal == NULL) {
|
||||
|
@ -354,7 +376,7 @@ void MqueueRefer(int sysFd)
|
|||
|
||||
privateMqPersonal->mq_refcount++;
|
||||
OUT_UNLOCK:
|
||||
(VOID)pthread_mutex_unlock(&g_mqueueMutex);
|
||||
(VOID)pthread_mutex_unlock(&IPC_QUEUE_MUTEX);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -498,7 +520,7 @@ mqd_t mq_open(const char *mqName, int openFlag, ...)
|
|||
return (mqd_t)-1;
|
||||
}
|
||||
|
||||
(VOID)pthread_mutex_lock(&g_mqueueMutex);
|
||||
(VOID)pthread_mutex_lock(&IPC_QUEUE_MUTEX);
|
||||
mqueueCB = GetMqueueCBByName(mqName);
|
||||
if ((UINT32)openFlag & (UINT32)O_CREAT) {
|
||||
if (mqueueCB != NULL) {
|
||||
|
@ -543,7 +565,7 @@ mqd_t mq_open(const char *mqName, int openFlag, ...)
|
|||
mqFd = (mqd_t)sysFd;
|
||||
}
|
||||
OUT:
|
||||
(VOID)pthread_mutex_unlock(&g_mqueueMutex);
|
||||
(VOID)pthread_mutex_unlock(&IPC_QUEUE_MUTEX);
|
||||
return mqFd;
|
||||
}
|
||||
|
||||
|
@ -552,7 +574,7 @@ int mq_close(mqd_t personal)
|
|||
INT32 ret = -1;
|
||||
struct mqpersonal *privateMqPersonal = NULL;
|
||||
|
||||
(VOID)pthread_mutex_lock(&g_mqueueMutex);
|
||||
(VOID)pthread_mutex_lock(&IPC_QUEUE_MUTEX);
|
||||
|
||||
/* Get the personal sysFd and reset personal fd -1 */
|
||||
privateMqPersonal = MqGetPrivDataBuff(personal);
|
||||
|
@ -577,7 +599,7 @@ int mq_close(mqd_t personal)
|
|||
MqFreeSysFd(personal);
|
||||
|
||||
OUT_UNLOCK:
|
||||
(VOID)pthread_mutex_unlock(&g_mqueueMutex);
|
||||
(VOID)pthread_mutex_unlock(&IPC_QUEUE_MUTEX);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -586,20 +608,22 @@ int OsMqGetAttr(mqd_t personal, struct mq_attr *mqAttr)
|
|||
struct mqarray *mqueueCB = NULL;
|
||||
struct mqpersonal *privateMqPersonal = NULL;
|
||||
|
||||
(VOID)pthread_mutex_lock(&IPC_QUEUE_MUTEX);
|
||||
privateMqPersonal = MqGetPrivDataBuff(personal);
|
||||
if (privateMqPersonal == NULL) {
|
||||
(VOID)pthread_mutex_unlock(&IPC_QUEUE_MUTEX);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (mqAttr == NULL) {
|
||||
errno = EINVAL;
|
||||
(VOID)pthread_mutex_unlock(&IPC_QUEUE_MUTEX);
|
||||
return -1;
|
||||
}
|
||||
|
||||
(VOID)pthread_mutex_lock(&g_mqueueMutex);
|
||||
if (privateMqPersonal->mq_status != MQ_USE_MAGIC) {
|
||||
errno = EBADF;
|
||||
(VOID)pthread_mutex_unlock(&g_mqueueMutex);
|
||||
(VOID)pthread_mutex_unlock(&IPC_QUEUE_MUTEX);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -608,7 +632,7 @@ int OsMqGetAttr(mqd_t personal, struct mq_attr *mqAttr)
|
|||
mqAttr->mq_msgsize = mqueueCB->mqcb->queueSize - sizeof(UINT32);
|
||||
mqAttr->mq_curmsgs = mqueueCB->mqcb->readWriteableCnt[OS_QUEUE_READ];
|
||||
mqAttr->mq_flags = privateMqPersonal->mq_flags;
|
||||
(VOID)pthread_mutex_unlock(&g_mqueueMutex);
|
||||
(VOID)pthread_mutex_unlock(&IPC_QUEUE_MUTEX);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -616,20 +640,22 @@ int OsMqSetAttr(mqd_t personal, const struct mq_attr *mqSetAttr, struct mq_attr
|
|||
{
|
||||
struct mqpersonal *privateMqPersonal = NULL;
|
||||
|
||||
(VOID)pthread_mutex_lock(&IPC_QUEUE_MUTEX);
|
||||
privateMqPersonal = MqGetPrivDataBuff(personal);
|
||||
if (privateMqPersonal == NULL) {
|
||||
(VOID)pthread_mutex_unlock(&IPC_QUEUE_MUTEX);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (mqSetAttr == NULL) {
|
||||
errno = EINVAL;
|
||||
(VOID)pthread_mutex_unlock(&IPC_QUEUE_MUTEX);
|
||||
return -1;
|
||||
}
|
||||
|
||||
(VOID)pthread_mutex_lock(&g_mqueueMutex);
|
||||
if (privateMqPersonal->mq_status != MQ_USE_MAGIC) {
|
||||
errno = EBADF;
|
||||
(VOID)pthread_mutex_unlock(&g_mqueueMutex);
|
||||
(VOID)pthread_mutex_unlock(&IPC_QUEUE_MUTEX);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -641,7 +667,7 @@ int OsMqSetAttr(mqd_t personal, const struct mq_attr *mqSetAttr, struct mq_attr
|
|||
if (((UINT32)mqSetAttr->mq_flags & (UINT32)FNONBLOCK) == (UINT32)FNONBLOCK) {
|
||||
privateMqPersonal->mq_flags = (INT32)((UINT32)privateMqPersonal->mq_flags | (UINT32)FNONBLOCK);
|
||||
}
|
||||
(VOID)pthread_mutex_unlock(&g_mqueueMutex);
|
||||
(VOID)pthread_mutex_unlock(&IPC_QUEUE_MUTEX);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -662,7 +688,7 @@ int mq_unlink(const char *mqName)
|
|||
return -1;
|
||||
}
|
||||
|
||||
(VOID)pthread_mutex_lock(&g_mqueueMutex);
|
||||
(VOID)pthread_mutex_lock(&IPC_QUEUE_MUTEX);
|
||||
mqueueCB = GetMqueueCBByName(mqName);
|
||||
if (mqueueCB == NULL) {
|
||||
errno = ENOENT;
|
||||
|
@ -675,11 +701,11 @@ int mq_unlink(const char *mqName)
|
|||
ret = DoMqueueDelete(mqueueCB);
|
||||
}
|
||||
|
||||
(VOID)pthread_mutex_unlock(&g_mqueueMutex);
|
||||
(VOID)pthread_mutex_unlock(&IPC_QUEUE_MUTEX);
|
||||
return ret;
|
||||
|
||||
ERROUT_UNLOCK:
|
||||
(VOID)pthread_mutex_unlock(&g_mqueueMutex);
|
||||
(VOID)pthread_mutex_unlock(&IPC_QUEUE_MUTEX);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -767,7 +793,7 @@ int mq_timedsend(mqd_t personal, const char *msg, size_t msgLen, unsigned int ms
|
|||
OS_MQ_GOTO_ERROUT_IF(!MqParamCheck(personal, msg, msgLen), errno);
|
||||
OS_MQ_GOTO_ERROUT_IF(msgPrio > (MQ_PRIO_MAX - 1), EINVAL);
|
||||
|
||||
(VOID)pthread_mutex_lock(&g_mqueueMutex);
|
||||
(VOID)pthread_mutex_lock(&IPC_QUEUE_MUTEX);
|
||||
privateMqPersonal = MqGetPrivDataBuff(personal);
|
||||
|
||||
OS_MQ_GOTO_ERROUT_UNLOCK_IF(privateMqPersonal == NULL || privateMqPersonal->mq_status != MQ_USE_MAGIC, EBADF);
|
||||
|
@ -781,7 +807,7 @@ int mq_timedsend(mqd_t personal, const char *msg, size_t msgLen, unsigned int ms
|
|||
|
||||
OS_MQ_GOTO_ERROUT_UNLOCK_IF(ConvertTimeout(privateMqPersonal->mq_flags, absTimeout, &absTicks) == -1, errno);
|
||||
mqueueID = mqueueCB->mq_id;
|
||||
(VOID)pthread_mutex_unlock(&g_mqueueMutex);
|
||||
(VOID)pthread_mutex_unlock(&IPC_QUEUE_MUTEX);
|
||||
|
||||
if (LOS_ListEmpty(&mqueueCB->mqcb->readWriteList[OS_QUEUE_READ])) {
|
||||
MqSendNotify(mqueueCB);
|
||||
|
@ -793,7 +819,7 @@ int mq_timedsend(mqd_t personal, const char *msg, size_t msgLen, unsigned int ms
|
|||
}
|
||||
return 0;
|
||||
ERROUT_UNLOCK:
|
||||
(VOID)pthread_mutex_unlock(&g_mqueueMutex);
|
||||
(VOID)pthread_mutex_unlock(&IPC_QUEUE_MUTEX);
|
||||
ERROUT:
|
||||
return -1;
|
||||
}
|
||||
|
@ -815,7 +841,7 @@ ssize_t mq_timedreceive(mqd_t personal, char *msg, size_t msgLen, unsigned int *
|
|||
*msgPrio = 0;
|
||||
}
|
||||
|
||||
(VOID)pthread_mutex_lock(&g_mqueueMutex);
|
||||
(VOID)pthread_mutex_lock(&IPC_QUEUE_MUTEX);
|
||||
privateMqPersonal = MqGetPrivDataBuff(personal);
|
||||
if (privateMqPersonal == NULL || privateMqPersonal->mq_status != MQ_USE_MAGIC) {
|
||||
errno = EBADF;
|
||||
|
@ -839,7 +865,7 @@ ssize_t mq_timedreceive(mqd_t personal, char *msg, size_t msgLen, unsigned int *
|
|||
|
||||
receiveLen = msgLen;
|
||||
mqueueID = mqueueCB->mq_id;
|
||||
(VOID)pthread_mutex_unlock(&g_mqueueMutex);
|
||||
(VOID)pthread_mutex_unlock(&IPC_QUEUE_MUTEX);
|
||||
|
||||
err = LOS_QueueReadCopy(mqueueID, (VOID *)msg, &receiveLen, (UINT32)absTicks);
|
||||
if (map_errno(err) == ENOERR) {
|
||||
|
@ -849,7 +875,7 @@ ssize_t mq_timedreceive(mqd_t personal, char *msg, size_t msgLen, unsigned int *
|
|||
}
|
||||
|
||||
ERROUT_UNLOCK:
|
||||
(VOID)pthread_mutex_unlock(&g_mqueueMutex);
|
||||
(VOID)pthread_mutex_unlock(&IPC_QUEUE_MUTEX);
|
||||
ERROUT:
|
||||
return -1;
|
||||
}
|
||||
|
@ -898,7 +924,7 @@ int OsMqNotify(mqd_t personal, const struct sigevent *sigev)
|
|||
goto ERROUT;
|
||||
}
|
||||
|
||||
(VOID)pthread_mutex_lock(&g_mqueueMutex);
|
||||
(VOID)pthread_mutex_lock(&IPC_QUEUE_MUTEX);
|
||||
privateMqPersonal = MqGetPrivDataBuff(personal);
|
||||
if (privateMqPersonal == NULL) {
|
||||
goto OUT_UNLOCK;
|
||||
|
@ -936,11 +962,26 @@ int OsMqNotify(mqd_t personal, const struct sigevent *sigev)
|
|||
mqnotify->pid = LOS_GetCurrProcessID();
|
||||
}
|
||||
|
||||
(VOID)pthread_mutex_unlock(&g_mqueueMutex);
|
||||
(VOID)pthread_mutex_unlock(&IPC_QUEUE_MUTEX);
|
||||
return 0;
|
||||
OUT_UNLOCK:
|
||||
(VOID)pthread_mutex_unlock(&g_mqueueMutex);
|
||||
(VOID)pthread_mutex_unlock(&IPC_QUEUE_MUTEX);
|
||||
ERROUT:
|
||||
return -1;
|
||||
}
|
||||
|
||||
VOID OsMqueueCBDestroy(struct mqarray *queueTable)
|
||||
{
|
||||
if (queueTable == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (UINT32 index = 0; index < LOSCFG_BASE_IPC_QUEUE_LIMIT; index++) {
|
||||
struct mqarray *mqueueCB = &(queueTable[index]);
|
||||
if (mqueueCB->mq_name == NULL) {
|
||||
continue;
|
||||
}
|
||||
(VOID)DoMqueueClose(mqueueCB->mq_personal);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
|
@ -158,7 +158,7 @@ STATIC VOID SetPthreadAttr(const _pthread_data *self, const pthread_attr_t *attr
|
|||
}
|
||||
if (outAttr->inheritsched == PTHREAD_INHERIT_SCHED) {
|
||||
if (self->task == NULL) {
|
||||
outAttr->schedparam.sched_priority = ((LosTaskCB *)(OsCurrTaskGet()))->priority;
|
||||
outAttr->schedparam.sched_priority = LOS_TaskPriGet(OsCurrTaskGet()->taskID);
|
||||
} else {
|
||||
outAttr->schedpolicy = self->attr.schedpolicy;
|
||||
outAttr->schedparam = self->attr.schedparam;
|
||||
|
@ -240,9 +240,9 @@ int pthread_create(pthread_t *thread, const pthread_attr_t *attr,
|
|||
taskInitParam.usTaskPrio = (UINT16)userAttr.schedparam.sched_priority;
|
||||
taskInitParam.uwStackSize = userAttr.stacksize;
|
||||
if (OsProcessIsUserMode(OsCurrProcessGet())) {
|
||||
taskInitParam.processID = OsGetKernelInitProcessID();
|
||||
taskInitParam.processID = (UINTPTR)OsGetKernelInitProcess();
|
||||
} else {
|
||||
taskInitParam.processID = OsCurrProcessGet()->processID;
|
||||
taskInitParam.processID = (UINTPTR)OsCurrProcessGet();
|
||||
}
|
||||
if (userAttr.detachstate == PTHREAD_CREATE_DETACHED) {
|
||||
taskInitParam.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2023 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
|
@ -71,7 +71,7 @@
|
|||
|
||||
#ifdef LOSCFG_AARCH64
|
||||
/*
|
||||
* This two structures originally did't exit,
|
||||
* This two structures originally didn't exit,
|
||||
* they added by liteos to support 64bit interfaces on 32bit platform,
|
||||
* in 64bit platform, timeval64 define to timeval which is platform adaptive.
|
||||
*/
|
||||
|
@ -117,7 +117,7 @@ STATIC INLINE BOOL ValidTimerID(UINT16 swtmrID)
|
|||
}
|
||||
|
||||
/* check owner of this timer */
|
||||
if (OS_SWT_FROM_SID(swtmrID)->uwOwnerPid != LOS_GetCurrProcessID()) {
|
||||
if (OS_SWT_FROM_SID(swtmrID)->uwOwnerPid != (UINTPTR)OsCurrProcessGet()) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -387,9 +387,16 @@ int gettimeofday64(struct timeval64 *tv, struct timezone *tz)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef LOSCFG_LIBC_NEWLIB
|
||||
int gettimeofday(struct timeval *tv, void *_tz)
|
||||
#else
|
||||
int gettimeofday(struct timeval *tv, struct timezone *tz)
|
||||
#endif
|
||||
{
|
||||
struct timeval64 stTimeVal64 = {0};
|
||||
#ifdef LOSCFG_LIBC_NEWLIB
|
||||
struct timezone *tz = (struct timezone *)_tz;
|
||||
#endif
|
||||
|
||||
if (tv == NULL) {
|
||||
TIME_RETURN(EINVAL);
|
||||
|
@ -471,14 +478,13 @@ static int PthreadGetCputime(clockid_t clockID, struct timespec *ats)
|
|||
uint64_t runtime;
|
||||
UINT32 intSave;
|
||||
UINT32 tid = GetTidFromClockID(clockID);
|
||||
|
||||
if (OS_TID_CHECK_INVALID(tid)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
LosTaskCB *task = OsGetTaskCB(tid);
|
||||
|
||||
if (OsCurrTaskGet()->processID != task->processID) {
|
||||
if (OsCurrTaskGet()->processCB != task->processCB) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -593,13 +599,22 @@ int clock_gettime(clockid_t clockID, struct timespec *tp)
|
|||
|
||||
switch (clockID) {
|
||||
case CLOCK_MONOTONIC_RAW:
|
||||
#ifdef LOSCFG_TIME_CONTAINER
|
||||
tmp = OsTimeSpecAdd(hwTime, CLOCK_MONOTONIC_TIME_BASE);
|
||||
tp->tv_sec = tmp.tv_sec;
|
||||
tp->tv_nsec = tmp.tv_nsec;
|
||||
#else
|
||||
tp->tv_sec = hwTime.tv_sec;
|
||||
tp->tv_nsec = hwTime.tv_nsec;
|
||||
#endif
|
||||
break;
|
||||
case CLOCK_MONOTONIC:
|
||||
LOS_SpinLockSave(&g_timeSpin, &intSave);
|
||||
tmp = OsTimeSpecAdd(hwTime, g_accDeltaFromAdj);
|
||||
LOS_SpinUnlockRestore(&g_timeSpin, intSave);
|
||||
#ifdef LOSCFG_TIME_CONTAINER
|
||||
tmp = OsTimeSpecAdd(tmp, CLOCK_MONOTONIC_TIME_BASE);
|
||||
#endif
|
||||
tp->tv_sec = tmp.tv_sec;
|
||||
tp->tv_nsec = tmp.tv_nsec;
|
||||
break;
|
||||
|
@ -633,7 +648,7 @@ int clock_gettime(clockid_t clockID, struct timespec *tp)
|
|||
|
||||
return 0;
|
||||
|
||||
ERROUT:
|
||||
ERROUT:
|
||||
TIME_RETURN(EINVAL);
|
||||
}
|
||||
|
||||
|
@ -647,7 +662,7 @@ int clock_getres(clockid_t clockID, struct timespec *tp)
|
|||
case CLOCK_MONOTONIC_RAW:
|
||||
case CLOCK_MONOTONIC:
|
||||
case CLOCK_REALTIME:
|
||||
/* the accessable rtc resolution */
|
||||
/* the accessible rtc resolution */
|
||||
tp->tv_nsec = OS_SYS_NS_PER_US; /* the precision of clock_gettime is 1us */
|
||||
tp->tv_sec = 0;
|
||||
break;
|
||||
|
@ -718,6 +733,7 @@ typedef struct {
|
|||
|
||||
static VOID SwtmrProc(UINTPTR tmrArg)
|
||||
{
|
||||
#ifdef LOSCFG_KERNEL_VM
|
||||
INT32 sig, ret;
|
||||
UINT32 intSave;
|
||||
pid_t pid;
|
||||
|
@ -741,7 +757,7 @@ static VOID SwtmrProc(UINTPTR tmrArg)
|
|||
/* Make sure that the para is valid */
|
||||
OS_GOTO_EXIT_IF(OS_TID_CHECK_INVALID(arg->tid), EINVAL);
|
||||
stcb = OsGetTaskCB(arg->tid);
|
||||
ret = OsUserProcessOperatePermissionsCheck(stcb, stcb->processID);
|
||||
ret = OsUserProcessOperatePermissionsCheck(stcb, stcb->processCB);
|
||||
OS_GOTO_EXIT_IF(ret != LOS_OK, -ret);
|
||||
|
||||
/* Dispatch the signal to thread, bypassing normal task group thread
|
||||
|
@ -761,9 +777,47 @@ static VOID SwtmrProc(UINTPTR tmrArg)
|
|||
return;
|
||||
EXIT:
|
||||
PRINT_ERR("Dispatch signals failed!, ret: %d\r\n", ret);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
int timer_create(clockid_t clockID, struct sigevent *restrict evp, timer_t *restrict timerID)
|
||||
{
|
||||
UINT32 ret;
|
||||
UINT16 swtmrID;
|
||||
#ifdef LOSCFG_SECURITY_VID
|
||||
UINT16 vid;
|
||||
#endif
|
||||
|
||||
if (!timerID || (clockID != CLOCK_REALTIME) || !evp) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((evp->sigev_notify != SIGEV_THREAD) || evp->sigev_notify_attributes) {
|
||||
errno = ENOTSUP;
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = LOS_SwtmrCreate(1, LOS_SWTMR_MODE_ONCE, (SWTMR_PROC_FUNC)evp->sigev_notify_function,
|
||||
&swtmrID, (UINTPTR)evp->sigev_value.sival_ptr);
|
||||
if (ret != LOS_OK) {
|
||||
errno = (ret == LOS_ERRNO_SWTMR_MAXSIZE) ? EAGAIN : EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef LOSCFG_SECURITY_VID
|
||||
vid = AddNodeByRid(swtmrID);
|
||||
if (vid == MAX_INVALID_TIMER_VID) {
|
||||
(VOID)LOS_SwtmrDelete(swtmrID);
|
||||
return -1;
|
||||
}
|
||||
swtmrID = vid;
|
||||
#endif
|
||||
*timerID = (timer_t)(UINTPTR)swtmrID;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int OsTimerCreate(clockid_t clockID, struct ksigevent *evp, timer_t *timerID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
@ -823,6 +877,7 @@ int timer_delete(timer_t timerID)
|
|||
{
|
||||
UINT16 swtmrID = (UINT16)(UINTPTR)timerID;
|
||||
VOID *arg = NULL;
|
||||
UINTPTR swtmrProc;
|
||||
|
||||
#ifdef LOSCFG_SECURITY_VID
|
||||
swtmrID = GetRidByVid(swtmrID);
|
||||
|
@ -832,10 +887,11 @@ int timer_delete(timer_t timerID)
|
|||
}
|
||||
|
||||
arg = (VOID *)OS_SWT_FROM_SID(swtmrID)->uwArg;
|
||||
swtmrProc = (UINTPTR)OS_SWT_FROM_SID(swtmrID)->pfnHandler;
|
||||
if (LOS_SwtmrDelete(swtmrID)) {
|
||||
goto ERROUT;
|
||||
}
|
||||
if (arg != NULL) {
|
||||
if ((swtmrProc == (UINTPTR)SwtmrProc) && (arg != NULL)) {
|
||||
free(arg);
|
||||
}
|
||||
|
||||
|
@ -979,7 +1035,11 @@ STATIC INT32 DoNanoSleep(UINT64 nanoseconds)
|
|||
return -1;
|
||||
}
|
||||
|
||||
#ifdef LOSCFG_LIBC_NEWLIB
|
||||
int usleep(unsigned long useconds)
|
||||
#else
|
||||
int usleep(unsigned useconds)
|
||||
#endif
|
||||
{
|
||||
return DoNanoSleep((UINT64)useconds * OS_SYS_NS_PER_US);
|
||||
}
|
||||
|
@ -1036,8 +1096,7 @@ clock_t times(struct tms *buf)
|
|||
int setitimer(int which, const struct itimerval *value, struct itimerval *ovalue)
|
||||
{
|
||||
UINT32 intSave;
|
||||
LosTaskCB *taskCB = OS_TCB_FROM_TID(LOS_CurTaskIDGet());
|
||||
LosProcessCB *processCB = OS_PCB_FROM_PID(taskCB->processID);
|
||||
LosProcessCB *processCB = OsCurrProcessGet();
|
||||
timer_t timerID = 0;
|
||||
struct itimerspec spec;
|
||||
struct itimerspec ospec;
|
||||
|
@ -1090,8 +1149,7 @@ int setitimer(int which, const struct itimerval *value, struct itimerval *ovalue
|
|||
|
||||
int getitimer(int which, struct itimerval *value)
|
||||
{
|
||||
LosTaskCB *taskCB = OS_TCB_FROM_TID(LOS_CurTaskIDGet());
|
||||
LosProcessCB *processCB = OS_PCB_FROM_PID(taskCB->processID);
|
||||
LosProcessCB *processCB = OsCurrProcessGet();
|
||||
struct itimerspec spec = {};
|
||||
|
||||
int ret = LOS_OK;
|
||||
|
|
|
@ -5,7 +5,7 @@ config DRIVERS
|
|||
Answer Y to enable LiteOS support driver.
|
||||
|
||||
source "bsd/dev/usb/Kconfig"
|
||||
source "../../drivers/adapter/khdf/liteos/Kconfig"
|
||||
source "../../drivers/hdf_core/adapter/khdf/liteos/Kconfig"
|
||||
|
||||
# Device driver Kconfig import
|
||||
source "$(DEVICE_PATH)/drivers/Kconfig"
|
||||
|
@ -17,5 +17,4 @@ source "drivers/char/video/Kconfig"
|
|||
source "drivers/char/trace/Kconfig"
|
||||
source "drivers/char/perf/Kconfig"
|
||||
|
||||
source "../../drivers/liteos/tzdriver/Kconfig"
|
||||
source "../../drivers/liteos/hievent/Kconfig"
|
||||
|
|
|
@ -45,8 +45,6 @@
|
|||
#include "bcache.h"
|
||||
#endif
|
||||
|
||||
#include "pthread.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
|
@ -165,7 +163,7 @@ extern "C" {
|
|||
#define DISK_ATA_GET_MODEL 21 /* Get model name */
|
||||
#define DISK_ATA_GET_SN 22 /* Get serial number */
|
||||
|
||||
#ifdef LOSCFG_FS_FAT_CACHE
|
||||
#ifndef LOSCFG_FS_FAT_CACHE
|
||||
#define DISK_DIRECT_BUFFER_SIZE 4 /* los_disk direct io buffer when bcache is off */
|
||||
#endif
|
||||
|
||||
|
@ -253,7 +251,7 @@ struct disk_divide_info {
|
|||
* </ul>
|
||||
*
|
||||
* @param diskName [IN] Type #const CHAR * disk driver name.
|
||||
* @param bops [IN] Type #const struct block_operations * block driver control sturcture.
|
||||
* @param bops [IN] Type #const struct block_operations * block driver control structure.
|
||||
* @param priv [IN] Type #VOID * private data of vnode.
|
||||
* @param diskID [IN] Type #INT32 disk id number, less than SYS_MAX_DISK.
|
||||
* @param info [IN] Type #VOID * disk driver partition information.
|
||||
|
@ -712,7 +710,7 @@ INT32 los_alloc_diskid_byname(const CHAR *diskName);
|
|||
* @brief get the INUSED disk id.
|
||||
*
|
||||
* @par Description:
|
||||
* Get the correponding INUSED disk id by diskName.
|
||||
* Get the corresponding INUSED disk id by diskName.
|
||||
*
|
||||
* @attention
|
||||
* <ul>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
|
@ -42,7 +42,7 @@
|
|||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C"{
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ INT32 los_alloc_diskid_byname(const CHAR *diskName)
|
|||
size_t nameLen;
|
||||
|
||||
if (diskName == NULL) {
|
||||
PRINT_ERR("The paramter disk_name is NULL");
|
||||
PRINT_ERR("The parameter disk_name is NULL");
|
||||
return VFS_ERROR;
|
||||
}
|
||||
|
||||
|
@ -163,7 +163,7 @@ INT32 los_get_diskid_byname(const CHAR *diskName)
|
|||
size_t diskNameLen;
|
||||
|
||||
if (diskName == NULL) {
|
||||
PRINT_ERR("The paramter diskName is NULL");
|
||||
PRINT_ERR("The parameter diskName is NULL");
|
||||
return VFS_ERROR;
|
||||
}
|
||||
|
||||
|
@ -756,7 +756,7 @@ INT32 DiskPartitionRegister(los_disk *disk)
|
|||
los_part *part = NULL;
|
||||
struct disk_divide_info parInfo;
|
||||
|
||||
/* Fill disk_divide_info structure to set partition's infomation. */
|
||||
/* Fill disk_divide_info structure to set partition's information. */
|
||||
(VOID)memset_s(parInfo.part, sizeof(parInfo.part), 0, sizeof(parInfo.part));
|
||||
partSize = sizeof(parInfo.part) / sizeof(parInfo.part[0]);
|
||||
|
||||
|
@ -788,7 +788,7 @@ INT32 DiskPartitionRegister(los_disk *disk)
|
|||
}
|
||||
|
||||
for (i = 0; i < partSize; i++) {
|
||||
/* Read the disk_divide_info structure to get partition's infomation. */
|
||||
/* Read the disk_divide_info structure to get partition's information. */
|
||||
if ((parInfo.part[i].type != 0) && (parInfo.part[i].type != EXTENDED_PAR) &&
|
||||
(parInfo.part[i].type != EXTENDED_8G)) {
|
||||
part = get_part(DiskAddPart(disk, parInfo.part[i].sector_start, parInfo.part[i].sector_count, TRUE));
|
||||
|
@ -1465,7 +1465,7 @@ INT32 los_disk_init(const CHAR *diskName, const struct block_operations *bops,
|
|||
ret = VnodeLookup(diskName, &blkDriver, 0);
|
||||
if (ret < 0) {
|
||||
VnodeDrop();
|
||||
ret = ENOENT;
|
||||
PRINT_ERR("disk_init : %s, failed to find the vnode, ERRNO=%d\n", diskName, ret);
|
||||
goto DISK_FIND_ERROR;
|
||||
}
|
||||
struct block_operations *bops2 = (struct block_operations *)((struct drv_data *)blkDriver->data)->ops;
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import("//kernel/liteos_a/liteos.gni")
|
||||
import("//third_party/NuttX/NuttX.gni")
|
||||
import("$THIRDPARTY_NUTTX_DIR/NuttX.gni")
|
||||
|
||||
module_switch = defined(LOSCFG_FS_VFS_BLOCK_DEVICE)
|
||||
module_name = get_path_info(rebase_path("."), "name")
|
||||
|
|
|
@ -61,7 +61,7 @@ static ssize_t MemMap(struct file *filep, LosVmMapRegion *region)
|
|||
VADDR_T vaddr = region->range.base;
|
||||
LosVmSpace *space = LOS_SpaceGet(vaddr);
|
||||
|
||||
if ((paddr >= SYS_MEM_BASE) && (paddr < SYS_MEM_END)) {
|
||||
if (((paddr + size) >= SYS_MEM_BASE) && (paddr < SYS_MEM_END)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -97,5 +97,5 @@ static const struct file_operations_vfs g_memDevOps = {
|
|||
|
||||
int DevMemRegister(void)
|
||||
{
|
||||
return register_driver("/dev/mem", &g_memDevOps, 0666, 0); /* 0666: file mode */
|
||||
return register_driver("/dev/mem", &g_memDevOps, 0644, 0); /* 0644: file mode */
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ static ssize_t QuickstartIoctl(struct file *filep, int cmd, unsigned long arg)
|
|||
return QuickstartNotify(arg);
|
||||
}
|
||||
|
||||
if (OsGetUserInitProcessID() != LOS_GetCurrProcessID()) {
|
||||
if (LOS_GetCurrProcessID() != OS_USER_ROOT_PROCESS_ID) {
|
||||
PRINT_ERR("Permission denios!\n");
|
||||
return -EACCES;
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ void RandomOperationsInit(const RandomOperations *r)
|
|||
if (r != NULL) {
|
||||
(void)memcpy_s(&g_randomOp, sizeof(RandomOperations), r, sizeof(RandomOperations));
|
||||
} else {
|
||||
PRINT_ERR("param is invalid\n", __FUNCTION__, __LINE__);
|
||||
PRINT_ERR("%s %d param is invalid\n", __FUNCTION__, __LINE__);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ static ssize_t TraceWrite(struct file *filep, const char *buffer, size_t buflen)
|
|||
if (info == NULL) {
|
||||
return -ENOMEM;
|
||||
}
|
||||
memset_s(info, infoLen, 0, infoLen);
|
||||
(void)memset_s(info, infoLen, 0, infoLen);
|
||||
|
||||
ret = LOS_CopyToKernel(info, infoLen, buffer, buflen);
|
||||
if (ret != 0) {
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import("//kernel/liteos_a/liteos.gni")
|
||||
import("//third_party/NuttX/NuttX.gni")
|
||||
import("$THIRDPARTY_NUTTX_DIR/NuttX.gni")
|
||||
|
||||
module_switch = defined(LOSCFG_DRIVERS_VIDEO)
|
||||
module_name = get_path_info(rebase_path("."), "name")
|
||||
|
|
|
@ -39,10 +39,6 @@ kernel_module(module_name) {
|
|||
|
||||
include_dirs = [ "$LITEOSTOPDIR/fs/jffs2/include" ]
|
||||
|
||||
if (defined(LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7)) {
|
||||
include_dirs += [ "//device/qemu/drivers/cfiflash" ]
|
||||
}
|
||||
|
||||
public_configs = [ ":public" ]
|
||||
}
|
||||
|
||||
|
|
|
@ -36,10 +36,6 @@ LOCAL_SRCS := $(wildcard src/*.c)
|
|||
LOCAL_INCLUDE := \
|
||||
-I $(LITEOSTOPDIR)/fs/jffs2/include
|
||||
|
||||
ifeq ($(LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7), y)
|
||||
LOCAL_INCLUDE += -I $(LITEOSTOPDIR)/../../device/qemu/drivers/cfiflash
|
||||
endif
|
||||
|
||||
LOCAL_FLAGS := $(LOCAL_INCLUDE)
|
||||
|
||||
include $(MODULE)
|
||||
|
|
|
@ -39,11 +39,6 @@
|
|||
#include "fs/driver.h"
|
||||
#include "mtd/mtd_legacy_lite.h"
|
||||
|
||||
#ifdef LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7
|
||||
#include "cfiflash.h"
|
||||
#endif
|
||||
|
||||
|
||||
#define DRIVER_NAME_ADD_SIZE 3
|
||||
pthread_mutex_t g_mtdPartitionLock = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
|
@ -134,17 +129,10 @@ static VOID MtdNorParamAssign(partition_param *spinorParam, const struct MtdDev
|
|||
* you can change the SPIBLK_NAME or SPICHR_NAME to NULL.
|
||||
*/
|
||||
spinorParam->flash_mtd = (struct MtdDev *)spinorMtd;
|
||||
#ifndef LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7
|
||||
spinorParam->flash_ops = GetDevSpinorOps();
|
||||
spinorParam->char_ops = GetMtdCharFops();
|
||||
spinorParam->blockname = SPIBLK_NAME;
|
||||
spinorParam->charname = SPICHR_NAME;
|
||||
#else
|
||||
spinorParam->flash_ops = GetCfiBlkOps();
|
||||
spinorParam->char_ops = NULL;
|
||||
spinorParam->blockname = CFI_DRIVER;
|
||||
spinorParam->charname = NULL;
|
||||
#endif
|
||||
spinorParam->partition_head = g_spinorPartitionHead;
|
||||
spinorParam->block_size = spinorMtd->eraseSize;
|
||||
}
|
||||
|
@ -158,11 +146,7 @@ static VOID MtdDeinitSpinorParam(VOID)
|
|||
|
||||
static partition_param *MtdInitSpinorParam(partition_param *spinorParam)
|
||||
{
|
||||
#ifndef LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7
|
||||
struct MtdDev *spinorMtd = GetMtd("spinor");
|
||||
#else
|
||||
struct MtdDev *spinorMtd = GetCfiMtdDev();
|
||||
#endif
|
||||
if (spinorMtd == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -289,7 +273,7 @@ static INT32 BlockDriverRegisterOperate(mtd_partition *newNode,
|
|||
if (ret) {
|
||||
free(newNode->blockdriver_name);
|
||||
newNode->blockdriver_name = NULL;
|
||||
PRINT_ERR("register blkdev partion error\n");
|
||||
PRINT_ERR("register blkdev partition error\n");
|
||||
return ret;
|
||||
}
|
||||
} else {
|
||||
|
@ -322,7 +306,7 @@ static INT32 CharDriverRegisterOperate(mtd_partition *newNode,
|
|||
|
||||
ret = register_driver(newNode->chardriver_name, param->char_ops, RWE_RW_RW, newNode);
|
||||
if (ret) {
|
||||
PRINT_ERR("register chardev partion error\n");
|
||||
PRINT_ERR("register chardev partition error\n");
|
||||
free(newNode->chardriver_name);
|
||||
newNode->chardriver_name = NULL;
|
||||
return ret;
|
||||
|
@ -340,7 +324,7 @@ static INT32 BlockDriverUnregister(mtd_partition *node)
|
|||
if (node->blockdriver_name != NULL) {
|
||||
ret = unregister_blockdriver(node->blockdriver_name);
|
||||
if (ret == -EBUSY) {
|
||||
PRINT_ERR("unregister blkdev partion error:%d\n", ret);
|
||||
PRINT_ERR("unregister blkdev partition error:%d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
free(node->blockdriver_name);
|
||||
|
@ -356,7 +340,7 @@ static INT32 CharDriverUnregister(mtd_partition *node)
|
|||
if (node->chardriver_name != NULL) {
|
||||
ret = unregister_driver(node->chardriver_name);
|
||||
if (ret == -EBUSY) {
|
||||
PRINT_ERR("unregister chardev partion error:%d\n", ret);
|
||||
PRINT_ERR("unregister chardev partition error:%d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
free(node->chardriver_name);
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 155 KiB |
Binary file not shown.
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 139 KiB |
|
@ -4,7 +4,7 @@ source "fs/ramfs/Kconfig"
|
|||
source "fs/romfs/Kconfig"
|
||||
source "fs/nfs/Kconfig"
|
||||
source "fs/proc/Kconfig"
|
||||
source "fs/jffs2/Kconfig"
|
||||
#source "fs/jffs2/Kconfig"
|
||||
source "fs/rootfs/Kconfig"
|
||||
source "fs/patchfs/Kconfig"
|
||||
source "fs/zpfs/Kconfig"
|
||||
source "fs/zpfs/Kconfig"
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import("//kernel/liteos_a/liteos.gni")
|
||||
import("//third_party/FatFs/FatFs.gni")
|
||||
import("$THIRDPARTY_FATFS_DIR/FatFs.gni")
|
||||
|
||||
module_switch = defined(LOSCFG_FS_FAT)
|
||||
module_name = get_path_info(rebase_path("."), "name")
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
|
@ -343,7 +343,8 @@ static FRESULT init_cluster(DIR_FILE *pdfp, DIR *dp_new, FATFS *fs, int type, co
|
|||
return FR_OK;
|
||||
}
|
||||
|
||||
static int fatfs_create_obj(struct Vnode *parent, const char *name, int mode, struct Vnode **vpp, BYTE type, const char *target)
|
||||
static int fatfs_create_obj(struct Vnode *parent, const char *name, int mode, struct Vnode **vpp,
|
||||
BYTE type, const char *target)
|
||||
{
|
||||
struct Vnode *vp = NULL;
|
||||
FATFS *fs = (FATFS *)parent->originMount->data;
|
||||
|
@ -1408,7 +1409,7 @@ DWORD fattime_format(time_t time)
|
|||
ftime |= ((DWORD)((st.tm_year > YEAR_OFFSET) ? (st.tm_year - YEAR_OFFSET) : 0)) << FTIME_YEAR_OFFSET;
|
||||
ftime <<= FTIME_DATE_OFFSET;
|
||||
|
||||
ftime = (DWORD)st.tm_sec / SEC_MULTIPLIER;
|
||||
ftime |= (DWORD)st.tm_sec / SEC_MULTIPLIER;
|
||||
ftime |= ((DWORD)st.tm_min) << FTIME_MIN_OFFSET;
|
||||
ftime |= ((DWORD)st.tm_hour) << FTIME_HR_OFFSET;
|
||||
|
||||
|
@ -1861,7 +1862,7 @@ static FRESULT fatfs_setlabel(los_part *part)
|
|||
return result;
|
||||
}
|
||||
|
||||
int fatfs_mkfs (struct Vnode *device, int sectors, int option)
|
||||
int fatfs_mkfs(struct Vnode *device, int sectors, int option)
|
||||
{
|
||||
BYTE *work_buff = NULL;
|
||||
los_part *part = NULL;
|
||||
|
@ -2166,7 +2167,7 @@ int fatfs_symlink(struct Vnode *parentVnode, struct Vnode **newVnode, const char
|
|||
ssize_t fatfs_readlink(struct Vnode *vnode, char *buffer, size_t bufLen)
|
||||
{
|
||||
int ret;
|
||||
FRESULT res = FR_OK;
|
||||
FRESULT res;
|
||||
DWORD clust;
|
||||
QWORD sect;
|
||||
DIR_FILE *dfp = (DIR_FILE *)(vnode->data);
|
||||
|
|
|
@ -64,7 +64,7 @@ extern "C" {
|
|||
#define MBR_PRIMARY_PART_NUM 4
|
||||
#define JUMP_CODE "\xEB\xFE\x90"
|
||||
|
||||
/* Partiton type */
|
||||
/* Partition type */
|
||||
#define FAT12 0x01 /* FAT12 as primary partition in first physical 32MB */
|
||||
#define FAT16 0x04 /* FAT16 with less than 65536 sectors(32MB) */
|
||||
#define EXTENDED_PARTITION_CHS 0x05
|
||||
|
@ -137,7 +137,7 @@ int fatfs_readdir(struct Vnode *vnode, struct fs_dirent_s *idir);
|
|||
int fatfs_rewinddir(struct Vnode *vnode, struct fs_dirent_s *dir);
|
||||
int fatfs_closedir(struct Vnode *vnode, struct fs_dirent_s *dir);
|
||||
int fatfs_rename(struct Vnode *oldvnode, struct Vnode *newparent, const char *oldname, const char *newname);
|
||||
int fatfs_mkfs (struct Vnode *device, int sectors, int option);
|
||||
int fatfs_mkfs(struct Vnode *device, int sectors, int option);
|
||||
int fatfs_mkdir(struct Vnode *parent, const char *name, mode_t mode, struct Vnode **vpp);
|
||||
int fatfs_rmdir(struct Vnode *parent, struct Vnode *vp, const char *name);
|
||||
int fatfs_unlink(struct Vnode *parent, struct Vnode *vp, const char *name);
|
||||
|
|
|
@ -179,7 +179,7 @@ static INT FatfsDisablePart(void *handle)
|
|||
* Scan the FAT inside the boundary of CHILD FATFS limit, and update the free cluster and last cluster
|
||||
* for all CHILD FATFS.
|
||||
* Acceptable Return Value:
|
||||
* - FR_OK : Successfully scaned the FAT and update field.
|
||||
* - FR_OK : Successfully scanned the FAT and update field.
|
||||
* Others Return Value:
|
||||
* - FR_INVAILD_FATFS : The FATFS object has error or the info in it has been occuried
|
||||
* - FR_DENIED : The virtual partition feature has been shut down by switcher
|
||||
|
|
|
@ -319,7 +319,7 @@ FRESULT f_regvirfs(FATFS *fs)
|
|||
|
||||
/* Set the CHILD object field */
|
||||
for (i = 0; i < fs->vir_amount; i++) {
|
||||
pfs = ff_memalloc(sizeof(FATFS)); /* Allocate a memeory for current child FATFS object */
|
||||
pfs = ff_memalloc(sizeof(FATFS)); /* Allocate a memory for current child FATFS object */
|
||||
if (pfs == NULL) { /* If allocate failed, must call 'f_unregvirfs' to free the previous FATFS object memory */
|
||||
goto ERROUT;
|
||||
}
|
||||
|
@ -373,7 +373,7 @@ static FRESULT FatfsCheckScanFatParam(FATFS *fs)
|
|||
* Scan the FAT inside the boundary of CHILD FATFS limit, and update the free cluster and last cluster
|
||||
*
|
||||
* Acceptable Return Value:
|
||||
* - FR_OK : Successfully scaned the FAT and update field.
|
||||
* - FR_OK : Successfully scanned the FAT and update field.
|
||||
*
|
||||
* Others Return Value:
|
||||
* - FR_INVAILD_FATFS : The FATFS object has error or the info in it has been occuried
|
||||
|
@ -500,7 +500,7 @@ static void FatfsSetChildClst(BYTE *work, FATFS *fs, WORD i)
|
|||
* - FR_OK : The external SD configure is complete, all info has been set to the
|
||||
* each CHILD FATFS
|
||||
* - FR_NOT_MATCHED : The virtual partition's configure does not matched as current setting
|
||||
* - FR_MODIFIED : The virtual partition's configure has been destoried partly or completely
|
||||
* - FR_MODIFIED : The virtual partition's configure has been destroyed partly or completely
|
||||
* - FR_NOVIRPART : The external SD has not been apllied as virtual partition yet
|
||||
*
|
||||
* Others Return Value:
|
||||
|
@ -581,11 +581,11 @@ FRESULT f_checkvirpart(FATFS *fs, const TCHAR *path, BYTE vol)
|
|||
labelTmp = (DWORD *)label;
|
||||
*labelTmp = tmp;
|
||||
tmp = ld_dword(work + VR_PARTITION + i * VR_ITEMSIZE + VR_Entry + 4);
|
||||
*((DWORD * )(label + 4)) = tmp;
|
||||
*((DWORD *)(label + 4)) = tmp;
|
||||
tmp = ld_dword(work + VR_PARTITION + i * VR_ITEMSIZE + VR_Entry + 8);
|
||||
*((DWORD * )(label + 8)) = tmp;
|
||||
*((DWORD *)(label + 8)) = tmp;
|
||||
tmp = ld_dword(work + VR_PARTITION + i * VR_ITEMSIZE + VR_Entry + 12);
|
||||
*((DWORD * )(label + 12)) = tmp;
|
||||
*((DWORD *)(label + 12)) = tmp;
|
||||
|
||||
if (f_checkname(label) != FR_OK) {
|
||||
(void)f_unregvirfs(fs);
|
||||
|
@ -721,11 +721,11 @@ FRESULT f_makevirpart(FATFS *fs, const TCHAR *path, BYTE vol)
|
|||
labelTmp = (DWORD *)label;
|
||||
tmp = *labelTmp;
|
||||
st_dword(work + VR_PARTITION + i * VR_ITEMSIZE + VR_Entry + 0, tmp);
|
||||
tmp = *((DWORD * )(label + 4));
|
||||
tmp = *((DWORD *)(label + 4));
|
||||
st_dword(work + VR_PARTITION + i * VR_ITEMSIZE + VR_Entry + 4, tmp);
|
||||
tmp = *((DWORD * )(label + 8));
|
||||
tmp = *((DWORD *)(label + 8));
|
||||
st_dword(work + VR_PARTITION + i * VR_ITEMSIZE + VR_Entry + 8, tmp);
|
||||
tmp = *((DWORD * )(label + 12));
|
||||
tmp = *((DWORD *)(label + 12));
|
||||
st_dword(work + VR_PARTITION + i * VR_ITEMSIZE + VR_Entry + 12, tmp);
|
||||
|
||||
virpartper += g_fatVirPart.virtualinfo.virpartpercent[i];
|
||||
|
|
|
@ -59,6 +59,9 @@ struct files_struct {
|
|||
spinlock_t workdir_lock;
|
||||
char workdir[PATH_MAX];
|
||||
#endif
|
||||
#ifdef LOSCFG_CHROOT
|
||||
struct Vnode *rootVnode;
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef struct ProcessCB LosProcessCB;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
|
@ -98,7 +98,7 @@ extern char *rindex(const char *s, int c);
|
|||
* @ingroup fs
|
||||
*
|
||||
* @par Description:
|
||||
* The set_label() function shall set the value of a global varible,
|
||||
* The set_label() function shall set the value of a global variable,
|
||||
* the value will be used to set the label of SD card in format().
|
||||
*
|
||||
* @param name [IN] label to set, the length must be less than 12
|
||||
|
@ -244,8 +244,9 @@ extern int chattr(const char *pathname, struct IATTR *attr);
|
|||
*
|
||||
* @retval #0 On success.
|
||||
* @retval #-1 On failure with errno set.
|
||||
* @retval CONTINE_NUTTX_FCNTL doesn't support some cmds in VfsFcntl, needs to continue going through Nuttx vfs operation.</li>
|
||||
*
|
||||
* @retval CONTINE_NUTTX_FCNTL doesn't support some cmds in VfsFcntl, needs to continue going through
|
||||
* Nuttx vfs operation.</li>
|
||||
*
|
||||
* @par Dependency:
|
||||
* <ul><li>fs.h</li></ul>
|
||||
* @see None
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#define MS_NOSYNC 2
|
||||
|
||||
struct MountOps;
|
||||
struct fsmap_t;
|
||||
|
||||
struct Mount {
|
||||
LIST_ENTRY mountList; /* mount list */
|
||||
|
@ -49,7 +50,7 @@ struct Mount {
|
|||
LIST_HEAD vnodeList; /* list of vnodes */
|
||||
int vnodeSize; /* size of vnode list */
|
||||
LIST_HEAD activeVnodeList; /* list of active vnodes */
|
||||
int activeVnodeSize; /* szie of active vnodes list */
|
||||
int activeVnodeSize; /* size of active vnodes list */
|
||||
void *data; /* private data */
|
||||
uint32_t hashseed; /* Random seed for vfshash */
|
||||
unsigned long mountFlags; /* Flags for mount */
|
||||
|
@ -69,8 +70,11 @@ typedef int (*foreach_mountpoint_t)(const char *devpoint,
|
|||
struct statfs *statbuf,
|
||||
void *arg);
|
||||
|
||||
struct Mount* MountAlloc(struct Vnode* vnode, struct MountOps* mop);
|
||||
LIST_HEAD* GetMountList(void);
|
||||
struct Mount *MountAlloc(struct Vnode *vnode, struct MountOps *mop);
|
||||
LIST_HEAD *GetMountList(void);
|
||||
#ifdef LOSCFG_MNT_CONTAINER
|
||||
LIST_HEAD *GetMountCache(void);
|
||||
#endif
|
||||
int foreach_mountpoint(foreach_mountpoint_t handler, void *arg);
|
||||
int ForceUmountDev(struct Vnode *dev);
|
||||
#endif
|
||||
|
|
|
@ -28,23 +28,89 @@
|
|||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import("//kernel/liteos_a/liteos.gni")
|
||||
import("//third_party/Linux_Kernel/Linux_Kernel.gni")
|
||||
|
||||
module_switch = defined(LOSCFG_FS_JFFS)
|
||||
module_name = get_path_info(rebase_path("."), "name")
|
||||
linux_path = rebase_path("$KERNEL_LINUX_DIR")
|
||||
out_path = rebase_path(target_out_dir)
|
||||
|
||||
kernel_module(module_name) {
|
||||
patch_path = rebase_path(".")
|
||||
cmd = "if [ -d ${out_path}/jffs2_build ]; then rm -r ${out_path}/jffs2_build; fi && mkdir -p ${out_path}/jffs2_build/fs"
|
||||
cmd += " && cp ${linux_path}/fs/jffs2 ${out_path}/jffs2_build/fs/. -r"
|
||||
cmd += " && pushd ${out_path}/jffs2_build/"
|
||||
cmd += " && patch -p1 < ${patch_path}/jffs2.patch && popd"
|
||||
exec_script("//build/lite/run_shell_cmd.py", [ cmd ])
|
||||
|
||||
sources = [
|
||||
"src/jffs2_hash.c",
|
||||
"src/vfs_jffs2.c",
|
||||
]
|
||||
|
||||
sources += LINUX_KERNEL_FS_JFFS2_SRC_FILES
|
||||
sources += [
|
||||
"${out_path}/jffs2_build/fs/jffs2/background.c",
|
||||
"${out_path}/jffs2_build/fs/jffs2/build.c",
|
||||
"${out_path}/jffs2_build/fs/jffs2/compr.c",
|
||||
"${out_path}/jffs2_build/fs/jffs2/compr_rtime.c",
|
||||
"${out_path}/jffs2_build/fs/jffs2/compr_rubin.c",
|
||||
"${out_path}/jffs2_build/fs/jffs2/compr_zlib.c",
|
||||
"${out_path}/jffs2_build/fs/jffs2/debug.c",
|
||||
"${out_path}/jffs2_build/fs/jffs2/dir.c",
|
||||
"${out_path}/jffs2_build/fs/jffs2/erase.c",
|
||||
"${out_path}/jffs2_build/fs/jffs2/file.c",
|
||||
"${out_path}/jffs2_build/fs/jffs2/fs.c",
|
||||
"${out_path}/jffs2_build/fs/jffs2/gc.c",
|
||||
"${out_path}/jffs2_build/fs/jffs2/malloc.c",
|
||||
"${out_path}/jffs2_build/fs/jffs2/nodelist.c",
|
||||
"${out_path}/jffs2_build/fs/jffs2/nodemgmt.c",
|
||||
"${out_path}/jffs2_build/fs/jffs2/read.c",
|
||||
"${out_path}/jffs2_build/fs/jffs2/readinode.c",
|
||||
"${out_path}/jffs2_build/fs/jffs2/scan.c",
|
||||
"${out_path}/jffs2_build/fs/jffs2/summary.c",
|
||||
"${out_path}/jffs2_build/fs/jffs2/super.c",
|
||||
"${out_path}/jffs2_build/fs/jffs2/write.c",
|
||||
"${out_path}/jffs2_build/fs/jffs2/writev.c",
|
||||
]
|
||||
|
||||
include_dirs = LINUX_KERNEL_FS_JFFS2_INCLUDE_DIRS
|
||||
include_dirs = [
|
||||
"${out_path}/jffs2_build/fs",
|
||||
"${out_path}/jffs2_build/fs/jffs2",
|
||||
]
|
||||
|
||||
public_configs = [ ":public" ]
|
||||
|
||||
deps = [ ":cp_jffs2_src" ]
|
||||
}
|
||||
|
||||
config("public") {
|
||||
include_dirs = [ "include" ]
|
||||
}
|
||||
|
||||
action("cp_jffs2_src") {
|
||||
script = "//build/lite/run_shell_cmd.py"
|
||||
|
||||
outputs = [
|
||||
"${target_out_dir}/jffs2_build/fs/jffs2/background.c",
|
||||
"${target_out_dir}/jffs2_build/fs/jffs2/build.c",
|
||||
"${target_out_dir}/jffs2_build/fs/jffs2/compr.c",
|
||||
"${target_out_dir}/jffs2_build/fs/jffs2/compr_rtime.c",
|
||||
"${target_out_dir}/jffs2_build/fs/jffs2/compr_rubin.c",
|
||||
"${target_out_dir}/jffs2_build/fs/jffs2/compr_zlib.c",
|
||||
"${target_out_dir}/jffs2_build/fs/jffs2/debug.c",
|
||||
"${target_out_dir}/jffs2_build/fs/jffs2/dir.c",
|
||||
"${target_out_dir}/jffs2_build/fs/jffs2/erase.c",
|
||||
"${target_out_dir}/jffs2_build/fs/jffs2/file.c",
|
||||
"${target_out_dir}/jffs2_build/fs/jffs2/fs.c",
|
||||
"${target_out_dir}/jffs2_build/fs/jffs2/gc.c",
|
||||
"${target_out_dir}/jffs2_build/fs/jffs2/malloc.c",
|
||||
"${target_out_dir}/jffs2_build/fs/jffs2/nodelist.c",
|
||||
"${target_out_dir}/jffs2_build/fs/jffs2/nodemgmt.c",
|
||||
"${target_out_dir}/jffs2_build/fs/jffs2/read.c",
|
||||
"${target_out_dir}/jffs2_build/fs/jffs2/readinode.c",
|
||||
"${target_out_dir}/jffs2_build/fs/jffs2/scan.c",
|
||||
"${target_out_dir}/jffs2_build/fs/jffs2/summary.c",
|
||||
"${target_out_dir}/jffs2_build/fs/jffs2/super.c",
|
||||
"${target_out_dir}/jffs2_build/fs/jffs2/write.c",
|
||||
"${target_out_dir}/jffs2_build/fs/jffs2/writev.c",
|
||||
]
|
||||
}
|
||||
|
|
|
@ -31,13 +31,51 @@ include $(LITEOSTOPDIR)/config.mk
|
|||
|
||||
MODULE_NAME := $(notdir $(shell pwd))
|
||||
|
||||
LOCAL_SRCS := $(wildcard src/*.c) \
|
||||
$(wildcard $(LITEOSTHIRDPARTY)/Linux_Kernel/fs/jffs2/*.c)
|
||||
LINUX_PATH := $(LITEOSTOPDIR)/../linux/linux-5.10
|
||||
LOCAL_PATH := $(shell pwd)
|
||||
TEMP_SRC_PATH := $(OUT)/jffs2_build
|
||||
|
||||
LOCAL_SRCS := \
|
||||
$(TEMP_SRC_PATH)/fs/jffs2/background.c \
|
||||
$(TEMP_SRC_PATH)/fs/jffs2/build.c \
|
||||
$(TEMP_SRC_PATH)/fs/jffs2/compr.c \
|
||||
$(TEMP_SRC_PATH)/fs/jffs2/compr_rtime.c \
|
||||
$(TEMP_SRC_PATH)/fs/jffs2/compr_rubin.c \
|
||||
$(TEMP_SRC_PATH)/fs/jffs2/compr_zlib.c \
|
||||
$(TEMP_SRC_PATH)/fs/jffs2/debug.c \
|
||||
$(TEMP_SRC_PATH)/fs/jffs2/dir.c \
|
||||
$(TEMP_SRC_PATH)/fs/jffs2/erase.c \
|
||||
$(TEMP_SRC_PATH)/fs/jffs2/file.c \
|
||||
$(TEMP_SRC_PATH)/fs/jffs2/fs.c \
|
||||
$(TEMP_SRC_PATH)/fs/jffs2/gc.c \
|
||||
$(TEMP_SRC_PATH)/fs/jffs2/malloc.c \
|
||||
$(TEMP_SRC_PATH)/fs/jffs2/nodelist.c \
|
||||
$(TEMP_SRC_PATH)/fs/jffs2/nodemgmt.c \
|
||||
$(TEMP_SRC_PATH)/fs/jffs2/read.c \
|
||||
$(TEMP_SRC_PATH)/fs/jffs2/readinode.c \
|
||||
$(TEMP_SRC_PATH)/fs/jffs2/scan.c \
|
||||
$(TEMP_SRC_PATH)/fs/jffs2/summary.c \
|
||||
$(TEMP_SRC_PATH)/fs/jffs2/super.c \
|
||||
$(TEMP_SRC_PATH)/fs/jffs2/write.c \
|
||||
$(TEMP_SRC_PATH)/fs/jffs2/writev.c \
|
||||
$(LOCAL_PATH)/src/jffs2_hash.c \
|
||||
$(LOCAL_PATH)/src/vfs_jffs2.c \
|
||||
|
||||
LOCAL_INCLUDE := \
|
||||
-I $(LITEOSTOPDIR)/fs/jffs2/include \
|
||||
-I $(LITEOSTHIRDPARTY)/Linux_Kernel/fs/jffs2 \
|
||||
-I $(LITEOSTHIRDPARTY)/Linux_Kernel/fs
|
||||
-I $(TEMP_SRC_PATH)/fs/jffs2 \
|
||||
-I $(TEMP_SRC_PATH)/fs
|
||||
LOCAL_FLAGS := $(LOCAL_INCLUDE)
|
||||
|
||||
.PHONY: patch patch_clean
|
||||
$(LOCAL_SRCS): patch
|
||||
|
||||
patch: patch_clean
|
||||
cp $(LINUX_PATH)/fs/jffs2 $(TEMP_SRC_PATH)/fs/. -r
|
||||
cd $(TEMP_SRC_PATH) && patch -p1 < $(LOCAL_PATH)/jffs2.patch
|
||||
|
||||
patch_clean:
|
||||
$(HIDE) $(RM) -rf $(TEMP_SRC_PATH)
|
||||
|
||||
include $(MODULE)
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
|
@ -490,14 +490,14 @@ off_t VfsJffs2Seek(struct file *filep, off_t offset, int whence)
|
|||
filePos = filep->f_pos;
|
||||
|
||||
switch (whence) {
|
||||
case SEEK_SET:
|
||||
filePos = offset;
|
||||
break;
|
||||
|
||||
case SEEK_CUR:
|
||||
filePos += offset;
|
||||
break;
|
||||
|
||||
case SEEK_SET:
|
||||
filePos = offset;
|
||||
break;
|
||||
|
||||
case SEEK_END:
|
||||
filePos = node->i_size + offset;
|
||||
break;
|
||||
|
@ -682,7 +682,6 @@ int VfsJffs2Rmdir(struct Vnode *parentVnode, struct Vnode *targetVnode, const ch
|
|||
LOS_MuxLock(&g_jffs2FsLock, (uint32_t)JFFS2_WAITING_FOREVER);
|
||||
|
||||
ret = jffs2_rmdir(parentInode, targetInode, (const unsigned char *)path);
|
||||
|
||||
if (ret == 0) {
|
||||
(void)jffs2_iput(targetInode);
|
||||
}
|
||||
|
@ -781,7 +780,6 @@ ssize_t VfsJffs2Readlink(struct Vnode *vnode, char *buffer, size_t bufLen)
|
|||
|
||||
cnt = (bufLen - 1) < targetLen ? (bufLen - 1) : targetLen;
|
||||
if (LOS_CopyFromKernel(buffer, bufLen, (const char *)f->target, cnt) != 0) {
|
||||
cnt = 0;
|
||||
LOS_MuxUnlock(&g_jffs2FsLock);
|
||||
return -EFAULT;
|
||||
}
|
||||
|
@ -809,7 +807,6 @@ int VfsJffs2Unlink(struct Vnode *parentVnode, struct Vnode *targetVnode, const c
|
|||
LOS_MuxLock(&g_jffs2FsLock, (uint32_t)JFFS2_WAITING_FOREVER);
|
||||
|
||||
ret = jffs2_unlink(parentInode, targetInode, (const unsigned char *)path);
|
||||
|
||||
if (ret == 0) {
|
||||
(void)jffs2_iput(targetInode);
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import("//kernel/liteos_a/liteos.gni")
|
||||
import("//third_party/NuttX/NuttX.gni")
|
||||
import("$THIRDPARTY_NUTTX_DIR/NuttX.gni")
|
||||
|
||||
module_switch = defined(LOSCFG_FS_NFS)
|
||||
module_name = get_path_info(rebase_path("."), "name")
|
||||
|
|
|
@ -55,14 +55,15 @@ INT32 OsMountPatchFs(VOID)
|
|||
}
|
||||
partInfo.fsType = strdup(FS_TYPE);
|
||||
if (partInfo.fsType == NULL) {
|
||||
return LOS_NOK;
|
||||
ret = LOS_NOK;
|
||||
goto EXIT;
|
||||
}
|
||||
partInfo.startAddr = PATCHFS_FLASH_ADDR;
|
||||
partInfo.partSize = PATCHFS_FLASH_SIZE;
|
||||
#else
|
||||
ret = GetPartitionInfo(&partInfo);
|
||||
if (ret != LOS_OK) {
|
||||
return ret;
|
||||
goto EXIT;
|
||||
}
|
||||
partInfo.startAddr = (partInfo.startAddr >= 0) ? partInfo.startAddr : PATCHFS_FLASH_ADDR;
|
||||
partInfo.partSize = (partInfo.partSize >= 0) ? partInfo.partSize : PATCHFS_FLASH_SIZE;
|
||||
|
@ -71,7 +72,7 @@ INT32 OsMountPatchFs(VOID)
|
|||
ret = LOS_NOK;
|
||||
partInfo.devName = strdup(PATCH_FLASH_DEV_NAME);
|
||||
if (partInfo.devName == NULL) {
|
||||
return LOS_NOK;
|
||||
goto EXIT;
|
||||
}
|
||||
const CHAR *devName = GetDevNameOfPartition(&partInfo);
|
||||
if (devName != NULL) {
|
||||
|
@ -92,9 +93,13 @@ INT32 OsMountPatchFs(VOID)
|
|||
ResetDevNameofPartition(&partInfo);
|
||||
}
|
||||
|
||||
EXIT:
|
||||
free(partInfo.devName);
|
||||
partInfo.devName = NULL;
|
||||
free(partInfo.storageType);
|
||||
partInfo.storageType = NULL;
|
||||
free(partInfo.fsType);
|
||||
partInfo.fsType = NULL;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,12 +34,16 @@ module_name = get_path_info(rebase_path("."), "name")
|
|||
kernel_module(module_name) {
|
||||
sources = [
|
||||
"os_adapt/fd_proc.c",
|
||||
"os_adapt/file_sys.c",
|
||||
"os_adapt/fs_cache_proc.c",
|
||||
"os_adapt/mem_info.c",
|
||||
"os_adapt/mounts_proc.c",
|
||||
"os_adapt/plimits_proc.c",
|
||||
"os_adapt/power_proc.c",
|
||||
"os_adapt/proc_init.c",
|
||||
"os_adapt/proc_vfs.c",
|
||||
"os_adapt/process_proc.c",
|
||||
"os_adapt/sys_user.c",
|
||||
"os_adapt/uptime_proc.c",
|
||||
"os_adapt/vmm_proc.c",
|
||||
"src/proc_file.c",
|
||||
|
|
|
@ -4,3 +4,8 @@ config FS_PROC
|
|||
depends on FS_VFS
|
||||
help
|
||||
Answer Y to enable LiteOS support proc filesystem.
|
||||
|
||||
config PROC_PROCESS_DIR
|
||||
bool "Enable Process mount directory"
|
||||
default n
|
||||
depends on FS_PROC
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2023 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
|
@ -45,6 +45,26 @@ extern "C" {
|
|||
extern spinlock_t procfsLock;
|
||||
extern bool procfsInit;
|
||||
|
||||
#ifdef LOSCFG_PROC_PROCESS_DIR
|
||||
int ProcCreateProcessDir(UINT32 pid, uintptr_t process);
|
||||
|
||||
void ProcFreeProcessDir(struct ProcDirEntry *processDir);
|
||||
|
||||
void ProcSysMemInfoInit(void);
|
||||
|
||||
void ProcFileSysInit(void);
|
||||
#endif
|
||||
|
||||
#ifdef LOSCFG_KERNEL_PLIMITS
|
||||
void ProcLimitsInit(void);
|
||||
#endif
|
||||
|
||||
void ProcEntryClearVnode(struct ProcDirEntry *entry);
|
||||
|
||||
void ProcDetachNode(struct ProcDirEntry *pn);
|
||||
|
||||
void RemoveProcEntryTravalsal(struct ProcDirEntry *pn);
|
||||
|
||||
void ProcPmInit(void);
|
||||
|
||||
void ProcVmmInit(void);
|
||||
|
@ -57,15 +77,20 @@ struct ProcDirEntry *ProcFindEntry(const char *path);
|
|||
|
||||
void ProcFreeEntry(struct ProcDirEntry *pde);
|
||||
|
||||
extern int ProcStat(const char *file, struct ProcStat *buf);
|
||||
int ProcStat(const char *file, struct ProcStat *buf);
|
||||
|
||||
extern void ProcMountsInit(void);
|
||||
void ProcMountsInit(void);
|
||||
|
||||
extern void ProcUptimeInit(void);
|
||||
void ProcUptimeInit(void);
|
||||
|
||||
extern void ProcFsCacheInit(void);
|
||||
void ProcFsCacheInit(void);
|
||||
|
||||
extern void ProcFdInit(void);
|
||||
void ProcFdInit(void);
|
||||
|
||||
#ifdef LOSCFG_KERNEL_CONTAINER
|
||||
void *ProcfsContainerGet(int fd, unsigned int *containerType);
|
||||
void ProcSysUserInit(void);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2023 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
|
@ -60,7 +60,7 @@ typedef unsigned short fmode_t;
|
|||
#define FMODE_64BITHASH ((fmode_t)0x400)
|
||||
/* 32bit hashes as llseek() offset (for directories) */
|
||||
#define FMODE_32BITHASH ((fmode_t)0x200)
|
||||
/* File is opened using open(.., 3, ..) and is writeable only for ioctls
|
||||
/* File is opened using open(.., 3, ..) and is writable only for ioctls
|
||||
* (specialy hack for floppy.c)
|
||||
*/
|
||||
#define FMODE_WRITE_IOCTL ((fmode_t)0x100)
|
||||
|
@ -82,6 +82,7 @@ typedef unsigned short fmode_t;
|
|||
#define FMODE_READ ((fmode_t)0x1)
|
||||
|
||||
struct ProcFile;
|
||||
struct ProcDirEntry;
|
||||
|
||||
struct ProcFileOperations {
|
||||
char *name;
|
||||
|
@ -89,8 +90,18 @@ struct ProcFileOperations {
|
|||
int (*open)(struct Vnode *vnode, struct ProcFile *pf);
|
||||
int (*release)(struct Vnode *vnode, struct ProcFile *pf);
|
||||
int (*read)(struct SeqBuf *m, void *v);
|
||||
ssize_t (*readLink)(struct ProcDirEntry *pde, char *buf, size_t bufLen);
|
||||
};
|
||||
|
||||
#ifdef LOSCFG_KERNEL_PLIMITS
|
||||
struct ProcDirOperations {
|
||||
int (*rmdir)(struct ProcDirEntry *parent, struct ProcDirEntry *pde, const char *name);
|
||||
int (*mkdir)(struct ProcDirEntry *parent, const char *dirName, mode_t mode, struct ProcDirEntry **pde);
|
||||
};
|
||||
#endif
|
||||
|
||||
#define PROC_DATA_STATIC 0
|
||||
#define PROC_DATA_FREE 1
|
||||
struct ProcDirEntry {
|
||||
uint uid;
|
||||
uint gid;
|
||||
|
@ -99,6 +110,10 @@ struct ProcDirEntry {
|
|||
const struct ProcFileOperations *procFileOps;
|
||||
struct ProcFile *pf;
|
||||
struct ProcDirEntry *next, *parent, *subdir;
|
||||
#ifdef LOSCFG_KERNEL_PLIMITS
|
||||
const struct ProcDirOperations *procDirOps;
|
||||
#endif
|
||||
int dataType;
|
||||
void *data;
|
||||
atomic_t count; /* open file count */
|
||||
spinlock_t pdeUnloadLock;
|
||||
|
@ -109,6 +124,11 @@ struct ProcDirEntry {
|
|||
enum VnodeType type;
|
||||
};
|
||||
|
||||
struct ProcDataParm {
|
||||
void *data;
|
||||
int dataType;
|
||||
};
|
||||
|
||||
struct ProcFile {
|
||||
fmode_t fMode;
|
||||
spinlock_t fLock;
|
||||
|
@ -137,7 +157,7 @@ struct ProcData {
|
|||
#define S_IALLUGO (S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO)
|
||||
|
||||
/**
|
||||
* Interface for modules using proc below internal proc moudule;
|
||||
* Interface for modules using proc below internal proc module;
|
||||
*/
|
||||
/**
|
||||
* @ingroup procfs
|
||||
|
@ -244,6 +264,35 @@ extern struct ProcDirEntry *ProcMkdir(const char *name, struct ProcDirEntry *par
|
|||
extern struct ProcDirEntry *ProcCreate(const char *name, mode_t mode,
|
||||
struct ProcDirEntry *parent, const struct ProcFileOperations *procFops);
|
||||
|
||||
/**
|
||||
* @ingroup procfs
|
||||
* @brief create a proc node
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to create the node by 'name' and parent vnode,
|
||||
* And assignment operation function
|
||||
*
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>This interface should be called after system initialization.</li>
|
||||
* <li>The parameter name should be a valid string.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param name [IN] Type #const char * The name of the node to be created.
|
||||
* @param mode [IN] Type #mode_t the mode of create's node.
|
||||
* @param parent [IN] Type #struct ProcDirEntry * the parent node of the node to be created.
|
||||
* @param procFops [IN] Type #const struct ProcFileOperations * operation function of the node.
|
||||
* @param data [IN] Type #void * data of the node.
|
||||
*
|
||||
* @retval #NULL Create failed.
|
||||
* @retval #ProcDirEntry* Create successfully.
|
||||
* @par Dependency:
|
||||
* <ul><li>proc_fs.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see
|
||||
*
|
||||
*/
|
||||
extern struct ProcDirEntry *ProcCreateData(const char *name, mode_t mode, struct ProcDirEntry *parent,
|
||||
const struct ProcFileOperations *procFileOps, struct ProcDataParm *param);
|
||||
/**
|
||||
* @ingroup procfs
|
||||
* @brief init proc fs
|
||||
|
@ -266,6 +315,7 @@ extern struct ProcDirEntry *ProcCreate(const char *name, mode_t mode,
|
|||
*/
|
||||
extern void ProcFsInit(void);
|
||||
|
||||
extern struct ProcDirEntry *VnodeToEntry(struct Vnode *node);
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
|
|
|
@ -135,7 +135,7 @@ void ProcFdInit(void)
|
|||
{
|
||||
struct ProcDirEntry *pde = CreateProcEntry("fd", 0, NULL);
|
||||
if (pde == NULL) {
|
||||
PRINT_ERR("creat /proc/fd error.\n");
|
||||
PRINT_ERR("create /proc/fd error.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* Copyright (c) 2023-2023 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "fs/fs.h"
|
||||
#include "proc_fs.h"
|
||||
#include "proc_file.h"
|
||||
#include "errno.h"
|
||||
#include "sys/mount.h"
|
||||
|
||||
extern struct fsmap_t g_fsmap[];
|
||||
extern struct fsmap_t g_fsmap_end;
|
||||
|
||||
static int FsFileSysProcRead(struct SeqBuf *seqBuf, void *buf)
|
||||
{
|
||||
(void)buf;
|
||||
|
||||
struct fsmap_t *m = NULL;
|
||||
for (m = &g_fsmap[0]; m != &g_fsmap_end; ++m) {
|
||||
if (m->fs_filesystemtype) {
|
||||
if (m->is_bdfs == true) {
|
||||
(void)LosBufPrintf(seqBuf, "\n %s\n", m->fs_filesystemtype);
|
||||
} else {
|
||||
(void)LosBufPrintf(seqBuf, "%s %s\n", "nodev", m->fs_filesystemtype);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct ProcFileOperations FILESYS_PROC_FOPS = {
|
||||
.read = FsFileSysProcRead,
|
||||
};
|
||||
|
||||
void ProcFileSysInit(void)
|
||||
{
|
||||
struct ProcDirEntry *pde = CreateProcEntry("filesystems", 0, NULL);
|
||||
if (pde == NULL) {
|
||||
PRINT_ERR("creat /proc/filesystems error!\n");
|
||||
return;
|
||||
}
|
||||
pde->procFileOps = &FILESYS_PROC_FOPS;
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
|
@ -154,7 +154,8 @@ static int FsCacheInfoFill(struct SeqBuf *buf, void *arg)
|
|||
|
||||
VnodeHold();
|
||||
LosBufPrintf(buf, "\n=================================================================\n");
|
||||
LosBufPrintf(buf, "VnodeAddr ParentAddr DataAddr VnodeOps Hash Ref Type Gid Uid Mode\n");
|
||||
LosBufPrintf(buf,
|
||||
"VnodeAddr ParentAddr DataAddr VnodeOps Hash Ref Type Gid Uid Mode\n");
|
||||
vnodeVirtual = VnodeListProcess(buf, GetVnodeVirtualList());
|
||||
vnodeFree = VnodeListProcess(buf, GetVnodeFreeList());
|
||||
vnodeActive = VnodeListProcess(buf, GetVnodeActiveList());
|
||||
|
@ -206,7 +207,7 @@ static const struct ProcFileOperations FS_CACHE_PROC_FOPS = {
|
|||
|
||||
void ProcFsCacheInit(void)
|
||||
{
|
||||
struct ProcDirEntry *pde = CreateProcEntry("fs_cache", 0, NULL);
|
||||
struct ProcDirEntry *pde = CreateProcEntry("fs_cache", 0400, NULL);
|
||||
if (pde == NULL) {
|
||||
PRINT_ERR("create fs_cache error!\n");
|
||||
return;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2023-2023 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
|
@ -29,40 +28,42 @@
|
|||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "internal.h"
|
||||
#include "proc_fs.h"
|
||||
#include "vnode.h"
|
||||
#include "los_memory.h"
|
||||
#include "los_vm_filemap.h"
|
||||
#include "los_memory_pri.h"
|
||||
|
||||
#include "It_vfs_fat.h"
|
||||
|
||||
static UINT32 TestCase(VOID)
|
||||
static int SysMemInfoFill(struct SeqBuf *seqBuf, void *arg)
|
||||
{
|
||||
INT32 ret;
|
||||
CHAR pathname[FAT_STANDARD_NAME_LENGTH] = "/dev/mmcblk0p0";
|
||||
|
||||
ret = chdir("/");
|
||||
ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT);
|
||||
|
||||
ret = umount(FAT_MOUNT_DIR);
|
||||
ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1);
|
||||
|
||||
ret = mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL);
|
||||
ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1);
|
||||
|
||||
ret = umount(FAT_MOUNT_DIR);
|
||||
ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1);
|
||||
|
||||
ret = format(pathname, 0, FAT_FILE_SYSTEMTYPE_AUTO);
|
||||
ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1);
|
||||
|
||||
ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL);
|
||||
ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1);
|
||||
|
||||
return FAT_NO_ERROR;
|
||||
EXIT1:
|
||||
mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL);
|
||||
EXIT:
|
||||
return FAT_NO_ERROR;
|
||||
(void)arg;
|
||||
LOS_MEM_POOL_STATUS mem = {0};
|
||||
if (LOS_MemInfoGet(m_aucSysMem0, &mem) == LOS_NOK) {
|
||||
return -EBADF;
|
||||
}
|
||||
(void)LosBufPrintf(seqBuf, "\nUsedSize: %u byte\n", mem.totalUsedSize);
|
||||
(void)LosBufPrintf(seqBuf, "FreeSize: %u byte\n", mem.totalFreeSize);
|
||||
(void)LosBufPrintf(seqBuf, "MaxFreeNodeSize: %u byte\n", mem.maxFreeNodeSize);
|
||||
(void)LosBufPrintf(seqBuf, "UsedNodeNum: %u\n", mem.usedNodeNum);
|
||||
(void)LosBufPrintf(seqBuf, "FreeNodeNum: %u\n", mem.freeNodeNum);
|
||||
#ifdef LOSCFG_MEM_WATERLINE
|
||||
(void)LosBufPrintf(seqBuf, "UsageWaterLine: %u byte\n", mem.usageWaterLine);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
VOID ItFsFat504(VOID)
|
||||
static const struct ProcFileOperations SYS_MEMINFO_PROC_FOPS = {
|
||||
.read = SysMemInfoFill,
|
||||
};
|
||||
|
||||
void ProcSysMemInfoInit(void)
|
||||
{
|
||||
TEST_ADD_CASE("IT_FS_FAT_504", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION);
|
||||
struct ProcDirEntry *pde = CreateProcEntry("meminfo", 0, NULL);
|
||||
if (pde == NULL) {
|
||||
PRINT_ERR("create mem_info error!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
pde->procFileOps = &SYS_MEMINFO_PROC_FOPS;
|
||||
}
|
|
@ -91,7 +91,7 @@ void ProcMountsInit(void)
|
|||
{
|
||||
struct ProcDirEntry *pde = CreateProcEntry("mounts", 0, NULL);
|
||||
if (pde == NULL) {
|
||||
PRINT_ERR("creat mounts error!\n");
|
||||
PRINT_ERR("create mounts error!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,905 @@
|
|||
/*
|
||||
* Copyright (c) 2023-2023 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/statfs.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include "stdlib.h"
|
||||
#include "los_printf.h"
|
||||
#include "los_base.h"
|
||||
#include "los_seq_buf.h"
|
||||
#include "internal.h"
|
||||
#include "proc_fs.h"
|
||||
#include "los_task_pri.h"
|
||||
#include "los_process_pri.h"
|
||||
#include "los_process.h"
|
||||
#include "show.h"
|
||||
#include "vnode.h"
|
||||
#include "proc_file.h"
|
||||
#include "user_copy.h"
|
||||
|
||||
#ifdef LOSCFG_KERNEL_PLIMITS
|
||||
#include "los_plimits.h"
|
||||
|
||||
#define PLIMITS_ENTRY_NAME_MAX 64
|
||||
#define PLIMITERSET_DELETE_ALLOC 4
|
||||
#define UNITPTR_NULL ((uintptr_t)(0xFFFFFFFF))
|
||||
#define PLIMIT_FILE_MODE_READ_WRITE (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)
|
||||
#define PLIMIT_FILE_MODE_READ_ONLY (S_IRUSR | S_IRGRP | S_IROTH)
|
||||
#define PLIMIT_FILE_MODE_WRITE_ONLY (S_IWUSR)
|
||||
#define PLIMIT_FILE_MODE_MASK_WRITE (~((mode_t)(S_IWUSR)))
|
||||
#define PLIMIT_FILE_MODE_MASK_NONE (~((mode_t)(0)))
|
||||
#define LOS_MAX_CACHE (UINT64)(0xFFFFFFFFFFFFFFFF)
|
||||
#define PLIMIT_CAT_BUF_SIZE 512
|
||||
#define MAX_PROTECTED_PROCESS_ID 14
|
||||
#define UNITPTR_NULL ((uintptr_t)(0xFFFFFFFF))
|
||||
|
||||
static int ShowPids(struct SeqBuf *seqBuf, VOID *data);
|
||||
static ssize_t PidMigrateFromProcLimiterSet(struct ProcFile *pf, const CHAR *buf, size_t count, loff_t *ppos);
|
||||
static ssize_t PidLimitReadPidLimit(struct SeqBuf *seqBuf, VOID *data);
|
||||
static ssize_t PidLimitReadPriorityLimit(struct SeqBuf *seqBuf, VOID *data);
|
||||
static ssize_t PriorityLimitVariableWrite(struct ProcFile *pf, const CHAR *buf, size_t count, loff_t *ppos);
|
||||
static ssize_t PidsMaxVariableWrite(struct ProcFile *pf, const CHAR *buf, size_t count, loff_t *ppos);
|
||||
static ssize_t ProcLimitsShowLimiters(struct SeqBuf *seqBuf, VOID *data);
|
||||
static int ProcfsPlimitsMkdir(struct ProcDirEntry *parent, const char *dirName, mode_t mode, struct ProcDirEntry **pde);
|
||||
static int ProcfsPlimitsRmdir(struct ProcDirEntry *parent, struct ProcDirEntry *pde, const char *name);
|
||||
#ifdef LOSCFG_KERNEL_MEM_PLIMIT
|
||||
static ssize_t MemLimitReadLimit(struct SeqBuf *seqBuf, VOID *data);
|
||||
static ssize_t MemLimitWriteLimit(struct ProcFile *pf, const CHAR *buf, size_t count, loff_t *ppos);
|
||||
static ssize_t MemLimitStatShow(struct SeqBuf *seqBuf, VOID *data);
|
||||
#endif
|
||||
#ifdef LOSCFG_KERNEL_IPC_PLIMIT
|
||||
static ssize_t IPCLimitReadMqLimit(struct SeqBuf *seqBuf, VOID *data);
|
||||
static ssize_t IPCLimitWriteMqLimit(struct ProcFile *pf, const CHAR *buf, size_t count, loff_t *ppos);
|
||||
static ssize_t IPCLimitReadShmLimit(struct SeqBuf *seqBuf, VOID *data);
|
||||
static ssize_t IPCLimitWriteShmLimit(struct ProcFile *pf, const CHAR *buf, size_t count, loff_t *ppos);
|
||||
static ssize_t IPCLimitShowStat(struct SeqBuf *seqBuf, VOID *data);
|
||||
#endif
|
||||
#ifdef LOSCFG_KERNEL_DEV_PLIMIT
|
||||
static ssize_t DevLimitWriteAllow(struct ProcFile *pf, const CHAR *buf, size_t count, loff_t *ppos);
|
||||
static ssize_t DevLimitWriteDeny(struct ProcFile *pf, const CHAR *buf, size_t count, loff_t *ppos);
|
||||
static ssize_t DevLimitShow(struct SeqBuf *seqBuf, VOID *data);
|
||||
#endif
|
||||
#ifdef LOSCFG_KERNEL_SCHED_PLIMIT
|
||||
static ssize_t SchedLimitReadPeriod(struct SeqBuf *seqBuf, VOID *data);
|
||||
static ssize_t SchedLimitWritePeriod(struct ProcFile *pf, const CHAR *buf, size_t count, loff_t *ppos);
|
||||
static ssize_t SchedLimitReadQuota(struct SeqBuf *seqBuf, VOID *data);
|
||||
static ssize_t SchedLimitWriteQuota(struct ProcFile *pf, const CHAR *buf, size_t count, loff_t *ppos);
|
||||
static ssize_t SchedLimitShow(struct SeqBuf *seqBuf, VOID *data);
|
||||
#endif
|
||||
|
||||
struct PLimitsEntryOpt {
|
||||
int id;
|
||||
char name[PLIMITS_ENTRY_NAME_MAX];
|
||||
mode_t mode;
|
||||
uintptr_t offset;
|
||||
struct ProcFileOperations ops;
|
||||
};
|
||||
|
||||
static struct ProcDirOperations g_procDirOperations = {
|
||||
.mkdir = ProcfsPlimitsMkdir,
|
||||
.rmdir = ProcfsPlimitsRmdir,
|
||||
};
|
||||
|
||||
static struct PLimitsEntryOpt g_plimitsEntryOpts[] = {
|
||||
{
|
||||
.id = PROCESS_LIMITER_COUNT,
|
||||
.name = "plimits.limiters",
|
||||
.mode = PLIMIT_FILE_MODE_READ_ONLY,
|
||||
.offset = UNITPTR_NULL,
|
||||
.ops = {
|
||||
.read = ProcLimitsShowLimiters,
|
||||
}
|
||||
},
|
||||
{
|
||||
.id = PROCESS_LIMITER_COUNT,
|
||||
.name = "plimits.procs",
|
||||
.mode = PLIMIT_FILE_MODE_READ_WRITE,
|
||||
.offset = UNITPTR_NULL,
|
||||
.ops = {
|
||||
.read = ShowPids,
|
||||
.write = PidMigrateFromProcLimiterSet,
|
||||
},
|
||||
},
|
||||
{
|
||||
.id = PROCESS_LIMITER_ID_PIDS,
|
||||
.name = "pids.max",
|
||||
.mode = PLIMIT_FILE_MODE_READ_WRITE,
|
||||
.offset = 0,
|
||||
.ops = {
|
||||
.read = PidLimitReadPidLimit,
|
||||
.write = PidsMaxVariableWrite,
|
||||
},
|
||||
},
|
||||
{
|
||||
.id = PROCESS_LIMITER_ID_PIDS,
|
||||
.name = "pids.priority",
|
||||
.mode = PLIMIT_FILE_MODE_READ_WRITE,
|
||||
.offset = 0,
|
||||
.ops = {
|
||||
.read = PidLimitReadPriorityLimit,
|
||||
.write = PriorityLimitVariableWrite,
|
||||
},
|
||||
},
|
||||
#ifdef LOSCFG_KERNEL_MEM_PLIMIT
|
||||
{
|
||||
.id = PROCESS_LIMITER_ID_MEM,
|
||||
.name = "memory.limit",
|
||||
.mode = PLIMIT_FILE_MODE_READ_WRITE,
|
||||
.offset = 0,
|
||||
.ops = {
|
||||
.read = MemLimitReadLimit,
|
||||
.write = MemLimitWriteLimit,
|
||||
},
|
||||
},
|
||||
{
|
||||
.id = PROCESS_LIMITER_ID_MEM,
|
||||
.name = "memory.stat",
|
||||
.mode = PLIMIT_FILE_MODE_READ_ONLY,
|
||||
.offset = UNITPTR_NULL,
|
||||
.ops = {
|
||||
.read = MemLimitStatShow,
|
||||
}
|
||||
},
|
||||
#endif
|
||||
#ifdef LOSCFG_KERNEL_IPC_PLIMIT
|
||||
{
|
||||
.id = PROCESS_LIMITER_ID_IPC,
|
||||
.name = "ipc.mq_limit",
|
||||
.mode = PLIMIT_FILE_MODE_READ_WRITE,
|
||||
.offset = 0,
|
||||
.ops = {
|
||||
.read = IPCLimitReadMqLimit,
|
||||
.write = IPCLimitWriteMqLimit,
|
||||
}
|
||||
},
|
||||
{
|
||||
.id = PROCESS_LIMITER_ID_IPC,
|
||||
.name = "ipc.shm_limit",
|
||||
.mode = PLIMIT_FILE_MODE_READ_WRITE,
|
||||
.offset = 0,
|
||||
.ops = {
|
||||
.read = IPCLimitReadShmLimit,
|
||||
.write = IPCLimitWriteShmLimit,
|
||||
}
|
||||
},
|
||||
{
|
||||
.id = PROCESS_LIMITER_ID_IPC,
|
||||
.name = "ipc.stat",
|
||||
.mode = PLIMIT_FILE_MODE_READ_ONLY,
|
||||
.offset = UNITPTR_NULL,
|
||||
.ops = {
|
||||
.read = IPCLimitShowStat,
|
||||
}
|
||||
},
|
||||
#endif
|
||||
#ifdef LOSCFG_KERNEL_DEV_PLIMIT
|
||||
{
|
||||
.id = PROCESS_LIMITER_ID_DEV,
|
||||
.name = "devices.allow",
|
||||
.mode = PLIMIT_FILE_MODE_WRITE_ONLY,
|
||||
.offset = UNITPTR_NULL,
|
||||
.ops = {
|
||||
.write = DevLimitWriteAllow,
|
||||
}
|
||||
},
|
||||
{
|
||||
.id = PROCESS_LIMITER_ID_DEV,
|
||||
.name = "devices.deny",
|
||||
.mode = PLIMIT_FILE_MODE_WRITE_ONLY,
|
||||
.offset = UNITPTR_NULL,
|
||||
.ops = {
|
||||
.write = DevLimitWriteDeny,
|
||||
}
|
||||
},
|
||||
{
|
||||
.id = PROCESS_LIMITER_ID_DEV,
|
||||
.name = "devices.list",
|
||||
.mode = PLIMIT_FILE_MODE_READ_ONLY,
|
||||
.offset = 0,
|
||||
.ops = {
|
||||
.read = DevLimitShow,
|
||||
}
|
||||
},
|
||||
#endif
|
||||
#ifdef LOSCFG_KERNEL_SCHED_PLIMIT
|
||||
{
|
||||
.id = PROCESS_LIMITER_ID_SCHED,
|
||||
.name = "sched.period",
|
||||
.mode = PLIMIT_FILE_MODE_READ_WRITE,
|
||||
.offset = 0,
|
||||
.ops = {
|
||||
.read = SchedLimitReadPeriod,
|
||||
.write = SchedLimitWritePeriod,
|
||||
},
|
||||
},
|
||||
{
|
||||
.id = PROCESS_LIMITER_ID_SCHED,
|
||||
.name = "sched.quota",
|
||||
.mode = PLIMIT_FILE_MODE_READ_WRITE,
|
||||
.offset = 0,
|
||||
.ops = {
|
||||
.read = SchedLimitReadQuota,
|
||||
.write = SchedLimitWriteQuota,
|
||||
},
|
||||
},
|
||||
{
|
||||
.id = PROCESS_LIMITER_ID_SCHED,
|
||||
.name = "sched.stat",
|
||||
.mode = PLIMIT_FILE_MODE_READ_ONLY,
|
||||
.offset = UNITPTR_NULL,
|
||||
.ops = {
|
||||
.read = SchedLimitShow,
|
||||
}
|
||||
},
|
||||
#endif
|
||||
};
|
||||
|
||||
static unsigned int MemUserCopy(const char *src, size_t len, char **kbuf)
|
||||
{
|
||||
if (LOS_IsUserAddressRange((VADDR_T)(UINTPTR)src, len)) {
|
||||
char *kernelBuf = LOS_MemAlloc(m_aucSysMem1, len + 1);
|
||||
if (kernelBuf == NULL) {
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
if (LOS_ArchCopyFromUser(kernelBuf, src, len) != 0) {
|
||||
(VOID)LOS_MemFree(m_aucSysMem1, kernelBuf);
|
||||
return EFAULT;
|
||||
}
|
||||
kernelBuf[len] = '\0';
|
||||
*kbuf = kernelBuf;
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline struct ProcDirEntry *GetCurrDirectory(struct ProcDirEntry *dirEntry)
|
||||
{
|
||||
return ((dirEntry == NULL) || S_ISDIR(dirEntry->mode)) ? dirEntry : dirEntry->parent;
|
||||
}
|
||||
|
||||
static inline ProcLimiterSet *GetProcLimiterSetFromDirEntry(struct ProcDirEntry *dirEntry)
|
||||
{
|
||||
struct ProcDirEntry *currDirectory = GetCurrDirectory(dirEntry);
|
||||
return (currDirectory == NULL) || (currDirectory->data == NULL) ? NULL : (ProcLimiterSet *)currDirectory->data;
|
||||
}
|
||||
|
||||
static struct ProcDirEntry *ProcCreateLimiterFiles(struct ProcDirEntry *parentEntry,
|
||||
struct PLimitsEntryOpt *entryOpt,
|
||||
mode_t mode, void *data)
|
||||
{
|
||||
struct ProcDataParm dataParm = {
|
||||
.data = data,
|
||||
.dataType = PROC_DATA_STATIC,
|
||||
};
|
||||
struct ProcDirEntry *plimitFile = ProcCreateData(entryOpt->name, entryOpt->mode & mode, parentEntry,
|
||||
&entryOpt->ops, &dataParm);
|
||||
if (plimitFile == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
return plimitFile;
|
||||
}
|
||||
|
||||
static void ProcLimiterDirEntryInit(struct ProcDirEntry *dirEntry, unsigned mask, mode_t mode)
|
||||
{
|
||||
struct ProcDirEntry *currDir = GetCurrDirectory(dirEntry);
|
||||
if (currDir == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
ProcLimiterSet *plimiterData = (ProcLimiterSet *)currDir->data;
|
||||
if (plimiterData == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int index = 0; index < (sizeof(g_plimitsEntryOpts) / sizeof(struct PLimitsEntryOpt)); index++) {
|
||||
struct PLimitsEntryOpt *entryOpt = &g_plimitsEntryOpts[index];
|
||||
enum ProcLimiterID plimiterType = entryOpt->id;
|
||||
if (!(BIT(plimiterType) & mask)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
void *head = (entryOpt->offset == UNITPTR_NULL) ?
|
||||
plimiterData : (void *)plimiterData->limitsList[plimiterType];
|
||||
struct ProcDirEntry *entry = ProcCreateLimiterFiles(currDir, entryOpt, mode, head);
|
||||
if (entry == NULL) {
|
||||
RemoveProcEntry(currDir->name, NULL);
|
||||
return;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
static ssize_t PLimitsCopyLimits(struct ProcDirEntry *dirEntry)
|
||||
{
|
||||
struct ProcDirEntry *parentPde = dirEntry->parent;
|
||||
ProcLimiterSet *parentPLimits = (ProcLimiterSet *)parentPde->data;
|
||||
if (parentPLimits == NULL) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ProcLimiterSet *newPLimits = OsPLimitsCreate(parentPLimits);
|
||||
if (newPLimits == NULL) {
|
||||
return -ENOMEM;
|
||||
}
|
||||
dirEntry->data = (VOID *)newPLimits;
|
||||
dirEntry->dataType = PROC_DATA_STATIC;
|
||||
dirEntry->procDirOps = parentPde->procDirOps;
|
||||
ProcLimiterDirEntryInit(dirEntry, newPLimits->mask, PLIMIT_FILE_MODE_MASK_NONE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ProcfsPlimitsMkdir(struct ProcDirEntry *parent, const char *dirName, mode_t mode, struct ProcDirEntry **pde)
|
||||
{
|
||||
int ret;
|
||||
if (strcmp(parent->name, "plimits") != 0) {
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
struct ProcDirEntry *plimitDir = ProcCreateData(dirName, S_IFDIR | mode, parent, NULL, NULL);
|
||||
if (plimitDir == NULL) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ret = PLimitsCopyLimits(plimitDir);
|
||||
if (ret != LOS_OK) {
|
||||
ProcFreeEntry(plimitDir);
|
||||
return -ENOSYS;
|
||||
}
|
||||
*pde = plimitDir;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int ProcfsPlimitsRmdir(struct ProcDirEntry *parent, struct ProcDirEntry *pde, const char *name)
|
||||
{
|
||||
if (pde == NULL) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ProcLimiterSet *plimits = GetProcLimiterSetFromDirEntry(pde);
|
||||
pde->data = NULL;
|
||||
|
||||
unsigned ret = OsPLimitsFree(plimits);
|
||||
if (ret != 0) {
|
||||
pde->data = plimits;
|
||||
return -ret;
|
||||
}
|
||||
|
||||
spin_lock(&procfsLock);
|
||||
ProcDetachNode(pde);
|
||||
spin_unlock(&procfsLock);
|
||||
|
||||
RemoveProcEntryTravalsal(pde->subdir);
|
||||
|
||||
ProcFreeEntry(pde);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static ssize_t ProcLimitsShowLimiters(struct SeqBuf *seqBuf, VOID *data)
|
||||
{
|
||||
ProcLimiterSet *plimits = (ProcLimiterSet *)data;
|
||||
UINT32 mask;
|
||||
if (plimits == NULL) {
|
||||
return -LOS_NOK;
|
||||
}
|
||||
mask = plimits->mask;
|
||||
|
||||
if (mask & BIT(PROCESS_LIMITER_ID_PIDS)) {
|
||||
LosBufPrintf(seqBuf, "%s ", "pids");
|
||||
}
|
||||
#ifdef LOSCFG_KERNEL_MEM_PLIMIT
|
||||
if (mask & BIT(PROCESS_LIMITER_ID_MEM)) {
|
||||
LosBufPrintf(seqBuf, "%s ", "memory");
|
||||
}
|
||||
#endif
|
||||
#ifdef LOSCFG_KERNEL_IPC_PLIMIT
|
||||
if (mask & BIT(PROCESS_LIMITER_ID_IPC)) {
|
||||
LosBufPrintf(seqBuf, "%s ", "ipc");
|
||||
}
|
||||
#endif
|
||||
#ifdef LOSCFG_KERNEL_DEV_PLIMIT
|
||||
if (mask & BIT(PROCESS_LIMITER_ID_DEV)) {
|
||||
LosBufPrintf(seqBuf, "%s ", "devices");
|
||||
}
|
||||
#endif
|
||||
#ifdef LOSCFG_KERNEL_SCHED_PLIMIT
|
||||
if (mask & BIT(PROCESS_LIMITER_ID_SCHED)) {
|
||||
LosBufPrintf(seqBuf, "%s ", "sched");
|
||||
}
|
||||
#endif
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
#define PLIMITS_PID_STR_LENGTH 4
|
||||
static int ShowPids(struct SeqBuf *seqBuf, VOID *data)
|
||||
{
|
||||
unsigned int size, pidMax;
|
||||
if (data == NULL) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
const ProcLimiterSet *plimits = (const ProcLimiterSet *)data;
|
||||
pidMax = LOS_GetSystemProcessMaximum();
|
||||
size = pidMax * sizeof(unsigned int);
|
||||
unsigned int *pids = (unsigned int *)LOS_MemAlloc(m_aucSysMem1, size);
|
||||
if (pids == NULL) {
|
||||
return -ENOMEM;
|
||||
}
|
||||
(void)memset_s(pids, size, 0, size);
|
||||
|
||||
unsigned int ret = OsPLimitsPidsGet(plimits, pids, size);
|
||||
if (ret != LOS_OK) {
|
||||
(VOID)LOS_MemFree(m_aucSysMem1, pids);
|
||||
return -ret;
|
||||
}
|
||||
|
||||
(void)LosBufPrintf(seqBuf, "\n");
|
||||
for (unsigned int index = 0; index < pidMax; index++) {
|
||||
if (pids[index] == 0) {
|
||||
continue;
|
||||
}
|
||||
(void)LosBufPrintf(seqBuf, "%u ", index);
|
||||
}
|
||||
(void)LOS_MemFree(m_aucSysMem1, pids);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long long int GetPidLimitValue(struct ProcFile *pf, const CHAR *buf, size_t count)
|
||||
{
|
||||
long long int value;
|
||||
char *kbuf = NULL;
|
||||
|
||||
if ((pf == NULL) || (pf->pPDE == NULL) || (buf == NULL) || (count <= 0)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
unsigned ret = MemUserCopy(buf, count, &kbuf);
|
||||
if (ret != 0) {
|
||||
return -ret;
|
||||
} else if ((ret == 0) && (kbuf != NULL)) {
|
||||
buf = (const char *)kbuf;
|
||||
}
|
||||
|
||||
if (strspn(buf, "0123456789") != count) {
|
||||
(void)LOS_MemFree(m_aucSysMem1, kbuf);
|
||||
return -EINVAL;
|
||||
}
|
||||
value = strtoll(buf, NULL, 10); /* 10: decimal */
|
||||
(void)LOS_MemFree(m_aucSysMem1, kbuf);
|
||||
return value;
|
||||
}
|
||||
|
||||
static ssize_t PidMigrateFromProcLimiterSet(struct ProcFile *pf, const CHAR *buf, size_t count, loff_t *ppos)
|
||||
{
|
||||
(VOID)ppos;
|
||||
unsigned ret;
|
||||
|
||||
long long int pid = GetPidLimitValue(pf, buf, count);
|
||||
if (pid < 0) {
|
||||
return pid;
|
||||
}
|
||||
|
||||
ProcLimiterSet *plimits = GetCurrDirectory(pf->pPDE)->data;
|
||||
ret = OsPLimitsAddPid(plimits, (unsigned int)pid);
|
||||
if (ret != LOS_OK) {
|
||||
return -ret;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t PidLimitReadPidLimit(struct SeqBuf *seqBuf, VOID *data)
|
||||
{
|
||||
PidLimit *pidLimit = (PidLimit *)data;
|
||||
if ((seqBuf == NULL) || (pidLimit == NULL)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
(void)LosBufPrintf(seqBuf, "%u\n", pidLimit->pidLimit);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static ssize_t PidLimitReadPriorityLimit(struct SeqBuf *seqBuf, VOID *data)
|
||||
{
|
||||
PidLimit *pidLimit = (PidLimit *)data;
|
||||
if ((seqBuf == NULL) || (pidLimit == NULL)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
(void)LosBufPrintf(seqBuf, "%u\n", pidLimit->priorityLimit);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static ssize_t PriorityLimitVariableWrite(struct ProcFile *pf, const CHAR *buf, size_t count, loff_t *ppos)
|
||||
{
|
||||
(void)ppos;
|
||||
long long int value = GetPidLimitValue(pf, buf, count);
|
||||
if (value < 0) {
|
||||
return value;
|
||||
}
|
||||
|
||||
PidLimit *pidLimit = (PidLimit *)pf->pPDE->data;
|
||||
unsigned ret = PidLimitSetPriorityLimit(pidLimit, (unsigned)value);
|
||||
if (ret != LOS_OK) {
|
||||
return -ret;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t PidsMaxVariableWrite(struct ProcFile *pf, const CHAR *buf, size_t count, loff_t *ppos)
|
||||
{
|
||||
(void)ppos;
|
||||
long long int value = GetPidLimitValue(pf, buf, count);
|
||||
if (value < 0) {
|
||||
return value;
|
||||
}
|
||||
|
||||
PidLimit *pidLimit = (PidLimit *)pf->pPDE->data;
|
||||
unsigned ret = PidLimitSetPidLimit(pidLimit, (unsigned)value);
|
||||
if (ret != LOS_OK) {
|
||||
return -ret;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
#ifdef LOSCFG_KERNEL_MEM_PLIMIT
|
||||
static ssize_t MemLimitReadLimit(struct SeqBuf *seqBuf, VOID *data)
|
||||
{
|
||||
ProcMemLimiter *memLimit = (ProcMemLimiter *)data;
|
||||
if ((seqBuf == NULL) || (memLimit == NULL)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
(void)LosBufPrintf(seqBuf, "%llu\n", memLimit->limit);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static ssize_t MemLimitWriteLimit(struct ProcFile *pf, const CHAR *buf, size_t count, loff_t *ppos)
|
||||
{
|
||||
(void)ppos;
|
||||
long long int value = GetPidLimitValue(pf, buf, count);
|
||||
if ((value < 0) || (value > (long long int)OS_NULL_INT)) {
|
||||
return value;
|
||||
}
|
||||
|
||||
ProcMemLimiter *memLimit = (ProcMemLimiter *)pf->pPDE->data;
|
||||
unsigned ret = OsMemLimitSetMemLimit(memLimit, (unsigned long long)value);
|
||||
if (ret != LOS_OK) {
|
||||
return -ret;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t MemLimitStatShow(struct SeqBuf *seqBuf, VOID *data)
|
||||
{
|
||||
ProcLimiterSet *plimits = (ProcLimiterSet *)data;
|
||||
if ((seqBuf == NULL) || (plimits == NULL)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
UINT32 pidMax = LOS_GetSystemProcessMaximum();
|
||||
UINT32 size = sizeof(ProcMemLimiter) + pidMax * sizeof(unsigned long long);
|
||||
unsigned long long *usage = (unsigned long long *)LOS_MemAlloc(m_aucSysMem1, size);
|
||||
if (usage == NULL) {
|
||||
return -ENOMEM;
|
||||
}
|
||||
(void)memset_s(usage, size, 0, size);
|
||||
|
||||
unsigned int ret = OsPLimitsMemUsageGet(plimits, usage, size);
|
||||
if (ret != LOS_OK) {
|
||||
(VOID)LOS_MemFree(m_aucSysMem1, usage);
|
||||
return -ret;
|
||||
}
|
||||
|
||||
ProcMemLimiter *memLimit = (ProcMemLimiter *)usage;
|
||||
unsigned long long *memUsage = (unsigned long long *)((uintptr_t)usage + sizeof(ProcMemLimiter));
|
||||
(void)LosBufPrintf(seqBuf, "\nMem used: %llu\n", memLimit->usage);
|
||||
(void)LosBufPrintf(seqBuf, "Mem peak: %llu\n", memLimit->peak);
|
||||
(void)LosBufPrintf(seqBuf, "Mem failed count: %u\n", memLimit->failcnt);
|
||||
|
||||
for (unsigned int index = 0; index < pidMax; index++) {
|
||||
if (memUsage[index] == 0) {
|
||||
continue;
|
||||
}
|
||||
(void)LosBufPrintf(seqBuf, "PID: %u mem used: %llu \n", index, memUsage[index]);
|
||||
}
|
||||
(void)LOS_MemFree(m_aucSysMem1, usage);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef LOSCFG_KERNEL_IPC_PLIMIT
|
||||
static ssize_t IPCLimitReadMqLimit(struct SeqBuf *seqBuf, VOID *data)
|
||||
{
|
||||
ProcIPCLimit *ipcLimit = (ProcIPCLimit *)data;
|
||||
if ((seqBuf == NULL) || (ipcLimit == NULL)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
(void)LosBufPrintf(seqBuf, "%u\n", ipcLimit->mqCountLimit);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static ssize_t IPCLimitWriteMqLimit(struct ProcFile *pf, const CHAR *buf, size_t count, loff_t *ppos)
|
||||
{
|
||||
(void)ppos;
|
||||
long long int value = GetPidLimitValue(pf, buf, count);
|
||||
if (value < 0) {
|
||||
return value;
|
||||
}
|
||||
|
||||
ProcIPCLimit *ipcLimit = (ProcIPCLimit *)pf->pPDE->data;
|
||||
unsigned ret = OsIPCLimitSetMqLimit(ipcLimit, (unsigned long long)value);
|
||||
if (ret != LOS_OK) {
|
||||
return -ret;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t IPCLimitReadShmLimit(struct SeqBuf *seqBuf, VOID *data)
|
||||
{
|
||||
ProcIPCLimit *ipcLimit = (ProcIPCLimit *)data;
|
||||
if ((seqBuf == NULL) || (ipcLimit == NULL)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
(void)LosBufPrintf(seqBuf, "%u\n", ipcLimit->shmSizeLimit);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static ssize_t IPCLimitWriteShmLimit(struct ProcFile *pf, const CHAR *buf, size_t count, loff_t *ppos)
|
||||
{
|
||||
(void)ppos;
|
||||
long long int value = GetPidLimitValue(pf, buf, count);
|
||||
if ((value < 0) || (value > (long long int)OS_NULL_INT)) {
|
||||
return value;
|
||||
}
|
||||
|
||||
ProcIPCLimit *ipcLimit = (ProcIPCLimit *)pf->pPDE->data;
|
||||
unsigned ret = OsIPCLimitSetShmLimit(ipcLimit, (unsigned long long)value);
|
||||
if (ret != LOS_OK) {
|
||||
return -ret;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t IPCLimitShowStat(struct SeqBuf *seqBuf, VOID *data)
|
||||
{
|
||||
ProcLimiterSet *plimits = (ProcLimiterSet *)data;
|
||||
if ((seqBuf == NULL) || (plimits == NULL)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
unsigned int size = sizeof(ProcIPCLimit);
|
||||
ProcIPCLimit *newIPCLimit = (ProcIPCLimit *)LOS_MemAlloc(m_aucSysMem1, size);
|
||||
if (newIPCLimit == NULL) {
|
||||
return -ENOMEM;
|
||||
}
|
||||
(void)memset_s(newIPCLimit, size, 0, size);
|
||||
|
||||
unsigned int ret = OsPLimitsIPCStatGet(plimits, newIPCLimit, size);
|
||||
if (ret != LOS_OK) {
|
||||
(VOID)LOS_MemFree(m_aucSysMem1, newIPCLimit);
|
||||
return -ret;
|
||||
}
|
||||
|
||||
(void)LosBufPrintf(seqBuf, "mq count: %u\n", newIPCLimit->mqCount);
|
||||
(void)LosBufPrintf(seqBuf, "mq failed count: %u\n", newIPCLimit->mqFailedCount);
|
||||
(void)LosBufPrintf(seqBuf, "shm size: %u\n", newIPCLimit->shmSize);
|
||||
(void)LosBufPrintf(seqBuf, "shm failed count: %u\n", newIPCLimit->shmFailedCount);
|
||||
(void)LOS_MemFree(m_aucSysMem1, newIPCLimit);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef LOSCFG_KERNEL_DEV_PLIMIT
|
||||
static ssize_t DevLimitWriteAllow(struct ProcFile *pf, const CHAR *buf, size_t count, loff_t *ppos)
|
||||
{
|
||||
(void)ppos;
|
||||
char *kbuf = NULL;
|
||||
|
||||
if ((pf == NULL) || (pf->pPDE == NULL) || (buf == NULL) || (count <= 0)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
unsigned ret = MemUserCopy(buf, count, &kbuf);
|
||||
if (ret != 0) {
|
||||
return -ret;
|
||||
} else if ((ret == 0) && (kbuf != NULL)) {
|
||||
buf = (const char *)kbuf;
|
||||
}
|
||||
|
||||
ProcLimiterSet *plimit = (ProcLimiterSet *)pf->pPDE->data;
|
||||
ret = OsDevLimitWriteAllow(plimit, buf, count);
|
||||
(VOID)LOS_MemFree(m_aucSysMem1, kbuf);
|
||||
if (ret != LOS_OK) {
|
||||
return -ret;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t DevLimitWriteDeny(struct ProcFile *pf, const CHAR *buf, size_t count, loff_t *ppos)
|
||||
{
|
||||
(void)ppos;
|
||||
char *kbuf = NULL;
|
||||
|
||||
if ((pf == NULL) || (pf->pPDE == NULL) || (buf == NULL) || (count <= 0)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
unsigned ret = MemUserCopy(buf, count, &kbuf);
|
||||
if (ret != 0) {
|
||||
return -ret;
|
||||
} else if ((ret == 0) && (kbuf != NULL)) {
|
||||
buf = (const char *)kbuf;
|
||||
}
|
||||
|
||||
ProcLimiterSet *plimit = (ProcLimiterSet *)pf->pPDE->data;
|
||||
ret = OsDevLimitWriteDeny(plimit, buf, count);
|
||||
(VOID)LOS_MemFree(m_aucSysMem1, kbuf);
|
||||
if (ret != LOS_OK) {
|
||||
return -ret;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t DevLimitShow(struct SeqBuf *seqBuf, VOID *data)
|
||||
{
|
||||
ProcDevLimit *devLimit = (ProcDevLimit *)data;
|
||||
if ((seqBuf == NULL) || (devLimit == NULL)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
unsigned ret = OsDevLimitShow(devLimit, seqBuf);
|
||||
if (ret != LOS_OK) {
|
||||
return -ret;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef LOSCFG_KERNEL_SCHED_PLIMIT
|
||||
static ssize_t SchedLimitReadPeriod(struct SeqBuf *seqBuf, VOID *data)
|
||||
{
|
||||
ProcSchedLimiter *schedLimit = (ProcSchedLimiter *)data;
|
||||
if ((seqBuf == NULL) || (schedLimit == NULL)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
(void)LosBufPrintf(seqBuf, "%lld\n", schedLimit->period);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static ssize_t SchedLimitWritePeriod(struct ProcFile *pf, const CHAR *buf, size_t count, loff_t *ppos)
|
||||
{
|
||||
(void)ppos;
|
||||
long long int value = GetPidLimitValue(pf, buf, count);
|
||||
if (value < 0) {
|
||||
return value;
|
||||
}
|
||||
|
||||
ProcSchedLimiter *schedLimit = (ProcSchedLimiter *)pf->pPDE->data;
|
||||
unsigned ret = OsSchedLimitSetPeriod(schedLimit, (unsigned long long)value);
|
||||
if (ret != LOS_OK) {
|
||||
return -ret;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t SchedLimitReadQuota(struct SeqBuf *seqBuf, VOID *data)
|
||||
{
|
||||
ProcSchedLimiter *schedLimit = (ProcSchedLimiter *)data;
|
||||
if ((seqBuf == NULL) || (schedLimit == NULL)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
(void)LosBufPrintf(seqBuf, "%lld\n", schedLimit->quota);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static ssize_t SchedLimitWriteQuota(struct ProcFile *pf, const CHAR *buf, size_t count, loff_t *ppos)
|
||||
{
|
||||
(void)ppos;
|
||||
long long int value = GetPidLimitValue(pf, buf, count);
|
||||
if (value < 0) {
|
||||
return value;
|
||||
}
|
||||
|
||||
ProcSchedLimiter *schedLimit = (ProcSchedLimiter *)pf->pPDE->data;
|
||||
unsigned ret = OsSchedLimitSetQuota(schedLimit, (unsigned long long)value);
|
||||
if (ret != LOS_OK) {
|
||||
return -ret;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
#define TIME_CYCLE_TO_US(time) ((((UINT64)time) * OS_NS_PER_CYCLE) / OS_SYS_NS_PER_US)
|
||||
#define SCHED_DEFAULT_VALUE (0x101010101010101)
|
||||
|
||||
static ssize_t SchedLimitShow(struct SeqBuf *seqBuf, VOID *data)
|
||||
{
|
||||
ProcLimiterSet *plimits = (ProcLimiterSet *)data;
|
||||
if ((seqBuf == NULL) || (plimits == NULL)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
UINT32 pidMax = LOS_GetSystemProcessMaximum();
|
||||
UINT32 size = pidMax * sizeof(unsigned long long);
|
||||
unsigned long long *usage = (unsigned long long *)LOS_MemAlloc(m_aucSysMem1, size);
|
||||
if (usage == NULL) {
|
||||
return -ENOMEM;
|
||||
}
|
||||
(void)memset_s(usage, size, 1, size);
|
||||
|
||||
unsigned int ret = OsPLimitsSchedUsageGet(plimits, usage, size);
|
||||
if (ret != LOS_OK) {
|
||||
(VOID)LOS_MemFree(m_aucSysMem1, usage);
|
||||
return -ret;
|
||||
}
|
||||
|
||||
for (unsigned int index = 0; index < pidMax; index++) {
|
||||
if (usage[index] == SCHED_DEFAULT_VALUE) {
|
||||
continue;
|
||||
}
|
||||
(void)LosBufPrintf(seqBuf, "PID: %u runTime: %llu us\n", index, TIME_CYCLE_TO_US(usage[index]));
|
||||
}
|
||||
(void)LOS_MemFree(m_aucSysMem1, usage);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#define PROC_PLIMITS_MODE (S_IFDIR | S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)
|
||||
void ProcLimitsInit(void)
|
||||
{
|
||||
struct ProcDirEntry *parentPDE = CreateProcEntry("plimits", PROC_PLIMITS_MODE, NULL);
|
||||
if (parentPDE == NULL) {
|
||||
return;
|
||||
}
|
||||
ProcLimiterSet *plimits = OsRootPLimitsGet();
|
||||
parentPDE->procDirOps = &g_procDirOperations;
|
||||
parentPDE->data = (VOID *)plimits;
|
||||
parentPDE->dataType = PROC_DATA_STATIC;
|
||||
plimits->mask = BIT(PROCESS_LIMITER_ID_PIDS) | BIT(PROCESS_LIMITER_COUNT);
|
||||
#ifdef LOSCFG_KERNEL_MEM_PLIMIT
|
||||
plimits->mask |= BIT(PROCESS_LIMITER_ID_MEM);
|
||||
#endif
|
||||
#ifdef LOSCFG_KERNEL_IPC_PLIMIT
|
||||
plimits->mask |= BIT(PROCESS_LIMITER_ID_IPC);
|
||||
#endif
|
||||
#ifdef LOSCFG_KERNEL_DEV_PLIMIT
|
||||
plimits->mask |= BIT(PROCESS_LIMITER_ID_DEV);
|
||||
#endif
|
||||
#ifdef LOSCFG_KERNEL_SCHED_PLIMIT
|
||||
plimits->mask |= BIT(PROCESS_LIMITER_ID_SCHED);
|
||||
#endif
|
||||
ProcLimiterDirEntryInit(parentPDE, plimits->mask, PLIMIT_FILE_MODE_MASK_WRITE);
|
||||
return;
|
||||
}
|
||||
#endif
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2023 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
|
@ -68,6 +68,16 @@ void ProcFsInit(void)
|
|||
#ifdef LOSCFG_KERNEL_PM
|
||||
ProcPmInit();
|
||||
#endif
|
||||
#ifdef LOSCFG_PROC_PROCESS_DIR
|
||||
ProcSysMemInfoInit();
|
||||
ProcFileSysInit();
|
||||
#endif
|
||||
#ifdef LOSCFG_KERNEL_PLIMITS
|
||||
ProcLimitsInit();
|
||||
#endif
|
||||
#ifdef LOSCFG_KERNEL_CONTAINER
|
||||
ProcSysUserInit();
|
||||
#endif
|
||||
}
|
||||
|
||||
LOS_MODULE_INIT(ProcFsInit, LOS_INIT_LEVEL_KMOD_EXTENDED);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
|
@ -45,7 +45,7 @@
|
|||
static struct VnodeOps g_procfsVops;
|
||||
static struct file_operations_vfs g_procfsFops;
|
||||
|
||||
static struct ProcDirEntry *VnodeToEntry(struct Vnode *node)
|
||||
struct ProcDirEntry *VnodeToEntry(struct Vnode *node)
|
||||
{
|
||||
return (struct ProcDirEntry *)(node->data);
|
||||
}
|
||||
|
@ -125,10 +125,16 @@ int VfsProcfsRead(struct file *filep, char *buffer, size_t buflen)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
VnodeHold();
|
||||
entry = VnodeToEntry(filep->f_vnode);
|
||||
if (entry == NULL) {
|
||||
VnodeDrop();
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
size = (ssize_t)ReadProcFile(entry, (void *)buffer, buflen);
|
||||
filep->f_pos = entry->pf->fPos;
|
||||
|
||||
VnodeDrop();
|
||||
return size;
|
||||
}
|
||||
|
||||
|
@ -140,10 +146,16 @@ int VfsProcfsWrite(struct file *filep, const char *buffer, size_t buflen)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
VnodeHold();
|
||||
entry = VnodeToEntry(filep->f_vnode);
|
||||
if (entry == NULL) {
|
||||
VnodeDrop();
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
size = (ssize_t)WriteProcFile(entry, (void *)buffer, buflen);
|
||||
filep->f_pos = entry->pf->fPos;
|
||||
|
||||
VnodeDrop();
|
||||
return size;
|
||||
}
|
||||
|
||||
|
@ -156,6 +168,7 @@ int VfsProcfsLookup(struct Vnode *parent, const char *name, int len, struct Vnod
|
|||
if (entry == NULL) {
|
||||
return -ENODATA;
|
||||
}
|
||||
|
||||
entry = entry->subdir;
|
||||
while (1) {
|
||||
if (entry == NULL) {
|
||||
|
@ -214,21 +227,70 @@ int VfsProcfsUnmount(void *handle, struct Vnode **blkdriver)
|
|||
|
||||
int VfsProcfsStat(struct Vnode *node, struct stat *buf)
|
||||
{
|
||||
VnodeHold();
|
||||
struct ProcDirEntry *entry = VnodeToEntry(node);
|
||||
|
||||
if (entry == NULL) {
|
||||
VnodeDrop();
|
||||
return -EPERM;
|
||||
}
|
||||
(void)memset_s(buf, sizeof(struct stat), 0, sizeof(struct stat));
|
||||
buf->st_mode = entry->mode;
|
||||
|
||||
VnodeDrop();
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
#ifdef LOSCFG_KERNEL_PLIMITS
|
||||
int VfsProcfsMkdir(struct Vnode *parent, const char *dirName, mode_t mode, struct Vnode **vnode)
|
||||
{
|
||||
struct ProcDirEntry *parentEntry = VnodeToEntry(parent);
|
||||
struct ProcDirEntry *pde = NULL;
|
||||
if ((parentEntry->procDirOps == NULL) || (parentEntry->procDirOps->mkdir == NULL)) {
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
int ret = parentEntry->procDirOps->mkdir(parentEntry, dirName, mode, &pde);
|
||||
if ((ret < 0) || (pde == NULL)) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
*vnode = EntryToVnode(pde);
|
||||
(*vnode)->vop = parent->vop;
|
||||
(*vnode)->parent = parent;
|
||||
(*vnode)->originMount = parent->originMount;
|
||||
if ((*vnode)->type == VNODE_TYPE_DIR) {
|
||||
(*vnode)->mode = S_IFDIR | PROCFS_DEFAULT_MODE;
|
||||
} else {
|
||||
(*vnode)->mode = S_IFREG | PROCFS_DEFAULT_MODE;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int VfsProcfsRmdir(struct Vnode *parent, struct Vnode *vnode, const char *dirName)
|
||||
{
|
||||
if (parent == NULL) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
struct ProcDirEntry *parentEntry = VnodeToEntry(parent);
|
||||
if ((parentEntry->procDirOps == NULL) || (parentEntry->procDirOps->rmdir == NULL)) {
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
struct ProcDirEntry *dirEntry = VnodeToEntry(vnode);
|
||||
int ret = parentEntry->procDirOps->rmdir(parentEntry, dirEntry, dirName);
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
vnode->data = NULL;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
int VfsProcfsReaddir(struct Vnode *node, struct fs_dirent_s *dir)
|
||||
{
|
||||
int result;
|
||||
char *buffer = NULL;
|
||||
int buflen = NAME_MAX;
|
||||
unsigned int min_size;
|
||||
unsigned int dst_name_size;
|
||||
unsigned int minSize, dstNameSize;
|
||||
struct ProcDirEntry *pde = NULL;
|
||||
int i = 0;
|
||||
|
||||
|
@ -238,28 +300,35 @@ int VfsProcfsReaddir(struct Vnode *node, struct fs_dirent_s *dir)
|
|||
if (node->type != VNODE_TYPE_DIR) {
|
||||
return -ENOTDIR;
|
||||
}
|
||||
VnodeHold();
|
||||
pde = VnodeToEntry(node);
|
||||
if (pde == NULL) {
|
||||
VnodeDrop();
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
while (i < dir->read_cnt) {
|
||||
buffer = (char *)zalloc(sizeof(char) * NAME_MAX);
|
||||
if (buffer == NULL) {
|
||||
VnodeDrop();
|
||||
PRINT_ERR("malloc failed\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
result = ReadProcFile(pde, (void *)buffer, buflen);
|
||||
result = ReadProcFile(pde, (void *)buffer, NAME_MAX);
|
||||
if (result != ENOERR) {
|
||||
free(buffer);
|
||||
break;
|
||||
}
|
||||
dst_name_size = sizeof(dir->fd_dir[i].d_name);
|
||||
min_size = (dst_name_size < NAME_MAX) ? dst_name_size : NAME_MAX;
|
||||
result = strncpy_s(dir->fd_dir[i].d_name, dst_name_size, buffer, min_size);
|
||||
dstNameSize = sizeof(dir->fd_dir[i].d_name);
|
||||
minSize = (dstNameSize < NAME_MAX) ? dstNameSize : NAME_MAX;
|
||||
result = strncpy_s(dir->fd_dir[i].d_name, dstNameSize, buffer, minSize);
|
||||
if (result != EOK) {
|
||||
VnodeDrop();
|
||||
free(buffer);
|
||||
return -ENAMETOOLONG;
|
||||
}
|
||||
dir->fd_dir[i].d_name[dst_name_size - 1] = '\0';
|
||||
dir->fd_dir[i].d_name[dstNameSize - 1] = '\0';
|
||||
dir->fd_position++;
|
||||
dir->fd_dir[i].d_off = dir->fd_position;
|
||||
dir->fd_dir[i].d_reclen = (uint16_t)sizeof(struct dirent);
|
||||
|
@ -267,19 +336,26 @@ int VfsProcfsReaddir(struct Vnode *node, struct fs_dirent_s *dir)
|
|||
i++;
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
VnodeDrop();
|
||||
return i;
|
||||
}
|
||||
|
||||
int VfsProcfsOpendir(struct Vnode *node, struct fs_dirent_s *dir)
|
||||
{
|
||||
VnodeHold();
|
||||
struct ProcDirEntry *pde = VnodeToEntry(node);
|
||||
if (pde == NULL) {
|
||||
VnodeDrop();
|
||||
return -EINVAL;
|
||||
}
|
||||
pde->pdirCurrent = pde->subdir;
|
||||
pde->pf->fPos = 0;
|
||||
|
||||
pde->pdirCurrent = pde->subdir;
|
||||
if (pde->pf == NULL) {
|
||||
VnodeDrop();
|
||||
return -EINVAL;
|
||||
}
|
||||
pde->pf->fPos = 0;
|
||||
VnodeDrop();
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
|
@ -288,8 +364,14 @@ int VfsProcfsOpen(struct file *filep)
|
|||
if (filep == NULL) {
|
||||
return -EINVAL;
|
||||
}
|
||||
VnodeHold();
|
||||
struct Vnode *node = filep->f_vnode;
|
||||
struct ProcDirEntry *pde = VnodeToEntry(node);
|
||||
if (pde == NULL) {
|
||||
VnodeDrop();
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
if (ProcOpen(pde->pf) != OK) {
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
@ -301,6 +383,7 @@ int VfsProcfsOpen(struct file *filep)
|
|||
pde->pf->fPos = 0;
|
||||
}
|
||||
filep->f_priv = (void *)pde;
|
||||
VnodeDrop();
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
|
@ -310,15 +393,22 @@ int VfsProcfsClose(struct file *filep)
|
|||
if (filep == NULL) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
VnodeHold();
|
||||
struct Vnode *node = filep->f_vnode;
|
||||
struct ProcDirEntry *pde = VnodeToEntry(node);
|
||||
if ((pde == NULL) || (pde->pf == NULL)) {
|
||||
VnodeDrop();
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
pde->pf->fPos = 0;
|
||||
if ((pde->procFileOps != NULL) && (pde->procFileOps->release != NULL)) {
|
||||
result = pde->procFileOps->release((struct Vnode *)pde, pde->pf);
|
||||
}
|
||||
LosBufRelease(pde->pf->sbuf);
|
||||
pde->pf->sbuf = NULL;
|
||||
|
||||
VnodeDrop();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -335,6 +425,24 @@ int VfsProcfsClosedir(struct Vnode *vp, struct fs_dirent_s *dir)
|
|||
return LOS_OK;
|
||||
}
|
||||
|
||||
ssize_t VfsProcfsReadlink(struct Vnode *vnode, char *buffer, size_t bufLen)
|
||||
{
|
||||
int result = -EINVAL;
|
||||
if (vnode == NULL) {
|
||||
return result;
|
||||
}
|
||||
|
||||
struct ProcDirEntry *pde = VnodeToEntry(vnode);
|
||||
if (pde == NULL) {
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
if ((pde->procFileOps != NULL) && (pde->procFileOps->readLink != NULL)) {
|
||||
result = pde->procFileOps->readLink(pde, buffer, bufLen);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
const struct MountOps procfs_operations = {
|
||||
.Mount = VfsProcfsMount,
|
||||
.Unmount = NULL,
|
||||
|
@ -347,7 +455,12 @@ static struct VnodeOps g_procfsVops = {
|
|||
.Readdir = VfsProcfsReaddir,
|
||||
.Opendir = VfsProcfsOpendir,
|
||||
.Closedir = VfsProcfsClosedir,
|
||||
.Truncate = VfsProcfsTruncate
|
||||
.Truncate = VfsProcfsTruncate,
|
||||
.Readlink = VfsProcfsReadlink,
|
||||
#ifdef LOSCFG_KERNEL_PLIMITS
|
||||
.Mkdir = VfsProcfsMkdir,
|
||||
.Rmdir = VfsProcfsRmdir,
|
||||
#endif
|
||||
};
|
||||
|
||||
static struct file_operations_vfs g_procfsFops = {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2023 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
|
@ -32,7 +32,666 @@
|
|||
#include <sys/statfs.h>
|
||||
#include <sys/mount.h>
|
||||
#include "proc_fs.h"
|
||||
#include "internal.h"
|
||||
#include "los_process_pri.h"
|
||||
#include "user_copy.h"
|
||||
#include "los_memory.h"
|
||||
|
||||
#ifdef LOSCFG_PROC_PROCESS_DIR
|
||||
#include "los_vm_dump.h"
|
||||
|
||||
typedef enum {
|
||||
PROC_PID,
|
||||
PROC_PID_MEM,
|
||||
#ifdef LOSCFG_KERNEL_CPUP
|
||||
PROC_PID_CPUP,
|
||||
#endif
|
||||
#ifdef LOSCFG_USER_CONTAINER
|
||||
PROC_UID_MAP,
|
||||
PROC_GID_MAP,
|
||||
#endif
|
||||
PROC_P_TYPE_MAX,
|
||||
} ProcessDataType;
|
||||
|
||||
struct ProcProcess {
|
||||
char *name;
|
||||
mode_t mode;
|
||||
int type;
|
||||
const struct ProcFileOperations *fileOps;
|
||||
};
|
||||
|
||||
struct ProcessData {
|
||||
uintptr_t process;
|
||||
unsigned int type;
|
||||
};
|
||||
|
||||
static LosProcessCB *ProcGetProcessCB(struct ProcessData *data)
|
||||
{
|
||||
if (data->process != 0) {
|
||||
return (LosProcessCB *)data->process;
|
||||
}
|
||||
return OsCurrProcessGet();
|
||||
}
|
||||
|
||||
#define PROC_PID_PRIVILEGE 7
|
||||
#define PROC_PID_DIR_LEN 100
|
||||
#ifdef LOSCFG_KERNEL_CONTAINER
|
||||
static ssize_t ProcessContainerLink(unsigned int containerID, ContainerType type, char *buffer, size_t bufLen)
|
||||
{
|
||||
ssize_t count = -1;
|
||||
if ((type == PID_CONTAINER) || (type == PID_CHILD_CONTAINER)) {
|
||||
count = snprintf_s(buffer, bufLen, bufLen - 1, "'pid:[%u]'", containerID);
|
||||
} else if (type == UTS_CONTAINER) {
|
||||
count = snprintf_s(buffer, bufLen, bufLen - 1, "'uts:[%u]'", containerID);
|
||||
} else if (type == MNT_CONTAINER) {
|
||||
count = snprintf_s(buffer, bufLen, bufLen - 1, "'mnt:[%u]'", containerID);
|
||||
} else if (type == IPC_CONTAINER) {
|
||||
count = snprintf_s(buffer, bufLen, bufLen - 1, "'ipc:[%u]'", containerID);
|
||||
} else if ((type == TIME_CONTAINER) || (type == TIME_CHILD_CONTAINER)) {
|
||||
count = snprintf_s(buffer, bufLen, bufLen - 1, "'time:[%u]'", containerID);
|
||||
} else if (type == USER_CONTAINER) {
|
||||
count = snprintf_s(buffer, bufLen, bufLen - 1, "'user:[%u]'", containerID);
|
||||
} else if (type == NET_CONTAINER) {
|
||||
count = snprintf_s(buffer, bufLen, bufLen - 1, "'net:[%u]'", containerID);
|
||||
}
|
||||
|
||||
if (count < 0) {
|
||||
return -EBADF;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t ProcessContainerReadLink(struct ProcDirEntry *entry, char *buffer, size_t bufLen)
|
||||
{
|
||||
char *freeBuf = NULL;
|
||||
char *buf = buffer;
|
||||
ssize_t count;
|
||||
unsigned int intSave;
|
||||
if (entry == NULL) {
|
||||
return -EINVAL;
|
||||
}
|
||||
struct ProcessData *data = (struct ProcessData *)entry->data;
|
||||
if (data == NULL) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (LOS_IsUserAddressRange((VADDR_T)(UINTPTR)buffer, bufLen)) {
|
||||
buf = LOS_MemAlloc(m_aucSysMem1, bufLen);
|
||||
if (buf == NULL) {
|
||||
return -ENOMEM;
|
||||
}
|
||||
(void)memset_s(buf, bufLen, 0, bufLen);
|
||||
freeBuf = buf;
|
||||
}
|
||||
|
||||
LosProcessCB *processCB = ProcGetProcessCB(data);
|
||||
SCHEDULER_LOCK(intSave);
|
||||
UINT32 containerID = OsGetContainerID(processCB, (ContainerType)data->type);
|
||||
SCHEDULER_UNLOCK(intSave);
|
||||
if (containerID != OS_INVALID_VALUE) {
|
||||
count = ProcessContainerLink(containerID, (ContainerType)data->type, buf, bufLen);
|
||||
} else {
|
||||
count = strlen("(unknown)");
|
||||
if (memcpy_s(buf, bufLen, "(unknown)", count + 1) != EOK) {
|
||||
(void)LOS_MemFree(m_aucSysMem1, freeBuf);
|
||||
return -EBADF;
|
||||
}
|
||||
}
|
||||
if (count < 0) {
|
||||
(void)LOS_MemFree(m_aucSysMem1, freeBuf);
|
||||
return count;
|
||||
}
|
||||
|
||||
if (LOS_IsUserAddressRange((VADDR_T)(UINTPTR)buffer, bufLen)) {
|
||||
if (LOS_ArchCopyToUser(buffer, buf, bufLen) != 0) {
|
||||
(void)LOS_MemFree(m_aucSysMem1, freeBuf);
|
||||
return -EFAULT;
|
||||
}
|
||||
}
|
||||
(void)LOS_MemFree(m_aucSysMem1, freeBuf);
|
||||
return count;
|
||||
}
|
||||
|
||||
static const struct ProcFileOperations PID_CONTAINER_FOPS = {
|
||||
.readLink = ProcessContainerReadLink,
|
||||
};
|
||||
|
||||
void *ProcfsContainerGet(int fd, unsigned int *containerType)
|
||||
{
|
||||
if ((fd <= 0) || (containerType == NULL)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
VnodeHold();
|
||||
struct Vnode *vnode = VnodeFind(fd);
|
||||
if (vnode == NULL) {
|
||||
VnodeDrop();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct ProcDirEntry *entry = VnodeToEntry(vnode);
|
||||
if (entry == NULL) {
|
||||
VnodeDrop();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct ProcessData *data = (struct ProcessData *)entry->data;
|
||||
if (data == NULL) {
|
||||
VnodeDrop();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void *processCB = (void *)ProcGetProcessCB(data);
|
||||
*containerType = data->type;
|
||||
VnodeDrop();
|
||||
return processCB;
|
||||
}
|
||||
|
||||
#endif /* LOSCFG_KERNEL_CONTAINER */
|
||||
|
||||
static int ProcessMemInfoRead(struct SeqBuf *seqBuf, LosProcessCB *pcb)
|
||||
{
|
||||
unsigned int intSave;
|
||||
unsigned int size = sizeof(LosVmSpace) + sizeof(LosVmMapRegion);
|
||||
LosVmSpace *vmSpace = (LosVmSpace *)LOS_MemAlloc(m_aucSysMem1, size);
|
||||
if (vmSpace == NULL) {
|
||||
return -ENOMEM;
|
||||
}
|
||||
(void)memset_s(vmSpace, size, 0, size);
|
||||
LosVmMapRegion *heap = (LosVmMapRegion *)((char *)vmSpace + sizeof(LosVmSpace));
|
||||
|
||||
SCHEDULER_LOCK(intSave);
|
||||
if (OsProcessIsInactive(pcb)) {
|
||||
SCHEDULER_UNLOCK(intSave);
|
||||
(void)LOS_MemFree(m_aucSysMem1, vmSpace);
|
||||
return -EINVAL;
|
||||
}
|
||||
(void)memcpy_s(vmSpace, sizeof(LosVmSpace), pcb->vmSpace, sizeof(LosVmSpace));
|
||||
(void)memcpy_s(heap, sizeof(LosVmMapRegion), pcb->vmSpace->heap, sizeof(LosVmMapRegion));
|
||||
SCHEDULER_UNLOCK(intSave);
|
||||
|
||||
(void)LosBufPrintf(seqBuf, "\nVMSpaceSize: %u byte\n", vmSpace->size);
|
||||
(void)LosBufPrintf(seqBuf, "VMSpaceMapSize: %u byte\n", vmSpace->mapSize);
|
||||
(void)LosBufPrintf(seqBuf, "VM TLB Asid: %u\n", vmSpace->archMmu.asid);
|
||||
(void)LosBufPrintf(seqBuf, "VMHeapSize: %u byte\n", heap->range.size);
|
||||
(void)LosBufPrintf(seqBuf, "VMHeapRegionName: %s\n", OsGetRegionNameOrFilePath(heap));
|
||||
(void)LosBufPrintf(seqBuf, "VMHeapRegionType: 0x%x\n", heap->regionType);
|
||||
(void)LOS_MemFree(m_aucSysMem1, vmSpace);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef LOSCFG_KERNEL_CPUP
|
||||
#define TIME_CYCLE_TO_US(time) ((((UINT64)time) * OS_NS_PER_CYCLE) / OS_SYS_NS_PER_US)
|
||||
static int ProcessCpupRead(struct SeqBuf *seqBuf, LosProcessCB *pcb)
|
||||
{
|
||||
unsigned int intSave;
|
||||
OsCpupBase *processCpup = (OsCpupBase *)LOS_MemAlloc(m_aucSysMem1, sizeof(OsCpupBase));
|
||||
if (processCpup == NULL) {
|
||||
return -ENOMEM;
|
||||
}
|
||||
(void)memset_s(processCpup, sizeof(OsCpupBase), 0, sizeof(OsCpupBase));
|
||||
|
||||
SCHEDULER_LOCK(intSave);
|
||||
if (OsProcessIsInactive(pcb)) {
|
||||
SCHEDULER_UNLOCK(intSave);
|
||||
(VOID)LOS_MemFree(m_aucSysMem1, processCpup);
|
||||
return -EINVAL;
|
||||
}
|
||||
(void)memcpy_s(processCpup, sizeof(OsCpupBase), pcb->processCpup, sizeof(OsCpupBase));
|
||||
SCHEDULER_UNLOCK(intSave);
|
||||
|
||||
(void)LosBufPrintf(seqBuf, "\nTotalRunningTime: %lu us\n", TIME_CYCLE_TO_US(processCpup->allTime));
|
||||
(void)LosBufPrintf(seqBuf, "HistoricalRunningTime:(us) ");
|
||||
for (UINT32 i = 0; i < OS_CPUP_HISTORY_RECORD_NUM + 1; i++) {
|
||||
(void)LosBufPrintf(seqBuf, "%lu ", TIME_CYCLE_TO_US(processCpup->historyTime[i]));
|
||||
}
|
||||
(void)LosBufPrintf(seqBuf, "\n");
|
||||
(void)LOS_MemFree(m_aucSysMem1, processCpup);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef LOSCFG_TIME_CONTAINER
|
||||
static const CHAR *g_monotonic = "monotonic";
|
||||
#define DECIMAL_BASE 10
|
||||
|
||||
static int ProcTimeContainerRead(struct SeqBuf *m, void *v)
|
||||
{
|
||||
int ret;
|
||||
unsigned int intSave;
|
||||
struct timespec64 offsets = {0};
|
||||
|
||||
if ((m == NULL) || (v == NULL)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
struct ProcessData *data = (struct ProcessData *)v;
|
||||
SCHEDULER_LOCK(intSave);
|
||||
LosProcessCB *processCB = ProcGetProcessCB(data);
|
||||
ret = OsGetTimeContainerMonotonic(processCB, &offsets);
|
||||
SCHEDULER_UNLOCK(intSave);
|
||||
if (ret != LOS_OK) {
|
||||
return -ret;
|
||||
}
|
||||
|
||||
LosBufPrintf(m, "monotonic %lld %ld\n", offsets.tv_sec, offsets.tv_nsec);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ProcSetTimensOffset(const char *buf, LosProcessCB *processCB)
|
||||
{
|
||||
unsigned int intSave;
|
||||
struct timespec64 offsets;
|
||||
char *endptr = NULL;
|
||||
|
||||
offsets.tv_sec = strtoll(buf, &endptr, DECIMAL_BASE);
|
||||
offsets.tv_nsec = strtoll(endptr, NULL, DECIMAL_BASE);
|
||||
if (offsets.tv_nsec >= OS_SYS_NS_PER_SECOND) {
|
||||
return -EACCES;
|
||||
}
|
||||
|
||||
SCHEDULER_LOCK(intSave);
|
||||
unsigned int ret = OsSetTimeContainerMonotonic(processCB, &offsets);
|
||||
SCHEDULER_UNLOCK(intSave);
|
||||
if (ret != LOS_OK) {
|
||||
return -ret;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ProcTimeContainerWrite(struct ProcFile *pf, const char *buf, size_t count, loff_t *ppos)
|
||||
{
|
||||
(void)ppos;
|
||||
char *kbuf = NULL;
|
||||
int ret;
|
||||
|
||||
if ((pf == NULL) || (count <= 0)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
struct ProcDirEntry *entry = pf->pPDE;
|
||||
if (entry == NULL) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
struct ProcessData *data = (struct ProcessData *)entry->data;
|
||||
if (data == NULL) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (LOS_IsUserAddressRange((VADDR_T)(UINTPTR)buf, count)) {
|
||||
kbuf = LOS_MemAlloc(m_aucSysMem1, count + 1);
|
||||
if (kbuf == NULL) {
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
if (LOS_ArchCopyFromUser(kbuf, buf, count) != 0) {
|
||||
(VOID)LOS_MemFree(m_aucSysMem1, kbuf);
|
||||
return -EFAULT;
|
||||
}
|
||||
kbuf[count] = '\0';
|
||||
buf = kbuf;
|
||||
}
|
||||
|
||||
ret = strncmp(buf, g_monotonic, strlen(g_monotonic));
|
||||
if (ret != 0) {
|
||||
(VOID)LOS_MemFree(m_aucSysMem1, kbuf);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
buf += strlen(g_monotonic);
|
||||
ret = ProcSetTimensOffset(buf, ProcGetProcessCB(data));
|
||||
if (ret < 0) {
|
||||
(VOID)LOS_MemFree(m_aucSysMem1, kbuf);
|
||||
return ret;
|
||||
}
|
||||
(VOID)LOS_MemFree(m_aucSysMem1, kbuf);
|
||||
return count;
|
||||
}
|
||||
|
||||
static const struct ProcFileOperations TIME_CONTAINER_FOPS = {
|
||||
.read = ProcTimeContainerRead,
|
||||
.write = ProcTimeContainerWrite,
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef LOSCFG_USER_CONTAINER
|
||||
|
||||
static void *MemdupUserNul(const void *src, size_t len)
|
||||
{
|
||||
char *des = NULL;
|
||||
if (len <= 0) {
|
||||
return NULL;
|
||||
}
|
||||
des = LOS_MemAlloc(OS_SYS_MEM_ADDR, len + 1);
|
||||
if (des == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (LOS_ArchCopyFromUser(des, src, len) != 0) {
|
||||
(VOID)LOS_MemFree(OS_SYS_MEM_ADDR, des);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
des[len] = '\0';
|
||||
return des;
|
||||
}
|
||||
|
||||
static LosProcessCB *ProcUidGidMapWriteCheck(struct ProcFile *pf, const char *buf, size_t size,
|
||||
char **kbuf, ProcessDataType *type)
|
||||
{
|
||||
if ((pf == NULL) || (size <= 0) || (size >= PAGE_SIZE)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct ProcDirEntry *entry = pf->pPDE;
|
||||
if (entry == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct ProcessData *data = (struct ProcessData *)entry->data;
|
||||
if (data == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*kbuf = MemdupUserNul(buf, size);
|
||||
if (*kbuf == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
*type = (ProcessDataType)data->type;
|
||||
return ProcGetProcessCB(data);
|
||||
}
|
||||
|
||||
static ssize_t ProcIDMapWrite(struct ProcFile *file, const char *buf, size_t size, loff_t *ppos)
|
||||
{
|
||||
(void)ppos;
|
||||
char *kbuf = NULL;
|
||||
int ret;
|
||||
unsigned int intSave;
|
||||
ProcessDataType type = PROC_P_TYPE_MAX;
|
||||
LosProcessCB *processCB = ProcUidGidMapWriteCheck(file, buf, size, &kbuf, &type);
|
||||
if (processCB == NULL) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
SCHEDULER_LOCK(intSave);
|
||||
if ((processCB->credentials == NULL) || (processCB->credentials->userContainer == NULL)) {
|
||||
SCHEDULER_UNLOCK(intSave);
|
||||
(void)LOS_MemFree(m_aucSysMem1, kbuf);
|
||||
return -EINVAL;
|
||||
}
|
||||
UserContainer *userContainer = processCB->credentials->userContainer;
|
||||
if (userContainer->parent == NULL) {
|
||||
SCHEDULER_UNLOCK(intSave);
|
||||
(void)LOS_MemFree(m_aucSysMem1, kbuf);
|
||||
return -EPERM;
|
||||
}
|
||||
if (type == PROC_UID_MAP) {
|
||||
ret = OsUserContainerMapWrite(file, kbuf, size, CAP_SETUID,
|
||||
&userContainer->uidMap, &userContainer->parent->uidMap);
|
||||
} else {
|
||||
ret = OsUserContainerMapWrite(file, kbuf, size, CAP_SETGID,
|
||||
&userContainer->gidMap, &userContainer->parent->gidMap);
|
||||
}
|
||||
SCHEDULER_UNLOCK(intSave);
|
||||
(void)LOS_MemFree(m_aucSysMem1, kbuf);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int ProcIDMapRead(struct SeqBuf *seqBuf, void *v)
|
||||
{
|
||||
unsigned int intSave;
|
||||
if ((seqBuf == NULL) || (v == NULL)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
struct ProcessData *data = (struct ProcessData *)v;
|
||||
LosProcessCB *processCB = ProcGetProcessCB(data);
|
||||
|
||||
SCHEDULER_LOCK(intSave);
|
||||
if ((processCB->credentials == NULL) || (processCB->credentials->userContainer == NULL)) {
|
||||
SCHEDULER_UNLOCK(intSave);
|
||||
return -EINVAL;
|
||||
}
|
||||
UserContainer *userContainer = processCB->credentials->userContainer;
|
||||
if ((userContainer != NULL) && (userContainer->parent == NULL)) {
|
||||
UidGidExtent uidGidExtent = userContainer->uidMap.extent[0];
|
||||
SCHEDULER_UNLOCK(intSave);
|
||||
(void)LosBufPrintf(seqBuf, "%d %d %u\n", uidGidExtent.first, uidGidExtent.lowerFirst,
|
||||
uidGidExtent.count);
|
||||
return 0;
|
||||
}
|
||||
SCHEDULER_LOCK(intSave);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct ProcFileOperations UID_GID_MAP_FOPS = {
|
||||
.read = ProcIDMapRead,
|
||||
.write = ProcIDMapWrite,
|
||||
};
|
||||
#endif
|
||||
|
||||
static int ProcProcessRead(struct SeqBuf *m, void *v)
|
||||
{
|
||||
if ((m == NULL) || (v == NULL)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
struct ProcessData *data = (struct ProcessData *)v;
|
||||
switch (data->type) {
|
||||
case PROC_PID_MEM:
|
||||
return ProcessMemInfoRead(m, ProcGetProcessCB(data));
|
||||
#ifdef LOSCFG_KERNEL_CPUP
|
||||
case PROC_PID_CPUP:
|
||||
return ProcessCpupRead(m, ProcGetProcessCB(data));
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static const struct ProcFileOperations PID_FOPS = {
|
||||
.read = ProcProcessRead,
|
||||
};
|
||||
|
||||
static struct ProcProcess g_procProcess[] = {
|
||||
{
|
||||
.name = NULL,
|
||||
.mode = S_IFDIR | S_IRWXU | S_IRWXG | S_IROTH,
|
||||
.type = PROC_PID,
|
||||
.fileOps = &PID_FOPS
|
||||
|
||||
},
|
||||
{
|
||||
.name = "meminfo",
|
||||
.mode = 0,
|
||||
.type = PROC_PID_MEM,
|
||||
.fileOps = &PID_FOPS
|
||||
},
|
||||
#ifdef LOSCFG_KERNEL_CPUP
|
||||
{
|
||||
.name = "cpup",
|
||||
.mode = 0,
|
||||
.type = PROC_PID_CPUP,
|
||||
.fileOps = &PID_FOPS
|
||||
|
||||
},
|
||||
#endif
|
||||
#ifdef LOSCFG_KERNEL_CONTAINER
|
||||
{
|
||||
.name = "container",
|
||||
.mode = S_IFDIR | S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH,
|
||||
.type = CONTAINER,
|
||||
.fileOps = &PID_CONTAINER_FOPS
|
||||
|
||||
},
|
||||
#ifdef LOSCFG_PID_CONTAINER
|
||||
{
|
||||
.name = "container/pid",
|
||||
.mode = S_IFLNK,
|
||||
.type = PID_CONTAINER,
|
||||
.fileOps = &PID_CONTAINER_FOPS
|
||||
},
|
||||
{
|
||||
.name = "container/pid_for_children",
|
||||
.mode = S_IFLNK,
|
||||
.type = PID_CHILD_CONTAINER,
|
||||
.fileOps = &PID_CONTAINER_FOPS
|
||||
},
|
||||
#endif
|
||||
#ifdef LOSCFG_UTS_CONTAINER
|
||||
{
|
||||
.name = "container/uts",
|
||||
.mode = S_IFLNK,
|
||||
.type = UTS_CONTAINER,
|
||||
.fileOps = &PID_CONTAINER_FOPS
|
||||
},
|
||||
#endif
|
||||
#ifdef LOSCFG_MNT_CONTAINER
|
||||
{
|
||||
.name = "container/mnt",
|
||||
.mode = S_IFLNK,
|
||||
.type = MNT_CONTAINER,
|
||||
.fileOps = &PID_CONTAINER_FOPS
|
||||
},
|
||||
#endif
|
||||
#ifdef LOSCFG_IPC_CONTAINER
|
||||
{
|
||||
.name = "container/ipc",
|
||||
.mode = S_IFLNK,
|
||||
.type = IPC_CONTAINER,
|
||||
.fileOps = &PID_CONTAINER_FOPS
|
||||
},
|
||||
#endif
|
||||
#ifdef LOSCFG_TIME_CONTAINER
|
||||
{
|
||||
.name = "container/time",
|
||||
.mode = S_IFLNK,
|
||||
.type = TIME_CONTAINER,
|
||||
.fileOps = &PID_CONTAINER_FOPS
|
||||
},
|
||||
{
|
||||
.name = "container/time_for_children",
|
||||
.mode = S_IFLNK,
|
||||
.type = TIME_CHILD_CONTAINER,
|
||||
.fileOps = &PID_CONTAINER_FOPS
|
||||
},
|
||||
{
|
||||
.name = "time_offsets",
|
||||
.mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH,
|
||||
.type = TIME_CONTAINER,
|
||||
.fileOps = &TIME_CONTAINER_FOPS
|
||||
},
|
||||
#endif
|
||||
#ifdef LOSCFG_IPC_CONTAINER
|
||||
{
|
||||
.name = "container/user",
|
||||
.mode = S_IFLNK,
|
||||
.type = USER_CONTAINER,
|
||||
.fileOps = &PID_CONTAINER_FOPS
|
||||
},
|
||||
{
|
||||
.name = "uid_map",
|
||||
.mode = 0,
|
||||
.type = PROC_UID_MAP,
|
||||
.fileOps = &UID_GID_MAP_FOPS
|
||||
},
|
||||
{
|
||||
.name = "gid_map",
|
||||
.mode = 0,
|
||||
.type = PROC_GID_MAP,
|
||||
.fileOps = &UID_GID_MAP_FOPS
|
||||
},
|
||||
#endif
|
||||
#ifdef LOSCFG_IPC_CONTAINER
|
||||
{
|
||||
.name = "container/net",
|
||||
.mode = S_IFLNK,
|
||||
.type = NET_CONTAINER,
|
||||
.fileOps = &PID_CONTAINER_FOPS
|
||||
},
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
void ProcFreeProcessDir(struct ProcDirEntry *processDir)
|
||||
{
|
||||
if (processDir == NULL) {
|
||||
return;
|
||||
}
|
||||
RemoveProcEntry(processDir->name, NULL);
|
||||
}
|
||||
|
||||
static struct ProcDirEntry *ProcCreatePorcess(UINT32 pid, struct ProcProcess *porcess, uintptr_t processCB)
|
||||
{
|
||||
int ret;
|
||||
struct ProcDataParm dataParm;
|
||||
char pidName[PROC_PID_DIR_LEN] = {0};
|
||||
struct ProcessData *data = (struct ProcessData *)malloc(sizeof(struct ProcessData));
|
||||
if (data == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
if (pid != OS_INVALID_VALUE) {
|
||||
if (porcess->name != NULL) {
|
||||
ret = snprintf_s(pidName, PROC_PID_DIR_LEN, PROC_PID_DIR_LEN - 1, "%u/%s", pid, porcess->name);
|
||||
} else {
|
||||
ret = snprintf_s(pidName, PROC_PID_DIR_LEN, PROC_PID_DIR_LEN - 1, "%u", pid);
|
||||
}
|
||||
} else {
|
||||
if (porcess->name != NULL) {
|
||||
ret = snprintf_s(pidName, PROC_PID_DIR_LEN, PROC_PID_DIR_LEN - 1, "%s/%s", "self", porcess->name);
|
||||
} else {
|
||||
ret = snprintf_s(pidName, PROC_PID_DIR_LEN, PROC_PID_DIR_LEN - 1, "%s", "self");
|
||||
}
|
||||
}
|
||||
if (ret < 0) {
|
||||
free(data);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
data->process = processCB;
|
||||
data->type = porcess->type;
|
||||
dataParm.data = data;
|
||||
dataParm.dataType = PROC_DATA_FREE;
|
||||
struct ProcDirEntry *container = ProcCreateData(pidName, porcess->mode, NULL, porcess->fileOps, &dataParm);
|
||||
if (container == NULL) {
|
||||
free(data);
|
||||
PRINT_ERR("create /proc/%s error!\n", pidName);
|
||||
return NULL;
|
||||
}
|
||||
return container;
|
||||
}
|
||||
|
||||
int ProcCreateProcessDir(UINT32 pid, uintptr_t process)
|
||||
{
|
||||
unsigned int intSave;
|
||||
struct ProcDirEntry *pidDir = NULL;
|
||||
for (int index = 0; index < (sizeof(g_procProcess) / sizeof(struct ProcProcess)); index++) {
|
||||
struct ProcProcess *procProcess = &g_procProcess[index];
|
||||
struct ProcDirEntry *dir = ProcCreatePorcess(pid, procProcess, process);
|
||||
if (dir == NULL) {
|
||||
PRINT_ERR("create /proc/%s error!\n", procProcess->name);
|
||||
goto CREATE_ERROR;
|
||||
}
|
||||
if (index == 0) {
|
||||
pidDir = dir;
|
||||
}
|
||||
}
|
||||
|
||||
if (process != 0) {
|
||||
SCHEDULER_LOCK(intSave);
|
||||
((LosProcessCB *)process)->procDir = pidDir;
|
||||
SCHEDULER_UNLOCK(intSave);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
CREATE_ERROR:
|
||||
if (pidDir != NULL) {
|
||||
RemoveProcEntry(pidDir->name, NULL);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
#endif /* LOSCFG_PROC_PROCESS_DIR */
|
||||
|
||||
static int ProcessProcFill(struct SeqBuf *m, void *v)
|
||||
{
|
||||
|
@ -52,7 +711,18 @@ void ProcProcessInit(void)
|
|||
PRINT_ERR("create /proc/process error!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
pde->procFileOps = &PROCESS_PROC_FOPS;
|
||||
}
|
||||
|
||||
#ifdef LOSCFG_PROC_PROCESS_DIR
|
||||
int ret = ProcCreateProcessDir(OS_INVALID_VALUE, 0);
|
||||
if (ret < 0) {
|
||||
PRINT_ERR("Create proc process self dir failed!\n");
|
||||
}
|
||||
|
||||
ret = ProcCreateProcessDir(OS_USER_ROOT_PROCESS_ID, (uintptr_t)OsGetUserInitProcess());
|
||||
if (ret < 0) {
|
||||
PRINT_ERR("Create proc process %d dir failed!\n", OS_USER_ROOT_PROCESS_ID);
|
||||
}
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,228 @@
|
|||
/*
|
||||
* Copyright (c) 2023-2023 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/statfs.h>
|
||||
#include <sys/mount.h>
|
||||
#include "proc_fs.h"
|
||||
#include "internal.h"
|
||||
#include "los_process_pri.h"
|
||||
#include "user_copy.h"
|
||||
#include "los_memory.h"
|
||||
|
||||
#ifdef LOSCFG_KERNEL_CONTAINER
|
||||
struct ProcSysUser {
|
||||
char *name;
|
||||
mode_t mode;
|
||||
int type;
|
||||
const struct ProcFileOperations *fileOps;
|
||||
};
|
||||
|
||||
static unsigned int MemUserCopy(const char *src, size_t len, char **kbuf)
|
||||
{
|
||||
if (LOS_IsUserAddressRange((VADDR_T)(UINTPTR)src, len)) {
|
||||
char *kernelBuf = LOS_MemAlloc(m_aucSysMem1, len + 1);
|
||||
if (kernelBuf == NULL) {
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
if (LOS_ArchCopyFromUser(kernelBuf, src, len) != 0) {
|
||||
(VOID)LOS_MemFree(m_aucSysMem1, kernelBuf);
|
||||
return EFAULT;
|
||||
}
|
||||
kernelBuf[len] = '\0';
|
||||
*kbuf = kernelBuf;
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int GetContainerLimitValue(struct ProcFile *pf, const CHAR *buf, size_t count)
|
||||
{
|
||||
int value;
|
||||
char *kbuf = NULL;
|
||||
|
||||
if ((pf == NULL) || (pf->pPDE == NULL) || (buf == NULL) || (count <= 0)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
unsigned ret = MemUserCopy(buf, count, &kbuf);
|
||||
if (ret != 0) {
|
||||
return -ret;
|
||||
} else if ((ret == 0) && (kbuf != NULL)) {
|
||||
buf = (const char *)kbuf;
|
||||
}
|
||||
|
||||
if (strspn(buf, "0123456789") != count) {
|
||||
(void)LOS_MemFree(m_aucSysMem1, kbuf);
|
||||
return -EINVAL;
|
||||
}
|
||||
value = atoi(buf);
|
||||
(void)LOS_MemFree(m_aucSysMem1, kbuf);
|
||||
return value;
|
||||
}
|
||||
|
||||
static ssize_t ProcSysUserWrite(struct ProcFile *pf, const char *buf, size_t size, loff_t *ppos)
|
||||
{
|
||||
(void)ppos;
|
||||
unsigned ret;
|
||||
int value = GetContainerLimitValue(pf, buf, size);
|
||||
if (value < 0) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ContainerType type = (ContainerType)(uintptr_t)pf->pPDE->data;
|
||||
ret = OsSetContainerLimit(type, value);
|
||||
if (ret != LOS_OK) {
|
||||
return -EINVAL;
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
static int ProcSysUserRead(struct SeqBuf *seqBuf, void *v)
|
||||
{
|
||||
unsigned ret;
|
||||
if ((seqBuf == NULL) || (v == NULL)) {
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
ContainerType type = (ContainerType)(uintptr_t)v;
|
||||
ret = OsGetContainerLimit(type);
|
||||
if (ret == OS_INVALID_VALUE) {
|
||||
return EINVAL;
|
||||
}
|
||||
(void)LosBufPrintf(seqBuf, "\nlimit: %u\n", ret);
|
||||
(void)LosBufPrintf(seqBuf, "count: %u\n", OsGetContainerCount(type));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct ProcFileOperations SYS_USER_OPT = {
|
||||
.read = ProcSysUserRead,
|
||||
.write = ProcSysUserWrite,
|
||||
};
|
||||
|
||||
static struct ProcSysUser g_sysUser[] = {
|
||||
#ifdef LOSCFG_MNT_CONTAINER
|
||||
{
|
||||
.name = "max_mnt_container",
|
||||
.mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH,
|
||||
.type = MNT_CONTAINER,
|
||||
.fileOps = &SYS_USER_OPT
|
||||
|
||||
},
|
||||
#endif
|
||||
#ifdef LOSCFG_PID_CONTAINER
|
||||
{
|
||||
.name = "max_pid_container",
|
||||
.mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH,
|
||||
.type = PID_CONTAINER,
|
||||
.fileOps = &SYS_USER_OPT
|
||||
},
|
||||
#endif
|
||||
#ifdef LOSCFG_USER_CONTAINER
|
||||
{
|
||||
.name = "max_user_container",
|
||||
.mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH,
|
||||
.type = USER_CONTAINER,
|
||||
.fileOps = &SYS_USER_OPT
|
||||
|
||||
},
|
||||
#endif
|
||||
#ifdef LOSCFG_UTS_CONTAINER
|
||||
{
|
||||
.name = "max_uts_container",
|
||||
.mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH,
|
||||
.type = UTS_CONTAINER,
|
||||
.fileOps = &SYS_USER_OPT
|
||||
|
||||
},
|
||||
#endif
|
||||
#ifdef LOSCFG_UTS_CONTAINER
|
||||
{
|
||||
.name = "max_time_container",
|
||||
.mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH,
|
||||
.type = UTS_CONTAINER,
|
||||
.fileOps = &SYS_USER_OPT
|
||||
|
||||
},
|
||||
#endif
|
||||
#ifdef LOSCFG_IPC_CONTAINER
|
||||
{
|
||||
.name = "max_ipc_container",
|
||||
.mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH,
|
||||
.type = IPC_CONTAINER,
|
||||
.fileOps = &SYS_USER_OPT
|
||||
},
|
||||
#endif
|
||||
#ifdef LOSCFG_NET_CONTAINER
|
||||
{
|
||||
.name = "max_net_container",
|
||||
.mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH,
|
||||
.type = NET_CONTAINER,
|
||||
.fileOps = &SYS_USER_OPT
|
||||
},
|
||||
#endif
|
||||
};
|
||||
|
||||
static int ProcCreateSysUser(struct ProcDirEntry *parent)
|
||||
{
|
||||
struct ProcDataParm parm;
|
||||
for (int index = 0; index < (sizeof(g_sysUser) / sizeof(struct ProcSysUser)); index++) {
|
||||
struct ProcSysUser *sysUser = &g_sysUser[index];
|
||||
parm.data = (void *)(uintptr_t)sysUser->type;
|
||||
parm.dataType = PROC_DATA_STATIC;
|
||||
struct ProcDirEntry *userFile = ProcCreateData(sysUser->name, sysUser->mode, parent, sysUser->fileOps, &parm);
|
||||
if (userFile == NULL) {
|
||||
PRINT_ERR("create /proc/%s/%s error!\n", parent->name, sysUser->name);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define PROC_SYS_USER_MODE (S_IFDIR | S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)
|
||||
void ProcSysUserInit(void)
|
||||
{
|
||||
struct ProcDirEntry *parentPDE = CreateProcEntry("sys", PROC_SYS_USER_MODE, NULL);
|
||||
if (parentPDE == NULL) {
|
||||
return;
|
||||
}
|
||||
struct ProcDirEntry *pde = CreateProcEntry("user", PROC_SYS_USER_MODE, parentPDE);
|
||||
if (pde == NULL) {
|
||||
PRINT_ERR("create /proc/process error!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
int ret = ProcCreateSysUser(pde);
|
||||
if (ret < 0) {
|
||||
PRINT_ERR("Create proc sys user failed!\n");
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif
|
|
@ -78,7 +78,7 @@ void ProcUptimeInit(void)
|
|||
{
|
||||
struct ProcDirEntry *pde = CreateProcEntry("uptime", 0, NULL);
|
||||
if (pde == NULL) {
|
||||
PRINT_ERR("creat /proc/uptime error!\n");
|
||||
PRINT_ERR("create /proc/uptime error!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2023 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
|
@ -62,8 +62,9 @@ static struct ProcDirEntry g_procRootDirEntry = {
|
|||
|
||||
int ProcMatch(unsigned int len, const char *name, struct ProcDirEntry *pn)
|
||||
{
|
||||
if (len != pn->nameLen)
|
||||
if (len != pn->nameLen) {
|
||||
return 0;
|
||||
}
|
||||
return !strncmp(name, pn->name, len);
|
||||
}
|
||||
|
||||
|
@ -87,7 +88,7 @@ static struct ProcDirEntry *ProcFindNode(struct ProcDirEntry *parent, const char
|
|||
}
|
||||
|
||||
/*
|
||||
* descrition: find the file's handle
|
||||
* description: find the file's handle
|
||||
* path: the file of fullpath
|
||||
* return: the file of handle
|
||||
* add by ll
|
||||
|
@ -295,7 +296,7 @@ static int ProcAddNode(struct ProcDirEntry *parent, struct ProcDirEntry *pn)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void ProcDetachNode(struct ProcDirEntry *pn)
|
||||
void ProcDetachNode(struct ProcDirEntry *pn)
|
||||
{
|
||||
struct ProcDirEntry *parent = pn->parent;
|
||||
struct ProcDirEntry **iter = NULL;
|
||||
|
@ -351,6 +352,11 @@ static struct ProcDirEntry *ProcCreateFile(struct ProcDirEntry *parent, const ch
|
|||
|
||||
pn->procFileOps = procFileOps;
|
||||
pn->type = VNODE_TYPE_REG;
|
||||
#ifdef LOSCFG_PROC_PROCESS_DIR
|
||||
if (S_ISLNK(mode)) {
|
||||
pn->type = VNODE_TYPE_VIR_LNK;
|
||||
}
|
||||
#endif
|
||||
ret = ProcAddNode(parent, pn);
|
||||
if (ret != 0) {
|
||||
free(pn->pf);
|
||||
|
@ -373,25 +379,50 @@ struct ProcDirEntry *CreateProcEntry(const char *name, mode_t mode, struct ProcD
|
|||
return pde;
|
||||
}
|
||||
|
||||
void ProcEntryClearVnode(struct ProcDirEntry *entry)
|
||||
{
|
||||
struct Vnode *item = NULL;
|
||||
struct Vnode *nextItem = NULL;
|
||||
|
||||
VnodeHold();
|
||||
LOS_DL_LIST_FOR_EACH_ENTRY_SAFE(item, nextItem, GetVnodeActiveList(), struct Vnode, actFreeEntry) {
|
||||
if ((struct ProcDirEntry *)item->data != entry) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (VnodeFree(item) != LOS_OK) {
|
||||
PRINT_ERR("ProcEntryClearVnode free failed, entry: %s\n", entry->name);
|
||||
}
|
||||
}
|
||||
VnodeDrop();
|
||||
return;
|
||||
}
|
||||
|
||||
static void FreeProcEntry(struct ProcDirEntry *entry)
|
||||
{
|
||||
if (entry == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (entry->pf != NULL) {
|
||||
free(entry->pf);
|
||||
entry->pf = NULL;
|
||||
}
|
||||
if ((entry->dataType == PROC_DATA_FREE) && (entry->data != NULL)) {
|
||||
free(entry->data);
|
||||
}
|
||||
entry->data = NULL;
|
||||
free(entry);
|
||||
}
|
||||
|
||||
void ProcFreeEntry(struct ProcDirEntry *pn)
|
||||
{
|
||||
if (atomic_dec_and_test(&pn->count))
|
||||
if (atomic_dec_and_test(&pn->count)) {
|
||||
FreeProcEntry(pn);
|
||||
}
|
||||
}
|
||||
|
||||
static void RemoveProcEntryTravalsal(struct ProcDirEntry *pn)
|
||||
void RemoveProcEntryTravalsal(struct ProcDirEntry *pn)
|
||||
{
|
||||
if (pn == NULL) {
|
||||
return;
|
||||
|
@ -399,6 +430,8 @@ static void RemoveProcEntryTravalsal(struct ProcDirEntry *pn)
|
|||
RemoveProcEntryTravalsal(pn->next);
|
||||
RemoveProcEntryTravalsal(pn->subdir);
|
||||
|
||||
ProcEntryClearVnode(pn);
|
||||
|
||||
ProcFreeEntry(pn);
|
||||
}
|
||||
|
||||
|
@ -428,6 +461,9 @@ void RemoveProcEntry(const char *name, struct ProcDirEntry *parent)
|
|||
spin_unlock(&procfsLock);
|
||||
|
||||
RemoveProcEntryTravalsal(pn->subdir);
|
||||
|
||||
ProcEntryClearVnode(pn);
|
||||
|
||||
ProcFreeEntry(pn);
|
||||
}
|
||||
|
||||
|
@ -442,14 +478,17 @@ struct ProcDirEntry *ProcMkdir(const char *name, struct ProcDirEntry *parent)
|
|||
}
|
||||
|
||||
struct ProcDirEntry *ProcCreateData(const char *name, mode_t mode, struct ProcDirEntry *parent,
|
||||
const struct ProcFileOperations *procFileOps, void *data)
|
||||
const struct ProcFileOperations *procFileOps, struct ProcDataParm *param)
|
||||
{
|
||||
struct ProcDirEntry *pde = CreateProcEntry(name, mode, parent);
|
||||
if (pde != NULL) {
|
||||
if (procFileOps != NULL) {
|
||||
pde->procFileOps = procFileOps;
|
||||
}
|
||||
pde->data = data;
|
||||
if (param != NULL) {
|
||||
pde->data = param->data;
|
||||
pde->dataType = param->dataType;
|
||||
}
|
||||
}
|
||||
return pde;
|
||||
}
|
||||
|
@ -519,7 +558,7 @@ int ProcOpen(struct ProcFile *procFile)
|
|||
|
||||
static int ProcRead(struct ProcDirEntry *pde, char *buf, size_t len)
|
||||
{
|
||||
if (pde == NULL || pde == NULL || pde->pf == NULL) {
|
||||
if (pde == NULL || pde->pf == NULL) {
|
||||
return PROC_ERROR;
|
||||
}
|
||||
struct ProcFile *procFile = pde->pf;
|
||||
|
@ -527,7 +566,7 @@ static int ProcRead(struct ProcDirEntry *pde, char *buf, size_t len)
|
|||
|
||||
if (sb->buf == NULL) {
|
||||
// only read once to build the storage buffer
|
||||
if (pde->procFileOps->read(sb, NULL) != 0) {
|
||||
if (pde->procFileOps->read(sb, pde->data) != 0) {
|
||||
return PROC_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -552,21 +591,17 @@ static int ProcRead(struct ProcDirEntry *pde, char *buf, size_t len)
|
|||
|
||||
struct ProcDirEntry *OpenProcFile(const char *fileName, int flags, ...)
|
||||
{
|
||||
unsigned int intSave;
|
||||
struct ProcDirEntry *pn = ProcFindEntry(fileName);
|
||||
if (pn == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SCHEDULER_LOCK(intSave);
|
||||
if (S_ISREG(pn->mode) && (pn->count != 1)) {
|
||||
SCHEDULER_UNLOCK(intSave);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pn->flags = (unsigned int)(pn->flags) | (unsigned int)flags;
|
||||
atomic_set(&pn->count, PROC_INUSE);
|
||||
SCHEDULER_UNLOCK(intSave);
|
||||
if (ProcOpen(pn->pf) != OK) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -615,7 +650,6 @@ int WriteProcFile(struct ProcDirEntry *pde, const void *buf, size_t len)
|
|||
result = pde->procFileOps->write(pde->pf, (const char *)buf, len, &(pde->pf->fPos));
|
||||
}
|
||||
spin_unlock(&procfsLock);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
|
@ -62,8 +62,8 @@ int OsShellCmdWriteProc(int argc, char **argv)
|
|||
|
||||
if (argc == WRITEPROC_ARGC) {
|
||||
value = argv[0];
|
||||
path = argv[2];
|
||||
len = strlen(value) + 1; /* +1:add the \0 */
|
||||
path = argv[2]; // 2: index of path
|
||||
len = strlen(value) + 1; /* + 1:add the \0 */
|
||||
if (strncmp(argv[1], ">>", strlen(">>")) == 0) {
|
||||
if ((realpath(path, realPath) == NULL) || (strncmp(realPath, rootProcDir, strlen(rootProcDir)) != 0)) {
|
||||
PRINT_ERR("No such file or directory\n");
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import("//kernel/liteos_a/liteos.gni")
|
||||
import("//third_party/NuttX/NuttX.gni")
|
||||
import("$THIRDPARTY_NUTTX_DIR/NuttX.gni")
|
||||
|
||||
module_switch = defined(LOSCFG_FS_RAMFS)
|
||||
module_name = get_path_info(rebase_path("."), "name")
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import("//kernel/liteos_a/liteos.gni")
|
||||
import("//third_party/NuttX/NuttX.gni")
|
||||
import("$THIRDPARTY_NUTTX_DIR/NuttX.gni")
|
||||
|
||||
module_switch = defined(LOSCFG_FS_ROMFS)
|
||||
module_name = get_path_info(rebase_path("."), "name")
|
||||
|
|
|
@ -29,10 +29,9 @@ endchoice
|
|||
config BOOTENV_ADDR
|
||||
int "Address of boot command line (KB)"
|
||||
depends on PLATFORM_ROOTFS && (STORAGE_SPINOR || STORAGE_SPINAND || STORAGE_EMMC)
|
||||
range 0 1024
|
||||
default 512
|
||||
help
|
||||
Boot command line addr, range from 0 to 1MB.
|
||||
Boot command line addr.
|
||||
|
||||
config BOOTENV_RAM
|
||||
bool "Read bootenv from RAM"
|
||||
|
|
|
@ -33,10 +33,6 @@ MODULE_NAME := rootfs
|
|||
|
||||
LOCAL_SRCS := $(wildcard los_rootfs.c los_bootargs.c)
|
||||
|
||||
ifeq ($(LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7), y)
|
||||
LOCAL_INCLUDE += -I $(LITEOSTOPDIR)/../../device/qemu/drivers/cfiflash
|
||||
endif
|
||||
|
||||
LOCAL_FLAGS := $(LOCAL_INCLUDE)
|
||||
|
||||
include $(MODULE)
|
||||
|
|
|
@ -32,14 +32,10 @@
|
|||
#include "los_base.h"
|
||||
#include "string.h"
|
||||
|
||||
#if defined(LOSCFG_STORAGE_SPINOR) || defined(LOSCFG_STORAGE_SPINAND) || defined(LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7)
|
||||
#if defined(LOSCFG_STORAGE_SPINOR) || defined(LOSCFG_STORAGE_SPINAND)
|
||||
#include "mtd_list.h"
|
||||
#endif
|
||||
|
||||
#ifdef LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7
|
||||
#include "cfiflash.h"
|
||||
#endif
|
||||
|
||||
#ifdef LOSCFG_STORAGE_EMMC
|
||||
#include "disk.h"
|
||||
#endif
|
||||
|
@ -98,19 +94,6 @@ INT32 LOS_GetCmdLine(VOID)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7
|
||||
struct MtdDev *mtd = GetCfiMtdDev();
|
||||
if (mtd == NULL) {
|
||||
PRINT_ERR("Get CFI mtd failed!\n");
|
||||
goto ERROUT;
|
||||
}
|
||||
g_alignSize = mtd->eraseSize;
|
||||
ret = mtd->read(mtd, CFIFLASH_BOOTARGS_ADDR, COMMAND_LINE_SIZE, g_cmdLine);
|
||||
if (ret == COMMAND_LINE_SIZE) {
|
||||
return LOS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
PRINT_ERR("Read cmdline error!\n");
|
||||
ERROUT:
|
||||
free(g_cmdLine);
|
||||
|
@ -214,7 +197,7 @@ UINT64 LOS_SizeStrToNum(CHAR *value)
|
|||
UINT64 num = 0;
|
||||
|
||||
/* If the string is a hexadecimal value */
|
||||
if (sscanf_s(value, "0x%x", &num) > 0) {
|
||||
if (sscanf_s(value, "0x%llx", &num) > 0) {
|
||||
value += strlen("0x");
|
||||
if (strspn(value, "0123456789abcdefABCDEF") < strlen(value)) {
|
||||
goto ERROUT;
|
||||
|
@ -247,4 +230,4 @@ UINT64 LOS_SizeStrToNum(CHAR *value)
|
|||
ERROUT:
|
||||
PRINT_ERR("Invalid value string \"%s\"!\n", value);
|
||||
return num;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,15 +37,11 @@
|
|||
#include "sys/stat.h"
|
||||
#include "sys/types.h"
|
||||
|
||||
#if defined(LOSCFG_STORAGE_SPINOR) || defined(LOSCFG_STORAGE_SPINAND) || defined(LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7)
|
||||
#if defined(LOSCFG_STORAGE_SPINOR) || defined(LOSCFG_STORAGE_SPINAND)
|
||||
#include "mtd_list.h"
|
||||
#include "mtd_partition.h"
|
||||
#endif
|
||||
|
||||
#ifdef LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7
|
||||
#include "cfiflash.h"
|
||||
#endif
|
||||
|
||||
#ifdef LOSCFG_STORAGE_EMMC
|
||||
#include "disk.h"
|
||||
#include "ff.h"
|
||||
|
@ -128,14 +124,7 @@ STATIC INT32 AddEmmcParts(INT32 rootAddr, INT32 rootSize, INT32 userAddr, INT32
|
|||
|
||||
STATIC INT32 AddPartitions(CHAR *dev, UINT64 rootAddr, UINT64 rootSize, UINT64 userAddr, UINT64 userSize)
|
||||
{
|
||||
#ifdef LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7
|
||||
if ((strcmp(dev, "cfi-flash") == 0) && (rootAddr != CFIFLASH_ROOT_ADDR)) {
|
||||
PRINT_ERR("Error rootAddr, must be %#0x!\n", CFIFLASH_ROOT_ADDR);
|
||||
return LOS_NOK;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(LOSCFG_STORAGE_SPINOR) || defined(LOSCFG_STORAGE_SPINAND) || defined(LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7)
|
||||
#if defined(LOSCFG_STORAGE_SPINOR) || defined(LOSCFG_STORAGE_SPINAND)
|
||||
INT32 ret;
|
||||
INT32 blk0 = 0;
|
||||
INT32 blk2 = 2;
|
||||
|
@ -327,7 +316,7 @@ STATIC INT32 CheckValidation(UINT64 rootAddr, UINT64 rootSize, UINT64 userAddr,
|
|||
|
||||
if ((rootAddr & (alignSize - 1)) || (rootSize & (alignSize - 1)) ||
|
||||
(userAddr & (alignSize - 1)) || (userSize & (alignSize - 1))) {
|
||||
PRINT_ERR("The address or size value should be 0x%x aligned!\n", alignSize);
|
||||
PRINT_ERR("The address or size value should be 0x%llx aligned!\n", alignSize);
|
||||
return LOS_NOK;
|
||||
}
|
||||
|
||||
|
@ -371,4 +360,4 @@ INT32 OsMountRootfs()
|
|||
}
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue