* when finding out whether or not R5 compatibility mode is required, we may have

to scan loaded libraries, too, as the dependency on network libraries may not
  be present in the executable image, but may be "hidden" in one of those
  library images (as is the case with Beam).
  


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26277 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Oliver Tappe
2008-07-06 13:50:28 +00:00
parent d2805ca9aa
commit 7da7c45951
+26 -19
View File
@@ -4,6 +4,7 @@
* *
* Authors: * Authors:
* Axel Dörfler, [email protected] * Axel Dörfler, [email protected]
* Oliver Tappe, [email protected]
*/ */
@@ -59,25 +60,31 @@ initialize_before()
// We're using the BeOS startup code, check if BONE libraries are in // We're using the BeOS startup code, check if BONE libraries are in
// use, and if not, enable the R5 compatibility layer. // use, and if not, enable the R5 compatibility layer.
// As dependencies to network libraries may be "hidden" in libraries, we
const char *name; // may have to scan not only the executable, but every loaded image.
cookie = 0;
int enable = 0; int enable = 0;
uint32 crumble;
const char *name;
do {
crumble = 0;
while (__get_next_image_dependency(info.id, &crumble, &name) == B_OK) {
if (!strcmp(name, "libbind.so")
|| !strcmp(name, "libsocket.so")
|| !strcmp(name, "libbnetapi.so")
|| !strcmp(name, "libnetwork.so"))
enable -= 2;
else if (!strcmp(name, "libnet.so")
|| !strcmp(name, "libnetapi.so"))
enable++;
}
while (__get_next_image_dependency(info.id, &cookie, &name) == B_OK) { if (enable > 0) {
if (!strcmp(name, "libbind.so") __gR5Compatibility = true;
|| !strcmp(name, "libsocket.so") find_own_image();
|| !strcmp(name, "libbnetapi.so") debug_printf("libnetwork.so running in R5 compatibility mode.\n");
|| !strcmp(name, "libnetwork.so")) return;
enable -= 2; }
else if (!strcmp(name, "libnet.so") } while(enable == 0
|| !strcmp(name, "libnetapi.so")) && get_next_image_info(B_CURRENT_TEAM, (int32 *)&cookie, &info)
enable++; == B_OK);
}
if (enable > 0) {
__gR5Compatibility = true;
find_own_image();
debug_printf("libnetwork.so running in R5 compatibility mode.\n");
}
} }