4242#include " cuttlefish/host/libs/config/logging.h"
4343#include " cuttlefish/posix/strerror.h"
4444
45- DEFINE_int32 (console_in_fd,
46- -1 ,
45+ DEFINE_int32 (console_in_fd, -1 ,
4746 " File descriptor for the console's input channel" );
48- DEFINE_int32 (console_out_fd,
49- -1 ,
47+ DEFINE_int32 (console_out_fd, -1 ,
5048 " File descriptor for the console's output channel" );
5149
5250namespace cuttlefish {
@@ -77,6 +75,7 @@ class ConsoleForwarder {
7775 // reading the console's output and input from the client.
7876 ReadLoop ();
7977 }
78+
8079 private:
8180 SharedFD OpenPTY () {
8281 // Remove any stale symlink to a pts device
@@ -137,8 +136,9 @@ class ConsoleForwarder {
137136 bytes_written =
138137 fd->Write (buf_ptr->data () + bytes_written, bytes_to_write);
139138 if (bytes_written < 0 ) {
140- // It is expected for writes to the PTY to fail if nothing is connected
141- if (fd->GetErrno () != EAGAIN ) {
139+ // It is expected for writes to the PTY to fail if nothing is
140+ // connected
141+ if (fd->GetErrno () != EAGAIN ) {
142142 LOG (ERROR ) << " Error writing to fd: " << fd->StrError ();
143143 }
144144
@@ -176,7 +176,8 @@ class ConsoleForwarder {
176176
177177 Select (&read_set, nullptr , &error_set, nullptr );
178178 if (read_set.IsSet (console_out_)) {
179- std::shared_ptr<std::vector<char >> buf_ptr = std::make_shared<std::vector<char >>(4096 );
179+ std::shared_ptr<std::vector<char >> buf_ptr =
180+ std::make_shared<std::vector<char >>(4096 );
180181 auto bytes_read = console_out_->Read (buf_ptr->data (), buf_ptr->size ());
181182 // This is likely unrecoverable, so exit here
182183 CHECK (bytes_read > 0 ) << " Error reading from console output: "
@@ -189,7 +190,8 @@ class ConsoleForwarder {
189190 EnqueueWrite (buf_ptr, kernel_log_);
190191 }
191192 if (read_set.IsSet (client_fd) || error_set.IsSet (client_fd)) {
192- std::shared_ptr<std::vector<char >> buf_ptr = std::make_shared<std::vector<char >>(4096 );
193+ std::shared_ptr<std::vector<char >> buf_ptr =
194+ std::make_shared<std::vector<char >>(4096 );
193195 auto bytes_read = client_fd->Read (buf_ptr->data (), buf_ptr->size ());
194196 if (bytes_read <= 0 ) {
195197 // If this happens, it's usually because the PTY controller went away
0 commit comments