Lines 196-201
newstat_copyout(struct stat *buf, void *ubuf)
Link Here
|
196 |
return (copyout(&tbuf, ubuf, sizeof(tbuf))); |
196 |
return (copyout(&tbuf, ubuf, sizeof(tbuf))); |
197 |
} |
197 |
} |
198 |
|
198 |
|
|
|
199 |
static int |
200 |
statx_copyout(struct stat *buf, void *ubuf) |
201 |
{ |
202 |
struct l_statx tbuf; |
203 |
|
204 |
bzero(&tbuf, sizeof(tbuf)); |
205 |
tbuf.stx_mask = STATX_ALL; |
206 |
tbuf.stx_blksize = buf->st_blksize; |
207 |
tbuf.stx_attributes = 0; |
208 |
tbuf.stx_nlink = buf->st_nlink; |
209 |
tbuf.stx_uid = buf->st_uid; |
210 |
tbuf.stx_gid = buf->st_gid; |
211 |
tbuf.stx_mode = buf->st_mode; |
212 |
tbuf.stx_ino = buf->st_ino; |
213 |
tbuf.stx_size = buf->st_size; |
214 |
tbuf.stx_blocks = buf->st_blocks; |
215 |
|
216 |
tbuf.stx_atime.tv_sec = buf->st_atim.tv_sec; |
217 |
tbuf.stx_atime.tv_nsec = buf->st_atim.tv_nsec; |
218 |
tbuf.stx_btime.tv_sec = buf->st_birthtim.tv_sec; |
219 |
tbuf.stx_btime.tv_nsec = buf->st_birthtim.tv_nsec; |
220 |
tbuf.stx_ctime.tv_sec = buf->st_ctim.tv_sec; |
221 |
tbuf.stx_ctime.tv_nsec = buf->st_ctim.tv_nsec; |
222 |
tbuf.stx_mtime.tv_sec = buf->st_mtim.tv_sec; |
223 |
tbuf.stx_mtime.tv_nsec = buf->st_mtim.tv_nsec; |
224 |
|
225 |
tbuf.stx_rdev_major = buf->st_rdev >> 8; |
226 |
tbuf.stx_rdev_minor = buf->st_rdev & 0xff; |
227 |
tbuf.stx_dev_major = buf->st_dev >> 8; |
228 |
tbuf.stx_dev_minor = buf->st_dev & 0xff; |
229 |
|
230 |
return (copyout(&tbuf, ubuf, sizeof(tbuf))); |
231 |
} |
232 |
|
199 |
#ifdef LINUX_LEGACY_SYSCALLS |
233 |
#ifdef LINUX_LEGACY_SYSCALLS |
200 |
int |
234 |
int |
201 |
linux_newstat(struct thread *td, struct linux_newstat_args *args) |
235 |
linux_newstat(struct thread *td, struct linux_newstat_args *args) |
Lines 730-732
linux_syncfs(struct thread *td, struct linux_syncfs_args *args)
Link Here
|
730 |
vrele(vp); |
764 |
vrele(vp); |
731 |
return (error); |
765 |
return (error); |
732 |
} |
766 |
} |
|
|
767 |
|
768 |
int |
769 |
linux_statx(struct thread *td, struct linux_statx_args *args) |
770 |
{ |
771 |
char *path; |
772 |
int error, dirfd, flags; |
773 |
struct stat buf; |
774 |
|
775 |
if (args->flags & ~(LINUX_AT_SYMLINK_NOFOLLOW | LINUX_AT_EMPTY_PATH)) { |
776 |
linux_msg(td, "statx unsupported flags 0x%x", args->flags); |
777 |
return (EINVAL); |
778 |
} |
779 |
|
780 |
flags = (args->flags & LINUX_AT_SYMLINK_NOFOLLOW) ? |
781 |
AT_SYMLINK_NOFOLLOW : 0; |
782 |
flags |= (args->flags & LINUX_AT_EMPTY_PATH) ? |
783 |
AT_EMPTY_PATH : 0; |
784 |
|
785 |
dirfd = (args->dirfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->dirfd; |
786 |
if (!LUSECONVPATH(td)) { |
787 |
error = linux_kern_statat(td, flags, dirfd, args->pathname, |
788 |
UIO_USERSPACE, &buf); |
789 |
} else { |
790 |
LCONVPATHEXIST_AT(td, args->pathname, &path, dirfd); |
791 |
error = linux_kern_statat(td, flags, dirfd, path, UIO_SYSSPACE, &buf); |
792 |
LFREEPATH(path); |
793 |
} |
794 |
if (error == 0) |
795 |
error = statx_copyout(&buf, args->statxbuf); |
796 |
|
797 |
return (error); |
798 |
} |
799 |
|