mirror of
https://github.com/apple/swift-system
synced 2026-11-22 04:30:46 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7502b711c9 | ||
|
|
abcf8e31b3 | ||
|
|
0a3460f369 | ||
|
|
c50ad26d06 |
No files matched your search
@@ -141,6 +141,12 @@ let package = Package(
|
||||
exclude: testsToExclude,
|
||||
cSettings: cSettings,
|
||||
swiftSettings: swiftSettings),
|
||||
// Builds a SystemPackage consumer with MemberImportVisibility enabled.
|
||||
// Fails if a C member of a vended type is attributed to the CSystem module.
|
||||
.testTarget(
|
||||
name: "MemberImportVisibility",
|
||||
dependencies: ["SystemPackage"],
|
||||
swiftSettings: [.enableUpcomingFeature("MemberImportVisibility")]),
|
||||
],
|
||||
swiftLanguageModes: [.v5]
|
||||
)
|
||||
@@ -32,7 +32,7 @@ To use the `SystemPackage` library in a SwiftPM project,
|
||||
add the following line to the dependencies in your `Package.swift` file:
|
||||
|
||||
```swift
|
||||
.package(url: "https://github.com/apple/swift-system", from: "1.6.1"),
|
||||
.package(url: "https://github.com/apple/swift-system", from: "1.7.1"),
|
||||
```
|
||||
|
||||
Finally, include `"SystemPackage"` as a dependency for your executable target:
|
||||
@@ -41,7 +41,7 @@ Finally, include `"SystemPackage"` as a dependency for your executable target:
|
||||
let package = Package(
|
||||
// name, platforms, products, etc.
|
||||
dependencies: [
|
||||
.package(url: "https://github.com/apple/swift-system", from: "1.6.1"),
|
||||
.package(url: "https://github.com/apple/swift-system", from: "1.7.1"),
|
||||
// other dependencies
|
||||
],
|
||||
targets: [
|
||||
@@ -88,6 +88,7 @@ The following table maps existing package releases to their minimum required Swi
|
||||
| ----------------------- | --------------- | ------------- |
|
||||
| swift-system 1.3.x | >= Swift 5.8 | >= Xcode 14.3 |
|
||||
| swift-system 1.4.x through 1.6.x | >= Swift 5.9 | >= Xcode 15.0 |
|
||||
| swift-system 1.7.x | >= Swift 6.1 | >= Xcode 16.3 |
|
||||
|
||||
We'd like this package to quickly embrace Swift language and toolchain improvements that are relevant to its mandate. Accordingly, from time to time, new versions of this package require clients to upgrade to a more recent Swift toolchain release. (This allows the package to make use of new language/stdlib features, build on compiler bug fixes, and adopt new package manager functionality as soon as they are available.) Patch (i.e., bugfix) releases will not increase the required toolchain version, but any minor (i.e., new feature) release may do so.
|
||||
|
||||
@@ -107,15 +108,16 @@ We maintain separate branches for each active minor version of the package:
|
||||
|
||||
| Package version | Branch |
|
||||
| ----------------------- | ----------- |
|
||||
| swift-system 1.3.x | release/1.3 |
|
||||
| swift-system 1.4.x | release/1.4 |
|
||||
| swift-system 1.5.x | release/1.5 |
|
||||
| swift-system 1.6.x | release/1.6 |
|
||||
| swift-system 1.7.x (unreleased) | main |
|
||||
| swift-system 1.3.x | release/1.3.0 |
|
||||
| swift-system 1.4.x | release/1.4.0 |
|
||||
| swift-system 1.5.x | release/1.5.0 |
|
||||
| swift-system 1.6.x | release/1.6.0 |
|
||||
| swift-system 1.7.x | release/1.7.0 |
|
||||
| swift-system 1.8.x (unreleased) | main |
|
||||
|
||||
Changes must land on the branch corresponding to the earliest release that they will need to ship on. They are periodically propagated to subsequent branches, in the following direction:
|
||||
|
||||
`release/1.3` → `release/1.4` → `main`
|
||||
`release/1.6.0` → `release/1.7.0` → `main`
|
||||
|
||||
For example, anything landing on `release/1.3` will eventually appear on `release/1.4` and then `main` too; there is no need to file standalone PRs for each release line. (Change propagation currently requires manual work -- it is performed by project maintainers.)
|
||||
|
||||
|
||||
@@ -11,13 +11,11 @@
|
||||
|
||||
#include <sys/epoll.h>
|
||||
#include <sys/eventfd.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/sysinfo.h>
|
||||
#include <sys/timerfd.h>
|
||||
#include <sys/types.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <pthread.h>
|
||||
#include <sched.h>
|
||||
#include <unistd.h>
|
||||
|
||||
@@ -9,6 +9,23 @@
|
||||
|
||||
#if !os(Windows)
|
||||
|
||||
#if SYSTEM_PACKAGE_DARWIN
|
||||
import Darwin
|
||||
#elseif canImport(Glibc)
|
||||
import CSystem
|
||||
import Glibc
|
||||
#elseif canImport(Musl)
|
||||
import CSystem
|
||||
import Musl
|
||||
#elseif canImport(WASILibc)
|
||||
import WASILibc
|
||||
#elseif canImport(Android)
|
||||
import CSystem
|
||||
import Android
|
||||
#else
|
||||
#error("Unsupported Platform")
|
||||
#endif
|
||||
|
||||
/// Get the path to the system temporary directory.
|
||||
internal func _getTemporaryDirectory() throws -> FilePath {
|
||||
guard let tmp = system_getenv("TMPDIR") else {
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
This source file is part of the Swift System open source project
|
||||
|
||||
Copyright (c) 2026 Apple Inc. and the Swift System project authors
|
||||
Licensed under Apache License v2.0 with Runtime Library Exception
|
||||
|
||||
See https://swift.org/LICENSE.txt for license information
|
||||
*/
|
||||
|
||||
// Compile-only canary for MemberImportVisibility regressions: this file fails
|
||||
// to build if a C member of a type SystemPackage vends is attributed to the
|
||||
// private CSystem module.
|
||||
//
|
||||
// For new type wrappers introduced to System, access their C members here:
|
||||
// - Import the platform overlay (Glibc/Musl), as consumers do.
|
||||
// - Access raw C members of vended types (e.g. CInterop.Stat) as a downstream
|
||||
// consumer would. Don't go through the Swift (e.g. Stat) wrapper since its
|
||||
// accesses happen inside System, where importing CSystem is fine.
|
||||
// - Touch every direct member the public API exposes. One field is not always
|
||||
// a safe proxy for the rest.
|
||||
|
||||
#if canImport(Glibc) || canImport(Musl)
|
||||
#if canImport(Glibc)
|
||||
import Glibc
|
||||
#elseif canImport(Musl)
|
||||
import Musl
|
||||
#endif
|
||||
import SystemPackage
|
||||
|
||||
func _mivProbe(_ s: CInterop.Stat) {
|
||||
_ = s.st_dev
|
||||
_ = s.st_ino
|
||||
_ = s.st_mode
|
||||
_ = s.st_nlink
|
||||
_ = s.st_uid
|
||||
_ = s.st_gid
|
||||
_ = s.st_rdev
|
||||
_ = s.st_size
|
||||
_ = s.st_blksize
|
||||
_ = s.st_blocks
|
||||
_ = s.st_atim
|
||||
_ = s.st_mtim
|
||||
_ = s.st_ctim
|
||||
}
|
||||
#endif
|
||||
Reference in new issue
Block a user