What to do when size of the struct differs on 32 and 64 bit?

Vitaliy Margolen wine-devel at kievinfo.com
Wed Aug 13 00:44:20 CDT 2008


While debugging some force-feedback issues ran into an interesting problem. 
The size of one struct from include/linux differs between 32-bit and 64-bit. 
That wouldn't be a major problem except that size is the part of the ioctl() 
request. Which results in EINVAL.

In more details:
input.h:
#define EVIOCSFF _IOC(_IOC_WRITE, 'E', 0x80, sizeof(struct ff_effect))

The simple test program:

#include <linux/input.h>
#include <stdio.h>
int main(int argc, char * argv[])
{
     printf("sizeof(struct ff_effect) = %d EVIOCSFF=%#x\n", sizeof(struct 
ff_effect), EVIOCSFF);

     return 0;
}


$ gcc test_size.c -o test_size && ./test_size
sizeof(struct ff_effect) = 48 EVIOCSFF=0x40304580
$ gcc -m32 test_size.c -o test_size32 && ./test_size32
sizeof(struct ff_effect) = 44 EVIOCSFF=0x402c4580

The question is what do we do about it? I'm sure there are might be more 
cases like that.

Vitaliy



More information about the wine-devel mailing list