Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Kernel Liteos A
提交
fe4082ca
K
Kernel Liteos A
项目概览
OpenHarmony
/
Kernel Liteos A
大约 2 年 前同步成功
通知
475
Star
414
Fork
55
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
4
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel Liteos A
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
4
Issue
4
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
fe4082ca
编写于
11月 16, 2021
作者:
O
openharmony_ci
提交者:
Gitee
11月 16, 2021
浏览文件
操作
浏览文件
下载
差异文件
!709 A核代码静态告警定期清理
Merge pull request !709 from wangchen/1112_codex
上级
ac089122
9ba725c3
变更
22
隐藏空白更改
内联
并排
Showing
22 changed file
with
144 addition
and
135 deletion
+144
-135
apps/perf/src/perf.c
apps/perf/src/perf.c
+1
-1
apps/shell/include/shmsg.h
apps/shell/include/shmsg.h
+2
-2
apps/shell/src/main.c
apps/shell/src/main.c
+2
-2
apps/shell/src/shmsg.c
apps/shell/src/shmsg.c
+1
-1
apps/trace/src/trace.c
apps/trace/src/trace.c
+12
-10
arch/arm/arm/src/smp.c
arch/arm/arm/src/smp.c
+1
-1
compat/posix/src/stdlib.c
compat/posix/src/stdlib.c
+1
-1
fs/proc/os_adapt/fs_cache_proc.c
fs/proc/os_adapt/fs_cache_proc.c
+6
-6
fs/vfs/epoll/fs_epoll.c
fs/vfs/epoll/fs_epoll.c
+12
-9
fs/vfs/include/epoll.h
fs/vfs/include/epoll.h
+6
-6
fs/vfs/operation/vfs_check.c
fs/vfs/operation/vfs_check.c
+1
-1
fs/vfs/operation/vfs_fallocate.c
fs/vfs/operation/vfs_fallocate.c
+5
-8
fs/vfs/operation/vfs_fallocate64.c
fs/vfs/operation/vfs_fallocate64.c
+4
-7
fs/vfs/operation/vfs_other.c
fs/vfs/operation/vfs_other.c
+13
-21
kernel/common/console.c
kernel/common/console.c
+3
-2
kernel/extended/dynload/src/los_load_elf.c
kernel/extended/dynload/src/los_load_elf.c
+1
-1
kernel/extended/liteipc/hm_liteipc.c
kernel/extended/liteipc/hm_liteipc.c
+5
-3
kernel/extended/trace/cnv/trace_cnv.c
kernel/extended/trace/cnv/trace_cnv.c
+1
-1
lib/libc/src/memcmp.c
lib/libc/src/memcmp.c
+21
-17
lib/libc/src/memset.c
lib/libc/src/memset.c
+42
-31
shell/full/src/cmds/watch_shellcmd.c
shell/full/src/cmds/watch_shellcmd.c
+1
-1
syscall/fs_syscall.c
syscall/fs_syscall.c
+3
-3
未找到文件。
apps/perf/src/perf.c
浏览文件 @
fe4082ca
...
...
@@ -70,7 +70,7 @@ static void PerfSetPeriod(PerfConfigAttr *attr)
void
PerfPrintBuffer
(
const
char
*
buf
,
ssize_t
num
)
{
#define BYTES_PER_LINE 4
ssize_t
i
=
0
;
ssize_t
i
;
for
(
i
=
0
;
i
<
num
;
i
++
)
{
printf
(
" %02x"
,
(
unsigned
char
)
buf
[
i
]);
if
(((
i
+
1
)
%
BYTES_PER_LINE
)
==
0
)
{
...
...
apps/shell/include/shmsg.h
浏览文件 @
fe4082ca
...
...
@@ -46,7 +46,7 @@ extern "C" {
#define SHELL_EXEC_COMMAND "exec"
#define SHELL_EXEC_COMMAND_BYTES 4
#define CMD_EXEC_COMMAND SHELL_EXEC_COMMAND" "
#define CMD_EXEC_COMMAND_BYTES (SHELL_EXEC_COMMAND_BYTES
+
1)
#define CMD_EXEC_COMMAND_BYTES (SHELL_EXEC_COMMAND_BYTES
+
1)
#define CMD_EXIT_COMMAND "exit"
#define CMD_EXIT_COMMAND_BYTES 4
#define CMD_EXIT_CODE_BASE_DEC 10
...
...
@@ -59,7 +59,7 @@ extern "C" {
#define COLOR_L_RED "\e[1;31m"
#define SHELL_PROMPT COLOR_L_RED"OHOS # "COLOR_NONE
typedef
void
(
*
OutputFunc
)(
const
char
*
fmt
,
...);
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
[]);
...
...
apps/shell/src/main.c
浏览文件 @
fe4082ca
...
...
@@ -110,12 +110,12 @@ static int DoShellExec(char **argv)
}
memset_s
(
cmdLine
,
len
,
0
,
len
);
for
(
j
=
0
;
j
<
i
;
j
++
)
{
for
(
j
=
0
;
j
<
i
;
j
++
)
{
strcat_s
(
cmdLine
,
len
,
argv
[
j
]);
strcat_s
(
cmdLine
,
len
,
" "
);
}
cmdLine
[
len
-
2
]
=
'\0'
;
cmdLine
[
len
-
2
]
=
'\0'
;
/* 2, (len - 2) is the end of cmdline buf */
ret
=
syscall
(
__NR_shellexec
,
argv
[
0
],
cmdLine
);
free
(
cmdLine
);
return
ret
;
...
...
apps/shell/src/shmsg.c
浏览文件 @
fe4082ca
...
...
@@ -391,7 +391,7 @@ int CheckExit(const char *cmdName, const CmdParsed *cmdParsed)
return
-
1
;
}
if
(
cmdParsed
->
paramCnt
==
1
)
{
char
*
p
;
char
*
p
=
NULL
;
ret
=
strtol
(
cmdParsed
->
paramArray
[
0
],
&
p
,
CMD_EXIT_CODE_BASE_DEC
);
if
(
*
p
!=
'\0'
)
{
printf
(
"exit: bad number: %s
\n
"
,
cmdParsed
->
paramArray
[
0
]);
...
...
apps/trace/src/trace.c
浏览文件 @
fe4082ca
...
...
@@ -88,11 +88,13 @@ static void TraceWrite(int fd, int argc, char **argv)
{
int
i
;
UsrEventInfo
info
=
{
0
};
info
.
eventType
=
strtoul
(
argv
[
2
],
NULL
,
0
);
info
.
identity
=
strtoul
(
argv
[
3
],
NULL
,
0
);
info
.
eventType
=
strtoul
(
argv
[
2
],
NULL
,
0
);
/* 2, argv number */
info
.
identity
=
strtoul
(
argv
[
3
],
NULL
,
0
);
/* 3, argv number */
/* 4, argc -4 means user argv that does not contain argv[0]~argv[3] */
int
paramNum
=
(
argc
-
4
)
>
TRACE_USR_MAX_PARAMS
?
TRACE_USR_MAX_PARAMS
:
(
argc
-
4
);
for
(
i
=
0
;
i
<
paramNum
;
i
++
)
{
/* 4, argc -4 means user argv that does not contain argv[0]~argv[3] */
info
.
params
[
i
]
=
strtoul
(
argv
[
4
+
i
],
NULL
,
0
);
}
(
void
)
write
(
fd
,
&
info
,
sizeof
(
UsrEventInfo
));
...
...
@@ -108,22 +110,22 @@ int main(int argc, char **argv)
if
(
argc
==
1
)
{
TraceUsage
();
}
else
if
(
argc
==
2
&&
strcmp
(
argv
[
1
],
"start"
)
==
0
)
{
}
else
if
(
argc
==
2
&&
strcmp
(
argv
[
1
],
"start"
)
==
0
)
{
/* 2, argv num, no special meaning */
ioctl
(
fd
,
TRACE_START
,
NULL
);
}
else
if
(
argc
==
2
&&
strcmp
(
argv
[
1
],
"stop"
)
==
0
)
{
}
else
if
(
argc
==
2
&&
strcmp
(
argv
[
1
],
"stop"
)
==
0
)
{
/* 2, argv num, no special meaning */
ioctl
(
fd
,
TRACE_STOP
,
NULL
);
}
else
if
(
argc
==
2
&&
strcmp
(
argv
[
1
],
"reset"
)
==
0
)
{
}
else
if
(
argc
==
2
&&
strcmp
(
argv
[
1
],
"reset"
)
==
0
)
{
/* 2, argv num, no special meaning */
ioctl
(
fd
,
TRACE_RESET
,
NULL
);
}
else
if
(
argc
==
3
&&
strcmp
(
argv
[
1
],
"mask"
)
==
0
)
{
}
else
if
(
argc
==
3
&&
strcmp
(
argv
[
1
],
"mask"
)
==
0
)
{
/* 3, argv num, no special meaning */
size_t
mask
=
strtoul
(
argv
[
2
],
NULL
,
0
);
ioctl
(
fd
,
TRACE_SET_MASK
,
mask
);
}
else
if
(
argc
==
3
&&
strcmp
(
argv
[
1
],
"dump"
)
==
0
)
{
}
else
if
(
argc
==
3
&&
strcmp
(
argv
[
1
],
"dump"
)
==
0
)
{
/* 3, argv num, no special meaning */
size_t
flag
=
strtoul
(
argv
[
2
],
NULL
,
0
);
ioctl
(
fd
,
TRACE_DUMP
,
flag
);
}
else
if
(
argc
==
3
&&
strcmp
(
argv
[
1
],
"read"
)
==
0
)
{
}
else
if
(
argc
==
3
&&
strcmp
(
argv
[
1
],
"read"
)
==
0
)
{
/* 3, argv num, no special meaning */
size_t
size
=
strtoul
(
argv
[
2
],
NULL
,
0
);
TraceRead
(
fd
,
size
);
}
else
if
(
argc
>=
4
&&
strcmp
(
argv
[
1
],
"write"
)
==
0
)
{
}
else
if
(
argc
>=
4
&&
strcmp
(
argv
[
1
],
"write"
)
==
0
)
{
/* 4, argv num, no special meaning */
TraceWrite
(
fd
,
argc
,
argv
);
}
else
{
printf
(
"Unsupported trace command.
\n
"
);
...
...
arch/arm/arm/src/smp.c
浏览文件 @
fe4082ca
...
...
@@ -55,7 +55,7 @@ VOID HalArchCpuOn(UINT32 cpuNum, ArchCpuStartFunc func, struct SmpOps *ops, VOID
{
struct
OsCpuInit
*
cpuInit
=
&
g_cpuInit
[
cpuNum
-
1
];
UINTPTR
startEntry
=
(
UINTPTR
)
&
reset_vector
-
KERNEL_VMM_BASE
+
SYS_MEM_BASE
;
INT32
ret
=
0
;
INT32
ret
;
cpuInit
->
cpuStart
=
func
;
cpuInit
->
arg
=
arg
;
...
...
compat/posix/src/stdlib.c
浏览文件 @
fe4082ca
...
...
@@ -47,7 +47,7 @@ void srand(unsigned s)
int
rand
(
void
)
{
return
random
();
return
random
();
}
void
_exit
(
int
status
)
...
...
fs/proc/os_adapt/fs_cache_proc.c
浏览文件 @
fe4082ca
...
...
@@ -136,16 +136,16 @@ static int PageCacheMapProcess(struct SeqBuf *buf)
static
int
FsCacheInfoFill
(
struct
SeqBuf
*
buf
,
void
*
arg
)
{
int
vnodeFree
=
0
;
int
vnodeActive
=
0
;
int
vnodeVirtual
=
0
;
int
vnodeTotal
=
0
;
int
vnodeFree
;
int
vnodeActive
;
int
vnodeVirtual
;
int
vnodeTotal
;
int
pathCacheTotal
=
0
;
int
pathCacheTotal
;
int
pathCacheTotalTry
=
0
;
int
pathCacheTotalHit
=
0
;
int
pageCacheTotal
=
0
;
int
pageCacheTotal
;
int
pageCacheTotalTry
=
0
;
int
pageCacheTotalHit
=
0
;
...
...
fs/vfs/epoll/fs_epoll.c
浏览文件 @
fe4082ca
...
...
@@ -71,8 +71,8 @@ static int EpollAllocSysFd(int maxfdp, struct epoll_head *head)
fd_set
*
fdset
=
&
g_epollFdSet
;
for
(
i
=
0
;
i
<
maxfdp
;
i
++
)
{
if
(
fdset
&&
!
(
FD_ISSET
(
i
+
EPOLL_FD_OFFSET
,
fdset
)))
{
FD_SET
(
i
+
EPOLL_FD_OFFSET
,
fdset
);
if
(
fdset
&&
!
(
FD_ISSET
(
i
,
fdset
)))
{
FD_SET
(
i
,
fdset
);
if
(
!
g_epPrivBuf
[
i
])
{
g_epPrivBuf
[
i
]
=
head
;
return
i
+
EPOLL_FD_OFFSET
;
...
...
@@ -92,17 +92,17 @@ static int EpollAllocSysFd(int maxfdp, struct epoll_head *head)
*/
static
int
EpollFreeSysFd
(
int
fd
)
{
int
i
d
=
fd
-
EPOLL_FD_OFFSET
;
int
ef
d
=
fd
-
EPOLL_FD_OFFSET
;
if
((
id
<
0
)
||
(
i
d
>=
MAX_EPOLL_FD
))
{
if
((
efd
<
0
)
||
(
ef
d
>=
MAX_EPOLL_FD
))
{
set_errno
(
EMFILE
);
return
-
1
;
}
fd_set
*
fdset
=
&
g_epollFdSet
;
if
(
fdset
&&
FD_ISSET
(
fd
,
fdset
))
{
FD_CLR
(
i
d
,
fdset
);
g_epPrivBuf
[
i
d
]
=
NULL
;
if
(
fdset
&&
FD_ISSET
(
e
fd
,
fdset
))
{
FD_CLR
(
ef
d
,
fdset
);
g_epPrivBuf
[
ef
d
]
=
NULL
;
}
return
0
;
...
...
@@ -159,7 +159,8 @@ static VOID DoEpollClose(struct epoll_head *epHead)
free
(
epHead
);
}
return
;
return
;
}
/**
...
...
@@ -236,7 +237,7 @@ int epoll_ctl(int epfd, int op, int fd, struct epoll_event *ev)
int
ret
=
-
1
;
epHead
=
EpollGetDataBuff
(
epfd
);
if
(
epHead
==
NULL
)
{
if
(
epHead
==
NULL
)
{
set_errno
(
EBADF
);
return
ret
;
}
...
...
@@ -328,6 +329,7 @@ int epoll_wait(int epfd, FAR struct epoll_event *evs, int maxevents, int timeout
ret
=
poll
(
pFd
,
pollSize
,
timeout
);
if
(
ret
<=
0
)
{
free
(
pFd
);
return
0
;
}
...
...
@@ -339,6 +341,7 @@ int epoll_wait(int epfd, FAR struct epoll_event *evs, int maxevents, int timeout
}
}
free
(
pFd
);
return
i
;
}
fs/vfs/include/epoll.h
浏览文件 @
fe4082ca
...
...
@@ -61,15 +61,15 @@ extern "C" {
#define EPOLL_CTL_MOD 3
typedef
union
epoll_data
{
void
*
ptr
;
int
fd
;
UINT32
u32
;
UINT64
u64
;
void
*
ptr
;
int
fd
;
UINT32
u32
;
UINT64
u64
;
}
epoll_data_t
;
struct
epoll_event
{
UINT32
events
;
epoll_data_t
data
;
UINT32
events
;
epoll_data_t
data
;
};
int
epoll_create
(
int
size
);
...
...
fs/vfs/operation/vfs_check.c
浏览文件 @
fe4082ca
...
...
@@ -63,7 +63,7 @@ int fscheck(const char *path)
dir
=
(
struct
fs_dirent_s
*
)
zalloc
(
sizeof
(
struct
fs_dirent_s
));
if
(
!
dir
)
{
/* Insufficient memory to complete the operation.*/
/* Insufficient memory to complete the operation.
*/
ret
=
-
ENOMEM
;
VnodeDrop
();
goto
errout
;
...
...
fs/vfs/operation/vfs_fallocate.c
浏览文件 @
fe4082ca
...
...
@@ -120,23 +120,20 @@ int fallocate(int fd, int mode, off_t offset, off_t len)
#if CONFIG_NFILE_DESCRIPTORS > 0
/* The descriptor is in the right range to be a file descriptor... write to the file.*/
/* The descriptor is in the right range to be a file descriptor... write to the file.
*/
int
ret
=
fs_getfilep
(
fd
,
&
filep
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
/* The errno value has already been set */
return
VFS_ERROR
;
}
}
if
(
filep
->
f_oflags
&
O_DIRECTORY
)
{
if
(
filep
->
f_oflags
&
O_DIRECTORY
)
{
set_errno
(
EBADF
);
return
VFS_ERROR
;
}
}
/* Perform the fallocate operation using the file descriptor as an index */
return
file_fallocate
(
filep
,
mode
,
offset
,
len
);
#endif
}
fs/vfs/operation/vfs_fallocate64.c
浏览文件 @
fe4082ca
...
...
@@ -128,20 +128,17 @@ int fallocate64(int fd, int mode, off64_t offset, off64_t len)
*/
int
ret
=
fs_getfilep
(
fd
,
&
filep
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
/* The errno value has already been set */
return
VFS_ERROR
;
}
}
if
(
filep
->
f_oflags
&
O_DIRECTORY
)
{
if
(
filep
->
f_oflags
&
O_DIRECTORY
)
{
set_errno
(
EBADF
);
return
VFS_ERROR
;
}
}
/* Perform the fallocate operation using the file descriptor as an index */
return
file_fallocate64
(
filep
,
mode
,
offset
,
len
);
#endif
}
fs/vfs/operation/vfs_other.c
浏览文件 @
fe4082ca
...
...
@@ -84,6 +84,7 @@ int VfsVnodePermissionCheck(const struct Vnode *node, int accMode)
uint
fileMode
=
node
->
mode
;
return
VfsPermissionCheck
(
fuid
,
fgid
,
fileMode
,
accMode
);
}
int
VfsPermissionCheck
(
uint
fuid
,
uint
fgid
,
uint
fileMode
,
int
accMode
)
{
uint
uid
=
OsCurrUserGet
()
->
effUserID
;
...
...
@@ -196,11 +197,10 @@ int chdir(const char *path)
#ifdef VFS_USING_WORKDIR
ret
=
SetWorkDir
(
fullpath
,
strlen
(
fullpath
));
if
(
ret
!=
0
)
{
if
(
ret
!=
0
)
{
PRINT_ERR
(
"chdir path error!
\n
"
);
ret
=
-
1
;
}
}
#endif
/* release normalize directory path name */
...
...
@@ -235,19 +235,17 @@ char *getcwd(char *buf, size_t n)
#ifdef VFS_USING_WORKDIR
spin_lock_irqsave
(
&
curr
->
files
->
workdir_lock
,
lock_flags
);
len
=
strlen
(
curr
->
files
->
workdir
);
if
(
n
<=
len
)
{
if
(
n
<=
len
)
{
set_errno
(
ERANGE
);
spin_unlock_irqrestore
(
&
curr
->
files
->
workdir_lock
,
lock_flags
);
return
NULL
;
}
}
ret
=
memcpy_s
(
buf
,
n
,
curr
->
files
->
workdir
,
len
+
1
);
if
(
ret
!=
EOK
)
{
if
(
ret
!=
EOK
)
{
set_errno
(
ENAMETOOLONG
);
spin_unlock_irqrestore
(
&
curr
->
files
->
workdir_lock
,
lock_flags
);
return
NULL
;
}
}
spin_unlock_irqrestore
(
&
curr
->
files
->
workdir_lock
,
lock_flags
);
#else
PRINT_ERR
(
"NO_WORKING_DIR
\n
"
);
...
...
@@ -393,8 +391,7 @@ static struct dirent **scandir_get_file_list(const char *dir, int *num, int(*fil
int
scandir
(
const
char
*
dir
,
struct
dirent
***
namelist
,
int
(
*
filter
)(
const
struct
dirent
*
),
int
(
*
compar
)(
const
struct
dirent
**
,
const
struct
dirent
**
))
int
(
*
compar
)(
const
struct
dirent
**
,
const
struct
dirent
**
))
{
int
n
=
0
;
struct
dirent
**
list
=
NULL
;
...
...
@@ -409,7 +406,6 @@ int scandir(const char *dir, struct dirent ***namelist,
}
/* Change to return to the array size */
*
namelist
=
(
struct
dirent
**
)
malloc
(
n
*
sizeof
(
struct
dirent
*
));
if
(
*
namelist
==
NULL
&&
n
>
0
)
{
*
namelist
=
list
;
...
...
@@ -447,18 +443,16 @@ char *rindex(const char *s, int c)
static
char
*
ls_get_fullpath
(
const
char
*
path
,
struct
dirent
*
pdirent
)
{
char
*
fullpath
=
NULL
;
int
ret
=
0
;
int
ret
;
if
(
path
[
1
]
!=
'\0'
)
{
/* 2: The position of the path character: / and the end character /0 */
/* 2, The position of the path character: / and the end character '/0' */
fullpath
=
(
char
*
)
malloc
(
strlen
(
path
)
+
strlen
(
pdirent
->
d_name
)
+
2
);
if
(
fullpath
==
NULL
)
{
goto
exit_with_nomem
;
}
/* 2: The position of the path character: / and the end character /0 */
/* 2, The position of the path character: / and the end character '/0' */
ret
=
snprintf_s
(
fullpath
,
strlen
(
path
)
+
strlen
(
pdirent
->
d_name
)
+
2
,
strlen
(
path
)
+
strlen
(
pdirent
->
d_name
)
+
1
,
"%s/%s"
,
path
,
pdirent
->
d_name
);
if
(
ret
<
0
)
{
...
...
@@ -467,15 +461,13 @@ static char *ls_get_fullpath(const char *path, struct dirent *pdirent)
return
NULL
;
}
}
else
{
/* 2: The position of the path character: / and the end character /0 */
/* 2, The position of the path character: / and the end character '/0' */
fullpath
=
(
char
*
)
malloc
(
strlen
(
pdirent
->
d_name
)
+
2
);
if
(
fullpath
==
NULL
)
{
goto
exit_with_nomem
;
}
/* 2: The position of the path character: / and the end character /0 */
/* 2, The position of the path character: / and the end character '/0' */
ret
=
snprintf_s
(
fullpath
,
strlen
(
pdirent
->
d_name
)
+
2
,
strlen
(
pdirent
->
d_name
)
+
1
,
"/%s"
,
pdirent
->
d_name
);
if
(
ret
<
0
)
{
...
...
kernel/common/console.c
浏览文件 @
fe4082ca
...
...
@@ -444,7 +444,8 @@ VOID KillPgrp(UINT16 consoleId)
if
((
consoleId
>
CONSOLE_NUM
)
||
(
consoleId
<=
0
))
{
return
;
}
CONSOLE_CB
*
consoleCB
=
g_console
[
consoleId
-
1
];
CONSOLE_CB
*
consoleCB
=
g_console
[
consoleId
-
1
];
/* the default of consoleCB->pgrpId is -1, may not be set yet, avoid killing all processes */
if
(
consoleCB
->
pgrpId
<
0
)
{
return
;
...
...
@@ -1445,7 +1446,7 @@ BOOL ConsoleEnable(VOID)
BOOL
IsShellEntryRunning
(
UINT32
shellEntryId
)
{
LosTaskCB
*
taskCB
;
LosTaskCB
*
taskCB
=
NULL
;
if
(
shellEntryId
==
SHELL_ENTRYID_INVALID
)
{
return
FALSE
;
}
...
...
kernel/extended/dynload/src/los_load_elf.c
浏览文件 @
fe4082ca
...
...
@@ -225,7 +225,7 @@ STATIC INT32 OsReadEhdr(const CHAR *fileName, ELFInfo *elfInfo, BOOL isExecFile)
#ifdef LOSCFG_DRIVERS_TZDRIVER
if
(
isExecFile
)
{
struct
file
*
filep
;
struct
file
*
filep
=
NULL
;
ret
=
fs_getfilep
(
GetAssociatedSystemFd
(
elfInfo
->
procfd
),
&
filep
);
if
(
ret
)
{
PRINT_ERR
(
"%s[%d], Failed to get struct file %s!
\n
"
,
__FUNCTION__
,
__LINE__
,
fileName
);
...
...
kernel/extended/liteipc/hm_liteipc.c
浏览文件 @
fe4082ca
...
...
@@ -239,8 +239,10 @@ LITE_OS_SEC_TEXT STATIC int LiteIpcMmap(struct file *filep, LosVmMapRegion *regi
ERROR_MAP_OUT:
LOS_VFree
(
ipcInfo
->
pool
.
kvaddr
);
ERROR_REGION_OUT:
ipcInfo
->
pool
.
uvaddr
=
NULL
;
ipcInfo
->
pool
.
kvaddr
=
NULL
;
if
(
ipcInfo
!=
NULL
)
{
ipcInfo
->
pool
.
uvaddr
=
NULL
;
ipcInfo
->
pool
.
kvaddr
=
NULL
;
}
return
ret
;
}
...
...
@@ -979,7 +981,7 @@ LITE_OS_SEC_TEXT STATIC UINT32 CheckPara(IpcContent *content, UINT32 *dstTid)
}
#endif
OsHookCall
(
LOS_HOOK_TYPE_IPC_WRITE_DROP
,
msg
,
*
dstTid
,
(
*
dstTid
==
INVAILD_ID
)
?
INVAILD_ID
:
OS_TCB_FROM_TID
(
*
dstTid
)
->
processID
,
0
);
(
*
dstTid
==
INVAILD_ID
)
?
INVAILD_ID
:
OS_TCB_FROM_TID
(
*
dstTid
)
->
processID
,
0
);
PRINT_ERR
(
"Liteipc A timeout reply, request timestamp:%lld, now:%lld
\n
"
,
msg
->
timestamp
,
now
);
return
-
ETIME
;
}
...
...
kernel/extended/trace/cnv/trace_cnv.c
浏览文件 @
fe4082ca
...
...
@@ -262,7 +262,7 @@ STATIC VOID LOS_TraceUsrEvent(VOID *buffer, UINT32 len)
return
;
}
LOS_TRACE_EASY
(
info
->
eventType
&
(
~
TRACE_USER_DEFAULT_FLAG
),
info
->
identity
,
info
->
params
[
0
],
info
->
params
[
1
],
info
->
params
[
2
]);
info
->
params
[
2
]);
/* 2, params num, no special meaning */
LOS_MemFree
(
m_aucSysMem0
,
buffer
);
#endif
}
...
...
lib/libc/src/memcmp.c
浏览文件 @
fe4082ca
...
...
@@ -36,39 +36,43 @@ int memcmp(const void *str1, const void *str2, size_t n)
const
unsigned
char
*
s1
=
str1
;
const
unsigned
char
*
s2
=
str2
;
size_t
num
=
n
;
while
(
n
>=
8
)
{
while
(
n
um
>=
8
)
{
/* 8, compare size, the number of chars of one uint64_t data */
if
(
*
(
const
uint64_t
*
)(
s1
)
!=
*
(
const
uint64_t
*
)(
s2
))
{
goto
L8_byte_diff
;
}
s1
+=
8
;
s2
+=
8
;
n
-=
8
;
s1
+=
8
;
/* 8, compare size, the number of chars of one uint64_t data */
s2
+=
8
;
/* 8, compare size, the number of chars of one uint64_t data */
num
-=
8
;
/* 8, compare size, the number of chars of one uint64_t data */
}
if
(
num
==
0
)
{
return
0
;
}
if
(
n
==
0
)
return
0
;
/* L4_byte_cmp */
if
(
n
>=
4
)
{
if
(
n
um
>=
4
)
{
/* 4, compare size, the number of chars of one uint32_t data */
if
(
*
(
const
uint32_t
*
)(
s1
)
!=
*
(
const
uint32_t
*
)(
s2
))
{
goto
L4_byte_diff
;
}
s1
+=
4
;
s2
+=
4
;
n
-=
4
;
s1
+=
4
;
/* 4, compare size, the number of chars of one uint32_t data */
s2
+=
4
;
/* 4, compare size, the number of chars of one uint32_t data */
num
-=
4
;
/* 4, compare size, the number of chars of one uint32_t data */
}
if
(
num
==
0
)
{
return
0
;
}
if
(
n
==
0
)
return
0
;
L4_byte_diff:
for
(;
n
&&
(
*
s1
==
*
s2
);
n
--
,
s1
++
,
s2
++
);
return
n
?
*
s1
-
*
s2
:
0
;
for
(;
num
&&
(
*
s1
==
*
s2
);
num
--
,
s1
++
,
s2
++
)
{
}
return
num
?
*
s1
-
*
s2
:
0
;
L8_byte_diff:
if
(
*
(
const
uint32_t
*
)(
s1
)
!=
*
(
const
uint32_t
*
)(
s2
))
{
goto
L4_byte_diff
;
}
s1
+=
4
;
s2
+=
4
;
n
-=
4
;
s1
+=
4
;
/* 4, compare size, the number of chars of one uint32_t data */
s2
+=
4
;
/* 4, compare size, the number of chars of one uint32_t data */
n
um
-=
4
;
/* 4, compare size, the number of chars of one uint32_t data */
goto
L4_byte_diff
;
}
\ No newline at end of file
lib/libc/src/memset.c
浏览文件 @
fe4082ca
...
...
@@ -38,25 +38,28 @@ void *memset(void *dest, int c, size_t n)
char
*
pos
=
dest
;
uint32_t
c32
=
0
;
uint64_t
c64
=
0
;
size_t
num
=
n
;
if
(
n
==
0
)
return
dest
;
if
(
num
==
0
)
{
return
dest
;
}
c
=
c
&
0xFF
;
if
(
c
)
{
c32
=
c
;
c32
|=
c32
<<
8
;
c32
|=
c32
<<
16
;
c32
|=
c32
<<
8
;
/* 8, Processed bits */
c32
|=
c32
<<
16
;
/* 16, Processed bits */
c64
=
c32
;
c64
|=
c64
<<
32
;
c64
|=
c64
<<
32
;
/* 32, Processed bits */
}
if
(((
uintptr_t
)(
pos
)
&
7
)
!=
0
)
{
int
unalignedCnt
=
8
-
((
uintptr_t
)(
pos
)
&
7
);
if
(
n
>=
unalignedCnt
)
{
n
=
n
-
unalignedCnt
;
if
(((
uintptr_t
)(
pos
)
&
7
)
!=
0
)
{
/* 7, Processed align */
int
unalignedCnt
=
8
-
((
uintptr_t
)(
pos
)
&
7
);
/* 7, 8, for calculate addr bits align */
if
(
n
um
>=
unalignedCnt
)
{
n
um
=
num
-
unalignedCnt
;
}
else
{
unalignedCnt
=
n
;
n
=
0
;
unalignedCnt
=
n
um
;
n
um
=
0
;
}
for
(
int
loop
=
1
;
loop
<=
unalignedCnt
;
++
loop
)
{
*
pos
=
(
char
)
c
;
...
...
@@ -65,41 +68,49 @@ void *memset(void *dest, int c, size_t n)
}
/* L32_byte_aligned */
while
(
n
>=
32
)
{
while
(
n
um
>=
32
)
{
/* 32, byte aligned */
*
(
uint64_t
*
)(
pos
)
=
c64
;
*
(
uint64_t
*
)(
pos
+
8
)
=
c64
;
*
(
uint64_t
*
)(
pos
+
16
)
=
c64
;
*
(
uint64_t
*
)(
pos
+
24
)
=
c64
;
n
-=
32
;
pos
+=
32
;
*
(
uint64_t
*
)(
pos
+
8
)
=
c64
;
/* 8, size of uint64_t */
*
(
uint64_t
*
)(
pos
+
16
)
=
c64
;
/* 16, size of two uint64_t data */
*
(
uint64_t
*
)(
pos
+
24
)
=
c64
;
/* 24, size of three uint64_t data */
num
-=
32
;
/* 32, size of four uint64_t data */
pos
+=
32
;
/* 32, size of four uint64_t data */
}
if
(
num
==
0
)
{
return
dest
;
}
if
(
n
==
0
)
return
dest
;
/* L16_byte_aligned */
if
(
n
>=
16
)
{
if
(
n
um
>=
16
)
{
/* 16, byte aligned */
*
(
uint64_t
*
)(
pos
)
=
c64
;
*
(
uint64_t
*
)(
pos
+
8
)
=
c64
;
n
-=
16
;
pos
+=
16
;
if
(
n
==
0
)
return
dest
;
*
(
uint64_t
*
)(
pos
+
8
)
=
c64
;
/* 8, size of uint64_t */
num
-=
16
;
/* 16, size of two uint64_t data */
pos
+=
16
;
/* 16, size of two uint64_t data */
if
(
num
==
0
)
{
return
dest
;
}
}
/* L8_byte_aligned */
if
(
n
>=
8
)
{
if
(
n
um
>=
8
)
{
/* 8, byte aligned */
*
(
uint64_t
*
)(
pos
)
=
c64
;
n
-=
8
;
pos
+=
8
;
if
(
n
==
0
)
return
dest
;
num
-=
8
;
/* 8, size of uint64_t */
pos
+=
8
;
/* 8, size of uint64_t */
if
(
num
==
0
)
{
return
dest
;
}
}
/* L4_byte_aligned */
if
(
n
>=
4
)
{
if
(
n
um
>=
4
)
{
/* 4, byte aligned */
*
(
uint32_t
*
)(
pos
)
=
c32
;
n
-=
4
;
pos
+=
4
;
if
(
n
==
0
)
return
dest
;
num
-=
4
;
/* 4, size of uint32_t */
pos
+=
4
;
/* 4, size of uint32_t */
if
(
num
==
0
)
{
return
dest
;
}
}
while
(
n
--
)
{
while
(
n
um
--
)
{
*
pos
++
=
c
;
}
...
...
shell/full/src/cmds/watch_shellcmd.c
浏览文件 @
fe4082ca
...
...
@@ -217,7 +217,7 @@ UINT32 OsShellCmdWatch(UINT32 argc, const CHAR **argv)
{
WatchCB
*
watchItem
=
NULL
;
UINT32
argoff
=
0
;
UINT32
ret
=
0
;
UINT32
ret
;
INT32
err
;
if
(
argc
==
0
)
{
...
...
syscall/fs_syscall.c
浏览文件 @
fe4082ca
...
...
@@ -2503,7 +2503,7 @@ int SysFstatfs(int fd, struct statfs *buf)
int
SysFstatfs64
(
int
fd
,
size_t
sz
,
struct
statfs
*
buf
)
{
int
ret
=
0
;
int
ret
;
if
(
sz
!=
sizeof
(
struct
statfs
))
{
ret
=
-
EINVAL
;
...
...
@@ -2654,13 +2654,13 @@ int SysEpollCtl(int epfd, int op, int fd, struct epoll_event *ev)
ret
=
epoll_ctl
(
epfd
,
op
,
fd
,
ev
);
if
(
ret
<
0
)
{
ret
=-
EBADF
;
ret
=
-
EBADF
;
goto
OUT
;
}
CPY_TO_USER
(
ev
);
OUT:
return
(
ret
==
-
1
)
?
-
get_errno
()
:
ret
;
return
(
ret
==
-
1
)
?
-
get_errno
()
:
ret
;
}
int
SysEpollWait
(
int
epfd
,
struct
epoll_event
*
evs
,
int
maxevents
,
int
timeout
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录