[libc-commits] [libc] [libc] add ioctl (PR #141393)

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Sun May 25 09:46:44 PDT 2025


================
@@ -13,19 +13,14 @@
 #include "src/__support/macros/config.h"
 #include "src/errno/libc_errno.h"
 
-#include <asm/ioctls.h> // Safe to include without the risk of name pollution.
+#include <asm/ioctls.h>  // Safe to include without the risk of name pollution.
 #include <sys/syscall.h> // For syscall numbers
 #include <termios.h>
 
 namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(int, tcdrain, (int fd)) {
-  int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_ioctl, fd, TCSBRK, 1);
-  if (ret < 0) {
-    libc_errno = -ret;
-    return -1;
-  }
-  return 0;
+  return LIBC_NAMESPACE::ioctl(fd, TCSBRK, 1);
----------------
jhuber6 wrote:

Also this should probably be a separate PR.

https://github.com/llvm/llvm-project/pull/141393


More information about the libc-commits mailing list