This patch reinstates fallback code when the 'prlimit64' system call is missing by reverting the relevant part of this upstream commit: commit 695d7d138eda449678a1650a8b8b58181033353f Author: Joseph Myers Date: Tue May 9 14:05:09 2017 +0000 Assume prlimit64 is available. The fallback code is useful on systems that lack 'prlimit64', such as the 2.6.32-on-steroid kernel found on RHEL 6: diff --git a/sysdeps/unix/sysv/linux/getrlimit64.c b/sysdeps/unix/sysv/linux/getrlimit64.c index 37c173286f..56af3c0646 100644 --- b/sysdeps/unix/sysv/linux/getrlimit64.c +++ a/sysdeps/unix/sysv/linux/getrlimit64.c @@ -35,7 +35,40 @@ int __getrlimit64 (enum __rlimit_resource resource, struct rlimit64 *rlimits) { - return INLINE_SYSCALL_CALL (prlimit64, 0, resource, NULL, rlimits); +#ifdef __NR_prlimit64 + int res = INLINE_SYSCALL_CALL (prlimit64, 0, resource, NULL, rlimits); + if (res == 0 || errno != ENOSYS) + return res; +#endif + +/* The fallback code only makes sense if the platform supports either + __NR_ugetrlimit and/or __NR_getrlimit. */ +#if defined (__NR_ugetrlimit) || defined (__NR_getrlimit) +# ifndef __NR_ugetrlimit +# define __NR_ugetrlimit __NR_getrlimit +# endif +# if __RLIM_T_MATCHES_RLIM64_T +# define rlimits32 (*rlimits) +# else + struct rlimit rlimits32; +# endif + + if (INLINE_SYSCALL_CALL (ugetrlimit, resource, &rlimits32) < 0) + return -1; + +# if !__RLIM_T_MATCHES_RLIM64_T + if (rlimits32.rlim_cur == RLIM_INFINITY) + rlimits->rlim_cur = RLIM64_INFINITY; + else + rlimits->rlim_cur = rlimits32.rlim_cur; + if (rlimits32.rlim_max == RLIM_INFINITY) + rlimits->rlim_max = RLIM64_INFINITY; + else + rlimits->rlim_max = rlimits32.rlim_max; +# endif /* !__RLIM_T_MATCHES_RLIM64_T */ +#endif /* defined (__NR_ugetrlimit)
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2022 Mathieu Othacehe <othacehe@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu compression)
  #:use-module (guix gexp)
  #:use-module (guix ui)
  #:use-module ((gnu packages compression) #:hide (zip))
  #:use-module (srfi srfi-1)
  #:use-module (srfi srfi-9)
  #:use-module (ice-9 match)
  #:export (compressor
            compressor?
            compressor-name
            compressor-extension
            compressor-command
            %compressors
            lookup-compressor))

;; Type of a compression tool.
(define-record-type <compressor>
  (compressor name extension command)
  compressor?
  (name       compressor-name)      ;string (e.g., "gzip")
  (extension  compressor-extension) ;string (e.g., ".lz")
  (command    compressor-command))  ;gexp (e.g., #~(list "/gnu/store/…/gzip"
                                    ;                    "-9n" ))

(define %compressors
  ;; Available compression tools.
  (list (compressor "gzip"  ".gz"
                    #~(list #+(file-append gzip "/bin/gzip") "-9n"))
        (compressor "lzip"  ".lz"
                    #~(list #+(file-append lzip "/bin/lzip") "-9"))
        (compressor "xz"    ".xz"