unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#63496: process-attributes returns incorrect start, etime, and pcpu attributes when run inside a lxc container
@ 2023-05-13 17:57 Scott Zimmermann
  2023-05-18 11:12 ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Scott Zimmermann @ 2023-05-13 17:57 UTC (permalink / raw)
  To: 63496

in src/sysdep.c line 3475:
Lisp_Object boot = Ftime_subtract (now, uptime);

it calculates the boot time for linux based on the uptime. Inside lxc 
containers, /proc/uptime is the uptime of the container rather than of 
the host system. However in /proc/[PID]/stat, starttime is the time 
since system boot, of the host system, not since the container started. 
This leads to emacs computing incorrect values for start, etime, and 
pcpu for processes.

I think it should get the boot time from "btime" in /proc/stat, this is 
what ps does, which shows correct times for processes inside the 
container. If this sounds like an appropriate fix I'm happy to write and 
test a patch for it.





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#63496: process-attributes returns incorrect start, etime, and pcpu attributes when run inside a lxc container
  2023-05-13 17:57 bug#63496: process-attributes returns incorrect start, etime, and pcpu attributes when run inside a lxc container Scott Zimmermann
@ 2023-05-18 11:12 ` Eli Zaretskii
  2023-05-18 21:17   ` Paul Eggert
  0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2023-05-18 11:12 UTC (permalink / raw)
  To: Scott Zimmermann, Paul Eggert, Andreas Schwab; +Cc: 63496

> Date: Sat, 13 May 2023 19:57:08 +0200
> From: Scott Zimmermann <sczimmer@gmail.com>
> 
> in src/sysdep.c line 3475:
> Lisp_Object boot = Ftime_subtract (now, uptime);
> 
> it calculates the boot time for linux based on the uptime. Inside lxc 
> containers, /proc/uptime is the uptime of the container rather than of 
> the host system. However in /proc/[PID]/stat, starttime is the time 
> since system boot, of the host system, not since the container started. 
> This leads to emacs computing incorrect values for start, etime, and 
> pcpu for processes.
> 
> I think it should get the boot time from "btime" in /proc/stat, this is 
> what ps does, which shows correct times for processes inside the 
> container. If this sounds like an appropriate fix I'm happy to write and 
> test a patch for it.

Paul and Andreas, any comments?

Patches to implement the change would be welcome, of course.





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#63496: process-attributes returns incorrect start, etime, and pcpu attributes when run inside a lxc container
  2023-05-18 11:12 ` Eli Zaretskii
@ 2023-05-18 21:17   ` Paul Eggert
  0 siblings, 0 replies; 3+ messages in thread
From: Paul Eggert @ 2023-05-18 21:17 UTC (permalink / raw)
  To: Eli Zaretskii, Scott Zimmermann, Andreas Schwab; +Cc: 63496

On 5/18/23 04:12, Eli Zaretskii wrote:
>> Date: Sat, 13 May 2023 19:57:08 +0200
>> From: Scott Zimmermann<sczimmer@gmail.com>

>> I think it should get the boot time from "btime" in /proc/stat, this is
>> what ps does, which shows correct times for processes inside the
>> container. If this sounds like an appropriate fix I'm happy to write and
>> test a patch for it.

Thanks, that sounds good.





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-05-18 21:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-13 17:57 bug#63496: process-attributes returns incorrect start, etime, and pcpu attributes when run inside a lxc container Scott Zimmermann
2023-05-18 11:12 ` Eli Zaretskii
2023-05-18 21:17   ` Paul Eggert

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).