diff --git a/basis/system-info/linux/linux.factor b/basis/system-info/linux/linux.factor index 09f2a91bc8..721daa43ac 100644 --- a/basis/system-info/linux/linux.factor +++ b/basis/system-info/linux/linux.factor @@ -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 diff --git a/basis/system-info/macosx/macosx.factor b/basis/system-info/macosx/macosx.factor index ccdec7877e..1fb1fdb86c 100644 --- a/basis/system-info/macosx/macosx.factor +++ b/basis/system-info/macosx/macosx.factor @@ -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 ; diff --git a/basis/system-info/system-info.factor b/basis/system-info/system-info.factor index 156d20ed8e..7c2d9bdbe3 100644 --- a/basis/system-info/system-info.factor +++ b/basis/system-info/system-info.factor @@ -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* ; diff --git a/basis/system-info/windows/windows.factor b/basis/system-info/windows/windows.factor index 67fd38211e..1e7bc07d69 100644 --- a/basis/system-info/windows/windows.factor +++ b/basis/system-info/windows/windows.factor @@ -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 + [ dup ] keep uint GetComputerName win32-error=0/f alien>native-string ;