32 bit FreeBSD compiled binary coredumps on 64 bit(amd) FreeBSD

navneet Upadhyay navneet.upadhyay at gmail.com
Wed Feb 20 06:17:32 UTC 2008

       I am compiling the binary on 32 bit FreeBSD and running it on 64
(amd64)bit FreeBSD . FreeBSD says it is possible to do so.
       But my application core dumps . I investigated the reason which is as
follows :

The problem is in the call retval = sysctl(mib, 4, &kp, &sz, NULL, 0);
where sz is size of kp and where kp is a structure of type kinfo_proc. The
size of this structure on 32bit system is 768 and on 64 bit system is 1088.

The call works on 32 bit system but when run on 64 bit system it coredumps ,
because of the size mismatch of kinfo_proc .

If i hardcode the sz to 1088 then it works on amd64 systems , how do i deal
with it. I am anticipating lot of coredumps like that, what is a generic
solution for such kinds of problems.

Do Anyone has any clues ?

More information about the freebsd-questions mailing list