From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#63496: process-attributes returns incorrect start, etime, and pcpu attributes when run inside a lxc container Date: Thu, 18 May 2023 14:12:03 +0300 Message-ID: <834jo9x5a4.fsf@gnu.org> References: <0f761478-aeb5-d65c-2c92-67dba69076d1@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36469"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 63496@debbugs.gnu.org To: Scott Zimmermann , Paul Eggert , Andreas Schwab Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu May 18 13:12:18 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pzbYP-0009IY-Ok for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 18 May 2023 13:12:17 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pzbYC-00050E-IS; Thu, 18 May 2023 07:12:04 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pzbYA-0004zx-Fk for bug-gnu-emacs@gnu.org; Thu, 18 May 2023 07:12:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pzbYA-0006Y2-80 for bug-gnu-emacs@gnu.org; Thu, 18 May 2023 07:12:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pzbYA-00079T-0n for bug-gnu-emacs@gnu.org; Thu, 18 May 2023 07:12:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 18 May 2023 11:12:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63496 X-GNU-PR-Package: emacs Original-Received: via spool by 63496-submit@debbugs.gnu.org id=B63496.168440832027483 (code B ref 63496); Thu, 18 May 2023 11:12:01 +0000 Original-Received: (at 63496) by debbugs.gnu.org; 18 May 2023 11:12:00 +0000 Original-Received: from localhost ([127.0.0.1]:52201 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pzbY7-00079D-Px for submit@debbugs.gnu.org; Thu, 18 May 2023 07:12:00 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:38554) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pzbY6-000791-9F for 63496@debbugs.gnu.org; Thu, 18 May 2023 07:11:58 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pzbXz-0006WE-2Y; Thu, 18 May 2023 07:11:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=QqixWZgANQGUeShs/LjrMVXsXfkaAzIlIevvXpjfwLc=; b=H7NAgQomJaRY vxnENzHUG8lOGKVFSioyGgWTwjXs4pgCzUFZp0pkMjsjHXLwyqfGiQw8sj/KcQ7b2U3m374tTN7SZ VZ+y2MYS84ihwwSljwA1Y4iMkrzMozuGhfjCTQLL4TZhc1jdQMTUVS8lSt0PIw52YWSaMy65VCz+q eJKuCNpAEafY3PBwZO4aOL6/v7uZbjRjX7vbtrLtTY5LrojfhyQt8enG2+Git3avj/OSHmRDb4jcw aT9QE54KK54v9YdghdOlcvLxMMLXjE0IgkG1aAzvWTM5YGUB8oiI04jSDDE8n7P6SY31Jq7exp6nt 1uxeNQgmkn8cVTEnPzhcxA==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pzbXy-0005Yg-Ir; Thu, 18 May 2023 07:11:50 -0400 In-Reply-To: <0f761478-aeb5-d65c-2c92-67dba69076d1@gmail.com> (message from Scott Zimmermann on Sat, 13 May 2023 19:57:08 +0200) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:261918 Archived-At: > Date: Sat, 13 May 2023 19:57:08 +0200 > From: Scott Zimmermann > > 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.