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

[ Available lists | Index of freebsd-questions | Month of Feb 2008 | Week of 20 Feb 2008 | Raw email | View thread | Wrap long lines | Reply | Tag ]
From
navneet Upadhyay <navneet.upadhyay@gmail.com>
Date
20 Feb 2008 06:17:32
Subject
32 bit FreeBSD compiled binary coredumps on 64 bit(amd) FreeBSD
Message-ID
1563a4fd0802192217v2776fd50hf299ee7d86d9fb5c@mail.gmail.com


[ Hide this part ]
Hi,
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 ?
Thanks,
navneet


Elapsed time: 0.096 seconds