* 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:
* 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
// use, and if not, enable the R5 compatibility layer.
const char *name;
cookie = 0;
// As dependencies to network libraries may be "hidden" in libraries, we
// may have to scan not only the executable, but every loaded image.
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 (!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++;
}
if (enable > 0) {
__gR5Compatibility = true;
find_own_image();
debug_printf("libnetwork.so running in R5 compatibility mode.\n");
}
if (enable > 0) {
__gR5Compatibility = true;
find_own_image();
debug_printf("libnetwork.so running in R5 compatibility mode.\n");
return;
}
} while(enable == 0
&& get_next_image_info(B_CURRENT_TEAM, (int32 *)&cookie, &info)
== B_OK);
}