process_prepare_shutdown(Shutdown_Full); // close all db's and fd's and block access
- // end dbus library
- bContinue = 0;
-
// send quit command to dbus mainloop
deliverToMainloop_NM(&data);
{
const char* busName = dbus_bus_get_unique_name(conn);
- printf("process_send_lifecycle_register => busName: %s\n", busName);
-
DBusMessage* message = dbus_message_new_method_call(gDbusLcConsDest, // destination
gDbusLcCons, // path
gDbusLcInterface, // interface
{
DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("addTimeout => cannot create another fd to be poll()'ed"));
}
-
return ret;
}
memset(&gPollInfo, 0 , sizeof(gPollInfo));
gPollInfo.nfds = 1;
- //gPollInfo.fds[0].fd = gEfds;
gPollInfo.fds[0].fd = gPipeFd[0];
gPollInfo.fds[0].events = POLLIN;
{
bContinue = 0; /* assume error */
- while (DBUS_DISPATCH_DATA_REMAINS==dbus_connection_dispatch(conn));
+ while(DBUS_DISPATCH_DATA_REMAINS==dbus_connection_dispatch(conn));
while ((-1==(ret=poll(gPollInfo.fds, gPollInfo.nfds, -1)))&&(EINTR==errno));
else
{
int i;
+ int bQuit = FALSE;
- for (i=0; gPollInfo.nfds>i; ++i)
+ for (i=0; gPollInfo.nfds>i && !bQuit; ++i)
{
/* anything to do */
if (0!=gPollInfo.fds[i].revents)
{
/* time-out occured */
unsigned long long nExpCount = 0;
+
if ((ssize_t)sizeof(nExpCount)!=read(gPollInfo.fds[i].fd, &nExpCount, sizeof(nExpCount)))
{
DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("mainLoop => read failed"));
}
bContinue = TRUE;
}
- //else if (gPollInfo.fds[i].fd == gEfds)
else if (gPollInfo.fds[i].fd == gPipeFd[0])
{
+
/* internal command */
if (0!=(gPollInfo.fds[i].revents & POLLIN))
{
break;
case CMD_QUIT:
bContinue = 0;
+ bQuit = TRUE;
break;
default:
DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("mainLoop => command not handled"), DLT_INT(readData.message.cmd) );
else
{
int flags = 0;
+
if (0!=(gPollInfo.fds[i].revents & POLLIN))
{
flags |= DBUS_WATCH_READABLE;
{
flags |= DBUS_WATCH_HANGUP;
}
-
bContinue = dbus_watch_handle(gPollInfo.objects[i].watch, flags);
}
}
dbus_connection_unregister_object_path(conn, gDbusLcConsPath);
dbus_connection_unregister_object_path(conn, "/");
}
- //close(gEfds);
+
close(gPipeFd[0]);
close(gPipeFd[1]);
}
DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("deliverToMainloop => failed to write to pipe"), DLT_INT(errno));
rval = -1;
}
-
return rval;
}
extern pthread_mutex_t gMainCondMtx;
-// declared in persistence_client_library_dbus_service.c
-// used to end dbus library
-extern int bContinue;
-
extern pthread_t gMainLoopThread;
(void)user_data;
- printf("checkLifecycleMsg ==> \n Interface: %s \n Message: %s \n", dbus_message_get_interface(message), dbus_message_get_member(message));
-
if((0==strncmp(gDbusLcConsterface, dbus_message_get_interface(message), 46)))
{
if((0==strncmp(gDbusLcConsMsg, dbus_message_get_member(message), 16)))
(void)user_data;
- printf("checkPersAdminMsg => \n interface: %s\n Message: %s \n", dbus_message_get_interface(message), dbus_message_get_member(message));
-
if((0==strcmp(gDbusPersAdminConsInterface, dbus_message_get_interface(message))))
{
if((0==strcmp(gDbusPersAdminConsMsg, dbus_message_get_member(message))))
resolution = ((clockRes.tv_sec * SECONDS2NANO) + clockRes.tv_nsec);
printf("Clock resolution => %f ms\n\n", (double)((double)resolution/NANO2MIL));
- init_benchmark(1000);
+ init_benchmark(numLoops);
// init library
#include <time.h>
#include <fcntl.h>
#include <sys/mman.h>
+#include <sys/stat.h>
#include <dlt/dlt.h>
#include <dlt/dlt_common.h>
* Logical DB ID: 0xFF with user 3 and seat 2
* ==> local USER value (user 3, seat 2)
*/
- ret = pclKeyWriteData(0xFF, "status/open_document", 3, 2, "WT_ /var/opt/user_manual_climateControl.pdf", strlen("WT_ /var/opt/user_manual_climateControl.pdf"));
+ ret = pclKeyWriteData(0xFF, "status/open_document", 3, 2, (unsigned char*)"WT_ /var/opt/user_manual_climateControl.pdf", strlen("WT_ /var/opt/user_manual_climateControl.pdf"));
x_fail_unless(ret == strlen("WT_ /var/opt/user_manual_climateControl.pdf"), "Wrong write size");
- ret = pclKeyWriteData(0x84, "links/last_link", 2, 1, "CACHE_ /last_exit/queens", strlen("CACHE_ /last_exit/queens"));
+ ret = pclKeyWriteData(0x84, "links/last_link", 2, 1, (unsigned char*)"CACHE_ /last_exit/queens", strlen("CACHE_ /last_exit/queens"));
x_fail_unless(ret == strlen("CACHE_ /last_exit/queens"), "Wrong write size");
- ret = pclKeyWriteData(0xFF, "posHandle/last_position", 0, 0, "WT_ H A N D L E: +48° 10' 38.95\", +8° 44' 39.06\"", strlen("WT_ H A N D L E: +48° 10' 38.95\", +8° 44' 39.06\""));
+ ret = pclKeyWriteData(0xFF, "posHandle/last_position", 0, 0, (unsigned char*)"WT_ H A N D L E: +48° 10' 38.95\", +8° 44' 39.06\"", strlen("WT_ H A N D L E: +48° 10' 38.95\", +8° 44' 39.06\""));
x_fail_unless(ret == strlen("WT_ H A N D L E: +48° 10' 38.95\", +8° 44' 39.06\""), "Wrong write size");
#endif
START_TEST(test_InitDeinit)
{
- unsigned int shutdownReg = PCL_SHUTDOWN_TYPE_FAST | PCL_SHUTDOWN_TYPE_NORMAL;
+ int i = 0;
+ unsigned int shutdownReg = PCL_SHUTDOWN_TYPE_FAST | PCL_SHUTDOWN_TYPE_NORMAL;
- // initialize and deinitialize 1. time
- (void)pclInitLibrary(gTheAppId, shutdownReg);
- pclDeinitLibrary();
+ for(i=1; i<20; i++)
+ {
+ // initialize and deinitialize 1. time
+ (void)pclInitLibrary(gTheAppId, shutdownReg);
+ pclDeinitLibrary();
- // initialize and deinitialize 2. time
- (void)pclInitLibrary(gTheAppId, shutdownReg);
- pclDeinitLibrary();
+ // initialize and deinitialize 2. time
+ (void)pclInitLibrary(gTheAppId, shutdownReg);
+ pclDeinitLibrary();
- // initialize and deinitialize 3. time
- (void)pclInitLibrary(gTheAppId, shutdownReg);
- pclDeinitLibrary();
+ // initialize and deinitialize 3. time
+ (void)pclInitLibrary(gTheAppId, shutdownReg);
+ pclDeinitLibrary();
+ }
+
}
END_TEST
// OK
int plugin_handle_get_data(int handle, char* buffer, int size)
{
- int strSize = 99;
+ //int strSize = 99;
//printf("plugin_handle_get_data: %s\n", LIBIDENT);
return snprintf(buffer, size, "Custom plugin -> plugin_get_data_handle: %s!", LIBIDENT);
// OK
int plugin_get_data(const char* path, char* buffer, int size)
{
- int strSize = 99;
+ //int strSize = 99;
//printf("Custom plugin -> plugin_get_data: %s!\n", LIBIDENT);
// OK
int plugin_init()
{
- int rval = 99;
+ //int rval = 99;
//printf("* * * * * plugin_init sync => %s!\n", LIBIDENT);
- return rval;
+ return 1;
}
int plugin_init_async(plugin_callback_async_t pfInitCompletedCB)
{
- int rval = -1;
+ //int rval = -1;
//printf("* * * * * plugin_init_async => %s!\n", LIBIDENT);
- return rval;
+ return 1;
}
int plugin_clear_all_data(void)
{
printf("plugin_clear_all_data\n");
+ return 1;
}
int plugin_sync(void)
{
printf("plugin_sync\n");
+ return 1;
}