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;
int main(int argc, char **argv)
{
- sem_t *sem = NULL;
server_arg serveropt;
#if !defined(USE_SYSTEM_SERVER_PROCESS_MONITORING)
int pid;
_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)
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 */
*
*/
-#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;
}