Re: uptime increases during suspend

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



27.03.2006 21:53, Peter T. Breuer wrote/a écrit:
In article <1143484821.2168.16.camel@leatherman> you wrote:
Would it be possible to get the old behaviour back?

Why exactly do you want this behavior? Maybe a better explanation would
help stir this discussion.

I don't know why he wants it (uptime does not increase during
hibernation) but I want it so that I can tell if I should time out or
not on an alarm for inactivity in userspace!  The alarm should fire if
there has been no activity for a while (30s) while activity is possible.
If the machine is suspended, no activity is possible, so the alarm
should not fire.

This is to counteract sysadamins playing with system time (e.g. syncing
with a net time server after bootup) which might cause artificial time
outs. Causing a timeout has nasty consequences when, for example, your
root fs is mounted over the net via daemons that do the network to-ing
and fro-ing from userspace. The only way they have of getting an
estimate of REAL time elapsed,  without admin playing about messing
with them, is by surreptitiously snooping uptime, which more or less
represents kernel jiffies.
It seems that what you are really looking for in your application is a monotonic clock. Linux has such thing since few releases. Using CLOCK_MONOTONIC (cf "man 3 clock_gettime") may look much less hacky than using the uptime ;-)

Now... concerning the suspend effect on this clock, I don't know. It's probably the same problem as uptime: no official semantic has ever been stated yet... Does anyone know?

Eric
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux