#include <stdint.h>
#include "X11.cc"
+
+#include <org/xwt/plat/Linux.h>
+
+// we love libgcj!
+extern const char **_Jv_argv;
+extern int _Jv_argc;
+
+void org::xwt::plat::Linux::fixEnvironment() {
+ // see http://lists.debian.org/debian-glibc/2003/debian-glibc-200311/msg00647.html
+ const char* ld_assume_kernel = getenv("LD_ASSUME_KERNEL");
+ if (ld_assume_kernel == NULL || strcmp("2.4.1", ld_assume_kernel)) {
+ int result;
+ printf("respawning self (%s) with LD_ASSUME_KERNEL=2.4.1\n", _Jv_argv[0]);
+ setenv("LD_ASSUME_KERNEL", "2.4.1", 1);
+ result = execvp(_Jv_argv[0], (char* const*)((void*)_Jv_argv));
+ printf("execvp() failed with error code %d\n", result);
+ exit(-1);
+ }
+}