15 Commits

Author SHA1 Message Date
Jeremy Schonfeld
543a9e4cd7
Use URL in JSON/Data APIs (#588)
* Use URL in JSON/Data APIs

* path -> URL

* Use fileSystemPath instead of path(percentEncoded:)

* Correct resource loading on linux
2024-05-08 12:58:00 -07:00
Saleem Abdulrasool
4e2aa38ff7
FoundationEssentials: properly handle env duplication (#583)
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.
2024-05-03 11:48:27 -07:00
Saleem Abdulrasool
e5a435f422
FoundationEssentials: repair ProcessInfo on Windows (#578)
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.
2024-05-02 10:49:20 -07:00
Saleem Abdulrasool
3e4077fcaf
FoundationEssentials: clean up some Windows warnings (#571)
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`.
2024-05-01 13:40:29 -07:00
Jeremy Schonfeld
ad9d6d4d7a
(127135444) Add ProcessInfo implementations for other platforms (#559)
* 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>
2024-04-29 15:35:18 -07:00
Charles Hu
c4e1a33848
Change ProcessInfo.procssName to be lazily loaded (#569) 2024-04-29 10:19:46 -07:00
Charles Hu
7c8859bcb9
Add bounds check for CommandLine.arguments since it could be empty (#481) 2024-03-14 13:03:03 -07:00
Jeremy Schonfeld
e5211f2926
(122981400) Standardize on using internal import 2024-03-06 13:42:02 -08:00
Charles Hu
d5ac168636
ProcessInfo Bincompact: always use full executable path for arg0 (#460) 2024-03-06 09:03:24 -08:00
Charles Hu
c2e623badc
ProcessInfo.environment should create String values outside of lock (#461) 2024-03-06 09:02:50 -08:00
Charles Hu
014e26c0c3
Add lock when retrieving ProcessInfo.environment (#420)
Resolves: rdar://122515578

Co-authored-by: Charles Hu <charle@hu.codes>
2024-02-14 17:20:06 -08:00
Jeremy Schonfeld
33856a556d
(120741818) Port FileManager to swift-foundation
* (120741818) Port FileManager to swift-foundation

* (120741818) Fix linux test failures

* (120741818) Fix build failures
2024-02-09 15:03:43 -08:00
Charles Hu
c67a494187
Removed import XPC since it's not needed (#405) 2024-02-07 17:10:23 -08:00
Charles Hu
b27cf2e8b6
Addressed the Sendable warnings in ProcessInfo (#383) 2024-01-17 17:28:28 -08:00
Charles Hu
4bc61cf900
Rewrite ProcessInfo in Swift (#353) 2024-01-10 16:08:03 -08:00