sync upstream patches

Sync upstream patches

Signed-off-by: EulerOSWander <314264452@qq.com>
This commit is contained in:
EulerOSWander 2021-02-27 15:35:38 +08:00
parent 7d9ade5082
commit b7d47c5200
3 changed files with 68 additions and 1 deletions

View File

@ -0,0 +1,37 @@
From 31343570e17cb13605c2c5a5c8b9a21d443bbb2a Mon Sep 17 00:00:00 2001
From: Stephen Brennan <stephen.s.brennan@oracle.com>
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

View File

@ -0,0 +1,25 @@
From 79097e55e4b08ec8c1de8332e32cf03c4be1d4ec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rapha=C3=ABl=20Jakse?= <raphael.gitlab@jakse.fr>
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

View File

@ -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 <hewenliang4@huawei.com> - 3.3.16-15
- sync patches
* Sat Feb 27 2021 hewenliang <hewenliang4@huawei.com> - 3.3.16-14
- sync patches