mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Martin Schwidefsky <schwidefsky@de.ibm.com>
To: akpm@osdl.org, linux-kernel@vger.kernel.org
Subject: [patch] cputime: fix do_setitimer.
Date: Tue, 2 Nov 2004 16:03:14 +0100	[thread overview]
Message-ID: <20041102150314.GA3908@mschwid3.boeblingen.de.ibm.com> (raw)

[patch] cputime: fix do_setitimer.

From: Martin Schwidefsky <schwidefsky@de.ibm.com>

Fix do_setitimer for ITIMER_VIRTUAL and ITIMER_PROF. Non-zero
it_virt_value and it_prof_value needs to get increamented by one
jiffies. Applications like konqueror depend on this behaviour.

Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>

diffstat:
 kernel/itimer.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff -urN linux-2.6/kernel/itimer.c linux-2.6-cputime/kernel/itimer.c
--- linux-2.6/kernel/itimer.c	2004-11-02 14:30:36.000000000 +0100
+++ linux-2.6-cputime/kernel/itimer.c	2004-11-02 14:31:42.000000000 +0100
@@ -102,16 +102,18 @@
 			break;
 		case ITIMER_VIRTUAL:
 			cputime = timeval_to_cputime(&value->it_value);
-			if (cputime_eq(cputime, cputime_zero))
-				cputime = jiffies_to_cputime(1);
+			if (cputime_gt(cputime, cputime_zero))
+				cputime = cputime_add(cputime,
+						      jiffies_to_cputime(1));
 			current->it_virt_value = cputime;
 			cputime = timeval_to_cputime(&value->it_interval);
 			current->it_virt_incr = cputime;
 			break;
 		case ITIMER_PROF:
 			cputime = timeval_to_cputime(&value->it_value);
-			if (cputime_eq(cputime, cputime_zero))
-				cputime = jiffies_to_cputime(1);
+			if (cputime_gt(cputime, cputime_zero))
+				cputime = cputime_add(cputime,
+						      jiffies_to_cputime(1));
 			current->it_prof_value = cputime;
 			cputime = timeval_to_cputime(&value->it_interval);
 			current->it_prof_incr = cputime;

                 reply	other threads:[~2004-11-02 15:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041102150314.GA3908@mschwid3.boeblingen.de.ibm.com \
    --to=schwidefsky@de.ibm.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®