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
This commit is contained in:
Thomas Weißschuh 2025-05-15 21:57:48 +02:00
parent 7281be5831
commit 6e7c805a93
4 changed files with 39 additions and 20 deletions

View file

@ -51,6 +51,7 @@ all_files := \
sys/auxv.h \
sys/ioctl.h \
sys/mman.h \
sys/mount.h \
sys/random.h \
sys/stat.h \
sys/syscall.h \

View file

@ -99,6 +99,7 @@
#include "sys/auxv.h"
#include "sys/ioctl.h"
#include "sys/mman.h"
#include "sys/mount.h"
#include "sys/random.h"
#include "sys/stat.h"
#include "sys/syscall.h"

View file

@ -672,26 +672,6 @@ int mknod(const char *path, mode_t mode, dev_t dev)
return __sysret(sys_mknod(path, mode, dev));
}
/*
* int mount(const char *source, const char *target,
* const char *fstype, unsigned long flags,
* const void *data);
*/
static __attribute__((unused))
int sys_mount(const char *src, const char *tgt, const char *fst,
unsigned long flags, const void *data)
{
return my_syscall5(__NR_mount, src, tgt, fst, flags, data);
}
static __attribute__((unused))
int mount(const char *src, const char *tgt,
const char *fst, unsigned long flags,
const void *data)
{
return __sysret(sys_mount(src, tgt, fst, flags, data));
}
/*
* int pipe2(int pipefd[2], int flags);

View file

@ -0,0 +1,37 @@
/* SPDX-License-Identifier: LGPL-2.1 OR MIT */
/*
* Mount definitions for NOLIBC
* Copyright (C) 2017-2021 Willy Tarreau <w@1wt.eu>
*/
/* make sure to include all global symbols */
#include "../nolibc.h"
#ifndef _NOLIBC_SYS_MOUNT_H
#define _NOLIBC_SYS_MOUNT_H
#include "../sys.h"
#include <linux/mount.h>
/*
* int mount(const char *source, const char *target,
* const char *fstype, unsigned long flags,
* const void *data);
*/
static __attribute__((unused))
int sys_mount(const char *src, const char *tgt, const char *fst,
unsigned long flags, const void *data)
{
return my_syscall5(__NR_mount, src, tgt, fst, flags, data);
}
static __attribute__((unused))
int mount(const char *src, const char *tgt,
const char *fst, unsigned long flags,
const void *data)
{
return __sysret(sys_mount(src, tgt, fst, flags, data));
}
#endif /* _NOLIBC_SYS_MOUNT_H */