lkml.org 
[lkml]   [1999]   [Jun]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: How can Emacs get a unique ID per Linux reboot?
Date
From
How about generating a 32bit random number at boot time.  There
is a 1 in 2**32 of getting the same number after a reboot, but
that should not be a large problem.

The hard part would be deciding how to access this number.

Allen

>>>Richard Gooch said:
> H. Peter Anvin writes:
> > Followup to: <199906010238.TAA18495@shade.twinsun.com>
> > By author: Paul Eggert <eggert@twinsun.com>
> > In newsgroup: linux.dev.kernel
> > >
> > > For most operating systems, BOOTID is the timestamp of the last
> > > reboot. For example, if I edit FOO on Solaris 7, Emacs might create a
> > > symbolic link from .#FOO to eggert@shade.twinsun.com.18323:924306205,
> > > since shade.twinsun.com was last rebooted 924306205 seconds after
> > > 1970-01-01 00:00:00 UTC.
> > >
> > > Unfortunately, RMS and I haven't been able to discover a documented,
> > > guaranteed, and fast way to get a unique reboot ID for Linux.
> > >
> >
> > Get the current uptime from /proc/uptime and subtract that from the
> > current time.
>
> Won't that foul up if the system is suspended (system clock is
> restored from hwclock on resume)?
> And probably also when settimeofday() is called?
>
> Regards,
>
> Richard....
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.rutgers.edu
> Please read the FAQ at http://www.tux.org/lkml/

---------------------------------
G. Allen Morris III

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:52    [W:0.129 / U:0.316 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site