summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--Src/jobs.c7
-rw-r--r--configure.ac6
3 files changed, 16 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 91d45894b..6a2ac0c22 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2021-05-15 Bart Schaefer <schaefer@zsh.org>
+ * Han Pingtian: 33465 (very belatedly): use prctl() for "jobs -Z"
+ where available
+
* Vincent Lefevre: 48723: Src/math.c: locale-safe recognition of
"Inf" and "NaN" constants
diff --git a/Src/jobs.c b/Src/jobs.c
index 0d4993554..f0b337110 100644
--- a/Src/jobs.c
+++ b/Src/jobs.c
@@ -2270,6 +2270,13 @@ bin_fg(char *name, char **argv, Options ops, int func)
memcpy(hackzero, *argv, len);
memset(hackzero + len, 0, hackspace - len);
#endif
+
+#ifdef HAVE_PRCTL
+ /* try to change /proc/$$/comm which will *
+ * be used when checking with "ps -e" */
+#include <sys/prctl.h>
+ prctl(PR_SET_NAME, *argv);
+#endif
unqueue_signals();
return 0;
}
diff --git a/configure.ac b/configure.ac
index e2ddf0e55..dd0d3ffac 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2065,6 +2065,12 @@ AH_TEMPLATE([HAVE_SETPROCTITLE],
AC_CHECK_FUNC(setproctitle,AC_DEFINE(HAVE_SETPROCTITLE),
AC_SEARCH_LIBS(setproctitle,util,AC_DEFINE(HAVE_SETPROCTITLE)))
+dnl CHECK FOR prctl() FOR jobs -Z / ARGV0 when checking with ps -e
+AH_TEMPLATE([HAVE_PRCTL],
+[Define to 1 if the system supports `prctl' to change process name])
+AC_CHECK_FUNC(prctl,AC_DEFINE(HAVE_PRCTL),
+AC_SEARCH_LIBS(prctl,c,AC_DEFINE(HAVE_PRCTL)))
+
dnl -------------
dnl CHECK FOR NIS
dnl -------------