libredirect: add more wrappers
This appears to satisfy the JVM and most coreutils programs like mkdir, etc., as used in self-contained installers like Revenera InstallAnywhere.
This commit is contained in:
parent
38d87c9132
commit
eb620ff9f7
|
@ -201,6 +201,37 @@ WRAPPER(int, __xstat64)(int ver, const char * path, struct stat64 * st)
|
||||||
WRAPPER_DEF(__xstat64)
|
WRAPPER_DEF(__xstat64)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
|
WRAPPER(int, statx)(int dirfd, const char * restrict pathname, int flags,
|
||||||
|
unsigned int mask, struct statx * restrict statxbuf)
|
||||||
|
{
|
||||||
|
int (*statx_real) (int, const char * restrict, int,
|
||||||
|
unsigned int, struct statx * restrict) = LOOKUP_REAL(statx);
|
||||||
|
char buf[PATH_MAX];
|
||||||
|
return statx_real(dirfd, rewrite(pathname, buf), flags, mask, statxbuf);
|
||||||
|
}
|
||||||
|
WRAPPER_DEF(statx)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
WRAPPER(int, fstatat)(int dirfd, const char * pathname, struct stat * statbuf, int flags)
|
||||||
|
{
|
||||||
|
int (*fstatat_real) (int, const char *, struct stat *, int) = LOOKUP_REAL(fstatat);
|
||||||
|
char buf[PATH_MAX];
|
||||||
|
return fstatat_real(dirfd, rewrite(pathname, buf), statbuf, flags);
|
||||||
|
}
|
||||||
|
WRAPPER_DEF(fstatat);
|
||||||
|
|
||||||
|
// In musl libc, fstatat64 is simply a macro for fstatat
|
||||||
|
#if !defined(__APPLE__) && !defined(fstatat64)
|
||||||
|
WRAPPER(int, fstatat64)(int dirfd, const char * pathname, struct stat64 * statbuf, int flags)
|
||||||
|
{
|
||||||
|
int (*fstatat64_real) (int, const char *, struct stat64 *, int) = LOOKUP_REAL(fstatat64);
|
||||||
|
char buf[PATH_MAX];
|
||||||
|
return fstatat64_real(dirfd, rewrite(pathname, buf), statbuf, flags);
|
||||||
|
}
|
||||||
|
WRAPPER_DEF(fstatat64);
|
||||||
|
#endif
|
||||||
|
|
||||||
WRAPPER(int, stat)(const char * path, struct stat * st)
|
WRAPPER(int, stat)(const char * path, struct stat * st)
|
||||||
{
|
{
|
||||||
int (*__stat_real) (const char *, struct stat *) = LOOKUP_REAL(stat);
|
int (*__stat_real) (const char *, struct stat *) = LOOKUP_REAL(stat);
|
||||||
|
@ -209,6 +240,17 @@ WRAPPER(int, stat)(const char * path, struct stat * st)
|
||||||
}
|
}
|
||||||
WRAPPER_DEF(stat)
|
WRAPPER_DEF(stat)
|
||||||
|
|
||||||
|
// In musl libc, stat64 is simply a macro for stat
|
||||||
|
#if !defined(__APPLE__) && !defined(stat64)
|
||||||
|
WRAPPER(int, stat64)(const char * path, struct stat64 * st)
|
||||||
|
{
|
||||||
|
int (*stat64_real) (const char *, struct stat64 *) = LOOKUP_REAL(stat64);
|
||||||
|
char buf[PATH_MAX];
|
||||||
|
return stat64_real(rewrite(path, buf), st);
|
||||||
|
}
|
||||||
|
WRAPPER_DEF(stat64)
|
||||||
|
#endif
|
||||||
|
|
||||||
WRAPPER(int, access)(const char * path, int mode)
|
WRAPPER(int, access)(const char * path, int mode)
|
||||||
{
|
{
|
||||||
int (*access_real) (const char *, int mode) = LOOKUP_REAL(access);
|
int (*access_real) (const char *, int mode) = LOOKUP_REAL(access);
|
||||||
|
@ -346,6 +388,14 @@ WRAPPER(int, system)(const char *command)
|
||||||
}
|
}
|
||||||
WRAPPER_DEF(system)
|
WRAPPER_DEF(system)
|
||||||
|
|
||||||
|
WRAPPER(int, chdir)(const char *path)
|
||||||
|
{
|
||||||
|
int (*chdir_real) (const char *) = LOOKUP_REAL(chdir);
|
||||||
|
char buf[PATH_MAX];
|
||||||
|
return chdir_real(rewrite(path, buf));
|
||||||
|
}
|
||||||
|
WRAPPER_DEF(chdir);
|
||||||
|
|
||||||
WRAPPER(int, mkdir)(const char *path, mode_t mode)
|
WRAPPER(int, mkdir)(const char *path, mode_t mode)
|
||||||
{
|
{
|
||||||
int (*mkdir_real) (const char *path, mode_t mode) = LOOKUP_REAL(mkdir);
|
int (*mkdir_real) (const char *path, mode_t mode) = LOOKUP_REAL(mkdir);
|
||||||
|
|
Loading…
Reference in a new issue