The terminator is a valid string and will give a valid pointer. However,
the string itself is empty (`\0\0`) and indicates the termination of the
process environment block. Handle this properly to avoid a buffer
overrun.
Use a dynamically allocated buffer to avoid truncation/underruns that
are not possible to recover from. Fix some parameter passing to match
the type signature of the C function. Fix some syntactic issues in the
code.
Use the Windows POSIX API spellings to avoid the warnings. Take the
opportunity to change the environment handling to ensure that we are
able to handle weird unicode environment variables which may not be
rendered properly in the ASCII environment representation. Adjust some
types to better match the implementation on Windows which is a minor uop
to avoid unnecessary `trunc` and `sext` or `zext`.
* Add ProcessInfo implementations for other platforms
* Update Platform.getHostname for Windows
Co-authored-by: Saleem Abdulrasool <compnerd@compnerd.org>
* Add alternate platform implementations of ProcessInfo tests
* Clean up windows switch statement
* Use nonzeroBitCount on Windows
* Add Linux implementation for retrieving active processor count
* Apply Windows additions from code review
Co-authored-by: Saleem Abdulrasool <compnerd@compnerd.org>
* Apply additional Windows suggestions
* TotalMemoryKB -> totalMemoryKB
* Fix conditional os directive
* Update process name
---------
Co-authored-by: Saleem Abdulrasool <compnerd@compnerd.org>