git: 965170da4548 - main - swap{on,off}(2): add/expose kern_ implementations
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 12 Nov 2026 11:01:51 UTC
The branch main has been updated by brooks:
URL: https://cgit.FreeBSD.org/src/commit/?id=965170da4548176cb0ec4ee65e01248af37f8824
commit 965170da4548176cb0ec4ee65e01248af37f8824
Author: Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2026-11-12 11:01:29 +0000
Commit: Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2026-11-12 11:01:29 +0000
swap{on,off}(2): add/expose kern_ implementations
Effort: CHERI upstreaming
Sponsored by: Innovate UK
Pull Request: https://github.com/freebsd/freebsd-src/pull/2284
---
sys/sys/syscallsubr.h | 3 +++
sys/vm/swap_pager.c | 11 +++++++++--
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/sys/sys/syscallsubr.h b/sys/sys/syscallsubr.h
index 23ba721a3c92..2aa79c2fc1d9 100644
--- a/sys/sys/syscallsubr.h
+++ b/sys/sys/syscallsubr.h
@@ -534,6 +534,9 @@ int kern_statat(struct thread *td, int flag, int fd, const char *path,
int kern_specialfd(struct thread *td, int type, void *arg);
int kern_statfs(struct thread *td, const char *path, enum uio_seg pathseg,
struct statfs *buf);
+int kern_swapoff(struct thread *td, const char *name,
+ enum uio_seg name_seg, u_int flags);
+int kern_swapon(struct thread *td, const char *name);
int kern_symlinkat(struct thread *td, const char *path1, int fd,
const char *path2, enum uio_seg segflg);
int kern_sync(struct thread *td);
diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c
index dd4568ba3b56..7846d138ff4a 100644
--- a/sys/vm/swap_pager.c
+++ b/sys/vm/swap_pager.c
@@ -92,6 +92,7 @@
#include <sys/resourcevar.h>
#include <sys/rwlock.h>
#include <sys/sbuf.h>
+#include <sys/syscallsubr.h>
#include <sys/sysctl.h>
#include <sys/sysproto.h>
#include <sys/systm.h>
@@ -2644,6 +2645,12 @@ struct swapon_args {
int
sys_swapon(struct thread *td, struct swapon_args *uap)
+{
+ return (kern_swapon(td, uap->name));
+}
+
+int
+kern_swapon(struct thread *td, const char *name)
{
struct vattr attr;
struct vnode *vp;
@@ -2666,7 +2673,7 @@ sys_swapon(struct thread *td, struct swapon_args *uap)
}
NDINIT(&nd, LOOKUP, ISOPEN | FOLLOW | LOCKLEAF | AUDITVNODE1,
- UIO_USERSPACE, uap->name);
+ UIO_USERSPACE, name);
error = namei(&nd);
if (error)
goto done;
@@ -2785,7 +2792,7 @@ swaponsomething(struct vnode *vp, void *id, u_long nblks,
* rather than filename as specification. We keep sw_vp around
* only to make this work.
*/
-static int
+int
kern_swapoff(struct thread *td, const char *name, enum uio_seg name_seg,
u_int flags)
{