The freebsd-sysctl Reference Manual

Next: , Previous: , Up: (dir)   [Contents][Index]

The freebsd-sysctl Reference Manual

This is the freebsd-sysctl Reference Manual, version 1.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Aug 15 04:34:44 2022 GMT+0.

Table of Contents


1 Introduction

freebsd-sysctl

Build Status

freebsd-sysctl is a wrapper around sysctl system call for FreeBSD. It can be used, for example, in system monitors in StumpWM's mode line for tracking CPU temperature. Currently it can get/set sysctl variables, automatically detecting their formats, list sysctl nodes, etc.

Examples

Here is the documentation in a form of examples.

;; Read a sysctl value
(freebsd-sysctl:sysctl-by-name "kern.hz")
;;  >> 1000
;;  >> NIL

;; You can also access values via MIBs (Management Information Base)
(freebsd-sysctl:sysctl (freebsd-sysctl:sysctl-name=>mib "kern.hz"))
;;  >> 1000
;;  >> NIL

;; It can detect temperature format
(freebsd-sysctl:sysctl-by-name "dev.cpu.0.temperature")
;;  >> 46.149994
;;  >> NIL

;; It also understands strings
(freebsd-sysctl:sysctl-by-name "dev.pcm.3.output")
;;  >> "Line-Out"
;;  >> NIL

;; You can set a new value to sysctl
(freebsd-sysctl:sysctl-by-name "dev.pcm.3.output" "Headphones")
;;  >> "Line-Out"
;;  >> "Headphones"

;; You can list a sysctl node
(freebsd-sysctl:list-sysctls "dev.pcm.3.play")
;;  >> ("dev.pcm.3.play.vchans" "dev.pcm.3.play.vchanmode" "dev.pcm.3.play.vchanrate"
;;      "dev.pcm.3.play.vchanformat")
~~~~~~~~~~~~~~~

TODO
----
Make it possible to get all sysctls as with `sysctl -a`.

2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 freebsd-sysctl

Sysctl kernel control mechanism for common lisp

Maintainer

Vasily Postnicov <shamaz.mazum@gmail.com>

License

2-clause BSD

Version

1.0

Defsystem Dependency

cffi-grovel (system).

Dependency

cffi (system).

Source

freebsd-sysctl.asd.

Child Components

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp   [Contents][Index]

3.1.1 freebsd-sysctl/freebsd-sysctl.asd

Source

freebsd-sysctl.asd.

Parent Component

freebsd-sysctl (system).

ASDF Systems

freebsd-sysctl.


3.1.2 freebsd-sysctl/package.lisp

Source

freebsd-sysctl.asd.

Parent Component

freebsd-sysctl (system).

Packages

freebsd-sysctl.


3.1.3 freebsd-sysctl/grovel.lisp

Dependency

package.lisp (file).

Source

freebsd-sysctl.asd.

Parent Component

freebsd-sysctl (system).


3.1.4 freebsd-sysctl/freebsd-sysctl.lisp

Dependency

grovel.lisp (file).

Source

freebsd-sysctl.asd.

Parent Component

freebsd-sysctl (system).

Public Interface
Internals

4 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

4.1 freebsd-sysctl

Source

package.lisp.

Use List
  • cffi.
  • common-lisp.
Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Public Interface


5.1.1 Ordinary functions

Function: list-sysctls (name)

Returns a list of sysctls for the node with name NAME.

Package

freebsd-sysctl.

Source

freebsd-sysctl.lisp.

Function: sysctl (mib &optional new-value)

Perform sysctl call for a value specified by mib array. If new-value is specified, it will be set as a new value for that sysctl. Two values are returned: the old and the new value.

Package

freebsd-sysctl.

Source

freebsd-sysctl.lisp.

Function: sysctl-by-name (name &optional new-value)

Same as SYSCTL, only it accepts string name for sysctl rather than mib array.

Package

freebsd-sysctl.

Source

freebsd-sysctl.lisp.

Function: sysctl-mib=>name (mib)

Get sysctl name corresponding to mib array

Package

freebsd-sysctl.

Source

freebsd-sysctl.lisp.

Function: sysctl-name=>mib (name)

Get sysctl mib array corresponding to sysctl name.

Package

freebsd-sysctl.

Source

freebsd-sysctl.lisp.


5.1.2 Generic functions

Generic Reader: sysctl-error-errno (condition)
Package

freebsd-sysctl.

Methods
Reader Method: sysctl-error-errno ((condition sysctl-error))
Source

freebsd-sysctl.lisp.

Target Slot

errno.


5.1.3 Conditions

Condition: sysctl-error
Package

freebsd-sysctl.

Source

freebsd-sysctl.lisp.

Direct superclasses

error.

Direct methods
Direct slots
Slot: errno
Initform

(quote 0)

Initargs

:errno

Readers

sysctl-error-errno.

Writers

This slot is read-only.

Slot: message
Initargs

:message

Readers

sysctl-error-message.

Writers

This slot is read-only.


5.2 Internals


Next: , Previous: , Up: Internals   [Contents][Index]

5.2.1 Constants

Constant: +max-foreign-len+

Maximal foreign data chunk length

Package

freebsd-sysctl.

Source

freebsd-sysctl.lisp.

Constant: +max-mib-len+

Maximal number of elements in mib array

Package

freebsd-sysctl.

Source

freebsd-sysctl.lisp.


Next: , Previous: , Up: Internals   [Contents][Index]

5.2.2 Ordinary functions

Function: fill-foreign-array (foreign array &key offset)
Package

freebsd-sysctl.

Source

freebsd-sysctl.lisp.

Function: get-errno ()
Package

freebsd-sysctl.

Source

freebsd-sysctl.lisp.

Function: interpret-result (data length type)
Package

freebsd-sysctl.

Source

freebsd-sysctl.lisp.

Function: output-data (foreign-data type data)
Package

freebsd-sysctl.

Source

freebsd-sysctl.lisp.

Function: parse-temperature (temp precision)
Package

freebsd-sysctl.

Source

freebsd-sysctl.lisp.

Function: strerror (errnum)
Package

freebsd-sysctl.

Source

freebsd-sysctl.lisp.

Function: sysctl% (name namelen oldp oldlenp newp newlen)
Package

freebsd-sysctl.

Source

freebsd-sysctl.lisp.

Function: sysctl-name=>mib% (name mibp sizep)
Package

freebsd-sysctl.

Source

freebsd-sysctl.lisp.

Function: sysctl-type (mib)
Package

freebsd-sysctl.

Source

freebsd-sysctl.lisp.


5.2.3 Generic functions

Generic Reader: sysctl-error-message (condition)
Package

freebsd-sysctl.

Methods
Reader Method: sysctl-error-message ((condition sysctl-error))
Source

freebsd-sysctl.lisp.

Target Slot

message.


Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts


Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   F   G   I   L   M   O   P   S  
Index Entry  Section

F
fill-foreign-array: Private ordinary functions
Function, fill-foreign-array: Private ordinary functions
Function, get-errno: Private ordinary functions
Function, interpret-result: Private ordinary functions
Function, list-sysctls: Public ordinary functions
Function, output-data: Private ordinary functions
Function, parse-temperature: Private ordinary functions
Function, strerror: Private ordinary functions
Function, sysctl: Public ordinary functions
Function, sysctl%: Private ordinary functions
Function, sysctl-by-name: Public ordinary functions
Function, sysctl-mib=>name: Public ordinary functions
Function, sysctl-name=>mib: Public ordinary functions
Function, sysctl-name=>mib%: Private ordinary functions
Function, sysctl-type: Private ordinary functions

G
Generic Function, sysctl-error-errno: Public generic functions
Generic Function, sysctl-error-message: Private generic functions
get-errno: Private ordinary functions

I
interpret-result: Private ordinary functions

L
list-sysctls: Public ordinary functions

M
Method, sysctl-error-errno: Public generic functions
Method, sysctl-error-message: Private generic functions

O
output-data: Private ordinary functions

P
parse-temperature: Private ordinary functions

S
strerror: Private ordinary functions
sysctl: Public ordinary functions
sysctl%: Private ordinary functions
sysctl-by-name: Public ordinary functions
sysctl-error-errno: Public generic functions
sysctl-error-errno: Public generic functions
sysctl-error-message: Private generic functions
sysctl-error-message: Private generic functions
sysctl-mib=>name: Public ordinary functions
sysctl-name=>mib: Public ordinary functions
sysctl-name=>mib%: Private ordinary functions
sysctl-type: Private ordinary functions

Jump to:   F   G   I   L   M   O   P   S