[NEW PORT] sysutils/sysctlbyname-improved-kmod: sysctl node to implement an improved sysctlbyname(3) clone

Kernel module to add the sysctl.entryidinputbyname sysctl node
to allow to implement an improved sysctlbyname(3) clone to handle:

 * a node without a level name, e.g., "security.jail.param.allow.mount."
 * a CTLTYPE_NODE with a no-NULL handler, e.g., "kern.proc.pid.<pid>"

The sysctlbyname_improved() function and an example are provided, too.

WWW: https://gitlab.com/alfix/sysctlbyname-improved/

PR:		242068
Submitted by:	Alfonso S. Siciliano <alfix86@gmail.com>
This commit is contained in:
Tobias C. Berner 2019-12-14 11:06:43 +00:00
parent dc4d0aae29
commit 975ca88a30
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=520107
5 changed files with 77 additions and 0 deletions

View File

@ -1261,6 +1261,7 @@
SUBDIR += symon
SUBDIR += synergy
SUBDIR += synergy-1
SUBDIR += sysctlbyname-improved-kmod
SUBDIR += sysctlinfo-kmod
SUBDIR += sysgather
SUBDIR += sysinfo

View File

@ -0,0 +1,49 @@
# $FreeBSD$
PORTNAME= sysctlbyname-improved-kmod
DISTVERSION= 20191124
CATEGORIES= sysutils
MAINTAINER= alfix86@gmail.com
COMMENT= Internal sysctl node to implement an improved sysctlbyname(3) clone
LICENSE= BSD2CLAUSE
LICENSE_FILE= ${WRKSRC}/LICENSE
USES= kmod
USE_GITLAB= yes
GL_ACCOUNT= alfix
GL_PROJECT= sysctlbyname-improved
GL_COMMIT= 522eb1f40c46a035c563f4f88594db5803ccf462
PLIST_FILES= ${KMODDIR}/sysctlbyname_improved.ko
PORTEXAMPLES= sysctlbyname_improved.h \
sysctlbyname_improved.c \
sysctlbyname_improved_example.c
OPTIONS_DEFINE= EXAMPLES
OPTIONS_DEFAULT= EXAMPLES
.include <bsd.port.pre.mk>
# Once the sysctlinfo interface (review D21700) lands into the base tree this
# node can be added to the interface and the following statement needs
# to be expanded
.if ${OPSYS} == FreeBSD && ${OSVERSION} < 1200019
IGNORE= needs oid_label member of struct sysctl_oid defined in sysctl.h which was first introduced in FreeBSD 12
.endif
.if ${OPSYS} != FreeBSD
IGNORE= not supported on anything but FreeBSD
.endif
do-install:
${INSTALL_KLD} ${WRKSRC}/sysctlbyname_improved.ko ${STAGEDIR}${KMODDIR}
do-install-EXAMPLES-on:
@${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
.for e in ${PORTEXAMPLES}
${INSTALL_DATA} ${WRKSRC}/examples/${e} ${STAGEDIR}${EXAMPLESDIR}
.endfor
.include <bsd.port.post.mk>

View File

@ -0,0 +1,3 @@
TIMESTAMP = 1574563228
SHA256 (alfix-sysctlbyname-improved-522eb1f40c46a035c563f4f88594db5803ccf462_GL0.tar.gz) = 6ddf449100ed2012eeef2d770bebd58f739f9997957a073dc59e8a08022520a1
SIZE (alfix-sysctlbyname-improved-522eb1f40c46a035c563f4f88594db5803ccf462_GL0.tar.gz) = 8680

View File

@ -0,0 +1,7 @@
Kernel module to add the sysctl.entryidinputbyname sysctl node
to allow to implement an improved sysctlbyname(3) clone to handle:
* a node without a level name, e.g., "security.jail.param.allow.mount."
* a CTLTYPE_NODE with a no-NULL handler, e.g., "kern.proc.pid.<pid>"
The sysctlbyname_improved() function and an example are provided, too.
WWW: https://gitlab.com/alfix/sysctlbyname-improved

View File

@ -0,0 +1,17 @@
[
{ type: install
message: <<EOM
To use the sysctl.entryidinputbyname sysctl node and the sysctlbyname_improved
function, make sure that you have loaded the sysctlbyname_improved kernel
module, by doing
# kldload sysctlbyname_improved
or adding
sysctlbyname_improved_load="YES"
to your /boot/loader.conf.
EOM
}
]