2.1.54: Chasing set_fs() with non-ulong argument; why ulong is correct

Teunis Peters (teunis@usa.net)
Tue, 9 Sep 1997 13:03:54 -0600 (MDT)


On Mon, 8 Sep 1997 root@jennifer-unix.dyn.ml.org wrote:

> On Mon, 8 Sep 1997, Just a Tree wrote:
>
> > On Sun, 7 Sep 1997 root@jennifer-unix.dyn.ml.org wrote:
> >
> > > A u32 is fine here, since sizeof(u32)==sizeof(long) (then again,
> > > sizeof(int)==sizeof(long), so I don't know what the problem is)... That is
> > > on a i386 with gcc 2.7.2.3. The source could probably use a good lint, but
> > > I would be suprised if there is a lint that can handle the kernel <G>.
> >
> > Ahh, but the main point of the set_fs() macro check was to catch problems
> > on non-i386 architectures as well. On the Alpha, for example, a long int
> > is 64 bits, whereas an int is only 32 bits, as is of course a u32. Thus it
> > really _must_ be an unsigned long for cross-platform compatibility.
> >
> OK, my bad. But shouldn't it be a __u32 for cross-platform compatibility
> (what if sombody has a 64 bit unsigned long?)?

Just to clear this up (if you haven't caught it yet)
Alpha - unsigned long == 64bit.
- requires 64bit set_fs()

ergo : unsigned long is the _RIGHT_ type. On 64bit platforms it will do
the Right Thing(tm:), and on 32bit platforms it will ALSO do the Right
Thing - which is be 32bit.

make sense?

(this is from following the whole kernel list.. I run a cyrix 6x86 intel
clone not an alpha <deep sigh>)

G'day, eh?
- Teunis