[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: gcc on a biarch system



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Monday 07 July 2003 21:07, Bart Trojanowski wrote:

> If I understand what linux32 does the program is quite trivial.

Right. I now found the 'official site' for the tool at
ftp://ftp.x86-64.org/pub/linux-x86_64/tools/linux32/

It's almost the same as your version, but we using the same
code as the others might be nice anyway. As a bonus, you
can run it as 'linux64'.

	Arnd <><
- --
/* Written 2002 by Andi Kleen */
#include <linux/personality.h>
#undef personality
#include <string.h>
#include <errno.h>
#include <stdio.h>

int main(int ac, char **av) 
{ 
	int pers = PER_LINUX32;
	if (!av[1]) { 
		fprintf(stderr, "usage: %s program args ...\n", av[0]); 
		exit(1); 
	} 
	if (!strcmp(av[0],"linux64")) pers= PER_LINUX;
	else if (!strcmp(av[0],"linux32")) pers = PER_LINUX32;

	if (personality(pers)) {
		fprintf(stderr, "Cannot set LINUX32 personality: %s\n",
			strerror(errno));
		exit(1);
	} 
	execvp(av[1],av+1);
	fprintf(stderr, "Cannot execute %s: %s\n", av[1], strerror(errno)); 
	exit(1); 
} 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE/CchN5t5GS2LDRf4RArEwAKCY6CqjaJX5ZqeRhbMSM6PVum5JIACfb45R
2JbVnxHMpjwkz6PwhQUH+S0=
=MOi9
-----END PGP SIGNATURE-----



Reply to: