Changeset View
Changeset View
Standalone View
Standalone View
sys/compat/freebsd32/freebsd32_misc.c
Show First 20 Lines • Show All 2,279 Lines • ▼ Show 20 Lines | |||||
int | int | ||||
ofreebsd32_stat(struct thread *td, struct ofreebsd32_stat_args *uap) | ofreebsd32_stat(struct thread *td, struct ofreebsd32_stat_args *uap) | ||||
{ | { | ||||
struct stat sb; | struct stat sb; | ||||
struct ostat32 sb32; | struct ostat32 sb32; | ||||
int error; | int error; | ||||
error = kern_statat(td, 0, AT_FDCWD, uap->path, UIO_USERSPACE, | error = kern_statat(td, 0, AT_FDCWD, uap->path, UIO_USERSPACE, | ||||
&sb, NULL); | &sb); | ||||
kib: If the line fits, I suggest unwrap this and most of the other kern_statat() instances. | |||||
if (error) | if (error) | ||||
return (error); | return (error); | ||||
copy_ostat(&sb, &sb32); | copy_ostat(&sb, &sb32); | ||||
error = copyout(&sb32, uap->ub, sizeof (sb32)); | error = copyout(&sb32, uap->ub, sizeof (sb32)); | ||||
return (error); | return (error); | ||||
} | } | ||||
#endif | #endif | ||||
Show All 32 Lines | |||||
int | int | ||||
freebsd32_fstatat(struct thread *td, struct freebsd32_fstatat_args *uap) | freebsd32_fstatat(struct thread *td, struct freebsd32_fstatat_args *uap) | ||||
{ | { | ||||
struct stat ub; | struct stat ub; | ||||
struct stat32 ub32; | struct stat32 ub32; | ||||
int error; | int error; | ||||
error = kern_statat(td, uap->flag, uap->fd, uap->path, UIO_USERSPACE, | error = kern_statat(td, uap->flag, uap->fd, uap->path, UIO_USERSPACE, | ||||
&ub, NULL); | &ub); | ||||
if (error) | if (error) | ||||
return (error); | return (error); | ||||
copy_stat(&ub, &ub32); | copy_stat(&ub, &ub32); | ||||
error = copyout(&ub32, uap->buf, sizeof(ub32)); | error = copyout(&ub32, uap->buf, sizeof(ub32)); | ||||
return (error); | return (error); | ||||
} | } | ||||
#ifdef COMPAT_43 | #ifdef COMPAT_43 | ||||
int | int | ||||
ofreebsd32_lstat(struct thread *td, struct ofreebsd32_lstat_args *uap) | ofreebsd32_lstat(struct thread *td, struct ofreebsd32_lstat_args *uap) | ||||
{ | { | ||||
struct stat sb; | struct stat sb; | ||||
struct ostat32 sb32; | struct ostat32 sb32; | ||||
int error; | int error; | ||||
error = kern_statat(td, AT_SYMLINK_NOFOLLOW, AT_FDCWD, uap->path, | error = kern_statat(td, AT_SYMLINK_NOFOLLOW, AT_FDCWD, uap->path, | ||||
UIO_USERSPACE, &sb, NULL); | UIO_USERSPACE, &sb); | ||||
if (error) | if (error) | ||||
return (error); | return (error); | ||||
copy_ostat(&sb, &sb32); | copy_ostat(&sb, &sb32); | ||||
error = copyout(&sb32, uap->ub, sizeof (sb32)); | error = copyout(&sb32, uap->ub, sizeof (sb32)); | ||||
return (error); | return (error); | ||||
} | } | ||||
#endif | #endif | ||||
▲ Show 20 Lines • Show All 102 Lines • ▼ Show 20 Lines | |||||
freebsd11_freebsd32_stat(struct thread *td, | freebsd11_freebsd32_stat(struct thread *td, | ||||
struct freebsd11_freebsd32_stat_args *uap) | struct freebsd11_freebsd32_stat_args *uap) | ||||
{ | { | ||||
struct stat sb; | struct stat sb; | ||||
struct freebsd11_stat32 sb32; | struct freebsd11_stat32 sb32; | ||||
int error; | int error; | ||||
error = kern_statat(td, 0, AT_FDCWD, uap->path, UIO_USERSPACE, | error = kern_statat(td, 0, AT_FDCWD, uap->path, UIO_USERSPACE, | ||||
&sb, NULL); | &sb); | ||||
if (error != 0) | if (error != 0) | ||||
return (error); | return (error); | ||||
error = freebsd11_cvtstat32(&sb, &sb32); | error = freebsd11_cvtstat32(&sb, &sb32); | ||||
if (error == 0) | if (error == 0) | ||||
error = copyout(&sb32, uap->ub, sizeof (sb32)); | error = copyout(&sb32, uap->ub, sizeof (sb32)); | ||||
return (error); | return (error); | ||||
} | } | ||||
Show All 18 Lines | |||||
freebsd11_freebsd32_fstatat(struct thread *td, | freebsd11_freebsd32_fstatat(struct thread *td, | ||||
struct freebsd11_freebsd32_fstatat_args *uap) | struct freebsd11_freebsd32_fstatat_args *uap) | ||||
{ | { | ||||
struct stat sb; | struct stat sb; | ||||
struct freebsd11_stat32 sb32; | struct freebsd11_stat32 sb32; | ||||
int error; | int error; | ||||
error = kern_statat(td, uap->flag, uap->fd, uap->path, UIO_USERSPACE, | error = kern_statat(td, uap->flag, uap->fd, uap->path, UIO_USERSPACE, | ||||
&sb, NULL); | &sb); | ||||
if (error != 0) | if (error != 0) | ||||
return (error); | return (error); | ||||
error = freebsd11_cvtstat32(&sb, &sb32); | error = freebsd11_cvtstat32(&sb, &sb32); | ||||
if (error == 0) | if (error == 0) | ||||
error = copyout(&sb32, uap->buf, sizeof (sb32)); | error = copyout(&sb32, uap->buf, sizeof (sb32)); | ||||
return (error); | return (error); | ||||
} | } | ||||
int | int | ||||
freebsd11_freebsd32_lstat(struct thread *td, | freebsd11_freebsd32_lstat(struct thread *td, | ||||
struct freebsd11_freebsd32_lstat_args *uap) | struct freebsd11_freebsd32_lstat_args *uap) | ||||
{ | { | ||||
struct stat sb; | struct stat sb; | ||||
struct freebsd11_stat32 sb32; | struct freebsd11_stat32 sb32; | ||||
int error; | int error; | ||||
error = kern_statat(td, AT_SYMLINK_NOFOLLOW, AT_FDCWD, uap->path, | error = kern_statat(td, AT_SYMLINK_NOFOLLOW, AT_FDCWD, uap->path, | ||||
UIO_USERSPACE, &sb, NULL); | UIO_USERSPACE, &sb); | ||||
if (error != 0) | if (error != 0) | ||||
return (error); | return (error); | ||||
error = freebsd11_cvtstat32(&sb, &sb32); | error = freebsd11_cvtstat32(&sb, &sb32); | ||||
if (error == 0) | if (error == 0) | ||||
error = copyout(&sb32, uap->ub, sizeof (sb32)); | error = copyout(&sb32, uap->ub, sizeof (sb32)); | ||||
return (error); | return (error); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | |||||
freebsd11_freebsd32_nstat(struct thread *td, | freebsd11_freebsd32_nstat(struct thread *td, | ||||
struct freebsd11_freebsd32_nstat_args *uap) | struct freebsd11_freebsd32_nstat_args *uap) | ||||
{ | { | ||||
struct stat sb; | struct stat sb; | ||||
struct nstat32 nsb; | struct nstat32 nsb; | ||||
int error; | int error; | ||||
error = kern_statat(td, 0, AT_FDCWD, uap->path, UIO_USERSPACE, | error = kern_statat(td, 0, AT_FDCWD, uap->path, UIO_USERSPACE, | ||||
&sb, NULL); | &sb); | ||||
if (error != 0) | if (error != 0) | ||||
return (error); | return (error); | ||||
error = freebsd11_cvtnstat32(&sb, &nsb); | error = freebsd11_cvtnstat32(&sb, &nsb); | ||||
if (error != 0) | if (error != 0) | ||||
error = copyout(&nsb, uap->ub, sizeof (nsb)); | error = copyout(&nsb, uap->ub, sizeof (nsb)); | ||||
return (error); | return (error); | ||||
} | } | ||||
int | int | ||||
freebsd11_freebsd32_nlstat(struct thread *td, | freebsd11_freebsd32_nlstat(struct thread *td, | ||||
struct freebsd11_freebsd32_nlstat_args *uap) | struct freebsd11_freebsd32_nlstat_args *uap) | ||||
{ | { | ||||
struct stat sb; | struct stat sb; | ||||
struct nstat32 nsb; | struct nstat32 nsb; | ||||
int error; | int error; | ||||
error = kern_statat(td, AT_SYMLINK_NOFOLLOW, AT_FDCWD, uap->path, | error = kern_statat(td, AT_SYMLINK_NOFOLLOW, AT_FDCWD, uap->path, | ||||
UIO_USERSPACE, &sb, NULL); | UIO_USERSPACE, &sb); | ||||
if (error != 0) | if (error != 0) | ||||
return (error); | return (error); | ||||
error = freebsd11_cvtnstat32(&sb, &nsb); | error = freebsd11_cvtnstat32(&sb, &nsb); | ||||
if (error == 0) | if (error == 0) | ||||
error = copyout(&nsb, uap->ub, sizeof (nsb)); | error = copyout(&nsb, uap->ub, sizeof (nsb)); | ||||
return (error); | return (error); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,489 Lines • Show Last 20 Lines |
If the line fits, I suggest unwrap this and most of the other kern_statat() instances.