Search
j0ke.net Open Build Service
>
Projects
>
GFS
>
openais
> revision-1450.patch
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File revision-1450.patch of Package openais
Index: lcr/test.c =================================================================== --- lcr/test.c (revision 1449) +++ lcr/test.c (revision 1450) @@ -87,7 +87,7 @@ (void *)0xaaaa1111); assert (res == 0); - a_iface_ver1 = (struct iface *)a_iface_ver0_p; + a_iface_ver1 = (struct iface *)a_iface_ver1_p; res = lcr_ifact_reference ( &b_ifact_handle_ver1, @@ -97,7 +97,7 @@ (void *)0xbbbb1111); assert (res == 0); - b_iface_ver1 = (struct iface *)b_iface_ver0_p; + b_iface_ver1 = (struct iface *)b_iface_ver1_p; a_iface_ver0->func1(); a_iface_ver0->func2(); Index: lcr/lcr_ifact.c =================================================================== --- lcr/lcr_ifact.c (revision 1449) +++ lcr/lcr_ifact.c (revision 1450) @@ -45,6 +45,7 @@ struct lcr_component_instance { struct lcr_iface *ifaces; int iface_count; + unsigned int comp_handle; void *dl_handle; int refcount; char library_name[256]; @@ -68,7 +69,7 @@ .iterator = 0 }; -static unsigned int g_component_handle; +static unsigned int g_component_handle = 0xFFFFFFFF; #ifdef OPENAIS_LINUX static int lcr_select_so (const struct dirent *dirent) @@ -170,7 +171,6 @@ res = getcwd (cwd, sizeof (cwd)); if (res != NULL) { - strcat (cwd, "/"); path_list[0] = strdup (cwd); path_list_entries++; } @@ -291,6 +291,8 @@ } dl_handle = dlopen (dl_name, RTLD_LAZY); if (dl_handle == NULL) { + fprintf (stderr, "LCR error loading plugin: %s\n", + dlerror()); continue; } instance = lcr_comp_find (iface_name, version, iface_number); @@ -301,8 +303,8 @@ } /* - * No matching interfaces found, try next shared object - */ + * No matching interfaces found, try next shared object + */ if (g_component_handle != 0xFFFFFFFF) { hdb_handle_destroy (&lcr_component_instance_database, g_component_handle); @@ -349,20 +351,20 @@ // TODO error checking in this code is weak /* - * Find all *.lcrso files in search paths + * Search through all lcrso files for desired interface */ for (i = 0; i < path_list_entries; i++) { - res = interface_find_and_load ( - path_list[i], - iface_name, - version, - &instance, - &iface_number); + res = interface_find_and_load ( + path_list[i], + iface_name, + version, + &instance, + &iface_number); - if (res == 0) { - goto found; + if (res == 0) { + goto found; + } } - } /* * No matching interfaces found in all shared objects @@ -379,9 +381,10 @@ iface_handle); hdb_handle_get (&lcr_iface_instance_database, *iface_handle, (void *)&iface_instance); - iface_instance->component_handle = g_component_handle; + iface_instance->component_handle = instance->comp_handle; iface_instance->context = context; iface_instance->destructor = instance->ifaces[iface_number].destructor; + hdb_handle_put (&lcr_iface_instance_database, *iface_handle); return (0); } @@ -408,17 +411,21 @@ void lcr_component_register (struct lcr_comp *comp) { struct lcr_component_instance *instance; + static unsigned int comp_handle; hdb_handle_create (&lcr_component_instance_database, sizeof (struct lcr_component_instance), - &g_component_handle); + &comp_handle); hdb_handle_get (&lcr_component_instance_database, - g_component_handle, (void *)&instance); + comp_handle, (void *)&instance); instance->ifaces = comp->ifaces; instance->iface_count = comp->iface_count; + instance->comp_handle = comp_handle; instance->dl_handle = NULL; hdb_handle_put (&lcr_component_instance_database, - g_component_handle); + comp_handle); + + g_component_handle = comp_handle; } Index: lcr/Makefile =================================================================== --- lcr/Makefile (revision 1449) +++ lcr/Makefile (revision 1450) @@ -27,7 +27,7 @@ include ../Makefile.inc CFLAGS += -I../include -LDFLAGS += -L./ ${DYFLAGS} +override LDFLAGS += ${DYFLAGS} ifeq (${OPENAIS_COMPAT}, LINUX) LDFLAGS += -ldl @@ -57,7 +57,7 @@ endif test: test.o uis.o lcr_ifact.o - $(CC) $(LDFLAGS) test.o lcr_ifact.o uis.o -lpthread -o test + $(CC) $(LDFLAGS) -fPIC test.o lcr_ifact.o uis.o -lpthread -o test test_static: test.o libtest_a.o libtest_b.o uis.o lcr_ifact.o $(CC) $(LDFLAGS) test.o libtest_a.o libtest_b.o lcr_ifact.o -o test_static @@ -71,6 +71,12 @@ libtest_b.o: libtest_b.c $(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -c -o $@ $(*F).c +lcr_ifact.o: lcr_ifact.c + $(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -c -o $@ $(*F).c + +test.o: test.c + $(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -c -o $@ $(*F).c + clean: rm -f test libtest.so* *.o uic liblcr.so* liblcr.a *.lcrso *.da *.ba *.bb *.bbg \ test_static