Changeset View
Changeset View
Standalone View
Standalone View
head/sys/compat/linux/linux_stats.c
Show First 20 Lines • Show All 75 Lines • ▼ Show 20 Lines | |||||
linux_kern_statat(struct thread *td, int flag, int fd, char *path, | linux_kern_statat(struct thread *td, int flag, int fd, char *path, | ||||
enum uio_seg pathseg, struct stat *sbp) | enum uio_seg pathseg, struct stat *sbp) | ||||
{ | { | ||||
return (kern_statat(td, flag, fd, path, pathseg, sbp, | return (kern_statat(td, flag, fd, path, pathseg, sbp, | ||||
translate_vnhook_major_minor)); | translate_vnhook_major_minor)); | ||||
} | } | ||||
#ifdef LINUX_LEGACY_SYSCALLS | |||||
static int | static int | ||||
linux_kern_stat(struct thread *td, char *path, enum uio_seg pathseg, | linux_kern_stat(struct thread *td, char *path, enum uio_seg pathseg, | ||||
struct stat *sbp) | struct stat *sbp) | ||||
{ | { | ||||
return (linux_kern_statat(td, 0, AT_FDCWD, path, pathseg, sbp)); | return (linux_kern_statat(td, 0, AT_FDCWD, path, pathseg, sbp)); | ||||
} | } | ||||
static int | static int | ||||
linux_kern_lstat(struct thread *td, char *path, enum uio_seg pathseg, | linux_kern_lstat(struct thread *td, char *path, enum uio_seg pathseg, | ||||
struct stat *sbp) | struct stat *sbp) | ||||
{ | { | ||||
return (linux_kern_statat(td, AT_SYMLINK_NOFOLLOW, AT_FDCWD, path, | return (linux_kern_statat(td, AT_SYMLINK_NOFOLLOW, AT_FDCWD, path, | ||||
pathseg, sbp)); | pathseg, sbp)); | ||||
} | } | ||||
#endif | |||||
static void | static void | ||||
translate_fd_major_minor(struct thread *td, int fd, struct stat *buf) | translate_fd_major_minor(struct thread *td, int fd, struct stat *buf) | ||||
{ | { | ||||
struct file *fp; | struct file *fp; | ||||
struct vnode *vp; | struct vnode *vp; | ||||
int major, minor; | int major, minor; | ||||
▲ Show 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | newstat_copyout(struct stat *buf, void *ubuf) | ||||
tbuf.st_ctim.tv_sec = buf->st_ctim.tv_sec; | tbuf.st_ctim.tv_sec = buf->st_ctim.tv_sec; | ||||
tbuf.st_ctim.tv_nsec = buf->st_ctim.tv_nsec; | tbuf.st_ctim.tv_nsec = buf->st_ctim.tv_nsec; | ||||
tbuf.st_blksize = buf->st_blksize; | tbuf.st_blksize = buf->st_blksize; | ||||
tbuf.st_blocks = buf->st_blocks; | tbuf.st_blocks = buf->st_blocks; | ||||
return (copyout(&tbuf, ubuf, sizeof(tbuf))); | return (copyout(&tbuf, ubuf, sizeof(tbuf))); | ||||
} | } | ||||
#ifdef LINUX_LEGACY_SYSCALLS | |||||
int | int | ||||
linux_newstat(struct thread *td, struct linux_newstat_args *args) | linux_newstat(struct thread *td, struct linux_newstat_args *args) | ||||
{ | { | ||||
struct stat buf; | struct stat buf; | ||||
char *path; | char *path; | ||||
int error; | int error; | ||||
LCONVPATHEXIST(td, args->path, &path); | LCONVPATHEXIST(td, args->path, &path); | ||||
Show All 25 Lines | |||||
#endif | #endif | ||||
error = linux_kern_lstat(td, path, UIO_SYSSPACE, &sb); | error = linux_kern_lstat(td, path, UIO_SYSSPACE, &sb); | ||||
LFREEPATH(path); | LFREEPATH(path); | ||||
if (error) | if (error) | ||||
return (error); | return (error); | ||||
return (newstat_copyout(&sb, args->buf)); | return (newstat_copyout(&sb, args->buf)); | ||||
} | } | ||||
#endif | |||||
int | int | ||||
linux_newfstat(struct thread *td, struct linux_newfstat_args *args) | linux_newfstat(struct thread *td, struct linux_newfstat_args *args) | ||||
{ | { | ||||
struct stat buf; | struct stat buf; | ||||
int error; | int error; | ||||
#ifdef DEBUG | #ifdef DEBUG | ||||
▲ Show 20 Lines • Show All 294 Lines • ▼ Show 20 Lines | |||||
struct l_ustat | struct l_ustat | ||||
{ | { | ||||
l_daddr_t f_tfree; | l_daddr_t f_tfree; | ||||
l_ino_t f_tinode; | l_ino_t f_tinode; | ||||
char f_fname[6]; | char f_fname[6]; | ||||
char f_fpack[6]; | char f_fpack[6]; | ||||
}; | }; | ||||
#ifdef LINUX_LEGACY_SYSCALLS | |||||
int | int | ||||
linux_ustat(struct thread *td, struct linux_ustat_args *args) | linux_ustat(struct thread *td, struct linux_ustat_args *args) | ||||
{ | { | ||||
#ifdef DEBUG | #ifdef DEBUG | ||||
if (ldebug(ustat)) | if (ldebug(ustat)) | ||||
printf(ARGS(ustat, "%ju, *"), (uintmax_t)args->dev); | printf(ARGS(ustat, "%ju, *"), (uintmax_t)args->dev); | ||||
#endif | #endif | ||||
return (EOPNOTSUPP); | return (EOPNOTSUPP); | ||||
} | } | ||||
#endif | |||||
#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32)) | #if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32)) | ||||
static int | static int | ||||
stat64_copyout(struct stat *buf, void *ubuf) | stat64_copyout(struct stat *buf, void *ubuf) | ||||
{ | { | ||||
struct l_stat64 lbuf; | struct l_stat64 lbuf; | ||||
▲ Show 20 Lines • Show All 188 Lines • Show Last 20 Lines |