From d66863adde054984036c176048277cb96db3928a Mon Sep 17 00:00:00 2001 From: "munkyu.im" Date: Mon, 26 Mar 2012 21:10:47 +0900 Subject: [PATCH] [Title]remove process.c [Type] [Module] [Priority] [CQ#] [Redmine#] [Problem] [Cause] [Solution] [TestCase] --- tizen/src/Makefile.tizen | 2 +- tizen/src/emulator.c | 7 +- tizen/src/process.c | 208 --------------------------------------- tizen/src/process.h | 62 ------------ 4 files changed, 3 insertions(+), 276 deletions(-) delete mode 100644 tizen/src/process.c delete mode 100644 tizen/src/process.h diff --git a/tizen/src/Makefile.tizen b/tizen/src/Makefile.tizen index 3ec5bef8fe..b6775b8648 100755 --- a/tizen/src/Makefile.tizen +++ b/tizen/src/Makefile.tizen @@ -54,7 +54,7 @@ endif #($(TARGET_ARCH), i386) endif #CONFIG_WIN32 # maru loader -obj-y += emulator.o emul_state.o process.o option.o maru_signal.o +obj-y += emulator.o emul_state.o option.o maru_signal.o # maru display obj-y += maru_sdl.o sdl_rotate.o maru_finger.o diff --git a/tizen/src/emulator.c b/tizen/src/emulator.c index 55770fe9c4..08567a11a8 100644 --- a/tizen/src/emulator.c +++ b/tizen/src/emulator.c @@ -40,11 +40,11 @@ #include "skin/maruskin_client.h" #include "guest_server.h" #include "debug_ch.h" -#include "process.h" #include "option.h" #include "emul_state.h" #include "qemu_socket.h" - +#include +#include #ifdef _WIN32 #include #endif @@ -75,8 +75,6 @@ void exit_emulator(void) shutdown_guest_server(); SDL_Quit(); - - remove_portfile(); } static void construct_main_window(int skin_argc, char* skin_argv[]) @@ -192,7 +190,6 @@ void extract_info(int qemu_argc, char** qemu_argv) } tizen_base_port = get_sdb_base_port(); - write_portfile(tizen_target_path); } static int skin_argc = 0; diff --git a/tizen/src/process.c b/tizen/src/process.c deleted file mode 100644 index 31108e4da4..0000000000 --- a/tizen/src/process.c +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Emulator - * - * Copyright (C) 2011, 2012 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: - * SeokYeon Hwang - * HyunJun Son - * MunKyu Im - * GiWoong Kim - * YeongKyoon Lee - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributors: - * - S-Core Co., Ltd - * - */ - - -#include "process.h" -#ifndef _WIN32 -#include -#else -#include -#endif -#include - -//#include "fileio.h" -#include "debug_ch.h" - -//DEFAULT_DEBUG_CHANNEL(tizen); -MULTI_DEBUG_CHANNEL(tizen, process); - -static char portfname[512] = { 0, }; -char tizen_vms_path[512] = {0, }; -extern int tizen_base_port; -#ifdef _WIN32 -static char *mbstok_r (char *string, const char *delim, char **save_ptr) -{ - if (MB_CUR_MAX > 1) - { - if (string == NULL) - { - string = *save_ptr; - if (string == NULL) - return NULL; /* reminder that end of token sequence has been - reached */ - } - - /* Skip leading delimiters. */ - string += _mbsspn (string, delim); - - /* Found a token? */ - if (*string == '\0') - { - *save_ptr = NULL; - return NULL; - } - - /* Move past the token. */ - { - char *token_end = _mbspbrk (string, delim); - - if (token_end != NULL) - { - /* NUL-terminate the token. */ - *token_end = '\0'; - *save_ptr = token_end + 1; - } - else - *save_ptr = NULL; - } - return string; - } - else - return NULL; -} -#endif - -/** - * @brief make port directory - * @param portfname : port file name - * @date Nov 25. 2008 - * */ - -static int make_port_path(const char *portfname) -{ - char dir[512] = "", buf[512] = ""; - char *ptr, *last = NULL, *lptr = NULL; - int dirnamelen = 0; - - sprintf(buf, "%s", portfname); -#ifndef _WIN32 - lptr = ptr = strtok_r(buf+1, "/", &last); -#else - lptr = ptr = mbstok_r(buf, "/", &last); -#endif - - for (;;) { -#ifndef _WIN32 - if ((ptr = strtok_r(NULL, "/", &last)) == NULL) break; -#else - if ((ptr = mbstok_r(NULL, "/", &last)) == NULL) break; -#endif - dirnamelen = strlen(lptr) + 1; - - if (sizeof(dir) < dirnamelen) { - return -1; - } -#ifdef _WIN32 - if (dir != NULL && strlen (dir) > 0) -#endif - strcat(dir, "/"); - strcat(dir, lptr); - -#ifndef _WIN32 - if (access(dir, R_OK) != 0) - mkdir(dir, S_IRWXU | S_IRWXG); -#else - if (access(g_win32_locale_filename_from_utf8(dir), R_OK) != 0) - mkdir(g_win32_locale_filename_from_utf8(dir)); -#endif - lptr = ptr; - } - - return 0; -} - - -/** - * @brief wirte port file - * @param mod: emulator, vinit - * @date Nov 25. 2008 - * */ - -int write_portfile(char *path) -{ - int fd = -1; - char buf[128] = ""; - - if(tizen_base_port == 0) - return 0; - - if(!g_path_is_absolute(path)) - strcpy(tizen_vms_path, g_get_current_dir()); - else - strcpy(tizen_vms_path, g_path_get_dirname(path)); - - sprintf(portfname, "%s/.port", tizen_vms_path); - - if (access(tizen_vms_path, R_OK) != 0) { - make_port_path(portfname); - } -#ifdef _WIN32 - if ((fd = open(g_win32_locale_filename_from_utf8(portfname), O_RDWR | O_CREAT, 0666)) < 0) { -#else - if ((fd = open(portfname, O_RDWR | O_CREAT, 0666)) < 0) { -#endif - ERR("Failed to create .port file\n"); - ERR("%s at %s(%d)\n", strerror(errno), __FILE__, __LINE__); - return -1; - } - - ftruncate(fd, 0); - memset(buf, 0, sizeof(buf)); - sprintf(buf, "%d", tizen_base_port); - write(fd, buf, strlen(buf)); - - close(fd); - - return 0; -} - -/** - * @brief remove port file - * @param mod: emulator, vinit - * @date Nov 25. 2008 - * */ - -int remove_portfile(void) -{ - if (strlen(portfname) <= 0) { - return -1; - } - -#ifdef _WIN32 - if (remove(g_win32_locale_filename_from_utf8(portfname)) < 0) { -#else - if (remove(portfname) < 0) { -#endif - ERR( "Can't remove port file. (%s)\n", portfname); - } - - return 0; -} diff --git a/tizen/src/process.h b/tizen/src/process.h deleted file mode 100644 index 59c972f953..0000000000 --- a/tizen/src/process.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Emulator - * - * Copyright (C) 2011, 2012 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: - * SeokYeon Hwang - * HyunJun Son - * MunKyu Im - * GiWoong Kim - * YeongKyoon Lee - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributors: - * - S-Core Co., Ltd - * - */ - - -#ifndef PROCESS_H -#define PROCESS_H -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -int write_portfile(char *path); -int remove_portfile(void); - -#ifdef _WIN32 -#include -#include -#endif - -#ifdef __cplusplus -} -#endif -#endif -- 2.34.1