I am running RHEL 6.4 64 bit, and I was given a program to compile and execute. The program has:
cpu_set_t cputset;
CPU_ZERO(&cpuset);
CPU_SET(data->num, &cpuset); //data is a structure, don't think it's relevant to my question
int ret = sched_setaffinity(0, sizeof(cpuset), &cpuset);
//print ret
When compiling for 32/64 bit gcc/icc, there are no compilation errors. This will return 0 and correctly produce the result when compiled with -m32 (32 bit compiler), but when compiled with a 64 bit compiler, it has returned 1, 2, and 128 seemingly randomly just by running without any recompilation. Could someone help me troubleshoot / identify what is going wrong with this when I compile it for 64 bit and execute? Thanks for any help.