Changeset View
Changeset View
Standalone View
Standalone View
sys/compat/linux/linux_file.c
Show First 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | |||||
#include <machine/../linux/linux_proto.h> | #include <machine/../linux/linux_proto.h> | ||||
#endif | #endif | ||||
#include <compat/linux/linux_misc.h> | #include <compat/linux/linux_misc.h> | ||||
#include <compat/linux/linux_util.h> | #include <compat/linux/linux_util.h> | ||||
#include <compat/linux/linux_file.h> | #include <compat/linux/linux_file.h> | ||||
static int linux_common_open(struct thread *, int, const char *, int, int, | static int linux_common_open(struct thread *, int, const char *, int, int, | ||||
enum uio_seg); | enum uio_seg); | ||||
static int linux_do_accessat(struct thread *t, int, const char *, int, int); | |||||
static int linux_getdents_error(struct thread *, int, int); | static int linux_getdents_error(struct thread *, int, int); | ||||
static struct bsd_to_linux_bitmap seal_bitmap[] = { | static struct bsd_to_linux_bitmap seal_bitmap[] = { | ||||
BITMAP_1t1_LINUX(F_SEAL_SEAL), | BITMAP_1t1_LINUX(F_SEAL_SEAL), | ||||
BITMAP_1t1_LINUX(F_SEAL_SHRINK), | BITMAP_1t1_LINUX(F_SEAL_SHRINK), | ||||
BITMAP_1t1_LINUX(F_SEAL_GROW), | BITMAP_1t1_LINUX(F_SEAL_GROW), | ||||
BITMAP_1t1_LINUX(F_SEAL_WRITE), | BITMAP_1t1_LINUX(F_SEAL_WRITE), | ||||
}; | }; | ||||
▲ Show 20 Lines • Show All 589 Lines • ▼ Show 20 Lines | error = kern_accessat(td, AT_FDCWD, path, UIO_SYSSPACE, 0, | ||||
args->amode); | args->amode); | ||||
LFREEPATH(path); | LFREEPATH(path); | ||||
} | } | ||||
return (error); | return (error); | ||||
} | } | ||||
#endif | #endif | ||||
int | static int | ||||
linux_faccessat(struct thread *td, struct linux_faccessat_args *args) | linux_do_accessat(struct thread *td, int ldfd, const char *filename, | ||||
int amode, int flags) | |||||
{ | { | ||||
char *path; | char *path; | ||||
int error, dfd; | int error, dfd; | ||||
/* Linux convention. */ | /* Linux convention. */ | ||||
if (args->amode & ~(F_OK | X_OK | W_OK | R_OK)) | if (amode & ~(F_OK | X_OK | W_OK | R_OK)) | ||||
return (EINVAL); | return (EINVAL); | ||||
dfd = (args->dfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->dfd; | dfd = (ldfd == LINUX_AT_FDCWD) ? AT_FDCWD : ldfd; | ||||
if (!LUSECONVPATH(td)) { | if (!LUSECONVPATH(td)) { | ||||
error = kern_accessat(td, dfd, args->filename, UIO_USERSPACE, 0, args->amode); | error = kern_accessat(td, dfd, filename, UIO_USERSPACE, flags, amode); | ||||
} else { | } else { | ||||
LCONVPATHEXIST_AT(td, args->filename, &path, dfd); | LCONVPATHEXIST_AT(td, filename, &path, dfd); | ||||
error = kern_accessat(td, dfd, path, UIO_SYSSPACE, 0, args->amode); | error = kern_accessat(td, dfd, path, UIO_SYSSPACE, flags, amode); | ||||
LFREEPATH(path); | LFREEPATH(path); | ||||
} | } | ||||
return (error); | return (error); | ||||
} | } | ||||
int | |||||
linux_faccessat(struct thread *td, struct linux_faccessat_args *args) | |||||
{ | |||||
return (linux_do_accessat(td, args->dfd, args->filename, args->amode, | |||||
0)); | |||||
} | |||||
int | |||||
linux_faccessat2(struct thread *td, struct linux_faccessat2_args *args) | |||||
{ | |||||
int flags, unsupported; | |||||
/* XXX. AT_SYMLINK_NOFOLLOW is not supported by kern_accessat */ | |||||
unsupported = args->flags & ~(LINUX_AT_EACCESS | LINUX_AT_EMPTY_PATH); | |||||
if (unsupported != 0) { | |||||
linux_msg(td, "faccessat2 unsupported flag 0x%x", unsupported); | |||||
trasz: The “fchownat” doesn’t look right.
Also: do you have some software which uses it? If so, it… | |||||
return (EINVAL); | |||||
} | |||||
flags = (args->flags & LINUX_AT_EACCESS) == 0 ? 0 : | |||||
AT_EACCESS; | |||||
flags |= (args->flags & LINUX_AT_EMPTY_PATH) == 0 ? 0 : | |||||
AT_EMPTY_PATH; | |||||
return (linux_do_accessat(td, args->dfd, args->filename, args->amode, | |||||
flags)); | |||||
} | |||||
#ifdef LINUX_LEGACY_SYSCALLS | #ifdef LINUX_LEGACY_SYSCALLS | ||||
int | int | ||||
linux_unlink(struct thread *td, struct linux_unlink_args *args) | linux_unlink(struct thread *td, struct linux_unlink_args *args) | ||||
{ | { | ||||
char *path; | char *path; | ||||
int error; | int error; | ||||
struct stat st; | struct stat st; | ||||
▲ Show 20 Lines • Show All 1,345 Lines • Show Last 20 Lines |
The “fchownat” doesn’t look right.
Also: do you have some software which uses it? If so, it might be useful to note it’s name and version, to make it easier to test it in the future.