diff --git a/Meta/CMake/ca_certificates_data.cmake b/Meta/CMake/ca_certificates_data.cmake index f8229a56eb8d18..7e145821726ff7 100644 --- a/Meta/CMake/ca_certificates_data.cmake +++ b/Meta/CMake/ca_certificates_data.cmake @@ -1,7 +1,7 @@ include(${CMAKE_CURRENT_LIST_DIR}/utils.cmake) -set(CACERT_VERSION "2025-11-04") -set(CACERT_SHA256 "8ac40bdd3d3e151a6b4078d2b2029796e8f843e3f86fbf2adbc4dd9f05e79def") +set(CACERT_VERSION "2025-12-02") +set(CACERT_SHA256 "f1407d974c5ed87d544bd931a278232e13925177e239fca370619aba63c757b4") set(CACERT_PATH "${SERENITY_CACHE_DIR}/CACERT" CACHE PATH "Download location for cacert.pem") set(CACERT_VERSION_FILE "${CACERT_PATH}/version.txt") diff --git a/Meta/gn/secondary/Userland/Libraries/LibTLS/BUILD.gn b/Meta/gn/secondary/Userland/Libraries/LibTLS/BUILD.gn index b73bb27e62a618..e719927a639cf0 100644 --- a/Meta/gn/secondary/Userland/Libraries/LibTLS/BUILD.gn +++ b/Meta/gn/secondary/Userland/Libraries/LibTLS/BUILD.gn @@ -9,7 +9,7 @@ declare_args() { cacert_cache = cache_path + "CACERT/" -cacert_version = "2025-11-04" +cacert_version = "2025-12-02" if (enable_cacert_download) { download_file("ca_certificates_download") { @@ -17,7 +17,7 @@ if (enable_cacert_download) { url = "https://curl.se/ca/cacert-$version.pem" output = "$root_build_dir/cacert.pem" version_file = cacert_cache + "version.txt" - sha256 = "8ac40bdd3d3e151a6b4078d2b2029796e8f843e3f86fbf2adbc4dd9f05e79def" + sha256 = "f1407d974c5ed87d544bd931a278232e13925177e239fca370619aba63c757b4" } # FIXME: Copy file to /etc/cacert.pem on serenity } diff --git a/Ports/AvailablePorts.md b/Ports/AvailablePorts.md index 2c1d2bb5f55217..2b991305376f3a 100644 --- a/Ports/AvailablePorts.md +++ b/Ports/AvailablePorts.md @@ -30,7 +30,7 @@ This list is also available at [ports.serenityos.net](https://ports.serenityos.n | [`bzip3`](bzip3/) | bzip3 | 1.5.1 | https://github.com/kspalaiologos/bzip3 | | [`c-ares`](c-ares/) | c-ares | 1.19.0 | https://c-ares.org | | [`c-ray`](c-ray/) | C-Ray | 8f30eb9 | https://github.com/vkoskiv/c-ray | -| [`ca-certificates`](ca-certificates/) | Mozilla CA certificate store | 2025-11-04 | https://curl.se/docs/caextract.html | +| [`ca-certificates`](ca-certificates/) | Mozilla CA certificate store | 2025-12-02 | https://curl.se/docs/caextract.html | | [`cairo`](cairo/) | Cairo | 1.18.2 | https://www.cairographics.org/ | | [`carl`](carl/) | Crypto Ancienne Resource Loader | 1.5 | https://github.com/classilla/cryanc | | [`cavestory`](cavestory/) | Cave Story | 2.6.5-1 | https://github.com/nxengine/nxengine-evo | @@ -45,7 +45,7 @@ This list is also available at [ports.serenityos.net](https://ports.serenityos.n | [`cmake`](cmake/) | CMake | 3.26.4 | https://cmake.org/ | | [`cmatrix`](cmatrix/) | cmatrix | 5c082c6 | https://github.com/abishekvashok/cmatrix | | [`composer`](composer/) | Composer | 2.6.5 | https://getcomposer.org/ | -| [`coreutils`](coreutils/) | GNU core utilities | 9.5 | https://www.gnu.org/software/coreutils/ | +| [`coreutils`](coreutils/) | GNU core utilities | 9.9 | https://www.gnu.org/software/coreutils/ | | [`cowsay`](cowsay/) | cowsay | 3.04 | https://github.com/tnalpgge/rank-amateur-cowsay | | [`cpio`](cpio/) | GNU cpio archive utility | 2.15 | https://www.gnu.org/software/cpio/ | | [`curl`](curl/) | curl | 8.17.0 | https://curl.se/ | @@ -227,7 +227,7 @@ This list is also available at [ports.serenityos.net](https://ports.serenityos.n | [`msttcorefonts`](msttcorefonts/) | Microsoft's TrueType core fonts | | https://corefonts.sourceforge.net/ | | [`mysthous`](mysthous/) | Hi-Res Adventure #1: Mystery House | 1.0 | https://www.scummvm.org/games/#games-hires1 | | [`nano`](nano/) | GNU nano | 8.5 | https://www.nano-editor.org/ | -| [`nasm`](nasm/) | Netwide Assembler (NASM) | 2.16.03 | https://www.nasm.us/ | +| [`nasm`](nasm/) | Netwide Assembler (NASM) | 3.01 | https://www.nasm.us/ | | [`ncdu`](ncdu/) | Ncdu | 1.18.1 | https://dev.yorhel.nl/ncdu | | [`ncurses`](ncurses/) | ncurses | 6.5 | https://invisible-island.net/ncurses/announce.html | | [`neofetch`](neofetch/) | neofetch | 7.1.0 | https://github.com/dylanaraps/neofetch | @@ -266,7 +266,7 @@ This list is also available at [ports.serenityos.net](https://ports.serenityos.n | [`pcre2`](pcre2/) | Perl-compatible Regular Expressions (PCRE2) | 10.45 | https://www.pcre.org/ | | [`perl5`](perl5/) | Perl | 5.40.1 | https://www.perl.org/ | | [`pfetch`](pfetch/) | pfetch | a906ff8 | https://github.com/dylanaraps/pfetch/ | -| [`php`](php/) | PHP | 8.2.10 | https://www.php.net/ | +| [`php`](php/) | PHP | 8.5.0 | https://www.php.net/ | | [`pixman`](pixman/) | pixman | 0.42.2 | http://pixman.org | | [`pkgconf`](pkgconf/) | pkgconf | 2.0.2 | https://github.com/pkgconf/pkgconf | | [`poppler`](poppler/) | Poppler is a PDF rendering library | 24.02.0 | https://poppler.freedesktop.org/ | @@ -355,7 +355,7 @@ This list is also available at [ports.serenityos.net](https://ports.serenityos.n | [`xash3d-fwgs`](xash3d-fwgs/) | Xash3D FWGS game engine | 2022.12.26 | https://github.com/FWGS/xash3d-fwgs | | [`xmp-cli`](xmp-cli/) | Extended Module Player | 4.2.0 | https://github.com/libxmp/xmp-cli | | [`xorriso`](xorriso/) | xorriso | 1.5.6 | https://www.gnu.org/software/xorriso | -| [`xz`](xz/) | xz | 5.6.2 | https://tukaani.org/xz/ | +| [`xz`](xz/) | xz | 5.8.1 | https://tukaani.org/xz/ | | [`yasm`](yasm/) | Yasm Modular Assembler | 1.3.0 | https://yasm.tortall.net/ | | [`zig`](zig/) | Zig programming language | 0.16.0-dev.627+e6e4792a5 | https://ziglang.org/ | | [`zlib`](zlib/) | zlib | 1.3.1 | https://www.zlib.net/ | diff --git a/Ports/ca-certificates/package.sh b/Ports/ca-certificates/package.sh index 20695721bf3a86..c1dc96376d7067 100755 --- a/Ports/ca-certificates/package.sh +++ b/Ports/ca-certificates/package.sh @@ -1,8 +1,8 @@ #!/usr/bin/env -S bash ../.port_include.sh port='ca-certificates' -version='2025-11-04' +version='2025-12-02' files=( - "https://curl.se/ca/cacert-${version}.pem#8ac40bdd3d3e151a6b4078d2b2029796e8f843e3f86fbf2adbc4dd9f05e79def" + "https://curl.se/ca/cacert-${version}.pem#f1407d974c5ed87d544bd931a278232e13925177e239fca370619aba63c757b4" ) workdir='.' diff --git a/Ports/coreutils/package.sh b/Ports/coreutils/package.sh index 1c61ddc1ba7e8d..2993f2f2b82b4e 100755 --- a/Ports/coreutils/package.sh +++ b/Ports/coreutils/package.sh @@ -1,13 +1,9 @@ #!/usr/bin/env -S bash ../.port_include.sh port='coreutils' -version='9.5' +version='9.9' useconfigure='true' -use_fresh_config_sub='true' -config_sub_paths=( - 'build-aux/config.sub' -) files=( - "https://ftpmirror.gnu.org/gnu/coreutils/coreutils-${version}.tar.gz#767ae6a22950ec42f3ba5f7c1de79dd27800ee8e9b8642da5dedb5974a1741e5" + "https://ftpmirror.gnu.org/gnu/coreutils/coreutils-${version}.tar.gz#91a719fcf923de686016f2c8d084a8be1f793f34173861273c4668f7c65af94a" ) # Exclude some non-working utilities: diff --git a/Ports/nasm/package.sh b/Ports/nasm/package.sh index 66e1f092c9660c..5ab7911768f313 100755 --- a/Ports/nasm/package.sh +++ b/Ports/nasm/package.sh @@ -1,10 +1,8 @@ #!/usr/bin/env -S bash ../.port_include.sh -port=nasm -version=2.16.03 +port='nasm' +version='3.01' files=( - "https://www.nasm.us/pub/nasm/releasebuilds/${version}/nasm-${version}.tar.gz#5bc940dd8a4245686976a8f7e96ba9340a0915f2d5b88356874890e207bdb581" + "https://www.nasm.us/pub/nasm/releasebuilds/${version}/nasm-${version}.tar.gz#aea120d4adb0241f08ae24d6add09e4a993bc1c4d9f754dbfc8020d6916c9be1" ) useconfigure=true -use_fresh_config_sub=true -config_sub_paths=("autoconf/helpers/config.sub") makeopts=() diff --git a/Ports/php/package.sh b/Ports/php/package.sh index fe136d21399481..3e99191b4bc2c1 100755 --- a/Ports/php/package.sh +++ b/Ports/php/package.sh @@ -1,9 +1,9 @@ #!/usr/bin/env -S bash ../.port_include.sh port='php' useconfigure='true' -version='8.2.10' +version='8.5.0' files=( - "https://www.php.net/distributions/php-${version}.tar.xz#561dc4acd5386e47f25be76f2c8df6ae854756469159248313bcf276e282fbb3" + "https://www.php.net/distributions/php-${version}.tar.xz#39cb6e4acd679b574d3d3276f148213e935fc25f90403eb84fb1b836a806ef1e" ) depends=( 'curl' @@ -16,7 +16,7 @@ depends=( ) configopts=( '--disable-cgi' - '--disable-opcache' + '--disable-opcache-jit' '--enable-fpm' "--prefix=${SERENITY_INSTALL_ROOT}/usr/local" '--with-curl' diff --git a/Ports/php/patches/0001-Build-Disable-pharcmd.patch b/Ports/php/patches/0001-Build-Disable-pharcmd.patch index 4fadd64020f748..f7c977d619b73e 100644 --- a/Ports/php/patches/0001-Build-Disable-pharcmd.patch +++ b/Ports/php/patches/0001-Build-Disable-pharcmd.patch @@ -10,10 +10,10 @@ not try to run phar locally. 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac -index 42d6a3b6ca968b488c871f7c6f5395530481138b..dd244cdbc28e650237249ae8b636f6034a578826 100644 +index a6078866df99986471679074841f679fe7332cd9..f73a3ab74762ba1e7c6878d1a4b35e889903f302 100644 --- a/configure.ac +++ b/configure.ac -@@ -1639,8 +1639,8 @@ CFLAGS="\$(CFLAGS_CLEAN) $standard_libtool_flag" +@@ -1614,8 +1614,8 @@ CFLAGS="\$(CFLAGS_CLEAN) $standard_libtool_flag" CXXFLAGS="$CXXFLAGS $standard_libtool_flag \$(PROF_FLAGS)" if test "$PHP_PHAR" != "no" && test "$PHP_CLI" != "no"; then diff --git a/Ports/php/patches/0002-Build-Force-inet_aton-detection.patch b/Ports/php/patches/0002-Build-Force-inet_aton-detection.patch deleted file mode 100644 index fd85b92b7fb32c..00000000000000 --- a/Ports/php/patches/0002-Build-Force-inet_aton-detection.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jelle Raaijmakers -Date: Tue, 29 Mar 2022 22:42:18 +0200 -Subject: [PATCH] Build: Force `inet_aton` detection - -For a reason unknown to me, the build system fails to find `inet_aton` -and tries to redefine it with its own implementation in -`flock_compat.c`. ---- - configure.ac | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/configure.ac b/configure.ac -index dd244cdbc28e650237249ae8b636f6034a578826..1cbb6027c42d09b8fe0bc6f69afd023528795d74 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -383,8 +383,7 @@ case $host_alias in - ;; - esac - --dnl Check for inet_aton in -lc, -lbind and -lresolv. --PHP_CHECK_FUNC(inet_aton, resolv, bind) -+AC_DEFINE(HAVE_INET_ATON, 1, [ ]) - - dnl Then headers. - dnl ---------------------------------------------------------------------------- diff --git a/Ports/php/patches/0003-Build-Patch-Serenity-root-directory-into-libtool.patch b/Ports/php/patches/0002-Build-Patch-Serenity-root-directory-into-libtool.patch similarity index 92% rename from Ports/php/patches/0003-Build-Patch-Serenity-root-directory-into-libtool.patch rename to Ports/php/patches/0002-Build-Patch-Serenity-root-directory-into-libtool.patch index 7c7399979744ce..b3df34b6f9626b 100644 --- a/Ports/php/patches/0003-Build-Patch-Serenity-root-directory-into-libtool.patch +++ b/Ports/php/patches/0002-Build-Patch-Serenity-root-directory-into-libtool.patch @@ -10,7 +10,7 @@ to get PHP to build. 1 file changed, 4 insertions(+) diff --git a/build/ltmain.sh b/build/ltmain.sh -index 2f1c8c9dc80f095832c58aeb30ca65fc27e8a64b..cce4f76267a211775ec97eb2b006df536cd4cc7b 100755 +index 3c00e79157079f42d54032c4096be1de5cb9fffe..e15618374d55082081188e36e3a6b442daf43b48 100755 --- a/build/ltmain.sh +++ b/build/ltmain.sh @@ -2353,6 +2353,9 @@ EOF diff --git a/Ports/php/patches/0003-Remove-include-of-sys-ipc.h.patch b/Ports/php/patches/0003-Remove-include-of-sys-ipc.h.patch new file mode 100644 index 00000000000000..08349f21167470 --- /dev/null +++ b/Ports/php/patches/0003-Remove-include-of-sys-ipc.h.patch @@ -0,0 +1,21 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Linus Groh +Date: Sat, 6 Dec 2025 17:11:07 +0000 +Subject: [PATCH] Remove include of sys/ipc.h + +--- + ext/opcache/ZendAccelerator.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c +index 84acae980ce3a5ec1d03e4aebe2f30e3fd601bb3..904a9c2ae08fd9acab89e0f192cde9fc56dc53e9 100644 +--- a/ext/opcache/ZendAccelerator.c ++++ b/ext/opcache/ZendAccelerator.c +@@ -89,7 +89,6 @@ typedef int gid_t; + #ifndef ZEND_WIN32 + # include + # include +-# include + # include + # include + #endif diff --git a/Ports/php/patches/0004-Disable-unsupported-prctl-call.patch b/Ports/php/patches/0004-Disable-unsupported-prctl-call.patch new file mode 100644 index 00000000000000..d8753b4c0630bb --- /dev/null +++ b/Ports/php/patches/0004-Disable-unsupported-prctl-call.patch @@ -0,0 +1,23 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Linus Groh +Date: Sat, 6 Dec 2025 17:16:03 +0000 +Subject: [PATCH] Disable unsupported prctl call + +Serenity has prctl but doesn't define PR_SET_PDEATHSIG. +--- + sapi/cli/php_cli_server.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c +index da6732f06e72a297315615352a8f399107b7e096..21a4e3224bc4cd27045c346fe1334c01adae1019 100644 +--- a/sapi/cli/php_cli_server.c ++++ b/sapi/cli/php_cli_server.c +@@ -2486,7 +2486,7 @@ static char *php_cli_server_parse_addr(const char *addr, int *pport) { + static void php_cli_server_worker_install_pdeathsig(void) + { + // Ignore failure to register PDEATHSIG, it's not available on all platforms anyway +-#if defined(HAVE_PRCTL) ++#if defined(HAVE_PRCTL) && !defined(__serenity__) + prctl(PR_SET_PDEATHSIG, SIGTERM); + #elif defined(HAVE_PROCCTL) + int signal = SIGTERM; diff --git a/Ports/php/patches/ReadMe.md b/Ports/php/patches/ReadMe.md index 527b1dc59c40c9..b3cc2be2fdc679 100644 --- a/Ports/php/patches/ReadMe.md +++ b/Ports/php/patches/ReadMe.md @@ -7,18 +7,21 @@ Build: Disable `pharcmd` We do not support running the PHP binary locally after its build, so do not try to run phar locally. -## `0002-Build-Force-inet_aton-detection.patch` - -Build: Force `inet_aton` detection - -For a reason unknown to me, the build system fails to find `inet_aton` -and tries to redefine it with its own implementation in -`flock_compat.c`. - -## `0003-Build-Patch-Serenity-root-directory-into-libtool.patch` +## `0002-Build-Patch-Serenity-root-directory-into-libtool.patch` Build: Patch Serenity root directory into libtool PHP's libtool does not have sysroot support; this is the minimum change to get PHP to build. +## `0003-Remove-include-of-sys-ipc.h.patch` + +Remove include of sys/ipc.h + + +## `0004-Disable-unsupported-prctl-call.patch` + +Disable unsupported prctl call + +Serenity has prctl but doesn't define PR_SET_PDEATHSIG. + diff --git a/Ports/xz/package.sh b/Ports/xz/package.sh index ceb93c79fe0e39..6ea2cb032e83e3 100755 --- a/Ports/xz/package.sh +++ b/Ports/xz/package.sh @@ -1,12 +1,12 @@ #!/usr/bin/env -S bash ../.port_include.sh port='xz' -version='5.6.2' +version='5.8.1' depends=( 'libiconv' 'zlib' ) files=( - "https://tukaani.org/xz/xz-${version}.tar.gz#8bfd20c0e1d86f0402f2497cfa71c6ab62d4cd35fd704276e3140bfb71414519" + "https://tukaani.org/xz/xz-${version}.tar.gz#507825b599356c10dca1cd720c9d0d0c9d5400b9de300af00e4d1ea150795543" ) useconfigure='true' use_fresh_config_sub='true' diff --git a/Ports/xz/patches/0001-libtool-Enable-shared-library-support-for-SerenityOS.patch b/Ports/xz/patches/0001-libtool-Enable-shared-library-support-for-SerenityOS.patch index 778b966ea0c78c..bf64b20d9deb7e 100644 --- a/Ports/xz/patches/0001-libtool-Enable-shared-library-support-for-SerenityOS.patch +++ b/Ports/xz/patches/0001-libtool-Enable-shared-library-support-for-SerenityOS.patch @@ -17,10 +17,10 @@ static library into a shared library. 1 file changed, 23 insertions(+) diff --git a/configure b/configure -index 897a25f77f257182ccd76245b447058199c3478b..aa9ea19199c408d8036c0a2d72d358ea9392b29e 100755 +index 4f89118495be24a8a5e228ad6ff00a6da9d58f9d..8849cd1ad50ec1015b0bcbd7bdce9d18e74e111f 100755 --- a/configure +++ b/configure -@@ -9810,6 +9810,10 @@ tpf*) +@@ -10032,6 +10032,10 @@ tpf*) os2*) lt_cv_deplibs_check_method=pass_all ;; @@ -31,7 +31,7 @@ index 897a25f77f257182ccd76245b447058199c3478b..aa9ea19199c408d8036c0a2d72d358ea esac ;; esac -@@ -13338,6 +13342,10 @@ lt_prog_compiler_static= +@@ -13663,6 +13667,10 @@ lt_prog_compiler_static= lt_prog_compiler_static='-Bstatic' ;; @@ -42,7 +42,7 @@ index 897a25f77f257182ccd76245b447058199c3478b..aa9ea19199c408d8036c0a2d72d358ea *) lt_prog_compiler_can_build_shared=no ;; -@@ -14880,6 +14888,10 @@ printf "%s\n" "$lt_cv_irix_exported_symbol" >&6; } +@@ -15216,6 +15224,10 @@ printf "%s\n" "$lt_cv_irix_exported_symbol" >&6; } hardcode_shlibpath_var=no ;; @@ -53,7 +53,7 @@ index 897a25f77f257182ccd76245b447058199c3478b..aa9ea19199c408d8036c0a2d72d358ea *) ld_shlibs=no ;; -@@ -15955,6 +15967,17 @@ uts4*) +@@ -16362,6 +16374,17 @@ uts4*) shlibpath_var=LD_LIBRARY_PATH ;; @@ -68,6 +68,6 @@ index 897a25f77f257182ccd76245b447058199c3478b..aa9ea19199c408d8036c0a2d72d358ea + dynamic_linker='SerenityOS LibELF' + ;; + - *) - dynamic_linker=no - ;; + emscripten*) + version_type=none + need_lib_prefix=no diff --git a/Ports/xz/patches/0002-liblzma-Don-t-assume-getauxval-is-Linux-only.patch b/Ports/xz/patches/0002-liblzma-Don-t-assume-getauxval-is-Linux-only.patch index 460a9941e781b7..453d53d4b2cb5d 100644 --- a/Ports/xz/patches/0002-liblzma-Don-t-assume-getauxval-is-Linux-only.patch +++ b/Ports/xz/patches/0002-liblzma-Don-t-assume-getauxval-is-Linux-only.patch @@ -11,10 +11,10 @@ in the auxiliary vector. 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/liblzma/check/crc32_arm64.h b/src/liblzma/check/crc32_arm64.h -index 39c1c63ec0eced25ad5042e1611ecd8064831d8d..bea249c9462c7298bce154a1228dba71c4f0e128 100644 +index fb0e8f0105a9e7ddf5abb3a8f8ef3bb2b48ab128..32072922d6b8e3cee8705d0169a1d083c8e08ad6 100644 --- a/src/liblzma/check/crc32_arm64.h +++ b/src/liblzma/check/crc32_arm64.h -@@ -78,7 +78,7 @@ crc32_arch_optimized(const uint8_t *buf, size_t size, uint32_t crc) +@@ -103,7 +103,7 @@ crc32_arch_optimized(const uint8_t *buf, size_t size, uint32_t crc) static inline bool is_arch_extension_supported(void) { @@ -24,15 +24,15 @@ index 39c1c63ec0eced25ad5042e1611ecd8064831d8d..bea249c9462c7298bce154a1228dba71 #elif defined(HAVE_ELF_AUX_INFO) diff --git a/src/liblzma/check/crc_common.h b/src/liblzma/check/crc_common.h -index 63a7b5cefebffc506dc54a6378134008ead3c806..917bf98c9ce611fc946f8acad0c1cf31f2a2fdee 100644 +index 7ea1e60b043bf86dfe421e7594cb01812c51caa0..30a7b5c1a8f4185d76c926c3b41a5488b72ce6ed 100644 --- a/src/liblzma/check/crc_common.h +++ b/src/liblzma/check/crc_common.h -@@ -48,7 +48,7 @@ - #endif - +@@ -89,7 +89,7 @@ extern const uint64_t lzma_crc64_table[4][256]; + // ARM64 + // // Keep this in sync with changes to crc32_arm64.h -#if defined(_WIN32) || defined(HAVE_GETAUXVAL) \ +#if defined(_WIN32) || (defined(__linux__) && defined(HAVE_GETAUXVAL)) \ || defined(HAVE_ELF_AUX_INFO) \ || (defined(__APPLE__) && defined(HAVE_SYSCTLBYNAME)) - # define ARM64_RUNTIME_DETECTION 1 + # define CRC_ARM64_RUNTIME_DETECTION 1 diff --git a/Userland/Libraries/LibC/fcntl.cpp b/Userland/Libraries/LibC/fcntl.cpp index 4d3a9b40960fb1..4de774cf891e4e 100644 --- a/Userland/Libraries/LibC/fcntl.cpp +++ b/Userland/Libraries/LibC/fcntl.cpp @@ -6,7 +6,6 @@ */ #include -#include #include #include #include @@ -120,65 +119,4 @@ int posix_fallocate(int fd, off_t offset, off_t len) // posix_fallocate does not set errno. return -static_cast(syscall(SC_posix_fallocate, fd, offset, len)); } - -// https://pubs.opengroup.org/onlinepubs/9699919799/functions/utimensat.html -int utimensat(int dirfd, char const* path, struct timespec const times[2], int flag) -{ - if (!path) { - errno = EFAULT; - return -1; - } - return __utimens(dirfd, path, times, flag); -} - -int __utimens(int fd, char const* path, struct timespec const times[2], int flag) -{ - size_t path_length = 0; - if (path) { - path_length = strlen(path); - if (path_length > INT32_MAX) { - errno = EINVAL; - return -1; - } - } - - // POSIX allows AT_SYMLINK_NOFOLLOW flag or no flags. - if (flag & ~AT_SYMLINK_NOFOLLOW) { - errno = EINVAL; - return -1; - } - - // Return early without error since both changes are to be omitted. - if (times && times[0].tv_nsec == UTIME_OMIT && times[1].tv_nsec == UTIME_OMIT) - return 0; - - // According to POSIX, when times is a nullptr, it's equivalent to setting - // both last access time and last modification time to the current time. - // Setting the times argument to nullptr if it matches this case prevents - // the need to copy it in the kernel. - if (times && times[0].tv_nsec == UTIME_NOW && times[1].tv_nsec == UTIME_NOW) - times = nullptr; - - if (times) { - for (int i = 0; i < 2; ++i) { - if ((times[i].tv_nsec != UTIME_NOW && times[i].tv_nsec != UTIME_OMIT) - && (times[i].tv_nsec < 0 || times[i].tv_nsec >= 1'000'000'000L)) { - errno = EINVAL; - return -1; - } - } - } - - int rc = 0; - if (path) { - // NOTE: fd is treated as dirfd for this syscall. - Syscall::SC_utimensat_params params { fd, { path, path_length }, times, flag }; - rc = syscall(SC_utimensat, ¶ms); - } else { - Syscall::SC_futimens_params params { fd, times }; - rc = syscall(SC_futimens, ¶ms); - } - - __RETURN_WITH_ERRNO(rc, rc, -1); -} } diff --git a/Userland/Libraries/LibC/fcntl.h b/Userland/Libraries/LibC/fcntl.h index ceb5896c474d2e..e1127b96d7e409 100644 --- a/Userland/Libraries/LibC/fcntl.h +++ b/Userland/Libraries/LibC/fcntl.h @@ -37,6 +37,4 @@ int inode_watcher_remove_watch(int fd, int wd); int posix_fadvise(int fd, off_t offset, off_t len, int advice); int posix_fallocate(int fd, off_t offset, off_t len); -int utimensat(int dirfd, char const* path, struct timespec const times[2], int flag); - __END_DECLS diff --git a/Userland/Libraries/LibC/stat.cpp b/Userland/Libraries/LibC/stat.cpp index 769634b971a0e2..5b5236131c2f45 100644 --- a/Userland/Libraries/LibC/stat.cpp +++ b/Userland/Libraries/LibC/stat.cpp @@ -87,6 +87,24 @@ int mkfifoat(int dirfd, char const* pathname, mode_t mode) return mknodat(dirfd, pathname, mode | S_IFIFO, 0); } +// https://pubs.opengroup.org/onlinepubs/9699919799/functions/mknod.html +int mknod(char const* pathname, mode_t mode, dev_t dev) +{ + return mknodat(AT_FDCWD, pathname, mode, dev); +} + +// https://pubs.opengroup.org/onlinepubs/9699919799/functions/mknodat.html +int mknodat(int dirfd, char const* pathname, mode_t mode, dev_t dev) +{ + if (!pathname) { + errno = EFAULT; + return -1; + } + Syscall::SC_mknod_params params { { pathname, strlen(pathname) }, mode, dev, dirfd }; + int rc = syscall(SC_mknod, ¶ms); + __RETURN_WITH_ERRNO(rc, rc, -1); +} + static int do_stat(int dirfd, char const* path, struct stat* statbuf, bool follow_symlinks) { if (!path) { @@ -128,4 +146,65 @@ int futimens(int fd, struct timespec const times[2]) { return __utimens(fd, nullptr, times, 0); } + +// https://pubs.opengroup.org/onlinepubs/9699919799/functions/utimensat.html +int utimensat(int dirfd, char const* path, struct timespec const times[2], int flag) +{ + if (!path) { + errno = EFAULT; + return -1; + } + return __utimens(dirfd, path, times, flag); +} + +int __utimens(int fd, char const* path, struct timespec const times[2], int flag) +{ + size_t path_length = 0; + if (path) { + path_length = strlen(path); + if (path_length > INT32_MAX) { + errno = EINVAL; + return -1; + } + } + + // POSIX allows AT_SYMLINK_NOFOLLOW flag or no flags. + if (flag & ~AT_SYMLINK_NOFOLLOW) { + errno = EINVAL; + return -1; + } + + // Return early without error since both changes are to be omitted. + if (times && times[0].tv_nsec == UTIME_OMIT && times[1].tv_nsec == UTIME_OMIT) + return 0; + + // According to POSIX, when times is a nullptr, it's equivalent to setting + // both last access time and last modification time to the current time. + // Setting the times argument to nullptr if it matches this case prevents + // the need to copy it in the kernel. + if (times && times[0].tv_nsec == UTIME_NOW && times[1].tv_nsec == UTIME_NOW) + times = nullptr; + + if (times) { + for (int i = 0; i < 2; ++i) { + if ((times[i].tv_nsec != UTIME_NOW && times[i].tv_nsec != UTIME_OMIT) + && (times[i].tv_nsec < 0 || times[i].tv_nsec >= 1'000'000'000L)) { + errno = EINVAL; + return -1; + } + } + } + + int rc = 0; + if (path) { + // NOTE: fd is treated as dirfd for this syscall. + Syscall::SC_utimensat_params params { fd, { path, path_length }, times, flag }; + rc = syscall(SC_utimensat, ¶ms); + } else { + Syscall::SC_futimens_params params { fd, times }; + rc = syscall(SC_futimens, ¶ms); + } + + __RETURN_WITH_ERRNO(rc, rc, -1); +} } diff --git a/Userland/Libraries/LibC/sys/stat.h b/Userland/Libraries/LibC/sys/stat.h index 67417a11ef9731..bee3e6c2d8dbde 100644 --- a/Userland/Libraries/LibC/sys/stat.h +++ b/Userland/Libraries/LibC/sys/stat.h @@ -21,10 +21,13 @@ int mkdir(char const* pathname, mode_t); int mkdirat(int dirfd, char const* pathname, mode_t); int mkfifo(char const* pathname, mode_t); int mkfifoat(int dirfd, char const* pathname, mode_t); +int mknod(char const* pathname, mode_t, dev_t); +int mknodat(int dirfd, char const* pathname, mode_t, dev_t); int fstat(int fd, struct stat* statbuf); int lstat(char const* path, struct stat* statbuf); int stat(char const* path, struct stat* statbuf); int fstatat(int fd, char const* path, struct stat* statbuf, int flags); int futimens(int fd, struct timespec const times[2]); +int utimensat(int dirfd, char const* path, struct timespec const times[2], int flag); __END_DECLS diff --git a/Userland/Libraries/LibC/unistd.cpp b/Userland/Libraries/LibC/unistd.cpp index a8125fe3c2c392..26632513231be4 100644 --- a/Userland/Libraries/LibC/unistd.cpp +++ b/Userland/Libraries/LibC/unistd.cpp @@ -826,24 +826,6 @@ int faccessat(int dirfd, char const* pathname, int mode, int flags) __RETURN_WITH_ERRNO(rc, rc, -1); } -// https://pubs.opengroup.org/onlinepubs/9699919799/functions/mknod.html -int mknod(char const* pathname, mode_t mode, dev_t dev) -{ - return mknodat(AT_FDCWD, pathname, mode, dev); -} - -// https://pubs.opengroup.org/onlinepubs/9699919799/functions/mknodat.html -int mknodat(int dirfd, char const* pathname, mode_t mode, dev_t dev) -{ - if (!pathname) { - errno = EFAULT; - return -1; - } - Syscall::SC_mknod_params params { { pathname, strlen(pathname) }, mode, dev, dirfd }; - int rc = syscall(SC_mknod, ¶ms); - __RETURN_WITH_ERRNO(rc, rc, -1); -} - // https://pubs.opengroup.org/onlinepubs/9699919799/functions/fpathconf.html long fpathconf([[maybe_unused]] int fd, int name) { diff --git a/Userland/Libraries/LibC/unistd.h b/Userland/Libraries/LibC/unistd.h index 74d4369ba5076d..7a6bb2c2af57e8 100644 --- a/Userland/Libraries/LibC/unistd.h +++ b/Userland/Libraries/LibC/unistd.h @@ -107,8 +107,6 @@ unsigned int alarm(unsigned int seconds); int access(char const* pathname, int mode); int faccessat(int dirfd, char const* pathname, int mode, int flags); int isatty(int fd); -int mknod(char const* pathname, mode_t, dev_t); -int mknodat(int dirfd, char const* pathname, mode_t, dev_t); long fpathconf(int fd, int name); long pathconf(char const* path, int name); char* getlogin(void);