-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
48 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1 @@ | ||
--[[--------------------------------------------------------------------------- | ||
-- | ||
-- NOTE: | ||
-- sysctl.get() and sysctl.set() raise an error if any problem occur. If | ||
-- you don't control the key you're passing to these function you might | ||
-- wanna use lua's protected calls (pcall). | ||
------------------------------------------------------------------------------- | ||
-- | ||
-- sysctl.get(key) | ||
-- returns two values. first returned value is the sysctl(3) value, | ||
-- second value is the format of returned value | ||
-- - "I" int | ||
-- - "UI" unsigned int | ||
-- - "IK" int, in (kelv * 10) (used to get temperature) | ||
-- - "L" long | ||
-- - "UL" unsigned long | ||
-- - "Q" quad_t | ||
-- - "UQ" unsigned quad_t | ||
-- - "A" char * | ||
-- - "T,dev_t" dev_t | ||
-- - "S,clockinfo" struct clockinfo | ||
-- - "S,loadavg" struct loadavg | ||
-- - "S,timeval" struct timeval | ||
-- - "S,vmtotal" struct vmtotal | ||
-- | ||
-- In lua land, it means that: | ||
-- - "I", "UI", "IK", "L", "UL", "Q", "UQ" are numbers. | ||
-- - "A" is a string | ||
-- - "T,dev_t" is a table of integers | ||
-- { minor, major } | ||
-- - "S,clockinfo" is a table of integers | ||
-- { hz, tick, profhz, stathz } | ||
-- - "S,loadavg" is an array of numbers (double) | ||
-- { 1, 2, 3 } | ||
-- - "S,timeval" is a table of integers | ||
-- { sec, sec } | ||
-- - "S,vmtotal" is a table of integers | ||
-- { rq, dw, pw, sl, vm, avm, rm, arm, vmshr, avmshr, | ||
-- rmshr, armshr, free } | ||
------------------------------------------------------------------------------- | ||
-- | ||
-- sysctl.set(key, newval) | ||
-- set the sysctl's key to newval. return nothin' and throw lua | ||
-- error if any problem occur. You should notice that some sysctl's key | ||
-- are read only or read only tunable and then can't be set at runtime. | ||
------------------------------------------------------------------------------- | ||
-- | ||
-- sysctl.IK2celsius(kelv) | ||
-- convert a sysctl's IK value into celsius and return it. | ||
------------------------------------------------------------------------------- | ||
-- | ||
-- sysctl.IK2farenheit(kelv) | ||
-- convert a sysctl's IK value into farenheit and return it. | ||
-----------------------------------------------------------------------------]] | ||
require('sysctl.core') |