From ca5479e2c94e1006f235ab65272dcbd0d3b7f8c4 Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Thu, 14 Aug 2025 17:07:36 -0700 Subject: [PATCH] Enable Amazon Linux 2 CI --- .github/workflows/pull_request.yml | 9 ++++++-- README.md | 26 ++++++++++++----------- Sources/_SubprocessCShims/process_shims.c | 12 +++++++++++ 3 files changed, 33 insertions(+), 14 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 753d801f..d212a627 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -9,10 +9,10 @@ jobs: name: Test uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main with: - linux_os_versions: '["noble", "jammy", "focal", "rhel-ubi9", "bookworm"]' + linux_os_versions: '["amazonlinux2", "bookworm", "noble", "jammy", "focal", "rhel-ubi9"]' linux_swift_versions: '["6.1", "nightly-main"]' linux_pre_build_command: | - if command -v apt-get >/dev/null 2>&1 ; then # noble, jammy, focal, or bookworm + if command -v apt-get >/dev/null 2>&1 ; then # bookworm, noble, jammy, focal apt-get update -y # Test dependencies @@ -22,6 +22,11 @@ jobs: # Test dependencies dnf install -y procps + elif command -v yum >/dev/null 2>&1 ; then # amazonlinux2 + yum update -y + + # Test dependencies + yum install -y procps fi windows_swift_versions: '["6.1", "nightly-main"]' enable_macos_checks: true diff --git a/README.md b/README.md index 233b7cbc..a1c78dc7 100644 --- a/README.md +++ b/README.md @@ -222,18 +222,20 @@ Use it by setting`.bytes(limit:)` for `output` or `error`. The table below describes the current level of support that Subprocess has for various platforms: -| **Platform** | **Support Status** | -|---|---| -| **macOS** | Supported | -| **iOS** | Not supported | -| **watchOS** | Not supported | -| **tvOS** | Not supported | -| **visionOS** | Not supported | -| **Ubuntu 22.04** | Supported | -| **Ubuntu 24.04** | Supported | -| **Red Hat Universal Base Image 9** | Supported | -| **Debian 12** | Supported | -| **Windows** | Supported | +| **Platform** | **Support Status** | +| ---------------------------------- | ------------------ | +| **macOS** | Supported | +| **iOS** | Not supported | +| **watchOS** | Not supported | +| **tvOS** | Not supported | +| **visionOS** | Not supported | +| **Ubuntu 20.04** | Supported | +| **Ubuntu 22.04** | Supported | +| **Ubuntu 24.04** | Supported | +| **Red Hat Universal Base Image 9** | Supported | +| **Debian 12** | Supported | +| **Amazon Linux 2** | Supported | +| **Windows** | Supported |

(back to top)

diff --git a/Sources/_SubprocessCShims/process_shims.c b/Sources/_SubprocessCShims/process_shims.c index 376abbd0..d456f4ca 100644 --- a/Sources/_SubprocessCShims/process_shims.c +++ b/Sources/_SubprocessCShims/process_shims.c @@ -73,6 +73,10 @@ int _was_process_suspended(int status) { #if TARGET_OS_LINUX #include +#ifndef SYS_pidfd_send_signal +#define SYS_pidfd_send_signal 424 +#endif + int _shims_snprintf( char * _Nonnull str, int len, @@ -322,6 +326,10 @@ int _subprocess_spawn( #define __GLIBC_PREREQ(maj, min) 0 #endif +#ifndef SYS_pidfd_open +#define SYS_pidfd_open 434 +#endif + int _pidfd_open(pid_t pid) { return syscall(SYS_pidfd_open, pid, 0); } @@ -332,6 +340,10 @@ int _pidfd_open(pid_t pid) { #define SYS_clone3 435 #endif +#ifndef CLONE_PIDFD +#define CLONE_PIDFD 0x00001000 +#endif + // Can't use clone_args from sched.h because only Glibc defines it; Musl does not (and there's no macro to detect Musl) struct _subprocess_clone_args { uint64_t flags;