Remove AUL to avoid User::Shell access level need
authorAleksei Vereshchagin <avereschagin@dev.rtsoft.ru>
Thu, 30 Aug 2018 18:53:49 +0000 (21:53 +0300)
committerAleksei Vereshchagin <avereschagin@dev.rtsoft.ru>
Mon, 3 Sep 2018 15:21:42 +0000 (18:21 +0300)
CMakeLists.txt
profctl.c
tizen_util.c

index dea249f3765a28db04c1d4f41f0c33119e9323aa..f504f79c5cafddc2f235e939d8a3746dda10d27e 100644 (file)
@@ -19,6 +19,11 @@ SET(CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG")
 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
@@ -32,7 +37,9 @@ SET(${PROFCTL}_SOURCE_FILES
 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")
 
index 6f8fe0842f88e90d45246f3ed3965f95af8a931f..f55b8f3b177b01c0ff462f67b039df64b1df7bd7 100644 (file)
--- a/profctl.c
+++ b/profctl.c
@@ -16,7 +16,9 @@
 
 #if TIZEN
 #include <termios.h>
+#if USE_AUL
 #include <aul/aul.h>
+#endif /* USE_AUL */
 #include "tizen_util.h"
 #endif /* TIZEN */
 
@@ -119,6 +121,8 @@ static void *data_output_thread(void *arg)
        return NULL;
 }
 
+#if USE_AUL
+
 static void *wait_app_exited_thread(void *arg)
 {
        intptr_t app_pid = (intptr_t)arg;
@@ -143,6 +147,8 @@ static void *wait_app_exited_thread(void *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()
@@ -227,9 +233,11 @@ static int process_option(int argc, char **argv)
        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;
@@ -258,6 +266,8 @@ static pthread_t SimpleThread(void* (*func)(void *), void *arg)
 }
 
 #if TIZEN
+#if USE_AUL
+
 static int app_launch_handler(int npid, const char *app_id, void *data)
 {
        if (verbose) {
@@ -288,6 +298,8 @@ static int app_dead_handler(int npid, void *data)
        global_stop = 1;
        return 1;
 }
+
+#endif /* USE_AUL */
 #endif /* TIZEN */
 
 static int openFileProcess()
@@ -516,21 +528,25 @@ static void *command_loop_thread(void *arg)
                        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;
@@ -728,8 +744,10 @@ int main(int argc, char **argv)
        }
 
 #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;
index b0ab0c50e2e298ec9d6ee3f6d5e6ab100b663436..9b8597fa4d08f4f04b3e09622b218d64e09c8da7 100644 (file)
@@ -1,10 +1,13 @@
 #if TIZEN
 
-#include <termios.h>
+#if USE_AUL
 #include <aul/aul.h>
+#endif /* USE_AUL */
 
 #include "tizen_util.h"
 
+#if USE_AUL
+
 static int output_app_info(const aul_app_info *info, void *data)
 {
        if (info == NULL || info->appid == NULL) {
@@ -54,4 +57,7 @@ int tizen_find_app_pid(char *appid, int timeout_seconds)
        }
        return -1;
 }
-#endif
+
+#endif /* USE_AUL */
+
+#endif /* TIZEN */