]> gitweb.factorcode.org Git - factor.git/commitdiff
system-info: Add computer-name
authorDoug Coleman <doug.coleman@gmail.com>
Mon, 9 Jul 2018 03:46:18 +0000 (22:46 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Mon, 9 Jul 2018 03:46:18 +0000 (22:46 -0500)
basis/system-info/linux/linux.factor
basis/system-info/macosx/macosx.factor
basis/system-info/system-info.factor
basis/system-info/windows/windows.factor

index 09f2a91bc88daaba48937600cfa94004305c54ca..721daa43ac0f670f5e9dce6545453380324d1377 100644 (file)
@@ -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 ;
\ No newline at end of file
index ccdec7877e62c6ae422229f7b68c079f2b3bf98c..1fb1fdb86cfdc2ef10d5e47e9c45f3cc696bf513 100644 (file)
@@ -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 ;
index 156d20ed8e24920132074051e35caaa877859e79..7c2d9bdbe3730c9e2b0b4ac483ab58d183eeda5b 100644 (file)
@@ -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* ;
index 67fd38211e13eb549aa292fc05a77800562a1088..1e7bc07d691b578c33c0ec5c6d34d2457de4c7a6 100644 (file)
@@ -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 ;