Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Feb 2008 18:59:42 +1100
From:      Peter Jeremy <peterjeremy@optushome.com.au>
To:        navneet Upadhyay <navneet.upadhyay@gmail.com>
Cc:        freebsd-amd64@freebsd.org
Subject:   Re: 32 bit FreeBSD compiled binary coredumps on 64 bit(amd) FreeBSD
Message-ID:  <20080221075942.GG51095@server.vk2pj.dyndns.org>
In-Reply-To: <1563a4fd0802192216w7d422fd2nf83ddaff038ac9cc@mail.gmail.com>
References:  <1563a4fd0802192216w7d422fd2nf83ddaff038ac9cc@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--Km1U/tdNT/EmXiR1
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Feb 20, 2008 at 11:46:00AM +0530, navneet Upadhyay wrote:
>       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.

In general, you can take a FreeBSD/i386 executable and run it on
FreeBSD/amd64.  I don't believe FreeBSD has ever stated that you
can take _any_ FreeBSD/i386 executable and run it on FreeBSD/amd64.

>       But my application core dumps . I investigated the reason which is =
as
>follows :
>The problem is in the call *retval =3D 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.

If your process grovels around inside kernel data structures then it's
unlikely to be portable.

>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.

There is no generic solution.  FreeBSD includes shims to handle
syscalls where the arguments differ in size between different
emulations (i386, Linux, iBCS etc).  If you want to pull assorted
machine-dependent datastructures out of the kernel then you will
need to write shims to handle the conversion.

--=20
Peter Jeremy
Please excuse any delays as the result of my ISP's inability to implement
an MTA that is either RFC2821-compliant or matches their claimed behaviour.

--Km1U/tdNT/EmXiR1
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4 (FreeBSD)

iD8DBQFHvS9u/opHv/APuIcRAjiyAJ9JME3xMauruYKyRVKVZpJoQULfbgCgkdhZ
mnqAcjet9yaci41b9BaKEEk=
=q/ps
-----END PGP SIGNATURE-----

--Km1U/tdNT/EmXiR1--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080221075942.GG51095>