!531 fix: 修复liteos-m在iar环境下的编译问题

Merge pull request !531 from zhushengle/iar
This commit is contained in:
openharmony_ci 2022-01-11 10:46:48 +00:00 committed by Gitee
commit 4a9d1f0c51
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 20 additions and 10 deletions

View File

@ -44,7 +44,7 @@ INT32 OsShellCmdHelp(INT32 argc, const CHAR **argv)
(VOID)argv;
if (argc > 0) {
PRINTK("\nUsage: help\n");
return OS_ERROR;
return (INT32)OS_ERROR;
}
PRINTK("*******************shell commands:*************************\n");

View File

@ -52,7 +52,7 @@ INT32 OsShellCmdDumpTask(INT32 argc, const CHAR **argv)
return OsShellCmdTskInfoGet((UINT32)taskId);
} else {
PRINTK("\nUsage: task\n");
return OS_ERROR;
return (INT32)OS_ERROR;
}
}

View File

@ -386,7 +386,7 @@ STATIC INT32 OsShellCmdDoCp(const CHAR *srcFilePath, const CHAR *dstFileName)
CHAR *dstFilePath = NULL;
CHAR *buf = NULL;
const CHAR *filename = NULL;
size_t rdSize, wrSize;
ssize_t rdSize, wrSize;
INT32 srcFd = -1;
INT32 dstFd = -1;
struct stat statBuf;
@ -646,7 +646,7 @@ STATIC INT32 OsWildcardDeleteFileOrDir(const CHAR *fullpath, wildcard_type mark)
ret = rmdir(fullpath);
break;
default:
return VFS_ERROR;
return (INT32)VFS_ERROR;
}
if (ret == -1) {
PRINTK("%s ", fullpath);
@ -787,7 +787,7 @@ STATIC INT32 OsWildcardExtractDirectory(CHAR *fullpath, VOID *dst, wildcard_type
return ret;
closedir_out:
(VOID)closedir(d);
return VFS_ERROR;
return (INT32)VFS_ERROR;
}
INT32 OsShellCmdCp(INT32 argc, const CHAR **argv)
@ -873,7 +873,7 @@ errout_with_path:
free(drcFullPath);
errout_with_srcpath:
free(srcFullPath);
return VFS_ERROR;
return (INT32)VFS_ERROR;
}
STATIC INLINE VOID PrintRmUsage(VOID)

View File

@ -38,6 +38,8 @@
#include "los_config.h"
#include "los_task.h"
#define PTHREAD_DEFAULT_NAME "pthread"
#define PTHREAD_DEFAULT_NAME_LEN 8
#define PTHREAD_NAMELEN 16
#define PTHREAD_KEY_UNUSED 0
#define PTHREAD_KEY_USED 1
@ -113,6 +115,12 @@ static int PthreadCreateAttrInit(const pthread_attr_t *attr, void *(*startRoutin
return ENOMEM;
}
errno_t error = memcpy_s(pthreadData->name, PTHREAD_NAMELEN, PTHREAD_DEFAULT_NAME, PTHREAD_DEFAULT_NAME_LEN);
if (error != EOK) {
free(pthreadData);
return error;
}
pthreadData->startRoutine = startRoutine;
pthreadData->param = arg;
pthreadData->key = NULL;
@ -142,9 +150,6 @@ int pthread_create(pthread_t *thread, const pthread_attr_t *attr,
return ret;
}
/* set pthread default name */
(void)sprintf_s(taskInitParam.pcName, PTHREAD_NAMELEN, "pthread%u", taskID);
if (LOS_TaskCreateOnly(&taskID, &taskInitParam) != LOS_OK) {
free((VOID *)(UINTPTR)taskInitParam.uwArg);
return EINVAL;
@ -258,9 +263,9 @@ void pthread_exit(void *retVal)
intSave = LOS_IntLock();
LOS_ListDelete(&pthreadData->threadList);
tcb->taskName = PTHREAD_DEFAULT_NAME;
LOS_IntRestore(intSave);
free(pthreadData);
(void)LOS_TaskDelete(tcb->taskID);
}
@ -279,6 +284,11 @@ int pthread_setname_np(pthread_t thread, const char *name)
taskCB = OS_TCB_FROM_TID((UINT32)thread);
intSave = LOS_IntLock();
if (taskCB->taskStatus & OS_TASK_STATUS_EXIT) {
LOS_IntRestore(intSave);
return EINVAL;
}
if (taskCB->taskEntry == PthreadEntry) {
(void)strcpy_s(taskName, PTHREAD_NAMELEN, name);
} else {