fstat(2): add user_fstat

Effort:		CHERI upstreaming
Sponsored by:	Innovate UK
Pull Request:	https://github.com/freebsd/freebsd-src/pull/2284
This commit is contained in:
Brooks Davis committed 2026-11-07 12:10:46 +00:00
1 parent 3369af6f98
commit 230d581d4e
2 files changed
+9 -7

No files matched your search

+8 -7
View File
@@ -374,7 +374,6 @@ struct dup2_args {
int
sys_dup2(struct thread *td, struct dup2_args *uap)
{
return (kern_dup(td, FDDUP_FIXED, 0, (int)uap->from, (int)uap->to));
}
@@ -390,7 +389,6 @@ struct dup_args {
int
sys_dup(struct thread *td, struct dup_args *uap)
{
return (kern_dup(td, FDDUP_NORMAL, 0, (int)uap->fd, 0));
}
@@ -408,7 +406,6 @@ struct fcntl_args {
int
sys_fcntl(struct thread *td, struct fcntl_args *uap)
{
return (kern_fcntl_freebsd(td, uap->fd, uap->cmd, uap->arg));
}
@@ -1493,7 +1490,6 @@ struct close_args {
int
sys_close(struct thread *td, struct close_args *uap)
{
return (kern_close(td, uap->fd));
}
@@ -1610,7 +1606,6 @@ struct close_range_args {
int
sys_close_range(struct thread *td, struct close_range_args *uap)
{
AUDIT_ARG_FD(uap->lowfd);
AUDIT_ARG_CMD(uap->highfd);
AUDIT_ARG_FFLAGS(uap->flags);
@@ -1703,13 +1698,19 @@ struct fstat_args {
/* ARGSUSED */
int
sys_fstat(struct thread *td, struct fstat_args *uap)
{
return (user_fstat(td, uap->fd, uap->sb));
}
int
user_fstat(struct thread *td, int fd, struct stat *sb)
{
struct stat ub;
int error;
error = kern_fstat(td, uap->fd, &ub);
error = kern_fstat(td, fd, &ub);
if (error == 0)
error = copyout(&ub, uap->sb, sizeof(ub));
error = copyout(&ub, sb, sizeof(ub));
return (error);
}
+1
View File
@@ -472,6 +472,7 @@ int user_cpuset_getaffinity(struct thread *td, cpulevel_t level,
int user_cpuset_setaffinity(struct thread *td, cpulevel_t level,
cpuwhich_t which, id_t id, size_t cpusetsize,
const cpuset_t *maskp, const struct cpuset_copy_cb *cb);
int user_fstat(struct thread *td, int fd, struct stat *sb);
int user_jail_get(struct thread *td, struct iovec *iovp,
unsigned int iovcnt, int flags, copyinuio_t *copyinuio_f,
updateiov_t *updateiov_f);