git: e3bdb45e811f - main - getrlimitusage(2): add user_ implementation
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 10 Nov 2026 12:33:05 UTC
The branch main has been updated by brooks:
URL: https://cgit.FreeBSD.org/src/commit/?id=e3bdb45e811fe9577fc187f45654d5003b970350
commit e3bdb45e811fe9577fc187f45654d5003b970350
Author: Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2026-11-10 11:49:21 +0000
Commit: Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2026-11-10 11:49:21 +0000
getrlimitusage(2): add user_ implementation
Effort: CHERI upstreaming
Sponsored by: Innovate UK
Pull Request: https://github.com/freebsd/freebsd-src/pull/2284
---
sys/kern/kern_resource.c | 13 +++++++++----
sys/sys/syscallsubr.h | 2 ++
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c
index f7f07d4253d5..cd3929ac8ea4 100644
--- a/sys/kern/kern_resource.c
+++ b/sys/kern/kern_resource.c
@@ -938,18 +938,23 @@ getrlimitusage_one(struct proc *p, struct vmspace *vm, u_int which, int flags,
int
sys_getrlimitusage(struct thread *td, struct getrlimitusage_args *uap)
+{
+ return (user_getrlimitusage(td, uap->which, uap->flags, uap->res));
+}
+
+int
+user_getrlimitusage(struct thread *td, u_int which, int flags, rlim_t *ures)
{
struct proc *p;
rlim_t res;
int error;
- if ((uap->flags & ~(GETRLIMITUSAGE_EUID)) != 0)
+ if ((flags & ~(GETRLIMITUSAGE_EUID)) != 0)
return (EINVAL);
p = curproc;
- error = getrlimitusage_one(p, p->p_vmspace, uap->which, uap->flags,
- &res);
+ error = getrlimitusage_one(p, p->p_vmspace, which, flags, &res);
if (error == 0)
- error = copyout(&res, uap->res, sizeof(res));
+ error = copyout(&res, ures, sizeof(res));
return (error);
}
diff --git a/sys/sys/syscallsubr.h b/sys/sys/syscallsubr.h
index 95e563ccbca8..4ecdc70fd3ba 100644
--- a/sys/sys/syscallsubr.h
+++ b/sys/sys/syscallsubr.h
@@ -529,6 +529,8 @@ 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_getrlimitusage(struct thread *td, u_int which, int flags,
+ rlim_t *ures);
int user_jail_get(struct thread *td, struct iovec *iovp,
unsigned int iovcnt, int flags, copyinuio_t *copyinuio_f,
updateiov_t *updateiov_f);