From d34c6a5e4d860d82e24f1a2ddaa5fcd84c30124f Mon Sep 17 00:00:00 2001 From: Arne Juul Date: Wed, 1 Sep 2021 20:19:03 +0000 Subject: remove unused sockets * CreateSocketPairs() isn't called * nothing reads from or writes to _mainSocket and _starterSocket --- fastos/src/vespa/fastos/unix_process.cpp | 41 +------------------------------- fastos/src/vespa/fastos/unix_process.h | 6 ----- 2 files changed, 1 insertion(+), 46 deletions(-) (limited to 'fastos') diff --git a/fastos/src/vespa/fastos/unix_process.cpp b/fastos/src/vespa/fastos/unix_process.cpp index c1a57f0a381..6789d39aa2f 100644 --- a/fastos/src/vespa/fastos/unix_process.cpp +++ b/fastos/src/vespa/fastos/unix_process.cpp @@ -946,41 +946,10 @@ RemoveChildProcess (FastOS_UNIX_RealProcess *node) } -bool FastOS_UNIX_ProcessStarter::CreateSocketPairs () -{ - bool rc = false; - int fileDescriptors[2]; - if (socketpair(AF_LOCAL, SOCK_STREAM, 0, fileDescriptors) == 0) { - _starterSocket = fileDescriptors[0]; - _mainSocket = fileDescriptors[1]; - - // We want to use a separate pair of sockets for passing - // file descriptors, as errors sending file descriptors - // shouldn't intefere with handshaking of the main <-> starter - // process protocol. - if (socketpair(AF_LOCAL, SOCK_STREAM, 0, fileDescriptors) == 0) { - _starterSocketDescr = fileDescriptors[0]; - _mainSocketDescr = fileDescriptors[1]; - rc = true; - } else { - std::error_code ec(errno, std::system_category()); - fprintf(stderr, "socketpair() failed: %s\n", ec.message().c_str()); - } - } else { - std::error_code ec(errno, std::system_category()); - fprintf(stderr, "socketpair() failed: %s\n", ec.message().c_str()); - } - return rc; -} - FastOS_UNIX_ProcessStarter::FastOS_UNIX_ProcessStarter (FastOS_ApplicationInterface *app) : _app(app), _processList(nullptr), _pid(-1), - _starterSocket(-1), - _mainSocket(-1), - _starterSocketDescr(-1), - _mainSocketDescr(-1), _closedProxyProcessFiles(false), _hasDetachedProcess(false), _hasDirectChildren(false) @@ -989,18 +958,12 @@ FastOS_UNIX_ProcessStarter::FastOS_UNIX_ProcessStarter (FastOS_ApplicationInterf FastOS_UNIX_ProcessStarter::~FastOS_UNIX_ProcessStarter () { - if(_starterSocket != -1) - close(_starterSocket); - if(_mainSocket != -1) - close(_mainSocket); } void FastOS_UNIX_ProcessStarter::CloseProxiedChildDescs() { - if (_starterSocket >= 0) close(_starterSocket); - if (_starterSocketDescr >= 0) close(_starterSocketDescr); } @@ -1019,9 +982,7 @@ FastOS_UNIX_ProcessStarter::CloseProxyDescs(int stdinPipedDes, int stdoutPipedDe fd != stderrPipedDes && fd != ipcDes && fd != handshakeDes0 && - fd != handshakeDes1 && - fd != _starterSocket && - fd != _starterSocketDescr) + fd != handshakeDes1) close(fd); } _closedProxyProcessFiles = true; diff --git a/fastos/src/vespa/fastos/unix_process.h b/fastos/src/vespa/fastos/unix_process.h index 9d2742c76ef..6c673a393e0 100644 --- a/fastos/src/vespa/fastos/unix_process.h +++ b/fastos/src/vespa/fastos/unix_process.h @@ -178,16 +178,10 @@ protected: FastOS_UNIX_RealProcess *_processList; pid_t _pid; - int _starterSocket; - int _mainSocket; - int _starterSocketDescr; - int _mainSocketDescr; bool _closedProxyProcessFiles; bool _hasDetachedProcess; bool _hasDirectChildren; - bool CreateSocketPairs (); - void AddChildProcess (FastOS_UNIX_RealProcess *node); void RemoveChildProcess (FastOS_UNIX_RealProcess *node); -- cgit v1.2.3