diff --git a/porting/liteos_m/kernel/src/stdio/__fdopen.c b/porting/liteos_m/kernel/src/stdio/__fdopen.c index bc50be7d67184e69843213308417c19249231379..868121e7e496e19a256cb1c0b60da40e1b9e3986 100644 --- a/porting/liteos_m/kernel/src/stdio/__fdopen.c +++ b/porting/liteos_m/kernel/src/stdio/__fdopen.c @@ -6,11 +6,6 @@ #include #include -int ioctl(int fd, int req, ...) -{ - return 0; -} - FILE *__fdopen(int fd, const char *mode) { FILE *f; @@ -32,9 +27,6 @@ FILE *__fdopen(int fd, const char *mode) /* Impose mode restrictions */ if (!strchr(mode, '+')) f->flags = (*mode == 'r') ? F_NOWR : F_NORD; - /* Apply close-on-exec flag */ - if (strchr(mode, 'e')) fcntl(fd, F_SETFD, FD_CLOEXEC); - /* Set append mode on fd if opened for append */ if (*mode == 'a') { int flags = fcntl(fd, F_GETFL); @@ -51,7 +43,7 @@ FILE *__fdopen(int fd, const char *mode) /* Activate line buffered mode for terminals */ f->lbf = EOF; - if (!(f->flags & F_NOWR) && !ioctl(fd, TIOCGWINSZ, &wsz)) + if (!(f->flags & F_NOWR)) f->lbf = '\n'; /* Initialize op ptrs. No problem if some are unneeded. */ diff --git a/porting/liteos_m/kernel/src/stdio/__stdout_write.c b/porting/liteos_m/kernel/src/stdio/__stdout_write.c index 8205b7b7bbbfd41ed4e4d57e1fa688010b88f665..b8228d4a6cdb891ff79007e6cb609c0e5dd35d88 100644 --- a/porting/liteos_m/kernel/src/stdio/__stdout_write.c +++ b/porting/liteos_m/kernel/src/stdio/__stdout_write.c @@ -3,8 +3,7 @@ size_t __stdout_write(FILE *f, const unsigned char *buf, size_t len) { - struct winsize wsz; - if (!(f->flags & F_SVB) && ioctl(f->fd, TIOCGWINSZ, &wsz)) { + if (!(f->flags & F_SVB)) { f->lbf = EOF; } return __stdio_write(f, buf, len); diff --git a/porting/liteos_m/kernel/src/stdio/fopen.c b/porting/liteos_m/kernel/src/stdio/fopen.c index 56086846694651fc00472262b7b3a9c8d99a3a7c..7709f99e5112488a688ef185eba02e47d626a472 100644 --- a/porting/liteos_m/kernel/src/stdio/fopen.c +++ b/porting/liteos_m/kernel/src/stdio/fopen.c @@ -22,8 +22,6 @@ FILE *fopen(const char *restrict filename, const char *restrict mode) fd = open(filename, flags, 0666); if (fd < 0) return 0; - if (flags & O_CLOEXEC) - fcntl(fd, F_SETFD, FD_CLOEXEC); #if !defined(__LP64__) if (fd > SHRT_MAX) { diff --git a/porting/liteos_m/kernel/src/stdio/vfprintf.c b/porting/liteos_m/kernel/src/stdio/vfprintf.c index f4371ae530b75d3406817643447ca67d6853fb9f..ef1f60f81ae0bba0234e2f436a538c4b9a7c1f6b 100644 --- a/porting/liteos_m/kernel/src/stdio/vfprintf.c +++ b/porting/liteos_m/kernel/src/stdio/vfprintf.c @@ -451,7 +451,7 @@ static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg, #ifdef LOSCFG_FS_VFS struct winsize wsz; - if (f && (f->write == __stdout_write) && !ioctl(f->fd, TIOCGWINSZ, &wsz)) { + if (f && (f->write == __stdout_write)) { f->lbf = '\n'; f->write = __stdio_write; f->wpos = f->wbase = f->buf; diff --git a/porting/liteos_m_iccarm/kernel/src/fs.c b/porting/liteos_m_iccarm/kernel/src/fs.c index ab2400679a0bcf1d518a6c2e4dbeb55b2d511791..b5074296aeaf038751b5f28d2ed99775c44ec719 100644 --- a/porting/liteos_m_iccarm/kernel/src/fs.c +++ b/porting/liteos_m_iccarm/kernel/src/fs.c @@ -185,6 +185,28 @@ int remove(const char *filename) return ret; } +int fcntl(int fd, int cmd, ...) +{ + int ret; + va_list vaList; + + va_start(vaList, cmd); + ret = OsFcntl(fd, cmd, vaList); + va_end(vaList); + return ret; +} + +int ioctl(int fd, int req, ...) +{ + int ret; + va_list vaList; + + va_start(vaList, req); + ret = OsIoctl(fd, req, vaList); + va_end(vaList); + return ret; +} + #else /* #ifdef LOSCFG_FS_VFS */ int mount(const char *source, const char *target, @@ -309,4 +331,13 @@ int remove(const char *filename) return -1; } +int fcntl(int fd, int cmd, ...) +{ + return -1; +} + +int ioctl(int fd, int req, ...) +{ + return -1; +} #endif