Bug 240390 - [NEW PORT] sysutils/sysctlinfo-kmod: Interface to visit the sysctl MIB-tree and to get the nodes info
Summary: [NEW PORT] sysutils/sysctlinfo-kmod: Interface to visit the sysctl MIB-tree a...
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Kai Knoblich
URL: https://gitlab.com/alfix/sysctlinfo
Keywords: feature, needs-qa
Depends on:
Blocks: 240391 240575
  Show dependency treegraph
 
Reported: 2019-09-07 15:01 UTC by Alfonso S. Siciliano
Modified: 2019-09-20 14:08 UTC (History)
3 users (show)

See Also:


Attachments
new port .shar (2.57 KB, text/plain)
2019-09-07 15:01 UTC, Alfonso S. Siciliano
no flags Details
new port .shar (sysctlinfo-kmod) (2.90 KB, patch)
2019-09-15 17:59 UTC, Alfonso S. Siciliano
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alfonso S. Siciliano 2019-09-07 15:01:18 UTC
Created attachment 207259 [details]
new port .shar

sysctlinfo is a new interface/kmod to explore the sysctl MIB tree and to get the tree nodes info

WWW: https://gitlab.com/alfix/sysctlinfo

Testing:

 * portlint -C
 * port test
 * poudriere testport -j 130Camd64 -p default -i -o sysutils/sysctlinfo


Thanks,
Alfonso
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2019-09-14 11:31:25 UTC
Comment on attachment 207259 [details]
new port .shar

New (uncommitted) ports don't (cant) need maintainer-approval
Comment 2 Kai Knoblich freebsd_committer 2019-09-15 11:38:09 UTC
Hi Alfonso,

thank you for your contribution and the work on sysctlinfo! The port builds fine on 12.0-RELEASE and 13.0-CURRENT@r352110 amd64 + i386.

On 11.2-, 11.3-RELEASE amd64 + i386 the ports fails to build and following error messages are emitted:

> sysctlinfo.c:292:12: error: no member named 'oid_label' in 'struct sysctl_oid'; did you mean 'oid_name'?
>                 if (oid->oid_label == NULL) {
>                          ^~~~~~~~~
>                          oid_name
> /usr/src/sys/sys/sysctl.h:186:14: note: 'oid_name' declared here
>         const char      *oid_name;
>                         ^
> sysctlinfo.c:300:37: error: no member named 'oid_label' in 'struct sysctl_oid'; did you mean 'oid_name'?
>                         error = SYSCTL_OUT_STR(req, oid->oid_label);
>                                                          ^~~~~~~~~
>                                                          oid_name
> /usr/src/sys/sys/sysctl.h:196:56: note: expanded from macro 'SYSCTL_OUT_STR'
> #define SYSCTL_OUT_STR(r, p)    (r->oldfunc)(r, p, strlen(p) + 1)
>                                                          ^
> /usr/src/sys/sys/sysctl.h:186:14: note: 'oid_name' declared here
>         const char      *oid_name;
>                         ^
> sysctlinfo.c:300:37: error: no member named 'oid_label' in 'struct sysctl_oid'; did you mean 'oid_name'?
>                         error = SYSCTL_OUT_STR(req, oid->oid_label);
>                                                          ^~~~~~~~~
>                                                          oid_name
> /usr/src/sys/sys/sysctl.h:196:46: note: expanded from macro 'SYSCTL_OUT_STR'
> #define SYSCTL_OUT_STR(r, p)    (r->oldfunc)(r, p, strlen(p) + 1)
>                                                 ^
> /usr/src/sys/sys/sysctl.h:186:14: note: 'oid_name' declared here
>         const char      *oid_name;
>                          ^
> 3 errors generated.
> *** Error code 1

For the case if this is expected/intended then we'll need to exclude out those releases from the Makefile, e.g. in a similar way as "graphics/drm-current-kmod" does.

At last but not least, I have two suggestions:

- The port is a kernel module so it makes sense to rename it to "sysutil/sysctlinfo-kmod" to make it more distinguishable.
- Maybe the pkg-descr can have 2-3 more lines with an info that's the port is a kernel module.

What do you think about it?
Comment 3 Alfonso S. Siciliano 2019-09-15 17:59:45 UTC
Created attachment 207510 [details]
new port .shar (sysctlinfo-kmod)

Thank you for your report,

Makefile fixed (FreeBSD 11 has not the `char *oid_label'), testing:

 * poudriere testport -j 130Ramd64 -p default -i -o sysutils/sysctlinfo-kmod
 * poudriere testport -j 120Ramd64 -p default -i -o sysutils/sysctlinfo-kmod
 * poudriere testport -j 113Ramd64 -p default -i -o sysutils/sysctlinfo-kmod


> - The port is a kernel module so it makes sense to rename it to "sysutil/sysctlinfo-kmod" to make it more distinguishable.
> - Maybe the pkg-descr can have 2-3 more lines with an info that's the port is a kernel module.

> What do you think about it?

It's right, the attachment (.shar) is updated


Alfonso
Comment 4 Conrad Meyer freebsd_committer 2019-09-15 19:44:52 UTC
Hi Alfonso,

Would you consider adapting this for inclusion in base instead of ports?  The sysctl kernel interface is old and crufty and clearly doesn't meet your needs; I don't see why an improved interface should live out of tree.

(For others looking for context, the Gitlab link is currently in the URL field and I'll copy it here: https://gitlab.com/alfix/sysctlinfo .)
Comment 5 Alfonso S. Siciliano 2019-09-18 04:06:13 UTC
Hi Conrad,

I created a review D21700
Comment 6 Kai Knoblich freebsd_committer 2019-09-20 06:46:19 UTC
(In reply to Alfonso S. Siciliano from comment #3)
Thank you for the updated patch.

(In reply to Conrad Meyer from comment #4)
(In reply to Alfonso S. Siciliano from comment #5)

Should we wait for the further process in the review (e.g. if greater changes are required) or can we handle this PR independently?

If the the latter is true, I could commit port in the next few days.
Comment 7 Conrad Meyer freebsd_committer 2019-09-20 14:08:29 UTC
Go ahead with the port for now, Kai; I won't have time to look at this any time soon :(.