OPTION(TIZEN "Tizen platform" ON)
ADD_DEFINITIONS(-DTIZEN=$<BOOL:${TIZEN}>)
+IF(${TIZEN})
+ OPTION(USE_AUL "Use AUL" ON)
+ ADD_DEFINITIONS(-DUSE_AUL=$<BOOL:${USE_AUL}>)
+ENDIF(${TIZEN})
+
SET(PROFCTL "profctl")
SET(${PROFCTL}_SOURCE_FILES
profctl.c
ADD_EXECUTABLE(${PROFCTL} ${${PROFCTL}_SOURCE_FILES})
SET_TARGET_PROPERTIES(${PROFCTL} PROPERTIES COMPILE_FLAGS "-fPIE")
IF(${TIZEN})
- TARGET_LINK_LIBRARIES(${PROFCTL} aul)
+ IF(${USE_AUL})
+ TARGET_LINK_LIBRARIES(${PROFCTL} aul)
+ ENDIF(${USE_AUL})
ENDIF(${TIZEN})
TARGET_LINK_LIBRARIES(${PROFCTL} ${${PROJECT_NAME}_LDFLAGS} "-pie -lpthread")
#if TIZEN
#include <termios.h>
+#if USE_AUL
#include <aul/aul.h>
+#endif /* USE_AUL */
#include "tizen_util.h"
#endif /* TIZEN */
return NULL;
}
+#if USE_AUL
+
static void *wait_app_exited_thread(void *arg)
{
intptr_t app_pid = (intptr_t)arg;
global_stop = 1;
}
+#endif /* USE_AUL */
+
// On Tizen, launch_app won't terminate until stdin, stdout and stderr are closed
// TODO!! is needed?
static void close_stdio()
case 'e': CheckValue(&ename, "exe name"); break;
case 'o': CheckValue(&oname, "error name"); break;
case 'v': verbose++; break;
-#if TIZEN
- case 'l': tizen_list_running_apps(stderr); exit(0);
-#endif /* TIZEN */
+ case 'l':
+#if USE_AUL
+ tizen_list_running_apps(stderr);
+#endif /* USE_AUL */
+ exit(0);
case 'i': doinfo = 1; break;
case 't': stat_period_usec = atoi(optarg) * 1000; break;
case 'w': isPipeOwner = 1; break;
}
#if TIZEN
+#if USE_AUL
+
static int app_launch_handler(int npid, const char *app_id, void *data)
{
if (verbose) {
global_stop = 1;
return 1;
}
+
+#endif /* USE_AUL */
#endif /* TIZEN */
static int openFileProcess()
if (app_pid == -1) {
if (pid == -1) {
#if TIZEN
+#if USE_AUL
pid = tizen_find_app_pid(appid, 10); // try 10 seconds
if (pid == -1) {
log_error("cannot find application %s", appid);
reply = "!app_not_found"; // report error
global_stop = 1;
}
+#endif /* USE_AUL */
#else
pid = getpid();
#endif /* TIZEN */
}
app_pid = pid;
+#if USE_AUL
if (verbose) {
log_message("waiting for controlled application exit (pid=%d)", pid);
}
SimpleThread(&wait_app_exited_thread, (void*)(intptr_t)pid);
+#endif /* USE_AUL */
if (doinfo) {
if (stat_file_out == NULL) {
stat_file_out = stdout;
}
#if TIZEN
+#if USE_AUL
aul_listen_app_launch_signal_v2(app_launch_handler, NULL);
aul_listen_app_dead_signal(app_dead_handler, NULL);
+#endif /* USE_AUL */
#endif /* TIZEN */
command_loop_thread_runs = 1;