[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master b4f0527: Fix truncated command names in process-attributes under
From: |
Lars Ingebrigtsen |
Subject: |
master b4f0527: Fix truncated command names in process-attributes under Macos |
Date: |
Tue, 18 Aug 2020 14:31:48 -0400 (EDT) |
branch: master
commit b4f05274c7a8facbf2a817ec14d234605959c4de
Author: Robert Pluim <rpluim@gmail.com>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
Fix truncated command names in process-attributes under Macos
* src/sysdep.c (system_process_attributes): Fix truncation of
command names in process-attributes under Macos (bug#36287).
---
src/sysdep.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/src/sysdep.c b/src/sysdep.c
index b1371cd..a1050c4 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -53,6 +53,10 @@ along with GNU Emacs. If not, see
<https://www.gnu.org/licenses/>. */
# include <sys/sysctl.h>
#endif
+#ifdef DARWIN_OS
+# include <libproc.h>
+#endif
+
#ifdef __FreeBSD__
/* Sparc/ARM machine/frame.h has 'struct frame' which conflicts with Emacs's
'struct frame', so rename it. */
@@ -3871,8 +3875,21 @@ system_process_attributes (Lisp_Object pid)
if (gr)
attrs = Fcons (Fcons (Qgroup, build_string (gr->gr_name)), attrs);
+ char pathbuf[PROC_PIDPATHINFO_MAXSIZE];
+ char *comm;
+
+ if (proc_pidpath (proc_id, pathbuf, sizeof(pathbuf)) > 0)
+ {
+ if ((comm = strrchr (pathbuf, '/')))
+ comm++;
+ else
+ comm = pathbuf;
+ }
+ else
+ comm = proc.kp_proc.p_comm;
+
decoded_comm = (code_convert_string_norecord
- (build_unibyte_string (proc.kp_proc.p_comm),
+ (build_unibyte_string (comm),
Vlocale_coding_system, 0));
attrs = Fcons (Fcons (Qcomm, decoded_comm), attrs);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master b4f0527: Fix truncated command names in process-attributes under Macos,
Lars Ingebrigtsen <=