\fix: M核用例编译问题修复
【背景】M核用例编译问题修复 【修改方案】 1, 添加musl缺失的fcntl 2,删除musl下对fcntl和ioctl的依赖 3,修改fs和vfs种fcntl入参的处理 【影响】 对现有的产品编译不会有影响。 re #I5PKBJ Signed-off-by: wangchen <wangchen240@huawei.com>
This commit is contained in:
@@ -44,6 +44,7 @@
|
||||
#include "sys/stat.h"
|
||||
#include "sys/uio.h"
|
||||
#include "unistd.h"
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
@@ -83,6 +84,9 @@ int LOS_FsMount(const char *source, const char *target,
|
||||
const char *fsType, unsigned long mountflags,
|
||||
const void *data);
|
||||
|
||||
int OsFcntl(int fd, int cmd, va_list ap);
|
||||
int OsIoctl(int fd, int req, va_list ap);
|
||||
|
||||
struct PartitionCfg {
|
||||
/* partition low-level read func */
|
||||
int (*readFunc)(int partition, UINT32 *offset, void *buf, UINT32 size);
|
||||
|
||||
+24
-14
@@ -582,17 +582,13 @@ static int VfsRename(const char *old, const char *new)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int VfsIoctl(int fd, int func, ...)
|
||||
static int VfsIoctl(int fd, int func, va_list ap)
|
||||
{
|
||||
va_list ap;
|
||||
unsigned long arg;
|
||||
struct File *file = NULL;
|
||||
int ret = (int)LOS_NOK;
|
||||
|
||||
va_start(ap, func);
|
||||
arg = va_arg(ap, unsigned long);
|
||||
va_end(ap);
|
||||
|
||||
file = VfsAttachFileReady(fd);
|
||||
if (file == NULL) {
|
||||
return ret;
|
||||
@@ -1143,12 +1139,10 @@ int LOS_Fstat(int fd, struct stat *buf)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int LOS_Fcntl(int fd, int cmd, ...)
|
||||
int OsFcntl(int fd, int cmd, va_list ap)
|
||||
{
|
||||
struct File *filep = NULL;
|
||||
va_list ap;
|
||||
int ret;
|
||||
va_start(ap, cmd);
|
||||
|
||||
if (fd < CONFIG_NFILE_DESCRIPTORS) {
|
||||
filep = VfsAttachFileReady(fd);
|
||||
@@ -1159,13 +1153,10 @@ int LOS_Fcntl(int fd, int cmd, ...)
|
||||
#ifdef LOSCFG_NET_LWIP_SACK
|
||||
int arg = va_arg(ap, int);
|
||||
ret = lwip_fcntl(fd, (long)cmd, arg);
|
||||
va_end(ap);
|
||||
return ret;
|
||||
#endif /* LOSCFG_NET_LWIP_SACK */
|
||||
}
|
||||
|
||||
va_end(ap);
|
||||
|
||||
if (ret < 0) {
|
||||
VFS_ERRNO_SET(-ret);
|
||||
ret = (int)LOS_NOK;
|
||||
@@ -1173,11 +1164,21 @@ int LOS_Fcntl(int fd, int cmd, ...)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int LOS_Ioctl(int fd, int req, ...)
|
||||
int LOS_Fcntl(int fd, int cmd, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int ret;
|
||||
va_start(ap, cmd);
|
||||
ret = OsFcntl(fd, cmd, ap);
|
||||
va_end(ap);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int OsIoctl(int fd, int req, va_list ap)
|
||||
{
|
||||
int ret;
|
||||
va_list ap;
|
||||
va_start(ap, req);
|
||||
|
||||
if (fd < CONFIG_NFILE_DESCRIPTORS) {
|
||||
ret = VfsIoctl(fd, req, ap);
|
||||
} else {
|
||||
@@ -1188,6 +1189,15 @@ int LOS_Ioctl(int fd, int req, ...)
|
||||
#endif /* LOSCFG_NET_LWIP_SACK */
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int LOS_Ioctl(int fd, int req, ...)
|
||||
{
|
||||
int ret;
|
||||
va_list ap;
|
||||
va_start(ap, req);
|
||||
ret = OsIoctl(fd, req, ap);
|
||||
va_end(ap);
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user