--- /dev/null
+gdb --args emulator-x86.exe --vtm default -- -net nic,model=virtio -usb -usbdevice wacom-tablet -vga tizen -bios bios.bin -L ..\x86\data\pc-bios -kernel ..\x86\data\kernel-img\bzImage -usbdevice keyboard -rtc base=utc -net user -redir tcp:1202:10.0.2.16:22
#!/bin/sh
CURDIR=`pwd`
-
-$CURDIR/emulator-x86 --vtm default \
+gdb --args $CURDIR/emulator-x86 --vtm default \
-- -net nic,model=virtio -usb -usbdevice wacom-tablet -vga tizen -bios bios.bin -L $CURDIR/../x86/data/pc-bios -kernel $CURDIR/../x86/data/kernel-img/bzImage -usbdevice keyboard -rtc base=utc -net user --enable-kvm -redir tcp:1202:10.0.2.16:22
#include <pthread.h>
#ifndef _WIN32
#include <sys/ipc.h>
-#include <sys/shm.h>
+#include <sys/shm.h>
+#else
+#include <windows.h>
#endif
#include "opengl_server.h"
// shmctl(shmid, IPC_RMID, 0);
// shmdt(shared_memory);
+#else
+ tizen_base_port = get_sdb_base_port();
+ HANDLE hMapFile;
+ char* pBuf;
+ char* port_in_use;
+ char *shared_memory;
+ shared_memory = g_strdup_printf("%s", startup_option.vtm);
+ port_in_use = g_strdup_printf("%d", tizen_base_port);
+ hMapFile = CreateFileMapping(
+ INVALID_HANDLE_VALUE, // use paging file
+ NULL, // default security
+ PAGE_READWRITE, // read/write access
+ 0, // maximum object size (high-order DWORD)
+ 50, // maximum object size (low-order DWORD)
+ port_in_use); // name of mapping object
+ if (hMapFile == NULL)
+ {
+ ERR("Could not create file mapping object (%d).\n", GetLastError());
+ return -1;
+ }
+ pBuf = MapViewOfFile(hMapFile, // handle to map object
+ FILE_MAP_ALL_ACCESS, // read/write permission
+ 0,
+ 0,
+ 50);
+
+ if (pBuf == NULL)
+ {
+ ERR("Could not map view of file (%d).\n", GetLastError());
+ CloseHandle(hMapFile);
+ return -1;
+ }
+
+ CopyMemory((PVOID)pBuf, shared_memory, strlen(shared_memory));
+ free(port_in_use);
+ free(shared_memory);
#endif
return 0;
}
ERR( "fail to remove shared memory\n");
else
INFO( "succedd to remove shared memory\n");
+#else
+ char *port_in_use;
+ port_in_use = g_strdup_printf("%d", tizen_base_port);
+ HANDLE hMapFile = OpenFileMapping(FILE_MAP_READ, TRUE, port_in_use);
+ if(hMapFile)
+ CloseHandle(hMapFile);
#endif
return;
}
}
}
+#else /* _WIN32*/
+ u_int port;
+ char* base_port = NULL;
+ char* pBuf;
+ HANDLE hMapFile;
+ for(port=26100;port < 26200; port += 10)
+ {
+ base_port = g_strdup_printf("%d", port);
+ hMapFile = OpenFileMapping(
+ FILE_MAP_READ,
+ TRUE,
+ base_port);
+ if(hMapFile == NULL)
+ {
+ INFO("port %s is not used.\n", base_port);
+ continue;
+ }
+ else
+ {
+ pBuf = (char*)MapViewOfFile(hMapFile,
+ FILE_MAP_READ,
+ 0,
+ 0,
+ 50);
+ if (pBuf == NULL)
+ {
+ ERR("Could not map view of file (%d).\n", GetLastError());
+ CloseHandle(hMapFile);
+ return -1;
+ }
+
+ if(strcmp(pBuf, target_name) == 0)
+ {
+ if(check_port_bind_listen(port+1) > 0)
+ {
+ UnmapViewOfFile(pBuf);
+ CloseHandle(hMapFile);
+ continue;
+ }
+
+ switch(type)
+ {
+ case CREATE_MODE:
+ show_message("Warning", "Can not activate this target!\nVirtual target with the same name is running now!");
+ break;
+ case DELETE_MODE:
+ show_message("Warning", "Can not delete this target!\nVirtual target with the same name is running now!");
+ break;
+ case MODIFY_MODE:
+ show_message("Warning", "Can not modify this target!\nVirtual target with the same name is running now!");
+ break;
+ case RESET_MODE:
+ show_message("Warning", "Can not reset this target!\nVirtual target with the same name is running now!");
+ break;
+ default:
+ ERR("wrong type passed\n");
+ }
+
+ UnmapViewOfFile(pBuf);
+ CloseHandle(hMapFile);
+ free(base_port);
+ return -1;
+ }
+ else
+ UnmapViewOfFile(pBuf);
+ }
+
+ CloseHandle(hMapFile);
+ free(base_port);
+ }
#endif
return 0;