From: "Mattias Engdegård" <mattiase@acm.org>
To: Werner LEMBERG <wl@gnu.org>
Cc: dports@macports.org, Paul Eggert <eggert@cs.ucla.edu>,
Filipp Gunbin <fgunbin@fastmail.fm>,
Emacs-Devel <emacs-devel@gnu.org>
Subject: Re: Emacs 28.1 doesn't compile on Mac OS 10.7.5
Date: Fri, 15 Apr 2022 18:41:28 +0200 [thread overview]
Message-ID: <13EE40A1-503F-4CDE-8334-E818E8702DCE@acm.org> (raw)
In-Reply-To: <2BC45081-033F-4796-891E-D052149C8BCB@acm.org>
[-- Attachment #1: Type: text/plain, Size: 373 bytes --]
15 apr. 2022 kl. 18.22 skrev Mattias Engdegård <mattiase@acm.org>:
> This appears to be a consequence of 6d51805154 (bug#48548) which uses an interface that was introduced in macOS 10.9. It should be possible to unify the old and new code to get something that works on your system as well. I'll write a patch.
Please try this (not tested on your macOS version).
[-- Attachment #2: old-macos-proced.diff --]
[-- Type: application/octet-stream, Size: 2360 bytes --]
diff --git a/src/sysdep.c b/src/sysdep.c
index 1e630835ad..b184c8e7a7 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -4027,6 +4027,9 @@ system_process_attributes (Lisp_Object pid)
#elif defined DARWIN_OS
+#define HAVE_PROC_PID_RUSAGE (MAC_OS_X_VERSION_MIN_REQUIRED >= 1090)
+#define HAVE_PROC_PIDINFO (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050)
+
Lisp_Object
system_process_attributes (Lisp_Object pid)
{
@@ -4130,6 +4133,7 @@ system_process_attributes (Lisp_Object pid)
attrs = Fcons (Fcons (Qtpgid, INT_TO_INTEGER (proc.kp_eproc.e_tpgid)),
attrs);
+#if HAVE_PROC_PID_RUSAGE
rusage_info_current ri;
if (proc_pid_rusage(proc_id, RUSAGE_INFO_CURRENT, (rusage_info_t *) &ri) == 0)
{
@@ -4143,6 +4147,24 @@ system_process_attributes (Lisp_Object pid)
attrs = Fcons (Fcons (Qmajflt, INT_TO_INTEGER (ri.ri_pageins)), attrs);
}
+#else /* !HAVE_PROC_PID_RUSAGE */
+ struct rusage *rusage = proc.kp_proc.p_ru;
+ if (rusage)
+ {
+ attrs = Fcons (Fcons (Qminflt, INT_TO_INTEGER (rusage->ru_minflt)),
+ attrs);
+ attrs = Fcons (Fcons (Qmajflt, INT_TO_INTEGER (rusage->ru_majflt)),
+ attrs);
+
+ attrs = Fcons (Fcons (Qutime, make_lisp_timeval (rusage->ru_utime)),
+ attrs);
+ attrs = Fcons (Fcons (Qstime, make_lisp_timeval (rusage->ru_stime)),
+ attrs);
+ struct timespec t = timespec_add (timeval_to_timespec (rusage->ru_utime),
+ timeval_to_timespec (rusage->ru_stime));
+ attrs = Fcons (Fcons (Qtime, make_lisp_time (t)), attrs);
+ }
+#endif /* !HAVE_PROC_PID_RUSAGE */
starttime = proc.kp_proc.p_starttime;
attrs = Fcons (Fcons (Qnice, make_fixnum (proc.kp_proc.p_nice)), attrs);
@@ -4152,6 +4174,7 @@ system_process_attributes (Lisp_Object pid)
t = timespec_sub (now, timeval_to_timespec (starttime));
attrs = Fcons (Fcons (Qetime, make_lisp_time (t)), attrs);
+#if HAVE_PROC_PIDINFO
struct proc_taskinfo taskinfo;
if (proc_pidinfo (proc_id, PROC_PIDTASKINFO, 0, &taskinfo, sizeof (taskinfo)) > 0)
{
@@ -4159,6 +4182,7 @@ system_process_attributes (Lisp_Object pid)
attrs = Fcons (Fcons (Qrss, make_fixnum (taskinfo.pti_resident_size / 1024)), attrs);
attrs = Fcons (Fcons (Qthcount, make_fixnum (taskinfo.pti_threadnum)), attrs);
}
+#endif /* HAVE_PROC_PIDINFO */
#ifdef KERN_PROCARGS2
char args[ARG_MAX];
next prev parent reply other threads:[~2022-04-15 16:41 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-15 11:55 Emacs 28.1 doesn't compile on Mac OS 10.7.5 Werner LEMBERG
2022-04-15 13:16 ` Mattias Engdegård
2022-04-15 13:48 ` Mattias Engdegård
2022-04-15 15:23 ` Werner LEMBERG
2022-04-15 15:54 ` Eli Zaretskii
2022-04-15 16:48 ` Werner LEMBERG
2022-04-15 16:22 ` Mattias Engdegård
2022-04-15 16:41 ` Mattias Engdegård [this message]
2022-04-15 16:51 ` Werner LEMBERG
2022-04-15 17:13 ` Mattias Engdegård
2022-04-15 17:40 ` Werner LEMBERG
2022-04-15 18:34 ` Mattias Engdegård
2022-04-15 19:47 ` Eli Zaretskii
2022-04-16 5:18 ` Werner LEMBERG
2022-04-16 7:35 ` Werner LEMBERG
2022-04-16 10:30 ` Mattias Engdegård
2022-04-16 15:25 ` Werner LEMBERG
2022-04-17 2:21 ` Paul Eggert
2022-04-17 3:28 ` Jeffrey Walton
2022-04-17 7:54 ` Paul Eggert
2022-04-17 11:09 ` Werner LEMBERG
2022-04-17 14:33 ` Ryan Schmidt
2022-04-17 14:51 ` Jeffrey Walton
2022-04-17 9:13 ` Mattias Engdegård
2022-04-17 9:32 ` Po Lu
2022-04-17 9:38 ` Mattias Engdegård
2022-04-17 11:33 ` Eli Zaretskii
2022-04-17 12:27 ` Mattias Engdegård
2022-04-17 17:54 ` Paul Eggert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=13EE40A1-503F-4CDE-8334-E818E8702DCE@acm.org \
--to=mattiase@acm.org \
--cc=dports@macports.org \
--cc=eggert@cs.ucla.edu \
--cc=emacs-devel@gnu.org \
--cc=fgunbin@fastmail.fm \
--cc=wl@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).