diff options
author | daichi <daichi@FreeBSD.org> | 2010-09-05 10:08:49 +0800 |
---|---|---|
committer | daichi <daichi@FreeBSD.org> | 2010-09-05 10:08:49 +0800 |
commit | a30878deee51492ecd5acf42d393d75d06586ec1 (patch) | |
tree | 3998e46a292e9bae62c3ce77c6bb053ed55c60b4 /japanese | |
parent | 6dc1b0594fe138a55a42be01f69133ca269ff38d (diff) | |
download | freebsd-ports-graphics-a30878deee51492ecd5acf42d393d75d06586ec1.tar.gz freebsd-ports-graphics-a30878deee51492ecd5acf42d393d75d06586ec1.tar.zst freebsd-ports-graphics-a30878deee51492ecd5acf42d393d75d06586ec1.zip |
Added some mozc improvements for FreeBSD:
- add signal treatments for FreeBSD to do correct
termination process (remove socket file and lock file
as closing time).
- improve socket filename treatment
Now mozc_server does correct termination process. By this
improvements, you don't need mozc-additions anymore. But
commands included in mozc-additions is safe and useful for
start, stop, restart and launch mozc tools even now.
Diffstat (limited to 'japanese')
-rw-r--r-- | japanese/ibus-mozc/Makefile | 1 | ||||
-rw-r--r-- | japanese/ibus-mozc/files/patch-ipc_unix_ipc.cc | 38 | ||||
-rw-r--r-- | japanese/ibus-mozc/files/patch-server_mozc_server.cc | 48 | ||||
-rw-r--r-- | japanese/mozc-server/Makefile | 1 | ||||
-rw-r--r-- | japanese/mozc-server/files/patch-ipc_unix_ipc.cc | 38 | ||||
-rw-r--r-- | japanese/mozc-server/files/patch-server_mozc_server.cc | 48 | ||||
-rw-r--r-- | japanese/mozc-tool/Makefile | 1 | ||||
-rw-r--r-- | japanese/mozc-tool/files/patch-ipc_unix_ipc.cc | 38 | ||||
-rw-r--r-- | japanese/mozc-tool/files/patch-server_mozc_server.cc | 48 | ||||
-rw-r--r-- | japanese/scim-mozc/Makefile | 1 | ||||
-rw-r--r-- | japanese/scim-mozc/files/patch-ipc_unix_ipc.cc | 38 | ||||
-rw-r--r-- | japanese/scim-mozc/files/patch-server_mozc_server.cc | 48 |
12 files changed, 344 insertions, 4 deletions
diff --git a/japanese/ibus-mozc/Makefile b/japanese/ibus-mozc/Makefile index 75f505910f3..f91d7cfb006 100644 --- a/japanese/ibus-mozc/Makefile +++ b/japanese/ibus-mozc/Makefile @@ -7,6 +7,7 @@ PORTNAME= ibus-mozc PORTVERSION= 0.12.434.102 +PORTREVISION= 1 CATEGORIES= japanese MASTER_SITES= http://people.freebsd.org/~daichi/distfiles/ DISTNAME= mozc-${PORTVERSION} diff --git a/japanese/ibus-mozc/files/patch-ipc_unix_ipc.cc b/japanese/ibus-mozc/files/patch-ipc_unix_ipc.cc index ea575d28240..7c173cb839e 100644 --- a/japanese/ibus-mozc/files/patch-ipc_unix_ipc.cc +++ b/japanese/ibus-mozc/files/patch-ipc_unix_ipc.cc @@ -1,5 +1,5 @@ --- ipc/unix_ipc.cc.org 2010-09-03 11:29:17.747782268 +0900 -+++ ipc/unix_ipc.cc 2010-09-03 11:30:16.703030211 +0900 ++++ ipc/unix_ipc.cc 2010-09-05 10:10:24.194440985 +0900 @@ -41,7 +41,7 @@ #include <sys/time.h> #include <sys/types.h> @@ -27,3 +27,39 @@ // On ARM Linux, we do nothing and just return true since the platform (at // least the qemu emulator) doesn't support the getsockopt(sock, SOL_SOCKET, // SO_PEERCRED) system call. +@@ -306,7 +306,7 @@ + address.sun_family = AF_UNIX; + ::memcpy(address.sun_path, server_address.data(), server_address_length); + address.sun_path[server_address_length] = '\0'; +-#ifdef OS_MACOSX ++#if defined(__FreeBSD__) || defined(OS_MACOSX) + address.sun_len = SUN_LEN(&address); + const size_t sun_len = sizeof(address); + #else +@@ -412,21 +412,21 @@ + SO_REUSEADDR, + reinterpret_cast<char *>(&on), + sizeof(on)); +-#ifdef OS_MACOSX ++#if defined(__FreeBSD__) || defined(OS_MACOSX) + addr.sun_len = SUN_LEN(&addr); + const size_t sun_len = sizeof(addr); + #else + const size_t sun_len = sizeof(addr.sun_family) + server_address_.size(); + #endif +- if (!IsAbstractSocket(server_address_)) { +- // Linux does not use files for IPC. +- ::chmod(server_address_.c_str(), 0600); +- } + if (::bind(socket_, reinterpret_cast<sockaddr *>(&addr), sun_len) != 0) { + // The UNIX domain socket file (server_address_) already exists? + LOG(FATAL) << "bind() failed: " << strerror(errno); + return; + } ++ if (!IsAbstractSocket(server_address_)) { ++ // Linux does not use files for IPC. ++ ::chmod(server_address_.c_str(), 0600); ++ } + + if (::listen(socket_, num_connections) < 0) { + LOG(FATAL) << "listen() failed: " << strerror(errno); diff --git a/japanese/ibus-mozc/files/patch-server_mozc_server.cc b/japanese/ibus-mozc/files/patch-server_mozc_server.cc new file mode 100644 index 00000000000..5562bd9b136 --- /dev/null +++ b/japanese/ibus-mozc/files/patch-server_mozc_server.cc @@ -0,0 +1,48 @@ +--- server/mozc_server.cc.org 2010-09-05 10:11:21.205396567 +0900 ++++ server/mozc_server.cc 2010-09-05 10:36:15.099047296 +0900 +@@ -29,6 +29,8 @@ + + #ifdef OS_WINDOWS + #include <windows.h> ++#else ++#include <signal.h> + #endif + + #include "base/base.h" +@@ -46,6 +48,23 @@ + mozc::SessionServer *g_session_server = NULL; + } + ++#ifndef OS_WINDOWS ++static void sig_func(int num) ++{ ++ VLOG(1) << "signal " << num << " recieved."; ++ switch (num) { ++ case SIGINT: ++ case SIGHUP: ++ case SIGTERM: ++ if (g_session_server) ++ g_session_server->Terminate(); ++ break; ++ default: ++ break; ++ } ++} ++#endif ++ + namespace mozc { + namespace { + +@@ -122,6 +141,12 @@ + return -1; + } + ++#ifndef OS_WINDOWS ++ ::signal(SIGINT, sig_func); ++ ::signal(SIGHUP, sig_func); ++ ::signal(SIGTERM, sig_func); ++#endif ++ + // Create a new thread. + // We can't call Loop() as Loop() doesn't make a thread. + // We have to make a thread here so that ShutdownSessionCallback() diff --git a/japanese/mozc-server/Makefile b/japanese/mozc-server/Makefile index df02aa5a96a..e516f8a99eb 100644 --- a/japanese/mozc-server/Makefile +++ b/japanese/mozc-server/Makefile @@ -7,6 +7,7 @@ PORTNAME= mozc-server PORTVERSION= 0.12.434.102 +PORTREVISION= 1 CATEGORIES= japanese MASTER_SITES= http://people.freebsd.org/~daichi/distfiles/ DISTNAME= mozc-${PORTVERSION} diff --git a/japanese/mozc-server/files/patch-ipc_unix_ipc.cc b/japanese/mozc-server/files/patch-ipc_unix_ipc.cc index ea575d28240..7c173cb839e 100644 --- a/japanese/mozc-server/files/patch-ipc_unix_ipc.cc +++ b/japanese/mozc-server/files/patch-ipc_unix_ipc.cc @@ -1,5 +1,5 @@ --- ipc/unix_ipc.cc.org 2010-09-03 11:29:17.747782268 +0900 -+++ ipc/unix_ipc.cc 2010-09-03 11:30:16.703030211 +0900 ++++ ipc/unix_ipc.cc 2010-09-05 10:10:24.194440985 +0900 @@ -41,7 +41,7 @@ #include <sys/time.h> #include <sys/types.h> @@ -27,3 +27,39 @@ // On ARM Linux, we do nothing and just return true since the platform (at // least the qemu emulator) doesn't support the getsockopt(sock, SOL_SOCKET, // SO_PEERCRED) system call. +@@ -306,7 +306,7 @@ + address.sun_family = AF_UNIX; + ::memcpy(address.sun_path, server_address.data(), server_address_length); + address.sun_path[server_address_length] = '\0'; +-#ifdef OS_MACOSX ++#if defined(__FreeBSD__) || defined(OS_MACOSX) + address.sun_len = SUN_LEN(&address); + const size_t sun_len = sizeof(address); + #else +@@ -412,21 +412,21 @@ + SO_REUSEADDR, + reinterpret_cast<char *>(&on), + sizeof(on)); +-#ifdef OS_MACOSX ++#if defined(__FreeBSD__) || defined(OS_MACOSX) + addr.sun_len = SUN_LEN(&addr); + const size_t sun_len = sizeof(addr); + #else + const size_t sun_len = sizeof(addr.sun_family) + server_address_.size(); + #endif +- if (!IsAbstractSocket(server_address_)) { +- // Linux does not use files for IPC. +- ::chmod(server_address_.c_str(), 0600); +- } + if (::bind(socket_, reinterpret_cast<sockaddr *>(&addr), sun_len) != 0) { + // The UNIX domain socket file (server_address_) already exists? + LOG(FATAL) << "bind() failed: " << strerror(errno); + return; + } ++ if (!IsAbstractSocket(server_address_)) { ++ // Linux does not use files for IPC. ++ ::chmod(server_address_.c_str(), 0600); ++ } + + if (::listen(socket_, num_connections) < 0) { + LOG(FATAL) << "listen() failed: " << strerror(errno); diff --git a/japanese/mozc-server/files/patch-server_mozc_server.cc b/japanese/mozc-server/files/patch-server_mozc_server.cc new file mode 100644 index 00000000000..5562bd9b136 --- /dev/null +++ b/japanese/mozc-server/files/patch-server_mozc_server.cc @@ -0,0 +1,48 @@ +--- server/mozc_server.cc.org 2010-09-05 10:11:21.205396567 +0900 ++++ server/mozc_server.cc 2010-09-05 10:36:15.099047296 +0900 +@@ -29,6 +29,8 @@ + + #ifdef OS_WINDOWS + #include <windows.h> ++#else ++#include <signal.h> + #endif + + #include "base/base.h" +@@ -46,6 +48,23 @@ + mozc::SessionServer *g_session_server = NULL; + } + ++#ifndef OS_WINDOWS ++static void sig_func(int num) ++{ ++ VLOG(1) << "signal " << num << " recieved."; ++ switch (num) { ++ case SIGINT: ++ case SIGHUP: ++ case SIGTERM: ++ if (g_session_server) ++ g_session_server->Terminate(); ++ break; ++ default: ++ break; ++ } ++} ++#endif ++ + namespace mozc { + namespace { + +@@ -122,6 +141,12 @@ + return -1; + } + ++#ifndef OS_WINDOWS ++ ::signal(SIGINT, sig_func); ++ ::signal(SIGHUP, sig_func); ++ ::signal(SIGTERM, sig_func); ++#endif ++ + // Create a new thread. + // We can't call Loop() as Loop() doesn't make a thread. + // We have to make a thread here so that ShutdownSessionCallback() diff --git a/japanese/mozc-tool/Makefile b/japanese/mozc-tool/Makefile index e7c8cd5c970..a1b3605edac 100644 --- a/japanese/mozc-tool/Makefile +++ b/japanese/mozc-tool/Makefile @@ -7,6 +7,7 @@ PORTNAME= mozc-tool PORTVERSION= 0.12.434.102 +PORTREVISION= 1 CATEGORIES= japanese MASTER_SITES= http://people.freebsd.org/~daichi/distfiles/ DISTNAME= mozc-${PORTVERSION} diff --git a/japanese/mozc-tool/files/patch-ipc_unix_ipc.cc b/japanese/mozc-tool/files/patch-ipc_unix_ipc.cc index ea575d28240..7c173cb839e 100644 --- a/japanese/mozc-tool/files/patch-ipc_unix_ipc.cc +++ b/japanese/mozc-tool/files/patch-ipc_unix_ipc.cc @@ -1,5 +1,5 @@ --- ipc/unix_ipc.cc.org 2010-09-03 11:29:17.747782268 +0900 -+++ ipc/unix_ipc.cc 2010-09-03 11:30:16.703030211 +0900 ++++ ipc/unix_ipc.cc 2010-09-05 10:10:24.194440985 +0900 @@ -41,7 +41,7 @@ #include <sys/time.h> #include <sys/types.h> @@ -27,3 +27,39 @@ // On ARM Linux, we do nothing and just return true since the platform (at // least the qemu emulator) doesn't support the getsockopt(sock, SOL_SOCKET, // SO_PEERCRED) system call. +@@ -306,7 +306,7 @@ + address.sun_family = AF_UNIX; + ::memcpy(address.sun_path, server_address.data(), server_address_length); + address.sun_path[server_address_length] = '\0'; +-#ifdef OS_MACOSX ++#if defined(__FreeBSD__) || defined(OS_MACOSX) + address.sun_len = SUN_LEN(&address); + const size_t sun_len = sizeof(address); + #else +@@ -412,21 +412,21 @@ + SO_REUSEADDR, + reinterpret_cast<char *>(&on), + sizeof(on)); +-#ifdef OS_MACOSX ++#if defined(__FreeBSD__) || defined(OS_MACOSX) + addr.sun_len = SUN_LEN(&addr); + const size_t sun_len = sizeof(addr); + #else + const size_t sun_len = sizeof(addr.sun_family) + server_address_.size(); + #endif +- if (!IsAbstractSocket(server_address_)) { +- // Linux does not use files for IPC. +- ::chmod(server_address_.c_str(), 0600); +- } + if (::bind(socket_, reinterpret_cast<sockaddr *>(&addr), sun_len) != 0) { + // The UNIX domain socket file (server_address_) already exists? + LOG(FATAL) << "bind() failed: " << strerror(errno); + return; + } ++ if (!IsAbstractSocket(server_address_)) { ++ // Linux does not use files for IPC. ++ ::chmod(server_address_.c_str(), 0600); ++ } + + if (::listen(socket_, num_connections) < 0) { + LOG(FATAL) << "listen() failed: " << strerror(errno); diff --git a/japanese/mozc-tool/files/patch-server_mozc_server.cc b/japanese/mozc-tool/files/patch-server_mozc_server.cc new file mode 100644 index 00000000000..5562bd9b136 --- /dev/null +++ b/japanese/mozc-tool/files/patch-server_mozc_server.cc @@ -0,0 +1,48 @@ +--- server/mozc_server.cc.org 2010-09-05 10:11:21.205396567 +0900 ++++ server/mozc_server.cc 2010-09-05 10:36:15.099047296 +0900 +@@ -29,6 +29,8 @@ + + #ifdef OS_WINDOWS + #include <windows.h> ++#else ++#include <signal.h> + #endif + + #include "base/base.h" +@@ -46,6 +48,23 @@ + mozc::SessionServer *g_session_server = NULL; + } + ++#ifndef OS_WINDOWS ++static void sig_func(int num) ++{ ++ VLOG(1) << "signal " << num << " recieved."; ++ switch (num) { ++ case SIGINT: ++ case SIGHUP: ++ case SIGTERM: ++ if (g_session_server) ++ g_session_server->Terminate(); ++ break; ++ default: ++ break; ++ } ++} ++#endif ++ + namespace mozc { + namespace { + +@@ -122,6 +141,12 @@ + return -1; + } + ++#ifndef OS_WINDOWS ++ ::signal(SIGINT, sig_func); ++ ::signal(SIGHUP, sig_func); ++ ::signal(SIGTERM, sig_func); ++#endif ++ + // Create a new thread. + // We can't call Loop() as Loop() doesn't make a thread. + // We have to make a thread here so that ShutdownSessionCallback() diff --git a/japanese/scim-mozc/Makefile b/japanese/scim-mozc/Makefile index 41bcfd33b4d..eb21d7afa30 100644 --- a/japanese/scim-mozc/Makefile +++ b/japanese/scim-mozc/Makefile @@ -7,6 +7,7 @@ PORTNAME= scim-mozc PORTVERSION= 0.12.434.102 +PORTREVISION= 1 CATEGORIES= japanese MASTER_SITES= http://people.freebsd.org/~daichi/distfiles/ DISTNAME= mozc-${PORTVERSION} diff --git a/japanese/scim-mozc/files/patch-ipc_unix_ipc.cc b/japanese/scim-mozc/files/patch-ipc_unix_ipc.cc index ea575d28240..7c173cb839e 100644 --- a/japanese/scim-mozc/files/patch-ipc_unix_ipc.cc +++ b/japanese/scim-mozc/files/patch-ipc_unix_ipc.cc @@ -1,5 +1,5 @@ --- ipc/unix_ipc.cc.org 2010-09-03 11:29:17.747782268 +0900 -+++ ipc/unix_ipc.cc 2010-09-03 11:30:16.703030211 +0900 ++++ ipc/unix_ipc.cc 2010-09-05 10:10:24.194440985 +0900 @@ -41,7 +41,7 @@ #include <sys/time.h> #include <sys/types.h> @@ -27,3 +27,39 @@ // On ARM Linux, we do nothing and just return true since the platform (at // least the qemu emulator) doesn't support the getsockopt(sock, SOL_SOCKET, // SO_PEERCRED) system call. +@@ -306,7 +306,7 @@ + address.sun_family = AF_UNIX; + ::memcpy(address.sun_path, server_address.data(), server_address_length); + address.sun_path[server_address_length] = '\0'; +-#ifdef OS_MACOSX ++#if defined(__FreeBSD__) || defined(OS_MACOSX) + address.sun_len = SUN_LEN(&address); + const size_t sun_len = sizeof(address); + #else +@@ -412,21 +412,21 @@ + SO_REUSEADDR, + reinterpret_cast<char *>(&on), + sizeof(on)); +-#ifdef OS_MACOSX ++#if defined(__FreeBSD__) || defined(OS_MACOSX) + addr.sun_len = SUN_LEN(&addr); + const size_t sun_len = sizeof(addr); + #else + const size_t sun_len = sizeof(addr.sun_family) + server_address_.size(); + #endif +- if (!IsAbstractSocket(server_address_)) { +- // Linux does not use files for IPC. +- ::chmod(server_address_.c_str(), 0600); +- } + if (::bind(socket_, reinterpret_cast<sockaddr *>(&addr), sun_len) != 0) { + // The UNIX domain socket file (server_address_) already exists? + LOG(FATAL) << "bind() failed: " << strerror(errno); + return; + } ++ if (!IsAbstractSocket(server_address_)) { ++ // Linux does not use files for IPC. ++ ::chmod(server_address_.c_str(), 0600); ++ } + + if (::listen(socket_, num_connections) < 0) { + LOG(FATAL) << "listen() failed: " << strerror(errno); diff --git a/japanese/scim-mozc/files/patch-server_mozc_server.cc b/japanese/scim-mozc/files/patch-server_mozc_server.cc new file mode 100644 index 00000000000..5562bd9b136 --- /dev/null +++ b/japanese/scim-mozc/files/patch-server_mozc_server.cc @@ -0,0 +1,48 @@ +--- server/mozc_server.cc.org 2010-09-05 10:11:21.205396567 +0900 ++++ server/mozc_server.cc 2010-09-05 10:36:15.099047296 +0900 +@@ -29,6 +29,8 @@ + + #ifdef OS_WINDOWS + #include <windows.h> ++#else ++#include <signal.h> + #endif + + #include "base/base.h" +@@ -46,6 +48,23 @@ + mozc::SessionServer *g_session_server = NULL; + } + ++#ifndef OS_WINDOWS ++static void sig_func(int num) ++{ ++ VLOG(1) << "signal " << num << " recieved."; ++ switch (num) { ++ case SIGINT: ++ case SIGHUP: ++ case SIGTERM: ++ if (g_session_server) ++ g_session_server->Terminate(); ++ break; ++ default: ++ break; ++ } ++} ++#endif ++ + namespace mozc { + namespace { + +@@ -122,6 +141,12 @@ + return -1; + } + ++#ifndef OS_WINDOWS ++ ::signal(SIGINT, sig_func); ++ ::signal(SIGHUP, sig_func); ++ ::signal(SIGTERM, sig_func); ++#endif ++ + // Create a new thread. + // We can't call Loop() as Loop() doesn't make a thread. + // We have to make a thread here so that ShutdownSessionCallback() |