Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tools/nolibc: move ioctl() to sys/ioctl.h

This is the location regular userspace expects this definition.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://lore.kernel.org/r/20250515-nolibc-sys-v1-1-74f82eea3b59@weissschuh.net

+31 -12
+1
tools/include/nolibc/Makefile
··· 49 49 string.h \ 50 50 sys.h \ 51 51 sys/auxv.h \ 52 + sys/ioctl.h \ 52 53 sys/mman.h \ 53 54 sys/random.h \ 54 55 sys/stat.h \
+1
tools/include/nolibc/nolibc.h
··· 97 97 #include "types.h" 98 98 #include "sys.h" 99 99 #include "sys/auxv.h" 100 + #include "sys/ioctl.h" 100 101 #include "sys/mman.h" 101 102 #include "sys/random.h" 102 103 #include "sys/stat.h"
-12
tools/include/nolibc/sys.h
··· 518 518 519 519 520 520 /* 521 - * int ioctl(int fd, unsigned long cmd, ... arg); 522 - */ 523 - 524 - static __attribute__((unused)) 525 - long sys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg) 526 - { 527 - return my_syscall3(__NR_ioctl, fd, cmd, arg); 528 - } 529 - 530 - #define ioctl(fd, cmd, arg) __sysret(sys_ioctl(fd, cmd, (unsigned long)(arg))) 531 - 532 - /* 533 521 * int kill(pid_t pid, int signal); 534 522 */ 535 523
+29
tools/include/nolibc/sys/ioctl.h
··· 1 + /* SPDX-License-Identifier: LGPL-2.1 OR MIT */ 2 + /* 3 + * Ioctl definitions for NOLIBC 4 + * Copyright (C) 2017-2021 Willy Tarreau <w@1wt.eu> 5 + */ 6 + 7 + /* make sure to include all global symbols */ 8 + #include "../nolibc.h" 9 + 10 + #ifndef _NOLIBC_SYS_IOCTL_H 11 + #define _NOLIBC_SYS_IOCTL_H 12 + 13 + #include "../sys.h" 14 + 15 + #include <linux/ioctl.h> 16 + 17 + /* 18 + * int ioctl(int fd, unsigned long cmd, ... arg); 19 + */ 20 + 21 + static __attribute__((unused)) 22 + long sys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg) 23 + { 24 + return my_syscall3(__NR_ioctl, fd, cmd, arg); 25 + } 26 + 27 + #define ioctl(fd, cmd, arg) __sysret(sys_ioctl(fd, cmd, (unsigned long)(arg))) 28 + 29 + #endif /* _NOLIBC_SYS_IOCTL_H */