Remove unused semaphore feature 73/245573/1
authorSeungbae Shin <seungbae.shin@samsung.com>
Mon, 12 Oct 2020 11:00:09 +0000 (20:00 +0900)
committerSeungbae Shin <seungbae.shin@samsung.com>
Mon, 12 Oct 2020 11:00:09 +0000 (20:00 +0900)
+ remove minor build warnings

[Version] 0.13.1
[Issue Type] Cleanup

Change-Id: Ie9a5d71a2ffe3010f4c0f315dd505f871da09877

configure.ac
focus_server/mm_sound_focus_server.c
mm_sound_bootsound.c
packaging/libmm-sound.spec
testsuite/mm_sound_testsuite_simple.c

index f3cc9d8..123e3f8 100644 (file)
@@ -4,8 +4,6 @@ AC_INIT([libmm-sound], [1.0])
 AM_INIT_AUTOMAKE([-Wall -Werror foreign])
 AC_CONFIG_HEADERS([config.h:config.hin])
 
-AC_CONFIG_MACRO_DIR([m4])
-
 # Checks for programs.
 m4_pattern_allow([AM_PROG_AR])
 AM_PROG_AR
index 15e4894..c1c6278 100644 (file)
@@ -65,19 +65,6 @@ static void _mainloop_run()
        g_main_loop_run(g_mainloop);
 }
 
-static sem_t * _sem_create_n_wait()
-{
-       sem_t *sem = NULL;
-
-       if ((sem = sem_open("booting-sound", O_CREAT, 0660, 0)) == SEM_FAILED) {
-               debug_error("error creating sem : %d", errno);
-               return NULL;
-       }
-
-       debug_msg("returning sem [%p]", sem);
-       return sem;
-}
-
 static int _get_option(int argc, char **argv, server_arg *arg)
 {
        int c;
@@ -228,7 +215,6 @@ static void _signal_finalize(void)
 
 int main(int argc, char **argv)
 {
-       sem_t *sem = NULL;
        server_arg serveropt;
 #if !defined(USE_SYSTEM_SERVER_PROCESS_MONITORING)
        int pid;
@@ -242,9 +228,6 @@ int main(int argc, char **argv)
 
        _signal_initialize();
 
-       if (serveropt.startserver)
-               sem = _sem_create_n_wait();
-
        /* Daemon process create */
        if (!serveropt.testmode && serveropt.startserver) {
 #if !defined(USE_SYSTEM_SERVER_PROCESS_MONITORING)
@@ -298,13 +281,6 @@ int main(int argc, char **argv)
        if (serveropt.startserver) {
                unlink(PA_READY); // remove pa_ready file after focus-server init.
 
-               if (sem) {
-                       if (sem_post(sem) == -1)
-                               debug_error("error sem post : %d", errno);
-                       else
-                               debug_msg("Ready to play booting sound!!!!");
-               }
-
                /* FIXME : This code is moved from sound_server temporally for TV migration
                                        As other modules which has dependancy on this file is cleared,
                                        this code will be removed */
index 9e69244..093fcd0 100644 (file)
  *
  */
 
-#include <stdlib.h>
-#include <memory.h>
-#include <unistd.h>
-#include <pthread.h>
-#include <fcntl.h>
-#include <vconf.h>
-#include <stdlib.h>
-
-#include <semaphore.h>
-
 #include <mm_error.h>
 #include <mm_debug.h>
 
-#define KEYTONE_PATH        "/tmp/keytone"  /* Keytone pipe path */
-#define FILE_FULL_PATH 1024                            /* File path lenth */
-#define MAX_RETRY 40
-#define RETRY_INTERVAL_USEC 50000
-
-#define ROLE_NAME_LEN 64                               /* Role name length */
-#define VOLUME_GAIN_TYPE_LEN 64                /* Volume gain type length */
-
-typedef struct {
-       char filename[FILE_FULL_PATH];
-       char role[ROLE_NAME_LEN];
-       char volume_gain_type[VOLUME_GAIN_TYPE_LEN];
-} ipc_t;
-
-#define MMSOUND_STRNCPY(dst, src, size) \
-do { \
-       if (src != NULL && dst != NULL && size > 0) { \
-               strncpy(dst, src, size - 1); \
-               dst[size - 1] = '\0'; \
-       } else if (dst == NULL) { \
-               debug_error("STRNCPY ERROR: Destination String is NULL"); \
-       } \
-       else if (size <= 0) { \
-               debug_error("STRNCPY ERROR: Destination String is NULL"); \
-       } \
-       else { \
-               debug_error("STRNCPY ERROR: Destination String is NULL"); \
-       } \
-} while (0)
-
-static void unlink_if_symbolic_link(const char *path)
-{
-       int ret = 0;
-       char *resolved_path = NULL;
-
-       if (path == NULL)
-               return;
-
-       /* return if it does not exist */
-       if ((ret = access(path, F_OK)))
-               return;
-
-       if ((resolved_path = realpath(path, NULL))) {
-               /* assume that the path paramether is an absolute path */
-               if (strcmp(path, resolved_path)) {
-                       debug_warning("unexpected symbolic link!, unlink the symbolic link(%s) to the resolved path(%s)", path, resolved_path);
-                       unlink(path);
-               }
-               free(resolved_path);
-       } else {
-               char str_error[256];
-               strerror_r(errno, str_error, sizeof(str_error));
-               debug_warning("failed to realpath() for path:%s, err:%s", path, str_error);
-       }
-}
-
 EXPORT_API
 int mm_sound_boot_ready(int timeout_sec)
 {
-       struct timespec ts;
-       sem_t* sem = NULL;
-
-       debug_msg("[BOOT] check for sync....");
-       if ((sem = sem_open("booting-sound", O_CREAT, 0660, 0)) == SEM_FAILED) {
-               debug_error("error creating sem : %d", errno);
-               return -1;
-       }
-
-       debug_msg("[BOOT] start to wait ready....timeout is set to %d sec", timeout_sec);
-       clock_gettime(CLOCK_REALTIME, &ts);
-       ts.tv_sec += timeout_sec;
-
-       if (sem_timedwait(sem, &ts) == -1) {
-               if (errno == ETIMEDOUT)
-                       debug_warning("[BOOT] timeout!");
-       } else {
-               debug_msg("[BOOT] ready wait success!!!!");
-               sem_post(sem);
-       }
-
-       return 0;
+       LOGW("DEPRECATION WARNING: %s() is deprecated and will be removed", __func__);
+       return MM_ERROR_NONE;
 }
 
 EXPORT_API
 int mm_sound_boot_play_sound(char* path)
 {
-       int err = 0;
-       int fd = -1;
-       int size = 0;
-       ipc_t data = { { 0, }, { 0, }, { 0, } };
-
-       debug_msg("[BOOT] play boot sound [%s]!!!!", path);
-       if (path == NULL)
-               return MM_ERROR_SOUND_INVALID_FILE;
-
-       /* Check whether file exists */
-       fd = open(path, O_RDONLY);
-       if (fd == -1) {
-               char str_error[256];
-               int errsv = errno;
-               strerror_r(errsv, str_error, sizeof(str_error));
-               debug_error("file open failed with [%s][%d]", str_error, errsv);
-               switch (errsv) {
-               case ENOENT:
-                       return MM_ERROR_SOUND_FILE_NOT_FOUND;
-               default:
-                       return MM_ERROR_SOUND_INTERNAL;
-               }
-       }
-       close(fd);
-       fd = -1;
-
-       unlink_if_symbolic_link(KEYTONE_PATH);
-       /* Open PIPE */
-       fd = open(KEYTONE_PATH, O_WRONLY | O_NONBLOCK);
-       if (fd == -1) {
-               debug_error("Fail to open pipe");
-               return MM_ERROR_SOUND_FILE_NOT_FOUND;
-       }
-
-       MMSOUND_STRNCPY(data.filename, path, FILE_FULL_PATH);
-       MMSOUND_STRNCPY(data.role, "system", ROLE_NAME_LEN);
-       MMSOUND_STRNCPY(data.volume_gain_type, "booting", VOLUME_GAIN_TYPE_LEN);
-
-       debug_msg("filepath=[%s], role=[%s], volume_gain_type=[%s]", data.filename, data.role, data.volume_gain_type);
-       size = sizeof(ipc_t);
-
-       /* Write to PIPE */
-       err = write(fd, &data, size);
-       if (err < 0) {
-               char str_error[256];
-               strerror_r(errno, str_error, sizeof(str_error));
-               debug_error("Fail to write data: [%s][%d]", str_error, errno);
-               close(fd);
-               return MM_ERROR_SOUND_INTERNAL;
-       }
-       /* Close PIPE */
-       close(fd);
-
+       LOGW("DEPRECATION WARNING: %s() is deprecated and will be removed", __func__);
        return MM_ERROR_NONE;
 }
index e6a4980..fc5e212 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-sound
 Summary:    MMSound Package contains client lib and sound_server binary
-Version:    0.13.0
+Version:    0.13.1
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0
@@ -73,7 +73,6 @@ export LDFLAGS+=" -lgcov "
 
 ./autogen.sh
 %configure \
-       --with-plugindir=%{_libdir}/soundplugins \
 %if "%{tizen_profile_name}" == "tv"
        --enable-prelink \
        --enable-lwipc \
index 2094be1..d21cd28 100755 (executable)
@@ -306,7 +306,6 @@ static void input_dirname(char *dirname)
 static void interpret(char *cmd)
 {
        int ret = 0;
-       static int handle = -1;
 
        switch (g_menu_state) {
        case CURRENT_STATUS_MAINMENU: