Changeset View
Changeset View
Standalone View
Standalone View
sys/compat/linux/linux_stats.c
Show First 20 Lines • Show All 655 Lines • ▼ Show 20 Lines | |||||
int | int | ||||
linux_newfstatat(struct thread *td, struct linux_newfstatat_args *args) | linux_newfstatat(struct thread *td, struct linux_newfstatat_args *args) | ||||
{ | { | ||||
char *path; | char *path; | ||||
int error, dfd, flag; | int error, dfd, flag; | ||||
struct stat buf; | struct stat buf; | ||||
if (args->flag & LINUX_AT_EMPTY_PATH) { | |||||
if (args->dfd == AT_FDCWD) { | |||||
emaste: Should this be (should we have) `LINUX_AT_FDCWD`? | |||||
traszAuthorUnsubmitted Done Inline ActionsLinux uses the same value as we do, -100. trasz: Linux uses the same value as we do, -100.
| |||||
linux_msg(td, "unsupported fstatat with AT_FDCWD"); | |||||
return (EBADF); | |||||
} | |||||
error = kern_fstat(td, args->dfd, &buf); | |||||
translate_fd_major_minor(td, args->dfd, &buf); | |||||
goto out; | |||||
} | |||||
if (args->flag & ~LINUX_AT_SYMLINK_NOFOLLOW) | if (args->flag & ~LINUX_AT_SYMLINK_NOFOLLOW) | ||||
return (EINVAL); | return (EINVAL); | ||||
flag = (args->flag & LINUX_AT_SYMLINK_NOFOLLOW) ? | flag = (args->flag & LINUX_AT_SYMLINK_NOFOLLOW) ? | ||||
AT_SYMLINK_NOFOLLOW : 0; | AT_SYMLINK_NOFOLLOW : 0; | ||||
dfd = (args->dfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->dfd; | dfd = (args->dfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->dfd; | ||||
if (!LUSECONVPATH(td)) { | if (!LUSECONVPATH(td)) { | ||||
error = linux_kern_statat(td, flag, dfd, args->pathname, | error = linux_kern_statat(td, flag, dfd, args->pathname, | ||||
UIO_USERSPACE, &buf); | UIO_USERSPACE, &buf); | ||||
} else { | } else { | ||||
LCONVPATHEXIST_AT(td, args->pathname, &path, dfd); | LCONVPATHEXIST_AT(td, args->pathname, &path, dfd); | ||||
error = linux_kern_statat(td, flag, dfd, path, UIO_SYSSPACE, &buf); | error = linux_kern_statat(td, flag, dfd, path, UIO_SYSSPACE, &buf); | ||||
LFREEPATH(path); | LFREEPATH(path); | ||||
} | } | ||||
out: | |||||
if (error == 0) | if (error == 0) | ||||
error = newstat_copyout(&buf, args->statbuf); | error = newstat_copyout(&buf, args->statbuf); | ||||
return (error); | return (error); | ||||
} | } | ||||
#endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */ | #endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */ | ||||
Show All 38 Lines |
Should this be (should we have) LINUX_AT_FDCWD?