summaryrefslogtreecommitdiffstats
path: root/sca-cpp/branches/lightweight-sca/patches/scribe-2.2.patch
diff options
context:
space:
mode:
authorgiorgio <giorgio@13f79535-47bb-0310-9956-ffa450edef68>2012-09-05 08:31:30 +0000
committergiorgio <giorgio@13f79535-47bb-0310-9956-ffa450edef68>2012-09-05 08:31:30 +0000
commitc9bfccc35345ce58fb5774d4b0b6a9868b262c0a (patch)
treefe84dd4b90f2acd0b933550b6978094926c1d733 /sca-cpp/branches/lightweight-sca/patches/scribe-2.2.patch
parent5ddabdaf1ff856aae79dadc045ef2aeff08c7887 (diff)
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1381061 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/branches/lightweight-sca/patches/scribe-2.2.patch')
-rw-r--r--sca-cpp/branches/lightweight-sca/patches/scribe-2.2.patch78
1 files changed, 78 insertions, 0 deletions
diff --git a/sca-cpp/branches/lightweight-sca/patches/scribe-2.2.patch b/sca-cpp/branches/lightweight-sca/patches/scribe-2.2.patch
new file mode 100644
index 0000000000..16c2e3871e
--- /dev/null
+++ b/sca-cpp/branches/lightweight-sca/patches/scribe-2.2.patch
@@ -0,0 +1,78 @@
+--- src/common.h
++++ src/common.h
+@@ -42,6 +42,8 @@
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <unistd.h>
++#include <signal.h>
++#include <fcntl.h>
+ #include <boost/shared_ptr.hpp>
+ #include <boost/filesystem/operations.hpp>
+ #include <boost/filesystem/convenience.hpp>
+
+--- src/file.cpp
++++ src/file.cpp
+@@ -74,9 +74,21 @@
+ }
+
+ bool StdFile::openWrite() {
++ // if file is a fifo, temporarily open it for read
++ int fd = -1;
++ struct stat st;
++ int s = stat(filename.c_str(), &st);
++ if (s != -1 && S_ISFIFO(st.st_mode))
++ fd = ::open(filename.c_str(), O_RDONLY | O_NONBLOCK);
++
+ // open file for write in append mode
+ ios_base::openmode mode = fstream::out | fstream::app;
+- return open(mode);
++ bool r = open(mode);
++
++ // close fifo
++ if (fd != -1)
++ ::close(fd);
++ return r;
+ }
+
+ bool StdFile::openTruncate() {
+
+--- src/scribe_server.cpp
++++ src/scribe_server.cpp
+@@ -55,6 +55,8 @@
+ if (-1 == setrlimit(RLIMIT_NOFILE, &r_fd)) {
+ LOG_OPER("setrlimit error (setting max fd size)");
+ }
++
++ signal(SIGPIPE, SIG_IGN);
+
+ int next_option;
+ const char* const short_options = "hp:c:";
+@@ -110,7 +112,7 @@
+ }
+
+ TNonblockingServer server(processor, binaryProtocolFactory,
+- g_Handler->port, thread_manager);
++ g_Handler->host, g_Handler->port, thread_manager);
+
+ LOG_OPER("Starting scribe server on port %lu", g_Handler->port);
+ fflush(stderr);
+@@ -583,6 +585,8 @@
+ throw runtime_error("No port number configured");
+ }
+
++ config.getString("host", host);
++
+ // check if config sets the size to use for the ThreadManager
+ unsigned long int num_threads;
+ if (config.getUnsigned("num_thrift_server_threads", num_threads)) {
+
+--- src/scribe_server.h
++++ src/scribe_server.h
+@@ -51,6 +51,7 @@
+ void setStatusDetails(const std::string& new_status_details);
+
+ unsigned long int port; // it's long because that's all I implemented in the conf class
++ std::string host;
+
+ // number of threads processing new Thrift connections
+ size_t numThriftServerThreads;