diff --git a/lib/os/fdtable.c b/lib/os/fdtable.c index 6d1f87bbc6f..6adb57696cd 100644 --- a/lib/os/fdtable.c +++ b/lib/os/fdtable.c @@ -379,22 +379,6 @@ off_t zvfs_lseek(int fd, off_t offset, int whence) whence); } -int ioctl(int fd, unsigned long request, ...) -{ - va_list args; - int res; - - if (_check_fd(fd) < 0) { - return -1; - } - - va_start(args, request); - res = fdtable[fd].vtable->ioctl(fdtable[fd].obj, request, args); - va_end(args); - - return res; -} - int zvfs_fcntl(int fd, int cmd, va_list args) { int res; @@ -434,6 +418,16 @@ int zvfs_ftruncate(int fd, off_t length) return zvfs_ftruncate_wrap(fd, ZFD_IOCTL_TRUNCATE, length); } +int zvfs_ioctl(int fd, unsigned long request, va_list args) +{ + if (_check_fd(fd) < 0) { + return -1; + } + + return fdtable[fd].vtable->ioctl(fdtable[fd].obj, request, args); +} + + #if defined(CONFIG_POSIX_DEVICE_IO) /* * fd operations for stdio/stdout/stderr diff --git a/lib/posix/options/stropts.c b/lib/posix/options/stropts.c index dab6ea97685..61d5e6abf5d 100644 --- a/lib/posix/options/stropts.c +++ b/lib/posix/options/stropts.c @@ -4,9 +4,11 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include #include +#include + #include +#include int putmsg(int fildes, const struct strbuf *ctlptr, const struct strbuf *dataptr, int flags) { @@ -79,3 +81,17 @@ int isastream(int fildes) errno = ENOSYS; return -1; } + +extern int zvfs_ioctl(int fd, unsigned long request, va_list args); + +int ioctl(int fd, unsigned long request, ...) +{ + int ret; + va_list args; + + va_start(args, request); + ret = zvfs_ioctl(fd, request, args); + va_end(args); + + return ret; +} diff --git a/samples/modules/thrift/hello/client/prj.conf b/samples/modules/thrift/hello/client/prj.conf index 0f094d14d6c..c8ac179680b 100644 --- a/samples/modules/thrift/hello/client/prj.conf +++ b/samples/modules/thrift/hello/client/prj.conf @@ -6,6 +6,7 @@ CONFIG_CPP=y CONFIG_STD_CPP17=y CONFIG_CPP_EXCEPTIONS=y CONFIG_POSIX_API=y +CONFIG_XOPEN_STREAMS=y CONFIG_COMMON_LIBC_THRD=y CONFIG_DYNAMIC_THREAD=y CONFIG_THREAD_STACK_INFO=y diff --git a/samples/modules/thrift/hello/server/prj.conf b/samples/modules/thrift/hello/server/prj.conf index fe78b9a2803..78b009fb3e2 100644 --- a/samples/modules/thrift/hello/server/prj.conf +++ b/samples/modules/thrift/hello/server/prj.conf @@ -6,6 +6,7 @@ CONFIG_CPP=y CONFIG_STD_CPP17=y CONFIG_CPP_EXCEPTIONS=y CONFIG_POSIX_API=y +CONFIG_XOPEN_STREAMS=y CONFIG_NET_SOCKETPAIR=y CONFIG_HEAP_MEM_POOL_SIZE=16384 CONFIG_EVENTFD=y diff --git a/tests/modules/thrift/ThriftTest/prj.conf b/tests/modules/thrift/ThriftTest/prj.conf index 80872a61085..4bc7153026a 100755 --- a/tests/modules/thrift/ThriftTest/prj.conf +++ b/tests/modules/thrift/ThriftTest/prj.conf @@ -7,6 +7,7 @@ CONFIG_STD_CPP17=y CONFIG_CPP_EXCEPTIONS=y CONFIG_GLIBCXX_LIBCPP=y CONFIG_POSIX_API=y +CONFIG_XOPEN_STREAMS=y CONFIG_NETWORKING=y CONFIG_NET_TCP=y CONFIG_NET_SOCKETS=y diff --git a/tests/posix/eventfd/prj.conf b/tests/posix/eventfd/prj.conf index 4fcab370408..a5839a7a447 100644 --- a/tests/posix/eventfd/prj.conf +++ b/tests/posix/eventfd/prj.conf @@ -9,4 +9,5 @@ CONFIG_TEST_RANDOM_GENERATOR=y CONFIG_ZTEST=y CONFIG_POSIX_API=y +CONFIG_XOPEN_STREAMS=y CONFIG_EVENTFD=y