* Advise porter on where to make necessary change.
In #1075 the change was already made for BSD (thank you!); my working
edit had this guidance to ensure future porters get an error directing
them where to make a necessary change.
Otherwise, the FoundationEssentials build will fail and complain these
variables are not defined but not have guidance as to where they are
sourced from.
* OpenBSD does not support extended attributes.
* OpenBSD does not have secure_getenv.
* Remaining OpenBSD changes.
* OpenBSD also needs `pthread_mutex_t?`.
* Originally I followed Darwin's check with `d_namlen`, but this should
work too.
* Correct statvfs type casts for OpenBSD.
On OpenBSD, fsblkcnt_t -- the type of f_blocks -- is a UInt64; therefore,
so must `blockSize` be.
Ultimately, both sides of the `totalSizeBytes` multiplication should
probably be type cast for all platforms, but that's a more significant
functional change for another time.
* Default activeProcessorCount to 1, not 0.
After a rather tedious debugging session trying to figure out why
swiftpm-bootstrap appeared to be deadlocked, this turned out to be the
culprit. Perhaps this should be #error instead, but for now, set a
sensible default.
* Use sysconf for activeProcessorCount.
This is what Dispatch does in some places for OpenBSD anyway, so do
likewise here.
* FreeBSD platform specific fixes
- Use "/usr/share/zoneinfo"
- Use platform specific types and values
- Implement extattr ops for FreeBSD
- Use copy_file_range(2) for file cloning
* Revise patch to ProcessInfo to reduce potential impact to other platforms
* Fix macOS build
* typo
* take suggested change
* [Android] Enable more code and tests
while disabling setting extended file attributes and a test creating a hard link,
features not normally allowed on Android.
* Remove incorrect WASI check
Windows GetEnvironmentStringsW API can return magic environment variables set by the cmd shell that starts with "=". We should hide these values to avoid surprising behavior.
resolves: https://github.com/apple/swift-foundation/issues/847
* Get FoundationEssentials building
Adding the missing musl imports to get FoundationEssentials building for
the Swift static SDKs again.
Also providing an option to disable building the macros. The macros
aren't necessary for building the library and will not be run as part of
the static SDK. No need to bloat the SDK or build times further. For
Swift 6, the macros should be provided by the toolchain since the
toolchain and SDK are current revlocked due to swiftmodules.
* Get FoundationInternationalization building
Adding the missing Musl imports to get FoundationInternationalization
building for the static SDK.
* [android] fix the LP32 armv7/i686 android build
* Update Sources/FoundationEssentials/Android+Extensions.swift
Co-authored-by: Jeremy Schonfeld <1004103+jmschonfeld@users.noreply.github.com>
* drop the android Lp32 specific operator &
---------
Co-authored-by: Jeremy Schonfeld <1004103+jmschonfeld@users.noreply.github.com>
* Add `import WASILibc` statements to libc import chains
* Declare wasm32 arch as 32-bit environment
* Switch to _pointerBitWidth for architecture checks
This change switches the architecture checks in Data.swift to use the
_pointerBitWidth instead of the arch() checks for consistency with newer
platforms.
This adds the necessary guards and includes for the Android modules.
While the module does not compile currently due to nullability
differences (and in some cases missing declarations), this at least
brings the module to a point where we can start working on the errors
and differences to create a maintainable codebase for Android.
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>