From 4105ebb6ed85aaffec5e4469a939945fb9eea066 Mon Sep 17 00:00:00 2001 From: athenian200 Date: Tue, 1 Oct 2019 18:28:10 -0500 Subject: MoonchildProductions#1251 - Part 4: Core build system changes, lots of libevent/IPC junk. This is mostly ifdefs, but as you can see, Solaris is actually a lot like Linux. They're both more SysV than BSD at core, and most of the differences have more to do with Solaris not using glibc than anything else. I still need to audit a lot of these changes and understand why they're needed and what the alternative approaches are. After this patch, most of the core functionality needed to build Solaris is here. --- ipc/chromium/src/base/message_pump_glib.cc | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'ipc/chromium/src/base/message_pump_glib.cc') diff --git a/ipc/chromium/src/base/message_pump_glib.cc b/ipc/chromium/src/base/message_pump_glib.cc index 36ebfdd69..a5e719c72 100644 --- a/ipc/chromium/src/base/message_pump_glib.cc +++ b/ipc/chromium/src/base/message_pump_glib.cc @@ -9,6 +9,9 @@ #include #include +#if defined(OS_SOLARIS) +#include +#endif #include #include @@ -131,6 +134,12 @@ MessagePumpForUI::MessagePumpForUI() // Create our wakeup pipe, which is used to flag when work was scheduled. int fds[2]; CHECK(pipe(fds) == 0); +#if defined(OS_SOLARIS) + int flags = fcntl(fds[0], F_GETFL,0); + if (flags == -1) + flags = 0; + fntl(fds[0], F_SETFL, flags | O_NDELAY); +#endif wakeup_pipe_read_ = fds[0]; wakeup_pipe_write_ = fds[1]; wakeup_gpollfd_->fd = wakeup_pipe_read_; @@ -238,11 +247,15 @@ bool MessagePumpForUI::HandleCheck() { // whether there was data, so this read shouldn't block. if (wakeup_gpollfd_->revents & G_IO_IN) { pipe_full_ = false; - +#ifndef OS_SOLARIS char msg; if (HANDLE_EINTR(read(wakeup_pipe_read_, &msg, 1)) != 1 || msg != '!') { NOTREACHED() << "Error reading from the wakeup pipe."; } +#else + char buf[32]; + while (HANDLE_EINTR(read(wakeup_pipe_read_, &buf, 32))); +#endif // Since we ate the message, we need to record that we have more work, // because HandleCheck() may be called without HandleDispatch being called // afterwards. @@ -311,6 +324,10 @@ void MessagePumpForUI::ScheduleWork() { // variables as we would then need locks all over. This ensures that if // we are sleeping in a poll that we will wake up. char msg = '!'; +#if defined(OS_SOLARIS) + char buf[32]; + while (HANDLE_EINTR(read(wakeup_pipe_read_, &buf, 32))); +#endif if (HANDLE_EINTR(write(wakeup_pipe_write_, &msg, 1)) != 1) { NOTREACHED() << "Could not write to the UI message loop wakeup pipe!"; } -- cgit v1.2.3 From 575f51a27d6b3627ae5675cc8e920c8dcae073bd Mon Sep 17 00:00:00 2001 From: athenian200 Date: Fri, 4 Oct 2019 04:37:51 -0500 Subject: Fix a bunch of dumb typos and omissions. --- ipc/chromium/src/base/message_pump_glib.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ipc/chromium/src/base/message_pump_glib.cc') diff --git a/ipc/chromium/src/base/message_pump_glib.cc b/ipc/chromium/src/base/message_pump_glib.cc index a5e719c72..f92378f3b 100644 --- a/ipc/chromium/src/base/message_pump_glib.cc +++ b/ipc/chromium/src/base/message_pump_glib.cc @@ -138,7 +138,7 @@ MessagePumpForUI::MessagePumpForUI() int flags = fcntl(fds[0], F_GETFL,0); if (flags == -1) flags = 0; - fntl(fds[0], F_SETFL, flags | O_NDELAY); + fcntl(fds[0], F_SETFL, flags | O_NDELAY); #endif wakeup_pipe_read_ = fds[0]; wakeup_pipe_write_ = fds[1]; -- cgit v1.2.3 From 687a798e6dedacb8b42826debcd8e89baa69ce94 Mon Sep 17 00:00:00 2001 From: athenian200 Date: Sat, 19 Oct 2019 14:24:49 -0500 Subject: MoonchildProductions#1251 - Part 27: Fix ifdef style. This should do it for all the commits to files I changed, but while I'm in here I could probably go ahead and turn ALL the singular if defined statements into ifdef statements by using grep/find on the tree. On the other hand, perhaps we should do that as a separate issue so that this doesn't become a case of scope creep. --- ipc/chromium/src/base/message_pump_glib.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'ipc/chromium/src/base/message_pump_glib.cc') diff --git a/ipc/chromium/src/base/message_pump_glib.cc b/ipc/chromium/src/base/message_pump_glib.cc index f92378f3b..24081bd8b 100644 --- a/ipc/chromium/src/base/message_pump_glib.cc +++ b/ipc/chromium/src/base/message_pump_glib.cc @@ -9,7 +9,7 @@ #include #include -#if defined(OS_SOLARIS) +#ifdef OS_SOLARIS #include #endif #include @@ -134,7 +134,7 @@ MessagePumpForUI::MessagePumpForUI() // Create our wakeup pipe, which is used to flag when work was scheduled. int fds[2]; CHECK(pipe(fds) == 0); -#if defined(OS_SOLARIS) +#ifdef OS_SOLARIS int flags = fcntl(fds[0], F_GETFL,0); if (flags == -1) flags = 0; @@ -324,7 +324,7 @@ void MessagePumpForUI::ScheduleWork() { // variables as we would then need locks all over. This ensures that if // we are sleeping in a poll that we will wake up. char msg = '!'; -#if defined(OS_SOLARIS) +#ifdef OS_SOLARIS char buf[32]; while (HANDLE_EINTR(read(wakeup_pipe_read_, &buf, 32))); #endif -- cgit v1.2.3