diff --git a/configure.ac b/configure.ac index aae316284..58a2929ed 100644 --- a/configure.ac +++ b/configure.ac @@ -1047,7 +1047,6 @@ src/modules/tiling/Makefile src/modules/tiling/module.desktop src/modules/access/Makefile src/modules/access/module.desktop -src/preload/Makefile data/Makefile data/images/Makefile data/flags/Makefile diff --git a/src/Makefile.am b/src/Makefile.am index d29641709..c3625499b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,2 +1,2 @@ MAINTAINERCLEANFILES = Makefile.in -SUBDIRS = bin modules preload +SUBDIRS = bin modules diff --git a/src/bin/e_start_main.c b/src/bin/e_start_main.c index 6fab98b70..2c4fbedc0 100644 --- a/src/bin/e_start_main.c +++ b/src/bin/e_start_main.c @@ -60,69 +60,6 @@ prefix_determine(char *argv0) return 1; } -static void -precache(void) -{ - FILE *f; - char *home; - char buf[4096], tbuf[256 * 1024]; - struct stat st; - int l, fd, children = 0, cret; - - home = getenv("HOME"); - if (home) snprintf(buf, sizeof(buf), "%s/.e-precache", home); - else snprintf(buf, sizeof(buf), "/tmp/.e-precache"); - f = fopen(buf, "r"); - if (!f) return; - unlink(buf); - if (fork()) return; -// while (fgets(buf, sizeof(buf), f)); -// rewind(f); - while (fgets(buf, sizeof(buf), f)) - { - l = strlen(buf); - if (l > 0) buf[l - 1] = 0; - if (!fork()) - { - if (buf[0] == 's') stat(buf + 2, &st); - else if (buf[0] == 'o') - { - fd = open(buf + 2, O_RDONLY); - if (fd >= 0) - { - while (read(fd, tbuf, 256 * 1024) > 0) - ; - close(fd); - } - } - else if (buf[0] == 'd') - { - fd = open(buf + 2, O_RDONLY); - if (fd >= 0) - { - while (read(fd, tbuf, 256 * 1024) > 0) - ; - close(fd); - } - } - exit(0); - } - children++; - if (children > 400) - { - wait(&cret); - children--; - } - } - fclose(f); - while (children > 0) - { - wait(&cret); - children--; - } - exit(0); -} - static int find_valgrind(char *path, size_t path_len) { @@ -277,7 +214,7 @@ _env_path_append(const char *env, const char *path) int main(int argc, char **argv) { - int i, do_precache = 0, valgrind_mode = 0; + int i, valgrind_mode = 0; int valgrind_tool = 0; int valgrind_gdbserver = 0; char buf[16384], **args, *p; @@ -292,8 +229,7 @@ main(int argc, char **argv) for (i = 1; i < argc; i++) { - if (!strcmp(argv[i], "-no-precache")) do_precache = 0; - else if (!strcmp(argv[i], "-valgrind-gdb")) + if (!strcmp(argv[i], "-valgrind-gdb")) valgrind_gdbserver = 1; else if (!strncmp(argv[i], "-valgrind", sizeof("-valgrind") - 1)) { @@ -329,8 +265,6 @@ main(int argc, char **argv) printf ( "Options:\n" - "\t-no-precache\n" - "\t\tDisable pre-caching of files\n" "\t-valgrind[=MODE]\n" "\t\tRun enlightenment from inside valgrind, mode is OR of:\n" "\t\t 1 = plain valgrind to catch crashes (default)\n" @@ -375,7 +309,7 @@ main(int argc, char **argv) } } - printf("E - PID=%i, do_precache=%i, valgrind=%d", getpid(), do_precache, valgrind_mode); + printf("E - PID=%i, valgrind=%d", getpid(), valgrind_mode); if (valgrind_mode) { printf(" valgrind-command='%s'", valgrind_path); @@ -383,63 +317,6 @@ main(int argc, char **argv) } putchar('\n'); - if (do_precache) - { - void *lib, *func; - - /* sanity checks - if precache might fail - check here first */ - lib = dlopen("libeina.so", RTLD_GLOBAL | RTLD_LAZY); - if (!lib) dlopen("libeina.so.1", RTLD_GLOBAL | RTLD_LAZY); - if (!lib) goto done; - func = dlsym(lib, "eina_init"); - if (!func) goto done; - - lib = dlopen("libecore.so", RTLD_GLOBAL | RTLD_LAZY); - if (!lib) dlopen("libecore.so.1", RTLD_GLOBAL | RTLD_LAZY); - if (!lib) goto done; - func = dlsym(lib, "ecore_init"); - if (!func) goto done; - - lib = dlopen("libecore_file.so", RTLD_GLOBAL | RTLD_LAZY); - if (!lib) dlopen("libecore_file.so.1", RTLD_GLOBAL | RTLD_LAZY); - if (!lib) goto done; - func = dlsym(lib, "ecore_file_init"); - if (!func) goto done; - - lib = dlopen("libecore_x.so", RTLD_GLOBAL | RTLD_LAZY); - if (!lib) dlopen("libecore_x.so.1", RTLD_GLOBAL | RTLD_LAZY); - if (!lib) goto done; - func = dlsym(lib, "ecore_x_init"); - if (!func) goto done; - - lib = dlopen("libevas.so", RTLD_GLOBAL | RTLD_LAZY); - if (!lib) dlopen("libevas.so.1", RTLD_GLOBAL | RTLD_LAZY); - if (!lib) goto done; - func = dlsym(lib, "evas_init"); - if (!func) goto done; - - lib = dlopen("libedje.so", RTLD_GLOBAL | RTLD_LAZY); - if (!lib) dlopen("libedje.so.1", RTLD_GLOBAL | RTLD_LAZY); - if (!lib) goto done; - func = dlsym(lib, "edje_init"); - if (!func) goto done; - - lib = dlopen("libeet.so", RTLD_GLOBAL | RTLD_LAZY); - if (!lib) dlopen("libeet.so.0", RTLD_GLOBAL | RTLD_LAZY); - if (!lib) goto done; - func = dlsym(lib, "eet_init"); - if (!func) goto done; - - /* precache SHOULD work */ - snprintf(buf, sizeof(buf), "%s/enlightenment/preload/e_precache.so", - eina_prefix_lib_get(pfx)); - env_set("LD_PRELOAD", buf); - printf("E - PRECACHE GOING NOW...\n"); - fflush(stdout); - precache(); - } -done: - /* mtrack memory tracker support */ p = getenv("HOME"); if (p) diff --git a/src/preload/Makefile.am b/src/preload/Makefile.am deleted file mode 100644 index 1f5fc01f4..000000000 --- a/src/preload/Makefile.am +++ /dev/null @@ -1,25 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -INCLUDES = -I. \ - -I$(top_srcdir) \ - -I$(top_srcdir)src/preload \ - @e_cflags@ - -pkgdir = $(libdir)/enlightenment/preload - -#pkg_LTLIBRARIES = e_hack.la e_precache.la -pkg_LTLIBRARIES = e_precache.la - -#e_hack_la_SOURCES = \ -#e_hack.c \ -#e_hack.h -#e_hack_la_LIBADD = @dlopen_libs@ -#e_hack_la_LDFLAGS = -module -avoid-version -#e_hack_la_DEPENDENCIES = $(top_builddir)/config.h - -e_precache_la_SOURCES = \ -e_precache.c \ -e_precache.h -e_precache_la_LIBADD = @e_libs@ @dlopen_libs@ -e_precache_la_LDFLAGS = -module -avoid-version -e_precache_la_DEPENDENCIES = $(top_builddir)/config.h diff --git a/src/preload/e_hack.c b/src/preload/e_hack.c deleted file mode 100644 index 6562d807e..000000000 --- a/src/preload/e_hack.c +++ /dev/null @@ -1,232 +0,0 @@ -#include "config.h" -#include "e_hack.h" - -/* FIXME: - * * gnome-terminal does this funky thing where a new gnome-temrinal process - * tries to message an existing one asking it to create a new terminal. this - * means none of these properties ever end up on a new term window - in fact - * only the ones that are on the first term process. we need a way of knowing - * this, OR making sure no new iwndows other than the first appear with these - * properties. this also leads to handling splash windows - we might want then - * the first 2 or 3 windows with it. - * - * we need to discuss this... it's an interesting hack that solves a LOT of - * things (and that we can maybe in future expand to hacking away at gtk and - * qt directly) - * - * anyway - for now this is fairly harmless and just adds a property to all - * top-level app windows - */ - -/* prototypes */ -static void __e_hack_set_properties(Display *display, Window window); - -/* dlopened xlib so we can find the symbols in the real xlib to call them */ -static void *lib_xlib = NULL; - -/* the function that actually sets the properties on toplevel window */ -static void -__e_hack_set_properties(Display *display, Window window) -{ - static Atom a_hack = 0; - char *env = NULL; - char buf[4096]; - char buf2[4096]; - uid_t uid; - pid_t pid, ppid; - struct utsname ubuf; - - if (!a_hack) a_hack = XInternAtom(display, "__E_HACK", False); - buf[0] = 0; - buf[sizeof(buf) - 1] = 0; - uid = getuid(); - snprintf(buf2, sizeof(buf2), "uid: %i\n", uid); - strncat(buf, buf2, sizeof(buf) - strlen(buf) - 1); - pid = getpid(); - snprintf(buf2, sizeof(buf2), "pid: %i\n", pid); - strncat(buf, buf2, sizeof(buf) - strlen(buf) - 1); - ppid = getppid(); - snprintf(buf2, sizeof(buf2), "ppid: %i\n", ppid); - strncat(buf, buf2, sizeof(buf) - strlen(buf) - 1); - if (!uname(&ubuf)) - { - snprintf(buf2, sizeof(buf2), "machine_name: %s\n", ubuf.nodename); - strncat(buf, buf2, sizeof(buf) - strlen(buf) - 1); - } - if ((env = getenv("E_LAUNCH_ID"))) - { - snprintf(buf2, sizeof(buf2), "launch_id: %s\n", env); - strncat(buf, buf2, sizeof(buf) - strlen(buf) - 1); - } - if ((env = getenv("USER"))) - { - snprintf(buf2, sizeof(buf2), "username: %s\n", env); - strncat(buf, buf2, sizeof(buf) - strlen(buf) - 1); - } - if ((env = getenv("E_DESK"))) - { - snprintf(buf2, sizeof(buf2), "e_desk: %s\n", env); - strncat(buf, buf2, sizeof(buf) - strlen(buf) - 1); - } - if ((env = getenv("E_ZONE"))) - { - snprintf(buf2, sizeof(buf2), "e_zone: %s\n", env); - strncat(buf, buf2, sizeof(buf) - strlen(buf) - 1); - } - if ((env = getenv("E_CONTAINER"))) - { - snprintf(buf2, sizeof(buf2), "e_container: %s\n", env); - strncat(buf, buf2, sizeof(buf) - strlen(buf) - 1); - } - if ((env = getenv("E_MANAGER"))) - { - snprintf(buf2, sizeof(buf2), "e_manager: %s\n", env); - strncat(buf, buf2, sizeof(buf) - strlen(buf) - 1); - } - XChangeProperty(display, window, a_hack, XA_STRING, 8, PropModeReplace, (unsigned char *)buf, strlen(buf)); -} - -/* XCreateWindow intercept hack */ -Window -XCreateWindow( - Display *display, - Window parent, - int x, int y, - unsigned int width, unsigned int height, - unsigned int border_width, - int depth, - unsigned int class, - Visual *visual, - unsigned long valuemask, - XSetWindowAttributes *attributes - ) -{ - static Window (*func) - ( - Display *display, - Window parent, - int x, int y, - unsigned int width, unsigned int height, - unsigned int border_width, - int depth, - unsigned int class, - Visual *visual, - unsigned long valuemask, - XSetWindowAttributes *attributes - ) = NULL; - int i; - - /* find the real Xlib and the real X function */ - if (!lib_xlib) lib_xlib = dlopen("libX11.so", RTLD_GLOBAL | RTLD_LAZY); - if (!func) func = dlsym (lib_xlib, "XCreateWindow"); - - /* multihead screen handling loop */ - for (i = 0; i < ScreenCount(display); i++) - { - /* if the window is created as a toplevel window */ - if (parent == RootWindow(display, i)) - { - Window window; - - /* create it */ - window = (*func) (display, parent, x, y, width, height, - border_width, depth, class, visual, valuemask, - attributes); - /* set properties */ - __e_hack_set_properties(display, window); - /* return it */ - return window; - } - } - /* normal child window - create as usual */ - return (*func) (display, parent, x, y, width, height, border_width, depth, - class, visual, valuemask, attributes); -} - -/* XCreateSimpleWindow intercept hack */ -Window -XCreateSimpleWindow( - Display *display, - Window parent, - int x, int y, - unsigned int width, unsigned int height, - unsigned int border_width, - unsigned long border, - unsigned long background - ) -{ - static Window (*func) - ( - Display *display, - Window parent, - int x, int y, - unsigned int width, unsigned int height, - unsigned int border_width, - unsigned long border, - unsigned long background - ) = NULL; - int i; - - /* find the real Xlib and the real X function */ - if (!lib_xlib) lib_xlib = dlopen("libX11.so", RTLD_GLOBAL | RTLD_LAZY); - if (!func) func = dlsym (lib_xlib, "XCreateSimpleWindow"); - - /* multihead screen handling loop */ - for (i = 0; i < ScreenCount(display); i++) - { - /* if the window is created as a toplevel window */ - if (parent == RootWindow(display, i)) - { - Window window; - - /* create it */ - window = (*func) (display, parent, x, y, width, height, - border_width, border, background); - /* set properties */ - __e_hack_set_properties(display, window); - /* return it */ - return window; - } - } - /* normal child window - create as usual */ - return (*func) (display, parent, x, y, width, height, - border_width, border, background); -} - -/* XReparentWindow intercept hack */ -int -XReparentWindow( - Display *display, - Window window, - Window parent, - int x, int y - ) -{ - static int (*func) - ( - Display *display, - Window window, - Window parent, - int x, int y - ) = NULL; - int i; - - /* find the real Xlib and the real X function */ - if (!lib_xlib) lib_xlib = dlopen("libX11.so", RTLD_GLOBAL | RTLD_LAZY); - if (!func) func = dlsym (lib_xlib, "XReparentWindow"); - - /* multihead screen handling loop */ - for (i = 0; i < ScreenCount(display); i++) - { - /* if the window is created as a toplevel window */ - if (parent == RootWindow(display, i)) - { - /* set properties */ - __e_hack_set_properties(display, window); - /* reparent it */ - return (*func) (display, window, parent, x, y); - } - } - /* normal child window reparenting - reparent as usual */ - return (*func) (display, window, parent, x, y); -} diff --git a/src/preload/e_hack.h b/src/preload/e_hack.h deleted file mode 100644 index a2948c95d..000000000 --- a/src/preload/e_hack.h +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include diff --git a/src/preload/e_precache.c b/src/preload/e_precache.c deleted file mode 100644 index 272fa2ad1..000000000 --- a/src/preload/e_precache.c +++ /dev/null @@ -1,280 +0,0 @@ -#include "config.h" -#include "e_precache.h" - -static void *lib_eina = NULL; -static void *lib_ecore = NULL; -static void *lib_ecore_file = NULL; -static void *lib_ecore_x = NULL; -static void *lib_evas = NULL; -static void *lib_edje = NULL; -static void *lib_eet = NULL; - -static int *e_precache_end = NULL; - -/* internal calls */ -static int log_fd = -1; -static int do_log = 0; - -static void -log_open(void) -{ - char buf[4096] = "DUMMY", *home; - - if (log_fd != -1) return; - if (!e_precache_end) - { -#ifdef HAVE_UNSETENV - unsetenv("LD_PRELOAD"); -#else - if (getenv("LD_PRELOAD")) putenv("LD_PRELOAD"); -#endif - e_precache_end = dlsym(NULL, "e_precache_end"); - } - if (!e_precache_end) return; - if (*e_precache_end) return; - - home = getenv("HOME"); - if (home) - snprintf(buf, sizeof(buf), "%s/.e-precache", home); - else - snprintf(buf, sizeof(buf), "/tmp/.e-precache"); - log_fd = open(buf, O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR | S_IWUSR); - if (log_fd) do_log = 1; -} - -static void -log_close(void) -{ - if (log_fd >= 0) - { - close(log_fd); - log_fd = -1; - } - do_log = 0; -} - -static void -log_write(const char *type, const char *file) -{ - static Eina_Hash *s_hash = NULL; - static Eina_Hash *o_hash = NULL; - static Eina_Hash *d_hash = NULL; - char buf[2]; - - if ((e_precache_end) && (*e_precache_end)) - { - log_close(); - return; - } - if (type[0] == 's') - { - if (eina_hash_find(s_hash, file)) return; - if (!s_hash) s_hash = eina_hash_string_superfast_new(NULL); - eina_hash_add(s_hash, file, (void *)1); - } - else if (type[0] == 'o') - { - if (eina_hash_find(o_hash, file)) return; - if (!o_hash) o_hash = eina_hash_string_superfast_new(NULL); - eina_hash_add(o_hash, file, (void *)1); - } - else if (type[0] == 'd') - { - if (eina_hash_find(d_hash, file)) return; - if (!d_hash) d_hash = eina_hash_string_superfast_new(NULL); - eina_hash_add(d_hash, file, (void *)1); - } - buf[0] = type[0]; buf[1] = ' '; - write(log_fd, buf, 2); - write(log_fd, file, strlen(file)); - write(log_fd, "\n", 1); -} - -static void * -lib_func(const char *lib1, const char *lib2, const char *fname, const char *libname, void **lib) -{ - void *func; - - if (!*lib) *lib = dlopen(lib1, RTLD_GLOBAL | RTLD_LAZY); - if (!*lib) *lib = dlopen(lib2, RTLD_GLOBAL | RTLD_LAZY); - func = dlsym(*lib, fname); - if (!func) - { - printf("ABORT: Can't find %s() in %s or %s (%s = %p)\n", - fname, lib1, lib2, libname, *lib); - abort(); - } - log_open(); - return func; -} - -/* intercepts */ -Eina_Module * -eina_module_find(const Eina_Array *array, const char *module) -{ - static Eina_Module *(*func) (const Eina_Array *array, const char *module) = NULL; - - if (!func) - func = lib_func("libeina.so", "libeina.so.1", - "eina_module_find", "lib_eina", &lib_eina); - if (do_log) log_write("o", module); - return (*func) (array, module); -} - -void -ecore_app_args_set(int argc, const char **argv) -{ - static void (*func) (int argc, const char **argv) = NULL; - - if (!func) - func = lib_func("libecore.so", "libecore.so.1", - "ecore_app_args_set", "lib_ecore", &lib_ecore); - if (do_log) log_write("o", (const char *)argv); - (*func) (argc, argv); -} - -long long -ecore_file_mod_time(const char *file) -{ - static long long (*func) (const char *file) = NULL; - - if (!func) - func = lib_func("libecore_file.so", "libecore_file.so.1", - "ecore_file_mod_time", "lib_ecore_file", &lib_ecore_file); - if (do_log) log_write("s", file); - return (*func) (file); -} - -long long -ecore_file_size(const char *file) -{ - static int (*func) (const char *file) = NULL; - - if (!func) - func = lib_func("libecore_file.so", "libecore_file.so.1", - "ecore_file_size", "lib_ecore_file", &lib_ecore_file); - if (do_log) log_write("s", file); - return (*func) (file); -} - -Eina_Bool -ecore_file_exists(const char *file) -{ - static int (*func) (const char *file) = NULL; - - if (!func) - func = lib_func("libecore_file.so", "libecore_file.so.1", - "ecore_file_exists", "lib_ecore_file", &lib_ecore_file); - if (do_log) log_write("s", file); - return (*func) (file); -} - -Eina_Bool -ecore_file_is_dir(const char *file) -{ - static int (*func) (const char *file) = NULL; - - if (!func) - func = lib_func("libecore_file.so", "libecore_file.so.1", - "ecore_file_is_dir", "lib_ecore_file", &lib_ecore_file); - if (do_log) log_write("s", file); - return (*func) (file); -} - -Eina_Bool -ecore_file_can_read(const char *file) -{ - static int (*func) (const char *file) = NULL; - - if (!func) - func = lib_func("libecore_file.so", "libecore_file.so.1", - "ecore_file_can_read", "lib_ecore_file", &lib_ecore_file); - if (do_log) log_write("s", file); - return (*func) (file); -} - -Eina_Bool -ecore_file_can_write(const char *file) -{ - static int (*func) (const char *file) = NULL; - - if (!func) - func = lib_func("libecore_file.so", "libecore_file.so.1", - "ecore_file_can_write", "lib_ecore_file", &lib_ecore_file); - if (do_log) log_write("s", file); - return (*func) (file); -} - -Eina_Bool -ecore_file_can_exec(const char *file) -{ - static int (*func) (const char *file) = NULL; - - if (!func) - func = lib_func("libecore_file.so", "libecore_file.so.1", - "ecore_file_can_exec", "lib_ecore_file", &lib_ecore_file); - if (do_log) log_write("s", file); - return (*func) (file); -} - -Eina_List * -ecore_file_ls(const char *file) -{ - static Eina_List * (*func) (const char *file) = NULL; - - if (!func) - func = lib_func("libecore_file.so", "libecore_file.so.1", - "ecore_file_ls", "lib_ecore_file", &lib_ecore_file); - if (do_log) log_write("d", file); - return (*func) (file); -} - -int -ecore_x_init(const char *name) -{ - static int (*func) (const char *name) = NULL; - - if (!func) - func = lib_func("libecore_x.so", "libecore_x.so.1", - "ecore_x_init", "lib_ecore_x", &lib_ecore_x); - if (do_log) log_write("o", name); - return (*func) (name); -} - -void -evas_object_image_file_set(Evas_Object *obj, const char *file, const char *key) -{ - static void (*func) (Evas_Object *obj, const char *file, const char *key) = NULL; - - if (!func) - func = lib_func("libevas.so", "libevas.so.1", - "evas_object_image_file_set", "lib_evas", &lib_evas); - if (do_log) log_write("o", file); - (*func) (obj, file, key); -} - -/* edje */ -Eina_Bool -edje_object_file_set(Evas_Object *obj, const char *file, const char *group) -{ - static Eina_Bool (*func) (Evas_Object *obj, const char *file, const char *group) = NULL; - - if (!func) - func = lib_func("libedje.so", "libedje.so.1", - "edje_object_file_set", "lib_edje", &lib_edje); - if (do_log) log_write("o", file); - return (*func) (obj, file, group); -} - -Eet_File * -eet_open(const char *file, Eet_File_Mode mode) -{ - static Eet_File * (*func) (const char *file, Eet_File_Mode mode) = NULL; - - if (!func) - func = lib_func("libeet.so", "libeet.so.0", - "eet_open", "lib_eet", &lib_eet); - if (do_log) log_write("o", file); - return (*func) (file, mode); -} - diff --git a/src/preload/e_precache.h b/src/preload/e_precache.h deleted file mode 100644 index 0f98dbbbf..000000000 --- a/src/preload/e_precache.h +++ /dev/null @@ -1,18 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef HAVE_ALLOCA_H -#include -#endif -#include -#include -#include -#include -#include diff --git a/x-ui.sh b/x-ui.sh index 5b9d4e7ec..1266c8e28 100755 --- a/x-ui.sh +++ b/x-ui.sh @@ -273,7 +273,6 @@ sleep 1 export DISPLAY=:1 [ ! -z "$TEST_HOME" ] && export HOME="$TEST_HOME" enlightenment_start \ - -no-precache \ -i-really-know-what-i-am-doing-and-accept-full-responsibility-for-it \ -profile $PROFILE \ $E_OPTIONS $xinerama_auto_args \