system-info: Add computer-name
parent
565ac276cd
commit
97097fae2c
|
@ -26,3 +26,4 @@ M: linux cpus parse-proc-cpuinfo sort-cpus cpu-counts 2drop ;
|
|||
: hyperthreads ( -- n ) parse-proc-cpuinfo sort-cpus cpu-counts 2nip ;
|
||||
M: linux cpu-mhz parse-proc-cpuinfo first cpu-mhz>> 1,000,000 * ;
|
||||
M: linux physical-mem parse-proc-meminfo mem-total>> ;
|
||||
M: linux computer-name nodename ;
|
|
@ -101,3 +101,5 @@ M: macosx cpu-mhz ( -- n ) { 6 15 } sysctl-query-uint ;
|
|||
: tb-frequency ( -- n ) { 6 23 } sysctl-query-uint ;
|
||||
M: macosx physical-mem ( -- n ) { 6 24 } sysctl-query-ulonglong ;
|
||||
: available-cpus ( -- n ) { 6 25 } sysctl-query-uint ;
|
||||
|
||||
M: macosx computer-name { 1 10 } sysctl-query-string "." split1 drop ;
|
||||
|
|
|
@ -15,6 +15,7 @@ HOOK: available-page-file os ( -- n )
|
|||
HOOK: total-virtual-mem os ( -- n )
|
||||
HOOK: available-virtual-mem os ( -- n )
|
||||
HOOK: available-virtual-extended-mem os ( -- n )
|
||||
HOOK: computer-name os ( -- string )
|
||||
|
||||
: write-unit ( x n str -- )
|
||||
[ 2^ /f number>string write bl ] [ write ] bi* ;
|
||||
|
|
|
@ -96,7 +96,7 @@ M: windows total-virtual-mem ( -- n )
|
|||
M: windows available-virtual-mem ( -- n )
|
||||
memory-status ullAvailVirtual>> ;
|
||||
|
||||
: computer-name ( -- string )
|
||||
M: windows computer-name ( -- string )
|
||||
MAX_COMPUTERNAME_LENGTH 1 +
|
||||
[ <byte-array> dup ] keep uint <ref>
|
||||
GetComputerName win32-error=0/f alien>native-string ;
|
||||
|
|
Loading…
Reference in New Issue