kern_sysctl.c interface

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

kern_sysctl.c interface

Alfonso Sabato Siciliano
Hi hackers!

kern_sysctl.c provides an interface to get the members of a
'struct sysctl_oid' from the kernel to userland (it is needful to write
a sysctl-like utility).

A comment tells

 * This interface is under work and consideration, and should probably
 * be killed with a big axe by the first person who can find the time.
 * (be aware though, that the proper interface isn't as obvious as it
 * may seem, there are various conflicting requirements.

Where can I find documentation/discussion/tips about it?

I'm coding an interface https://gitlab.com/alfix/kernel-sysctlmibinfo
for my ports.

Regards,
Alfonso Siciliano
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: kern_sysctl.c interface

Poul-Henning Kamp
--------
In message <[hidden email]>, Alfonso Sicilia
no writes:

>A comment tells
>
> * This interface is under work and consideration, and should probably
> * be killed with a big axe by the first person who can find the time.
> * (be aware though, that the proper interface isn't as obvious as it
> * may seem, there are various conflicting requirements.

I think that is a comment I added more than 20 years ago because we,
or at least I, wondered if the sysctl-OID tree should be moved to
something SNMP-OID compatible.

I dont know of anything happening after that.

--
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
[hidden email]         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: kern_sysctl.c interface

Warner Losh
On Wed, Mar 13, 2019, 2:14 AM Poul-Henning Kamp <[hidden email]> wrote:

> --------
> In message <[hidden email]>, Alfonso
> Sicilia
> no writes:
>
> >A comment tells
> >
> > * This interface is under work and consideration, and should probably
> > * be killed with a big axe by the first person who can find the time.
> > * (be aware though, that the proper interface isn't as obvious as it
> > * may seem, there are various conflicting requirements.
>
> I think that is a comment I added more than 20 years ago because we,
> or at least I, wondered if the sysctl-OID tree should be moved to
> something SNMP-OID compatible.
>
> I dont know of anything happening after that.
>

I suspect after 20ish years the comment can be removed, eh?

Warner

--
> Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
> [hidden email]         | TCP/IP since RFC 956
> FreeBSD committer       | BSD since 4.3-tahoe
> Never attribute to malice what can adequately be explained by incompetence.
> _______________________________________________
> [hidden email] mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "[hidden email]"
>
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: kern_sysctl.c interface

Poul-Henning Kamp
--------
In message <[hidden email]>
, Warner Losh writes:

>> > * This interface is under work and consideration, and should probably
>> > * be killed with a big axe by the first person who can find the time.
>> > * (be aware though, that the proper interface isn't as obvious as it
>> > * may seem, there are various conflicting requirements.
>>
>> I think that is a comment I added more than 20 years ago because we,
>> or at least I, wondered if the sysctl-OID tree should be moved to
>> something SNMP-OID compatible.
>>
>> I dont know of anything happening after that.
>
>I suspect after 20ish years the comment can be removed, eh?

Well, it's still a butt-ugly and inefficient interface...

--
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
[hidden email]         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: kern_sysctl.c interface

Alfonso Sabato Siciliano
On Wed, 13 Mar 2019 at 20:53, Poul-Henning Kamp <[hidden email]> wrote:

> --------
> In message <
> [hidden email]>
> , Warner Losh writes:
>
> >> > * This interface is under work and consideration, and should probably
> >> > * be killed with a big axe by the first person who can find the time.
> >> > * (be aware though, that the proper interface isn't as obvious as it
> >> > * may seem, there are various conflicting requirements.
> >>
> >> I think that is a comment I added more than 20 years ago because we,
> >> or at least I, wondered if the sysctl-OID tree should be moved to
> >> something SNMP-OID compatible.
> >>
> >> I dont know of anything happening after that.
> >
> >I suspect after 20ish years the comment can be removed, eh?
>
> Well, it's still a butt-ugly and inefficient interface...
>

thank you for your answers, I agree with you,
snmp-oid could be a nice project in the future.

Regards,
Alfonso
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: kern_sysctl.c interface

Alan Somers-2
On Thu, Mar 14, 2019 at 9:57 AM Alfonso Sabato Siciliano
<[hidden email]> wrote:

>
> On Wed, 13 Mar 2019 at 20:53, Poul-Henning Kamp <[hidden email]> wrote:
>
> > --------
> > In message <
> > [hidden email]>
> > , Warner Losh writes:
> >
> > >> > * This interface is under work and consideration, and should probably
> > >> > * be killed with a big axe by the first person who can find the time.
> > >> > * (be aware though, that the proper interface isn't as obvious as it
> > >> > * may seem, there are various conflicting requirements.
> > >>
> > >> I think that is a comment I added more than 20 years ago because we,
> > >> or at least I, wondered if the sysctl-OID tree should be moved to
> > >> something SNMP-OID compatible.
> > >>
> > >> I dont know of anything happening after that.
> > >
> > >I suspect after 20ish years the comment can be removed, eh?
> >
> > Well, it's still a butt-ugly and inefficient interface...
> >
>
> thank you for your answers, I agree with you,
> snmp-oid could be a nice project in the future.
>
> Regards,
> Alfonso

This is the first time in a long time that I've read the words "snmp"
and "future" in the same sentence.  Does anybody still use SNMP
anymore?  Has it been supplanted yet?
-Alan
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: kern_sysctl.c interface

Enji Cooper

> On Mar 14, 2019, at 09:00, Alan Somers <[hidden email]> wrote:

...

> This is the first time in a long time that I've read the words "snmp"
> and "future" in the same sentence.  Does anybody still use SNMP
> anymore?  Has it been supplanted yet?

Cisco and isilon do. Facebook doesn’t on their main fleet because it doesn’t provide fine grained reporting efficiently at scale and for other reasons.

Monitoring systems like Zabbix or Prometheus provide greater value in contemporary complex  systems architectures.

Thanks,
-Enji (former SNMP advocate)
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: kern_sysctl.c interface

Mark Johnston-2
In reply to this post by Poul-Henning Kamp
On Wed, Mar 13, 2019 at 07:53:40PM +0000, Poul-Henning Kamp wrote:

> --------
> In message <[hidden email]>
> , Warner Losh writes:
>
> >> > * This interface is under work and consideration, and should probably
> >> > * be killed with a big axe by the first person who can find the time.
> >> > * (be aware though, that the proper interface isn't as obvious as it
> >> > * may seem, there are various conflicting requirements.
> >>
> >> I think that is a comment I added more than 20 years ago because we,
> >> or at least I, wondered if the sysctl-OID tree should be moved to
> >> something SNMP-OID compatible.
> >>
> >> I dont know of anything happening after that.
> >
> >I suspect after 20ish years the comment can be removed, eh?
>
> Well, it's still a butt-ugly and inefficient interface...

I don't know that it'd help much with efficiency, but lately I've wanted
an fd-based interface for sysctl so as to be able to use Capsicum to
restrict the sysctl namespace.  The idea is that a sysctlfd would
reference a node in the sysctl hierarchy, and it would be possible to
read or write a descendent node using the relative sysctlfd, like
the *at() system calls.  Only sysctls reachable from an open sysctlfd
could be accessed while in capability mode.  Today, we have a situation
where sysctls are either statically flagged as CTLFLAG_CAPRD and thus
are readable in capability mode, or you have to talk to another process
over a unix socket and have it access the sysctl on your behalf.

I'm not sure what an ideal syscall interface for this would look like.
I think you could probably implement the idea using the existing
__sysctl() syscall, by having a magic OID that writes an fd to the
out buffer.  Ideally you'd be able to use relative names to refer to
sysctl, so that if you had an fd for dev.cpu, you could read CPU 0's
temperature with something like:

        sysctlat(cpufd, "0.temperature", oldp, &oldlen, NULL, 0);

That could avoid resolving "dev.cpu" each time it's read, so it'd be
more efficient than what we do today.

A real interface has to handle iteration and name resolution (hopefully
avoiding an extra syscall just for resolution).  It also needs to handle
sysctl nodes that are addressed by OID, like kern.proc.pid.<pid>.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[hidden email]"