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

tools/nolibc: move mount() to sys/mount.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-2-74f82eea3b59@weissschuh.net

+39 -20
+1
tools/include/nolibc/Makefile
··· 51 51 sys/auxv.h \ 52 52 sys/ioctl.h \ 53 53 sys/mman.h \ 54 + sys/mount.h \ 54 55 sys/random.h \ 55 56 sys/stat.h \ 56 57 sys/syscall.h \
+1
tools/include/nolibc/nolibc.h
··· 99 99 #include "sys/auxv.h" 100 100 #include "sys/ioctl.h" 101 101 #include "sys/mman.h" 102 + #include "sys/mount.h" 102 103 #include "sys/random.h" 103 104 #include "sys/stat.h" 104 105 #include "sys/syscall.h"
-20
tools/include/nolibc/sys.h
··· 672 672 return __sysret(sys_mknod(path, mode, dev)); 673 673 } 674 674 675 - /* 676 - * int mount(const char *source, const char *target, 677 - * const char *fstype, unsigned long flags, 678 - * const void *data); 679 - */ 680 - static __attribute__((unused)) 681 - int sys_mount(const char *src, const char *tgt, const char *fst, 682 - unsigned long flags, const void *data) 683 - { 684 - return my_syscall5(__NR_mount, src, tgt, fst, flags, data); 685 - } 686 - 687 - static __attribute__((unused)) 688 - int mount(const char *src, const char *tgt, 689 - const char *fst, unsigned long flags, 690 - const void *data) 691 - { 692 - return __sysret(sys_mount(src, tgt, fst, flags, data)); 693 - } 694 - 695 675 696 676 /* 697 677 * int pipe2(int pipefd[2], int flags);
+37
tools/include/nolibc/sys/mount.h
··· 1 + /* SPDX-License-Identifier: LGPL-2.1 OR MIT */ 2 + /* 3 + * Mount 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_MOUNT_H 11 + #define _NOLIBC_SYS_MOUNT_H 12 + 13 + #include "../sys.h" 14 + 15 + #include <linux/mount.h> 16 + 17 + /* 18 + * int mount(const char *source, const char *target, 19 + * const char *fstype, unsigned long flags, 20 + * const void *data); 21 + */ 22 + static __attribute__((unused)) 23 + int sys_mount(const char *src, const char *tgt, const char *fst, 24 + unsigned long flags, const void *data) 25 + { 26 + return my_syscall5(__NR_mount, src, tgt, fst, flags, data); 27 + } 28 + 29 + static __attribute__((unused)) 30 + int mount(const char *src, const char *tgt, 31 + const char *fst, unsigned long flags, 32 + const void *data) 33 + { 34 + return __sysret(sys_mount(src, tgt, fst, flags, data)); 35 + } 36 + 37 + #endif /* _NOLIBC_SYS_MOUNT_H */