# Usage sysctl



## Andrew (Sep 17, 2009)

Hello,

I understand with the utility _sysctl(8)_. I use the command
_sysctl -a -d_

I see 
_kern.proc.pid: Process table_

Having rummaged in source codes I understand that this sysctl should output the information on process. But how it to make?

_sysctl kern.proc.pid_
Outputs nothing.


----------



## Alt (Sep 17, 2009)

/usr/src/tools/tools/sysdoc/tunables.mdoc


> kern.proc.pid
> struct
> 
> This internally used
> ...


Seems sysctl dont should do anything with this since its struct... "may be used" its not always may be used with sysctl utility =)


----------



## Carpetsmoker (Sep 17, 2009)

I believe this option in only available when the kernel is compiled with ``options STACK'' and/or ``options DDB''.


----------



## Andrew (Sep 17, 2009)

Here this moment also is not clear. I looked source codes and I know, how using _kern.proc.pid_ to receive the information on process.
On the other hand, kern.proc.all is practically for the same, but as a result of performance 
_sysctl -A_
We see
_kern.proc.all: Format:S, proc Lengty:45312 Dump:....._
Intuitively I understand that it is necessary to specify pid process for reception of the information on it.

Means _sysctl -a -d_ outputs the list of all possible sysctls? Even those which cannot be used with _sysctl_(8)?
:q


----------



## SirDice (Sep 17, 2009)

Some sysctl's are read-only.


----------



## Alt (Sep 18, 2009)

And i think some sysctl's are unavalable via sysctl xD


----------



## Andrew (Sep 18, 2009)

I understand all. A question purely rhetorical - what for to output the list sysctl's which then cannot be used with the command?
:q


----------



## aragon (Sep 19, 2009)

Andrew said:
			
		

> A question purely rhetorical - what for to output the list sysctl's which then cannot be used with the command?


There are two sysctls.  sysctl(8) is a command line utility that gives you access to many parts of the sysctl(3) API.  The parts it doesn't give you access to are those parts that are only useful to applications interfacing directly with the API.


----------



## Andrew (Sep 21, 2009)

For me a question. Whether has sense to write a set of utilities expanding sysctl (8) for reading of all known sysctl's? I wish to try, but whether there will be an advantage to a community?


----------



## aragon (Sep 21, 2009)

To answer that for the community you first need to answer it for yourself, ie. are there capabilities lacking in the sysctl(8) utility that would be of value to you?  If so, write them... at least the ones that are important to you, and then submit the changes to the project.


----------



## Andrew (Sep 21, 2009)

Thanks for council. Most likely and I will make. But nevertheless I tend to to write the version. The interface will differ.


----------

