summaryrefslogtreecommitdiffstats
path: root/sol
diff options
context:
space:
mode:
authorTom Joseph <tomjoseph@in.ibm.com>2017-03-14 18:08:14 +0530
committerPatrick Williams <patrick@stwcx.xyz>2017-04-24 11:22:15 -0500
commitb51f641ef64380de89f82a263d468f3ae7c01d41 (patch)
tree6ae04805d2cd8cc98862c54ef79c954bea924ca4 /sol
parent22c5ad34cd1be9e77f25a71c4fc88e2627117c8c (diff)
downloadphosphor-net-ipmid-b51f641ef64380de89f82a263d468f3ae7c01d41.tar.gz
phosphor-net-ipmid-b51f641ef64380de89f82a263d468f3ae7c01d41.zip
Implement function to write to host console socket
Change-Id: I92b9550d9b6d458bbafebfff08552db5b2ab78e6 Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
Diffstat (limited to 'sol')
-rw-r--r--sol/sol_manager.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/sol/sol_manager.cpp b/sol/sol_manager.cpp
index d26193b..5236ff5 100644
--- a/sol/sol_manager.cpp
+++ b/sol/sol_manager.cpp
@@ -41,4 +41,38 @@ void Manager::initHostConsoleFd()
}
}
+int Manager::writeConsoleSocket(const Buffer& input) const
+{
+ auto inBuffer = input.data();
+ auto inBufferSize = input.size();
+ size_t pos = 0;
+ ssize_t rc = 0;
+ int errVal = 0;
+ auto& conFD = *(consoleFD.get());
+
+ for (pos = 0; pos < inBufferSize; pos += rc)
+ {
+ rc = write(conFD(), inBuffer + pos, inBufferSize - pos);
+ if (rc <= 0)
+ {
+ if (errno == EINTR)
+ {
+ log<level::INFO>(" Retrying to handle EINTR",
+ entry("ERRNO=%d", errno));
+ rc = 0;
+ continue;
+ }
+ else
+ {
+ errVal = errno;
+ log<level::ERR>("Failed to write to host console socket",
+ entry("ERRNO=%d", errno));
+ return -errVal;
+ }
+ }
+ }
+
+ return 0;
+}
+
} // namespace sol
OpenPOWER on IntegriCloud