From b7d47c52005bcc357f08b0646226aeb470db393c Mon Sep 17 00:00:00 2001 From: EulerOSWander <314264452@qq.com> Date: Sat, 27 Feb 2021 15:35:38 +0800 Subject: [PATCH] sync upstream patches Sync upstream patches Signed-off-by: EulerOSWander <314264452@qq.com> --- ...to-avoid-repeated-stat-etc-localtime.patch | 37 +++++++++++++++++++ ...-argument-handling-for-negative-PIDs.patch | 25 +++++++++++++ procps-ng.spec | 7 +++- 3 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 backport-0012-Set-TZ-to-avoid-repeated-stat-etc-localtime.patch create mode 100644 backport-0013-kill-Fix-argument-handling-for-negative-PIDs.patch diff --git a/backport-0012-Set-TZ-to-avoid-repeated-stat-etc-localtime.patch b/backport-0012-Set-TZ-to-avoid-repeated-stat-etc-localtime.patch new file mode 100644 index 0000000..1ad194a --- /dev/null +++ b/backport-0012-Set-TZ-to-avoid-repeated-stat-etc-localtime.patch @@ -0,0 +1,37 @@ +From 31343570e17cb13605c2c5a5c8b9a21d443bbb2a Mon Sep 17 00:00:00 2001 +From: Stephen Brennan +Date: Thu, 19 Nov 2020 16:03:58 -0800 +Subject: [PATCH] Set TZ to avoid repeated stat("/etc/localtime") + +With glibc, each time the strftime() function is used (twice per process +in a typical ps -fe run), a stat("/etc/localtime") system call is used +to determine the timezone. Not only does this add extra system call +overhead, but when multiple ps processes are trying to access this +file (or multiple glibc programs using strftime) in parallel, this can +trigger significant lock contention within the OS kernel. + +Since ps is not intended to run for long periods of time as a +daemon (during which the system timezone could be altered and PS might +reasonably be expected to adapt its output), there is no benefit to +repeatedly doing this stat(). To stop this behavior, explicitly set the +TZ variable to its default value (:/etc/localtime) whenever it is unset. +glibc will then cache the stat() result. +--- + ps/display.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/ps/display.c b/ps/display.c +index 95a55c3..06094d3 100644 +--- a/ps/display.c ++++ b/ps/display.c +@@ -633,6 +633,7 @@ int main(int argc, char *argv[]){ + setlocale (LC_ALL, ""); + bindtextdomain(PACKAGE, LOCALEDIR); + textdomain(PACKAGE); ++ setenv("TZ", ":/etc/localtime", 0); + + #ifdef DEBUG + init_stack_trace(argv[0]); +-- +2.27.0 + diff --git a/backport-0013-kill-Fix-argument-handling-for-negative-PIDs.patch b/backport-0013-kill-Fix-argument-handling-for-negative-PIDs.patch new file mode 100644 index 0000000..d4d0102 --- /dev/null +++ b/backport-0013-kill-Fix-argument-handling-for-negative-PIDs.patch @@ -0,0 +1,25 @@ +From 79097e55e4b08ec8c1de8332e32cf03c4be1d4ec Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rapha=C3=ABl=20Jakse?= +Date: Fri, 7 Sep 2018 12:57:03 +0000 +Subject: [PATCH] kill: Fix argument handling for negative PIDs + +--- + skill.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/skill.c b/skill.c +index 5a79a41..38ebdc5 100644 +--- a/skill.c ++++ b/skill.c +@@ -507,7 +507,7 @@ static void __attribute__ ((__noreturn__)) + } else { + /* Special case for signal digit negative + * PIDs */ +- pid = atoi(argv[optind]); ++ pid = atoi(argv[optind-1]); + if (kill((pid_t)pid, signo) != 0) + exitvalue = EXIT_FAILURE; + exit(exitvalue); +-- +2.27.0 + diff --git a/procps-ng.spec b/procps-ng.spec index ed685a8..7b7b45c 100644 --- a/procps-ng.spec +++ b/procps-ng.spec @@ -1,6 +1,6 @@ Name: procps-ng Version: 3.3.16 -Release: 14 +Release: 15 Summary: Utilities that provide system information. License: GPL+ and GPLv2 and GPLv2+ and GPLv3+ and LGPLv2+ URL: https://sourceforge.net/projects/procps-ng/ @@ -20,6 +20,8 @@ Patch0007: backport-0008-misc-eliminate-a-couple-of-miscellaneous-gcc-warning.pa Patch0008: backport-0009-top-fix-potential-SEGV-when-no-tasks-were-displayabl.patch Patch0009: backport-0010-top-fix-additional-SEGVs-if-no-tasks-were-displayabl.patch Patch0010: backport-0011-pgrep-Remove-memory-leak.patch +Patch0011: backport-0012-Set-TZ-to-avoid-repeated-stat-etc-localtime.patch +Patch0012: backport-0013-kill-Fix-argument-handling-for-negative-PIDs.patch Patch9000: feature-add-options-M-and-N-for-top.patch Patch9001: bugfix-top-exit-with-error-when-pid-overflow.patch @@ -105,6 +107,9 @@ ln -s %{_bindir}/pidof %{buildroot}%{_sbindir}/pidof %{_mandir}/translated %changelog +* Sat Feb 27 2021 hewenliang - 3.3.16-15 +- sync patches + * Sat Feb 27 2021 hewenliang - 3.3.16-14 - sync patches -- Gitee