make i2 visible outside AWT.java
[org.ibex.core.git] / src / org / ibex / plat / Linux.cc
1 // Copyright 2000-2005 the Contributors, as shown in the revision logs.
2 // Licensed under the GNU General Public License version 2 ("the License").
3 // You may not use this file except in compliance with the License.
4
5 // IMPORTANT: inclusion order: always include gcjh'ed headers first, then superclass cc's, then system headers
6 #undef file
7 #include <stdint.h>
8 #include <java/lang/Class.h>
9 #include <org/ibex/js/JS.h>
10 #include <org/ibex/util/Log.h>
11 #include <org/ibex/plat/Linux.h>
12 #include "X11.cc"
13 #include <stdint.h>
14
15 // we love libgcj!
16 extern const char **_Jv_argv;
17 extern int _Jv_argc;
18
19 void org::ibex::plat::Linux::fixEnvironment() {
20   // this wreaks havoc on gdb
21   // see http://lists.debian.org/debian-glibc/2003/debian-glibc-200311/msg00647.html
22   const char* ld_assume_kernel = getenv("LD_ASSUME_KERNEL");
23   if (ld_assume_kernel == NULL || strcmp("2.4.1", ld_assume_kernel)) {
24     int result;
25     printf("respawning self (%s) with LD_ASSUME_KERNEL=2.4.1\n", _Jv_argv[0]);
26     setenv("LD_ASSUME_KERNEL", "2.4.1", 1);
27     result = execvp(_Jv_argv[0], (char* const*)((void*)_Jv_argv));
28     printf("execvp() failed with error code %d\n", result);
29     exit(-1);
30   }
31 }