summaryrefslogtreecommitdiff
path: root/ndb/src/cw
diff options
context:
space:
mode:
authorunknown <tulin@build.mysql.com>2004-05-10 17:40:57 +0200
committerunknown <tulin@build.mysql.com>2004-05-10 17:40:57 +0200
commit3c58a197b6cd36fa275ef281204ed9e5e5748abd (patch)
tree808e79a60bd6ef6a37714172df3a6b1f8c06b1b3 /ndb/src/cw
parent3ff2fcc9f11c796a610eae8e0584d082e3f5067c (diff)
parentd092cfb1c18ab8e48e462d26f3c751dc5e0e573b (diff)
downloadmariadb-git-3c58a197b6cd36fa275ef281204ed9e5e5748abd.tar.gz
merge resolve
extra/perror.c: Auto merged ndb/include/debugger/SignalLoggerManager.hpp: Auto merged ndb/include/ndb_version.h: Auto merged ndb/src/common/portlib/unix/NdbMem.c: Auto merged ndb/src/common/portlib/unix/NdbThread.c: Auto merged ndb/src/common/util/Parser.cpp: Auto merged ndb/src/common/util/getarg.c: Auto merged ndb/src/common/util/version.c: Auto merged ndb/src/kernel/blocks/backup/restore/Restore.cpp: Auto merged ndb/src/kernel/blocks/dbutil/DbUtil.cpp: Auto merged ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp: Auto merged ndb/src/kernel/ndb-main/Main.cpp: Auto merged ndb/src/mgmapi/test/keso.c: Auto merged ndb/src/mgmclient/test_cpcd/test_cpcd.cpp: Auto merged BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
Diffstat (limited to 'ndb/src/cw')
-rw-r--r--ndb/src/cw/cpcc-win32/C++/StdAfx.h5
-rw-r--r--ndb/src/cw/cpcd/APIService.cpp1
-rw-r--r--ndb/src/cw/cpcd/CPCD.cpp5
-rw-r--r--ndb/src/cw/cpcd/Monitor.cpp3
-rw-r--r--ndb/src/cw/cpcd/Process.cpp43
-rw-r--r--ndb/src/cw/cpcd/common.hpp2
-rw-r--r--ndb/src/cw/test/socketclient/socketClientTest.cpp3
-rw-r--r--ndb/src/cw/util/ClientInterface.hpp4
8 files changed, 29 insertions, 37 deletions
diff --git a/ndb/src/cw/cpcc-win32/C++/StdAfx.h b/ndb/src/cw/cpcc-win32/C++/StdAfx.h
index d84b5811f8d..370d04fb466 100644
--- a/ndb/src/cw/cpcc-win32/C++/StdAfx.h
+++ b/ndb/src/cw/cpcc-win32/C++/StdAfx.h
@@ -48,15 +48,12 @@
#include <afxtempl.h>
// C RunTime Header Files
-#include <stdlib.h>
-#include <malloc.h>
+#include <ndb_global.h>
#include <memory.h>
#include <tchar.h>
#include <commctrl.h>
#include <shlwapi.h>
#include <crtdbg.h>
-#include <string.h>
-#include <stdio.h>
// Local Header Files
#include "resource.h"
diff --git a/ndb/src/cw/cpcd/APIService.cpp b/ndb/src/cw/cpcd/APIService.cpp
index 9cf17addcc2..caf19ddba0e 100644
--- a/ndb/src/cw/cpcd/APIService.cpp
+++ b/ndb/src/cw/cpcd/APIService.cpp
@@ -23,7 +23,6 @@
#include "APIService.hpp"
#include "CPCD.hpp"
#include <NdbMutex.h>
-#include <NdbStdio.h>
#include <OutputStream.hpp>
/**
diff --git a/ndb/src/cw/cpcd/CPCD.cpp b/ndb/src/cw/cpcd/CPCD.cpp
index 8864ccf6e4e..f2878b7dea1 100644
--- a/ndb/src/cw/cpcd/CPCD.cpp
+++ b/ndb/src/cw/cpcd/CPCD.cpp
@@ -15,11 +15,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <string.h>
+#include <ndb_global.h>
#include <NdbOut.hpp>
-#include <NdbUnistd.h>
-#include <NdbStdio.h>
-#include <errno.h>
#include "APIService.hpp"
#include "CPCD.hpp"
diff --git a/ndb/src/cw/cpcd/Monitor.cpp b/ndb/src/cw/cpcd/Monitor.cpp
index a96f3509ee8..2935cd0a648 100644
--- a/ndb/src/cw/cpcd/Monitor.cpp
+++ b/ndb/src/cw/cpcd/Monitor.cpp
@@ -14,9 +14,10 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
+
#include <NdbThread.h>
#include <NdbOut.hpp>
-#include <NdbUnistd.h>
#include <NdbSleep.h>
#include "CPCD.hpp"
diff --git a/ndb/src/cw/cpcd/Process.cpp b/ndb/src/cw/cpcd/Process.cpp
index a54c6b8e475..76639a2a618 100644
--- a/ndb/src/cw/cpcd/Process.cpp
+++ b/ndb/src/cw/cpcd/Process.cpp
@@ -14,13 +14,10 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <sys/types.h>
+#include <ndb_global.h>
#include <signal.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <NdbUnistd.h>
#include <BaseString.hpp>
#include <InputStream.hpp>
@@ -28,10 +25,10 @@
#include "CPCD.hpp"
#include <pwd.h>
-#include <sys/types.h>
-#include <unistd.h>
#include <sys/stat.h>
#include <sys/resource.h>
+#include <sys/types.h>
+#include <sys/wait.h>
void
CPCD::Process::print(FILE * f){
@@ -108,7 +105,7 @@ bool
CPCD::Process::isRunning() {
if(m_pid <= 1){
- logger.critical("isRunning(%d) invalid pid: %d", m_id, m_pid);
+ //logger.critical("isRunning(%d) invalid pid: %d", m_id, m_pid);
return false;
}
/* Check if there actually exists a process with such a pid */
@@ -360,7 +357,7 @@ CPCD::Process::start() {
*/
switch(pid = fork()) {
case 0: /* Child */
-
+ setsid();
writePid(getpid());
if(runas(m_runas.c_str()) == 0){
do_exec();
@@ -389,11 +386,11 @@ CPCD::Process::start() {
pid_t pid;
switch(pid = fork()) {
case 0: /* Child */
+ setsid();
writePid(getpid());
if(runas(m_runas.c_str()) != 0){
_exit(1);
}
- setsid();
do_exec();
_exit(1);
/* NOTREACHED */
@@ -428,11 +425,11 @@ CPCD::Process::start() {
while(readPid() < 0){
sched_yield();
}
-
+
if(pid != -1 && pid != m_pid){
logger.error("pid and m_pid don't match: %d %d", pid, m_pid);
}
-
+
if(isRunning()){
m_status = RUNNING;
return 0;
@@ -454,28 +451,32 @@ CPCD::Process::stop() {
}
m_status = STOPPING;
- int ret = kill((pid_t)m_pid, SIGTERM);
+ const pid_t pgid = - getpgid(m_pid);
+ int ret = kill(pgid, SIGTERM);
switch(ret) {
case 0:
- logger.debug("Sent SIGTERM to pid %d", (int)m_pid);
+ logger.debug("Sent SIGTERM to pid %d", (int)pgid);
break;
default:
- logger.debug("kill pid: %d : %s", (int)m_pid, strerror(errno));
+ logger.debug("kill pid: %d : %s", (int)pgid, strerror(errno));
break;
}
-
- if(isRunning()){
- ret = kill((pid_t)m_pid, SIGKILL);
+
+ errno = 0;
+ ret = kill(pgid, 0);
+ if(ret == 0) {
+ errno = 0;
+ ret = kill(pgid, SIGKILL);
switch(ret) {
case 0:
- logger.debug("Sent SIGKILL to pid %d", (int)m_pid);
+ logger.debug("Sent SIGKILL to pid %d", (int)pgid);
break;
default:
- logger.debug("kill pid: %d : %s\n", (int)m_pid, strerror(errno));
+ logger.debug("kill pid: %d : %s\n", (int)pgid, strerror(errno));
break;
}
- }
-
+ }
+
m_pid = -1;
m_status = STOPPED;
}
diff --git a/ndb/src/cw/cpcd/common.hpp b/ndb/src/cw/cpcd/common.hpp
index 65fcce05f66..c3d87b8b9f5 100644
--- a/ndb/src/cw/cpcd/common.hpp
+++ b/ndb/src/cw/cpcd/common.hpp
@@ -17,7 +17,7 @@
#ifndef __CPCD_COMMON_HPP_INCLUDED__
#define __CPCD_COMMON_HPP_INCLUDED__
-#include <stdio.h>
+#include <ndb_global.h>
#include <logger/Logger.hpp>
#include <getarg.h>
diff --git a/ndb/src/cw/test/socketclient/socketClientTest.cpp b/ndb/src/cw/test/socketclient/socketClientTest.cpp
index a4a0ed1e933..423c196aa43 100644
--- a/ndb/src/cw/test/socketclient/socketClientTest.cpp
+++ b/ndb/src/cw/test/socketclient/socketClientTest.cpp
@@ -15,11 +15,10 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
#include <NdbOut.hpp>
#include <Properties.hpp>
#include <socket_io.h>
-#include <NdbStdio.h>
-#include <stdlib.h>
#include <NdbTick.h>
#include <NdbMain.h>
#include <NdbSleep.h>
diff --git a/ndb/src/cw/util/ClientInterface.hpp b/ndb/src/cw/util/ClientInterface.hpp
index 764705afacd..66ecfe05197 100644
--- a/ndb/src/cw/util/ClientInterface.hpp
+++ b/ndb/src/cw/util/ClientInterface.hpp
@@ -16,6 +16,7 @@
#ifndef CLIENT_IF_HPP
#define CLIENT_IF_HPP
+#include <ndb_global.h>
#include <Parser.hpp>
#include <InputStream.hpp>
#include <Parser.hpp>
@@ -23,9 +24,6 @@
#include <Properties.hpp>
#include "SocketRegistry.hpp"
#include "SocketService.hpp"
-#include "string.h"
-#include <stdio.h>
-#include <stdlib.h>
class ClientInterface {
private: