Re: long long in kernel

Marc Unangst (mju@cs.cmu.edu)
06 May 1999 13:55:22 -0400


Jes.Sorensen@cern.ch (Jes Sorensen) writes:
> I am curious, what sorta device requires 64 bit entities on a 32 bit
> architecture?

There are a lot of reasons to want 64-bit quantities in the kernel --
if you are doing filesystems or I/O work, you frequently want more
than 32 bits to represent a file offset or object length. Doing math
on time values is also a lot easier if you can store the values as
"number of nanoseconds since [epoch]" rather than as a
seconds/nanoseconds pair in a timespec struct. (A signed 64-bit
number can count nanoseconds for 292 years, which is probably long
enough for most purposes; a signed 32-bit number wraps after about two
seconds.)

To port our research code we had to get around this problem, and ended
up just linking libgcc.a into the kernel. It works fine, and since
the Linux kernel depends on gcc in a number of other places, it
doesn't seem to raise the bar any.

-Marc Unangst
Research Programmer, Parallel Data Lab
Carnegie Mellon University School of Computer Science
mju@cs.cmu.edu

-
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/