Skip to contentSkip to conversation

how to detect a 32 bit process on 64 bit kernel

DISCUSSION Bodo Eggert 1 participant 1 message Dec 16, 2004 2 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 4 lines · Michael S. Tsirkin

Quoting r. Brian Gerst ([email protected]) "Re: how to detect a 32 bit

Quoted 2 lines

The most portable way to do this is to have the first member of the structure be a 32-bit value containing the size of the structure.

Better: Use version numbers.

Quoted 2 lines

The size wont be sufficient here since its variable size (ends with an array).

Use the size without the array, check the array size seperately. Or see above.

Quoted 2 lines

Sure, I could also just ask everyone to pass pointers in a packed long long, but either way it will break the applications.

If the size of structs you use in APIs is system dependant, it's most likely b0rken.

Quoted 2 lines

Why wouldnt it make sence for struct task to have a bit that tells me its a compat system?

Not having it will prevent you from creating strange interfaces.-)