sysutils/devctl-jail-kmod: new port

This kernel module provides jails status changes
in devctl, and available to devd

    Initial non working draft
    Fix include order for 13+
    Fix category's makefile

    Remove devctl_notify_f that has been removed in later version
    The flag used is the default one, so we are not introducing
    different behaviors
This commit is contained in:
Luca Pizzamiglio
2022-10-03 19:08:45 +02:00
parent f4ddb2127c
commit 7ddec06278
5 changed files with 76 additions and 0 deletions
+1
View File
@@ -263,6 +263,7 @@
SUBDIR += deltup
SUBDIR += desktop-installer
SUBDIR += detox
SUBDIR += devctl-jail-kmod
SUBDIR += devcpu-data
SUBDIR += devcpu-data-amd
SUBDIR += devcpu-data-intel
+19
View File
@@ -0,0 +1,19 @@
PORTNAME= devctl-jail-kmod
DISTVERSION= g20190521
CATEGORIES= sysutils
MAINTAINER= pizzamig@FreeBSD.org
COMMENT= Module to expose jail lifecycle events
LICENSE= BSD3CLAUSE
LICENSE_FILE= ${WRKSRC}/LICENSE
USES= kmod uidfix
USE_GITHUB= yes
GH_ACCOUNT= fubarnetes
GH_PROJECT= kmod_devctl_jail
GH_TAGNAME= d3c17d2381a
PLIST_FILES= ${KMODDIR}/devctl_jail.ko
.include <bsd.port.mk>
+3
View File
@@ -0,0 +1,3 @@
TIMESTAMP = 1663582453
SHA256 (fubarnetes-kmod_devctl_jail-g20190521-d3c17d2381a_GH0.tar.gz) = 6ad5e1a8cfd4704499be29c5881ac41817220ba0cd51521ed2e9f9054afbbcfb
SIZE (fubarnetes-kmod_devctl_jail-g20190521-d3c17d2381a_GH0.tar.gz) = 4187
@@ -0,0 +1,50 @@
--- devctl_jail.c.orig 2019-05-21 13:00:05 UTC
+++ devctl_jail.c
@@ -34,10 +34,10 @@
#include <sys/cdefs.h>
#include <sys/types.h>
+#include <sys/param.h> /* defines used in kernel.h */
#include <sys/module.h>
#include <sys/systm.h> /* uprintf */
#include <sys/errno.h>
-#include <sys/param.h> /* defines used in kernel.h */
#include <sys/kernel.h> /* types used in module initialization */
#include <sys/jail.h>
#include <sys/proc.h>
@@ -73,7 +73,7 @@ devctl_jail_prison_create(void *obj, void *data __unus
sbuf_new(&sb, buf, DEVCTL_JAIL_LOGSIZE, SBUF_FIXEDLEN);
sbuf_printf(&sb, "jid=%d", pr->pr_id);
sbuf_finish(&sb);
- devctl_notify_f("kernel", "jail", "created", sbuf_data(&sb), M_NOWAIT);
+ devctl_notify("kernel", "jail", "created", sbuf_data(&sb));
sbuf_delete(&sb);
free(buf, M_DEVCTL_JAIL);
return (0);
@@ -117,7 +117,7 @@ devctl_jail_prison_set(void *obj, void *data)
}
sbuf_finish(&sb);
- devctl_notify_f("kernel", "jail", "updated", sbuf_data(&sb), M_NOWAIT);
+ devctl_notify("kernel", "jail", "updated", sbuf_data(&sb));
sbuf_delete(&sb);
free(buf, M_DEVCTL_JAIL);
return (0);
@@ -143,7 +143,7 @@ devctl_jail_prison_remove(void *obj, void *data __unus
sbuf_new(&sb, buf, DEVCTL_JAIL_LOGSIZE, SBUF_FIXEDLEN);
sbuf_printf(&sb, "jid=%d", pr->pr_id);
sbuf_finish(&sb);
- devctl_notify_f("kernel", "jail", "removed", sbuf_data(&sb), M_NOWAIT);
+ devctl_notify("kernel", "jail", "removed", sbuf_data(&sb));
sbuf_delete(&sb);
free(buf, M_DEVCTL_JAIL);
return (0);
@@ -165,7 +165,7 @@ devctl_jail_prison_attach(void *obj, void *data __unus
sbuf_new(&sb, buf, DEVCTL_JAIL_LOGSIZE, SBUF_FIXEDLEN);
sbuf_printf(&sb, "jid=%d pid=%d", pr->pr_id, td->td_proc->p_pid);
sbuf_finish(&sb);
- devctl_notify_f("kernel", "jail", "attached", sbuf_data(&sb), M_NOWAIT);
+ devctl_notify("kernel", "jail", "attached", sbuf_data(&sb));
sbuf_delete(&sb);
free(buf, M_DEVCTL_JAIL);
return (0);
+3
View File
@@ -0,0 +1,3 @@
Kernel mdule providing dectl notifications for jails
Jails event like start and stop can be notified via devd.
Devd acions can be added to send messages to syslogd