From eb02cb32adad27649b6d669b4a2b560c0b80ea84 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Tue, 6 Jun 2023 21:05:31 +0000 Subject: [PATCH] Bug 1835185 - Replace OS_POSIX with XP_UNIX in ipc code. r=ipc-reviewers,mccr8 Differential Revision: https://phabricator.services.mozilla.com/D180043 --- ipc/chromium/src/base/basictypes.h | 2 +- ipc/chromium/src/base/command_line.cc | 8 ++++---- ipc/chromium/src/base/command_line.h | 6 +++--- ipc/chromium/src/base/condition_variable.h | 4 ++-- ipc/chromium/src/base/eintr_wrapper.h | 4 ++-- ipc/chromium/src/base/file_path.cc | 4 ++-- ipc/chromium/src/base/file_path.h | 4 ++-- ipc/chromium/src/base/lock.h | 4 ++-- ipc/chromium/src/base/lock_impl.h | 6 +++--- ipc/chromium/src/base/message_loop.cc | 8 ++++---- ipc/chromium/src/base/message_loop.h | 8 ++++---- ipc/chromium/src/base/message_pump_libevent.cc | 2 +- ipc/chromium/src/base/platform_file.h | 2 +- ipc/chromium/src/base/platform_thread.h | 2 +- ipc/chromium/src/base/process.h | 2 +- ipc/chromium/src/base/process_util.h | 8 ++++---- ipc/chromium/src/base/shared_memory.h | 8 ++++---- ipc/chromium/src/base/string_util.cc | 4 ++-- ipc/chromium/src/base/string_util.h | 2 +- ipc/chromium/src/base/thread_local.h | 4 ++-- ipc/chromium/src/base/thread_local_storage.h | 4 ++-- ipc/chromium/src/base/time_posix.cc | 4 ++-- ipc/chromium/src/base/waitable_event.h | 2 +- ipc/chromium/src/chrome/common/ipc_channel.h | 4 ++-- ipc/glue/EnvironmentMap.h | 2 +- ipc/glue/GeckoChildProcessHost.cpp | 14 +++++++------- ipc/glue/IPCMessageUtils.h | 6 +++--- ipc/glue/ProtocolUtils.cpp | 4 ++-- ipc/ipdl/test/cxx/IPDLUnitTests.template.cpp | 2 +- ipc/ipdl/test/cxx/TestDemon.cpp | 12 ++++++------ ipc/ipdl/test/cxx/TestHighestPrio.cpp | 2 +- ipc/ipdl/test/cxx/TestRPC.cpp | 2 +- ipc/ipdl/test/cxx/TestSyncWakeup.cpp | 6 +++--- ipc/ipdl/test/cxx/TestUrgency.cpp | 4 ++-- ipc/ipdl/test/cxx/TestUrgentHangs.cpp | 2 +- 35 files changed, 81 insertions(+), 81 deletions(-) diff --git a/ipc/chromium/src/base/basictypes.h b/ipc/chromium/src/base/basictypes.h index 8cd84bee59ed..f35616ab25d3 100644 --- a/ipc/chromium/src/base/basictypes.h +++ b/ipc/chromium/src/base/basictypes.h @@ -36,7 +36,7 @@ const int64_t kint64min = ((int64_t)GG_LONGLONG(0x8000000000000000)); const int64_t kint64max = ((int64_t)GG_LONGLONG(0x7FFFFFFFFFFFFFFF)); // Platform- and hardware-dependent printf specifiers -#if defined(OS_POSIX) +#if defined(XP_UNIX) # define PRId64L "I64d" # define PRIu64L "I64u" # define PRIx64L "I64x" diff --git a/ipc/chromium/src/base/command_line.cc b/ipc/chromium/src/base/command_line.cc index 3118dcbe7b6a..6ba225a46a4d 100644 --- a/ipc/chromium/src/base/command_line.cc +++ b/ipc/chromium/src/base/command_line.cc @@ -27,7 +27,7 @@ CommandLine* CommandLine::current_process_commandline_ = NULL; const wchar_t* const kSwitchPrefixes[] = {L"--", L"-", L"/"}; const wchar_t kSwitchTerminator[] = L"--"; const wchar_t kSwitchValueSeparator[] = L"="; -#elif defined(OS_POSIX) +#elif defined(XP_UNIX) // Unixes don't use slash as a switch. const char* const kSwitchPrefixes[] = {"--", "-"}; const char kSwitchTerminator[] = "--"; @@ -97,7 +97,7 @@ CommandLine::CommandLine(const std::wstring& program) { command_line_string_ = L'"' + program + L'"'; } } -#elif defined(OS_POSIX) +#elif defined(XP_UNIX) CommandLine::CommandLine(int argc, const char* const* argv) { for (int i = 0; i < argc; ++i) argv_.push_back(argv[i]); InitFromArgv(); @@ -178,7 +178,7 @@ void CommandLine::Init(int argc, const char* const* argv) { #if defined(OS_WIN) current_process_commandline_ = new CommandLine; current_process_commandline_->ParseFromString(::GetCommandLineW()); -#elif defined(OS_POSIX) +#elif defined(XP_UNIX) current_process_commandline_ = new CommandLine(argc, argv); #endif } @@ -342,7 +342,7 @@ void CommandLine::PrependWrapper(const std::wstring& wrapper) { command_line_string_ = wrapper + L" " + command_line_string_; } -#elif defined(OS_POSIX) +#elif defined(XP_UNIX) void CommandLine::AppendSwitch(const std::wstring& switch_string) { std::string ascii_switch = WideToASCII(switch_string); argv_.push_back(kSwitchPrefixes[0] + ascii_switch); diff --git a/ipc/chromium/src/base/command_line.h b/ipc/chromium/src/base/command_line.h index d89824d8492e..89c941fbc5dc 100644 --- a/ipc/chromium/src/base/command_line.h +++ b/ipc/chromium/src/base/command_line.h @@ -36,7 +36,7 @@ class CommandLine { // Creates a parsed version of the given command-line string. // The program name is assumed to be the first item in the string. void ParseFromString(const std::wstring& command_line); -#elif defined(OS_POSIX) +#elif defined(XP_UNIX) // Initialize from an argv vector (or directly from main()'s argv). CommandLine(int argc, const char* const* argv); explicit CommandLine(const std::vector& argv); @@ -87,7 +87,7 @@ class CommandLine { const std::wstring& command_line_string() const { return command_line_string_; } -#elif defined(OS_POSIX) +#elif defined(XP_UNIX) // Returns the original command line string as a vector of strings. const std::vector& argv() const { return argv_; } #endif @@ -158,7 +158,7 @@ class CommandLine { // The type of native command line arguments. typedef std::wstring StringType; -#elif defined(OS_POSIX) +#elif defined(XP_UNIX) // The argv array, with the program name in argv_[0]. std::vector argv_; diff --git a/ipc/chromium/src/base/condition_variable.h b/ipc/chromium/src/base/condition_variable.h index 864479ec2834..baf54dd2539c 100644 --- a/ipc/chromium/src/base/condition_variable.h +++ b/ipc/chromium/src/base/condition_variable.h @@ -71,7 +71,7 @@ #include "base/lock.h" #include "build/build_config.h" -#if defined(OS_POSIX) +#if defined(XP_UNIX) # include #endif @@ -106,7 +106,7 @@ class ConditionVariable { #if defined(OS_WIN) CONDITION_VARIABLE cv_; SRWLOCK* const srwlock_; -#elif defined(OS_POSIX) +#elif defined(XP_UNIX) pthread_cond_t condition_; pthread_mutex_t* user_mutex_; #endif diff --git a/ipc/chromium/src/base/eintr_wrapper.h b/ipc/chromium/src/base/eintr_wrapper.h index c4a8b1a0adf5..a2fc816c6e96 100644 --- a/ipc/chromium/src/base/eintr_wrapper.h +++ b/ipc/chromium/src/base/eintr_wrapper.h @@ -18,7 +18,7 @@ #include "build/build_config.h" -#if defined(OS_POSIX) +#if defined(XP_UNIX) # include @@ -58,6 +58,6 @@ # define IGNORE_EINTR(x) (x) # define HANDLE_RV_EINTR(x) (x) -#endif // OS_POSIX +#endif // XP_UNIX #endif // !BASE_EINTR_WRAPPER_H_ diff --git a/ipc/chromium/src/base/file_path.cc b/ipc/chromium/src/base/file_path.cc index 6afb7d9b863a..63a03bd41ccd 100644 --- a/ipc/chromium/src/base/file_path.cc +++ b/ipc/chromium/src/base/file_path.cc @@ -246,14 +246,14 @@ FilePath FilePath::AppendASCII(const std::string& component) const { DCHECK(IsStringASCII(component)); #if defined(OS_WIN) return Append(ASCIIToWide(component)); -#elif defined(OS_POSIX) +#elif defined(XP_UNIX) return Append(component); #endif } bool FilePath::IsAbsolute() const { return IsPathAbsolute(path_); } -#if defined(OS_POSIX) +#if defined(XP_UNIX) // See file_path.h for a discussion of the encoding of paths on POSIX // platforms. These *Hack() functions are not quite correct, but they're // only temporary while we fix the remainder of the code. diff --git a/ipc/chromium/src/base/file_path.h b/ipc/chromium/src/base/file_path.h index 6fe4bbdd2963..4c9ee2250be4 100644 --- a/ipc/chromium/src/base/file_path.h +++ b/ipc/chromium/src/base/file_path.h @@ -85,7 +85,7 @@ // pathnames on different platforms. class FilePath { public: -#if defined(OS_POSIX) +#if defined(XP_UNIX) // On most platforms, native pathnames are char arrays, and the encoding // may or may not be specified. On Mac OS X, native pathnames are encoded // in UTF-8. @@ -239,7 +239,7 @@ class FilePath { }; // Macros for string literal initialization of FilePath::CharType[]. -#if defined(OS_POSIX) +#if defined(XP_UNIX) # define FILE_PATH_LITERAL(x) x #elif defined(OS_WIN) # define FILE_PATH_LITERAL(x) L##x diff --git a/ipc/chromium/src/base/lock.h b/ipc/chromium/src/base/lock.h index 17fe0dad6acd..e2d356ecc522 100644 --- a/ipc/chromium/src/base/lock.h +++ b/ipc/chromium/src/base/lock.h @@ -33,7 +33,7 @@ class Lock { // Whether Lock mitigates priority inversion when used from different thread // priorities. static bool HandlesMultipleThreadPriorities() { -#if defined(OS_POSIX) +#if defined(XP_UNIX) // POSIX mitigates priority inversion by setting the priority of a thread // holding a Lock to the maximum priority of any other thread waiting on it. return base::internal::LockImpl::PriorityInheritanceAvailable(); @@ -47,7 +47,7 @@ class Lock { #endif } -#if defined(OS_POSIX) || defined(OS_WIN) +#if defined(XP_UNIX) || defined(OS_WIN) // Both Windows and POSIX implementations of ConditionVariable need to be // able to see our lock and tweak our debugging counters, as they release and // acquire locks inside of their condition variable APIs. diff --git a/ipc/chromium/src/base/lock_impl.h b/ipc/chromium/src/base/lock_impl.h index 30df64c9b0ae..96fe67d292a6 100644 --- a/ipc/chromium/src/base/lock_impl.h +++ b/ipc/chromium/src/base/lock_impl.h @@ -12,7 +12,7 @@ #if defined(OS_WIN) # include -#elif defined(OS_POSIX) +#elif defined(XP_UNIX) # include #endif @@ -26,7 +26,7 @@ class LockImpl { public: #if defined(OS_WIN) using NativeHandle = SRWLOCK; -#elif defined(OS_POSIX) +#elif defined(XP_UNIX) using NativeHandle = pthread_mutex_t; #endif @@ -49,7 +49,7 @@ class LockImpl { // unnecessary. NativeHandle* native_handle() { return &native_handle_; } -#if defined(OS_POSIX) +#if defined(XP_UNIX) // Whether this lock will attempt to use priority inheritance. static bool PriorityInheritanceAvailable(); #endif diff --git a/ipc/chromium/src/base/message_loop.cc b/ipc/chromium/src/base/message_loop.cc index e7178a6792a7..e915f89a0887 100644 --- a/ipc/chromium/src/base/message_loop.cc +++ b/ipc/chromium/src/base/message_loop.cc @@ -23,7 +23,7 @@ #if defined(OS_MACOSX) # include "base/message_pump_mac.h" #endif -#if defined(OS_POSIX) +#if defined(XP_UNIX) # include "base/message_pump_libevent.h" #endif #if defined(OS_LINUX) || defined(OS_BSD) @@ -275,7 +275,7 @@ MessageLoop::MessageLoop(Type type, nsISerialEventTarget* aEventTarget) DCHECK(type_ == TYPE_UI); pump_ = new base::MessagePumpForUI(); } -#elif defined(OS_POSIX) +#elif defined(XP_UNIX) if (type_ == TYPE_UI) { # if defined(OS_MACOSX) pump_ = base::MessagePumpMac::Create(); @@ -287,7 +287,7 @@ MessageLoop::MessageLoop(Type type, nsISerialEventTarget* aEventTarget) } else { pump_ = new base::MessagePumpDefault(); } -#endif // OS_POSIX +#endif // XP_UNIX // We want GetCurrentSerialEventTarget() to return the real nsThread if it // will be used to dispatch tasks. However, under all other cases; we'll want @@ -705,7 +705,7 @@ bool MessageLoopForIO::WaitForIOCompletion(DWORD timeout, IOHandler* filter) { return pump_io()->WaitForIOCompletion(timeout, filter); } -#elif defined(OS_POSIX) +#elif defined(XP_UNIX) bool MessageLoopForIO::WatchFileDescriptor(int fd, bool persistent, Mode mode, FileDescriptorWatcher* controller, diff --git a/ipc/chromium/src/base/message_loop.h b/ipc/chromium/src/base/message_loop.h index b6e4938ee01f..a8a1430d6f93 100644 --- a/ipc/chromium/src/base/message_loop.h +++ b/ipc/chromium/src/base/message_loop.h @@ -22,7 +22,7 @@ // We need this to declare base::MessagePumpWin::Dispatcher, which we should // really just eliminate. # include "base/message_pump_win.h" -#elif defined(OS_POSIX) +#elif defined(XP_UNIX) # include "base/message_pump_libevent.h" #endif @@ -329,7 +329,7 @@ class MessageLoop : public base::MessagePump::Delegate { base::MessagePumpWin* pump_win() { return static_cast(pump_.get()); } -#elif defined(OS_POSIX) +#elif defined(XP_UNIX) base::MessagePumpLibevent* pump_libevent() { return static_cast(pump_.get()); } @@ -527,7 +527,7 @@ class MessageLoopForIO : public MessageLoop { return static_cast(pump_.get()); } -#elif defined(OS_POSIX) +#elif defined(XP_UNIX) typedef base::MessagePumpLibevent::Watcher Watcher; typedef base::MessagePumpLibevent::FileDescriptorWatcher FileDescriptorWatcher; @@ -547,7 +547,7 @@ class MessageLoopForIO : public MessageLoop { typedef base::MessagePumpLibevent::SignalWatcher SignalWatcher; bool CatchSignal(int sig, SignalEvent* sigevent, SignalWatcher* delegate); -#endif // defined(OS_POSIX) +#endif // defined(XP_UNIX) }; // Do not add any member variables to MessageLoopForIO! This is important b/c diff --git a/ipc/chromium/src/base/message_pump_libevent.cc b/ipc/chromium/src/base/message_pump_libevent.cc index c1f945bd4d48..004001fddd20 100644 --- a/ipc/chromium/src/base/message_pump_libevent.cc +++ b/ipc/chromium/src/base/message_pump_libevent.cc @@ -8,7 +8,7 @@ #include #include -#if defined(ANDROID) || defined(OS_POSIX) +#if defined(ANDROID) || defined(XP_UNIX) # include #endif diff --git a/ipc/chromium/src/base/platform_file.h b/ipc/chromium/src/base/platform_file.h index c76d6f29c5ab..e6535b8ed3ab 100644 --- a/ipc/chromium/src/base/platform_file.h +++ b/ipc/chromium/src/base/platform_file.h @@ -19,7 +19,7 @@ namespace base { #if defined(OS_WIN) typedef HANDLE PlatformFile; const PlatformFile kInvalidPlatformFileValue = INVALID_HANDLE_VALUE; -#elif defined(OS_POSIX) +#elif defined(XP_UNIX) typedef int PlatformFile; const PlatformFile kInvalidPlatformFileValue = -1; #endif diff --git a/ipc/chromium/src/base/platform_thread.h b/ipc/chromium/src/base/platform_thread.h index 0b7c461aeb3a..942b17f9f80d 100644 --- a/ipc/chromium/src/base/platform_thread.h +++ b/ipc/chromium/src/base/platform_thread.h @@ -21,7 +21,7 @@ # include typedef DWORD PlatformThreadId; typedef void* PlatformThreadHandle; // HANDLE -#elif defined(OS_POSIX) +#elif defined(XP_UNIX) # include typedef pthread_t PlatformThreadHandle; # if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(OS_SOLARIS) || \ diff --git a/ipc/chromium/src/base/process.h b/ipc/chromium/src/base/process.h index 222aaefff18a..bdfd65264044 100644 --- a/ipc/chromium/src/base/process.h +++ b/ipc/chromium/src/base/process.h @@ -34,7 +34,7 @@ const ProcessHandle kInvalidProcessHandle = INVALID_HANDLE_VALUE; // property, however even if that were to change, it seems safe to rely on this // particular value never being used. const ProcessId kInvalidProcessId = kuint32max; -#elif defined(OS_POSIX) +#elif defined(XP_UNIX) // On POSIX, our ProcessHandle will just be the PID. typedef pid_t ProcessHandle; typedef pid_t ProcessId; diff --git a/ipc/chromium/src/base/process_util.h b/ipc/chromium/src/base/process_util.h index af1c595c1433..103ec1a1e8bc 100644 --- a/ipc/chromium/src/base/process_util.h +++ b/ipc/chromium/src/base/process_util.h @@ -105,7 +105,7 @@ void CloseProcessHandle(ProcessHandle process); // Win XP SP1 as well. ProcessId GetProcId(ProcessHandle process); -#if defined(OS_POSIX) +#if defined(XP_UNIX) // Close all file descriptors, except for std{in,out,err} and those // for which the given function returns true. Only call this function // in a child process where you know that there aren't any other @@ -141,7 +141,7 @@ struct LaunchOptions { std::vector handles_to_inherit; #endif -#if defined(OS_POSIX) +#if defined(XP_UNIX) environment_map env_map; // If non-null, specifies the entire environment to use for the @@ -204,7 +204,7 @@ Result LaunchApp(const std::wstring& cmdline, const LaunchOptions& options, ProcessHandle* process_handle); -#elif defined(OS_POSIX) +#elif defined(XP_UNIX) // Runs the application specified in argv[0] with the command line argv. // // The pid will be stored in process_handle if that pointer is @@ -280,7 +280,7 @@ Result LaunchApp(const CommandLine& cl, const LaunchOptions&, // Returns true if this is successful, false otherwise. bool KillProcess(ProcessHandle process, int exit_code); -#ifdef OS_POSIX +#ifdef XP_UNIX // Returns whether the given process has exited. If it returns true, // the process status has been consumed and `IsProcessDead` should not // be called again on the same process (like `waitpid`). diff --git a/ipc/chromium/src/base/shared_memory.h b/ipc/chromium/src/base/shared_memory.h index ec3f9fc25972..b93fb76305e1 100644 --- a/ipc/chromium/src/base/shared_memory.h +++ b/ipc/chromium/src/base/shared_memory.h @@ -9,7 +9,7 @@ #include "build/build_config.h" -#if defined(OS_POSIX) +#if defined(XP_UNIX) # include # include #endif @@ -149,7 +149,7 @@ class SharedMemory { // something there in the meantime. static void* FindFreeAddressSpace(size_t size); -#ifdef OS_POSIX +#ifdef XP_UNIX // If named POSIX shm is being used, append the prefix (including // the leading '/') that would be used by a process with the given // pid to the given string and return true. If not, return false. @@ -165,7 +165,7 @@ class SharedMemory { // Unmapping shared memory requires the mapped size on Unix but not // Windows; this encapsulates that difference. struct MappingDeleter { -#ifdef OS_POSIX +#ifdef XP_UNIX // A default-constructed deleter must be used only with nullptr // (to allow default-constructing UniqueMapping). A deleter with // a size must be used at most once. @@ -184,7 +184,7 @@ class SharedMemory { // If true indicates this came from an external source so needs extra checks // before being mapped. bool external_section_ = false; -#elif defined(OS_POSIX) && !defined(ANDROID) +#elif defined(XP_UNIX) && !defined(ANDROID) mozilla::UniqueFileHandle frozen_file_; bool is_memfd_ = false; #endif diff --git a/ipc/chromium/src/base/string_util.cc b/ipc/chromium/src/base/string_util.cc index 6217721f8fd0..067843f5eaec 100644 --- a/ipc/chromium/src/base/string_util.cc +++ b/ipc/chromium/src/base/string_util.cc @@ -140,7 +140,7 @@ class StringToInt64Traits { string_type::value_type** endptr) { #ifdef OS_WIN return _strtoi64(str, endptr, kBase); -#else // assume OS_POSIX +#else // assume XP_UNIX return strtoll(str, endptr, kBase); #endif } @@ -158,7 +158,7 @@ class String16ToInt64Traits { string_type::value_type** endptr) { #ifdef OS_WIN return _wcstoi64(str, endptr, kBase); -#else // assume OS_POSIX +#else // assume XP_UNIX std::string ascii_string = UTF16ToASCII(string16(str)); char* ascii_end = NULL; value_type ret = strtoll(ascii_string.c_str(), &ascii_end, kBase); diff --git a/ipc/chromium/src/base/string_util.h b/ipc/chromium/src/base/string_util.h index 066a3fb678e5..d312b24a092b 100644 --- a/ipc/chromium/src/base/string_util.h +++ b/ipc/chromium/src/base/string_util.h @@ -104,7 +104,7 @@ bool IsWprintfFormatPortable(const wchar_t* format); #if defined(OS_WIN) # include "base/string_util_win.h" -#elif defined(OS_POSIX) +#elif defined(XP_UNIX) # include "base/string_util_posix.h" #else # error Define string operations appropriately for your platform diff --git a/ipc/chromium/src/base/thread_local.h b/ipc/chromium/src/base/thread_local.h index 15401f3c945e..3715b1ecc481 100644 --- a/ipc/chromium/src/base/thread_local.h +++ b/ipc/chromium/src/base/thread_local.h @@ -54,7 +54,7 @@ #if defined(OS_WIN) # include -#elif defined(OS_POSIX) +#elif defined(XP_UNIX) # include #endif @@ -64,7 +64,7 @@ namespace base { struct ThreadLocalPlatform { #if defined(OS_WIN) typedef DWORD SlotType; -#elif defined(OS_POSIX) +#elif defined(XP_UNIX) typedef pthread_key_t SlotType; #endif diff --git a/ipc/chromium/src/base/thread_local_storage.h b/ipc/chromium/src/base/thread_local_storage.h index cf488a2d8de6..4c39074823d8 100644 --- a/ipc/chromium/src/base/thread_local_storage.h +++ b/ipc/chromium/src/base/thread_local_storage.h @@ -9,7 +9,7 @@ #include "base/basictypes.h" -#if defined(OS_POSIX) +#if defined(XP_UNIX) # include #endif @@ -58,7 +58,7 @@ class ThreadLocalStorage { bool initialized_; #if defined(OS_WIN) int slot_; -#elif defined(OS_POSIX) +#elif defined(XP_UNIX) pthread_key_t key_; #endif diff --git a/ipc/chromium/src/base/time_posix.cc b/ipc/chromium/src/base/time_posix.cc index c07181ff54c0..133f9c3e215f 100644 --- a/ipc/chromium/src/base/time_posix.cc +++ b/ipc/chromium/src/base/time_posix.cc @@ -15,7 +15,7 @@ #else # include #endif -#if defined(ANDROID) || defined(OS_POSIX) +#if defined(ANDROID) || defined(XP_UNIX) # include #endif @@ -176,7 +176,7 @@ TimeTicks TimeTicks::Now() { // With numer and denom = 1 (the expected case), the 64-bit absolute time // reported in nanoseconds is enough to last nearly 585 years. -#elif defined(OS_OPENBSD) || defined(OS_POSIX) && \ +#elif defined(OS_OPENBSD) || defined(XP_UNIX) && \ defined(_POSIX_MONOTONIC_CLOCK) && \ _POSIX_MONOTONIC_CLOCK >= 0 diff --git a/ipc/chromium/src/base/waitable_event.h b/ipc/chromium/src/base/waitable_event.h index 40ed103b01c6..3cccb5dbe3a4 100644 --- a/ipc/chromium/src/base/waitable_event.h +++ b/ipc/chromium/src/base/waitable_event.h @@ -13,7 +13,7 @@ # include #endif -#if defined(OS_POSIX) +#if defined(XP_UNIX) # include # include # include "base/condition_variable.h" diff --git a/ipc/chromium/src/chrome/common/ipc_channel.h b/ipc/chromium/src/chrome/common/ipc_channel.h index 3cd04ba3de7f..cb2f22af4a66 100644 --- a/ipc/chromium/src/chrome/common/ipc_channel.h +++ b/ipc/chromium/src/chrome/common/ipc_channel.h @@ -141,7 +141,7 @@ class Channel { // be out of date. bool IsClosed() const; -#if defined(OS_POSIX) +#if defined(XP_UNIX) // On POSIX an IPC::Channel wraps a socketpair(), this method returns the // FD # for the client end of the socket and the equivalent FD# to use for // mapping it into the Child process. @@ -166,7 +166,7 @@ class Channel { // must be set as `MODE_SERVER`, and that side will be responsible for calling // `DuplicateHandle` to transfer the handle between processes. void StartAcceptingHandles(Mode mode); -#endif // defined(OS_POSIX) +#endif // defined(XP_UNIX) // On Windows: Generates a channel ID that, if passed to the client // as a shared secret, will validate the client's authenticity. diff --git a/ipc/glue/EnvironmentMap.h b/ipc/glue/EnvironmentMap.h index 5cd0ef8c5846..dedb6a7757da 100644 --- a/ipc/glue/EnvironmentMap.h +++ b/ipc/glue/EnvironmentMap.h @@ -36,7 +36,7 @@ typedef std::map NativeEnvironmentString AlterEnvironment(const wchar_t* env, const EnvironmentMap& changes); -#elif defined(OS_POSIX) +#elif defined(XP_UNIX) typedef std::string NativeEnvironmentString; typedef std::map diff --git a/ipc/glue/GeckoChildProcessHost.cpp b/ipc/glue/GeckoChildProcessHost.cpp index c308bd166504..47ea50dd56e6 100644 --- a/ipc/glue/GeckoChildProcessHost.cpp +++ b/ipc/glue/GeckoChildProcessHost.cpp @@ -282,7 +282,7 @@ class WindowsProcessLauncher : public BaseProcessLauncher { typedef WindowsProcessLauncher ProcessLauncher; #endif // XP_WIN -#ifdef OS_POSIX +#ifdef XP_UNIX class PosixProcessLauncher : public BaseProcessLauncher { public: PosixProcessLauncher(GeckoChildProcessHost* aHost, @@ -379,7 +379,7 @@ typedef LinuxProcessLauncher ProcessLauncher; # elif # error "Unknown platform" # endif -#endif // OS_POSIX +#endif // XP_UNIX using base::ProcessHandle; using mozilla::ipc::BaseProcessLauncher; @@ -557,7 +557,7 @@ mozilla::BinPathType BaseProcessLauncher::GetPathToBinary( MOZ_CRASH("GetModuleFileNameW failed (FIXME)"); } exePath = FilePath::FromWStringHack(exePathBuf); -#elif defined(OS_POSIX) +#elif defined(XP_UNIX) exePath = FilePath(CommandLine::ForCurrentProcess()->argv()[0]); #else # error Sorry; target OS not supported yet. @@ -1192,7 +1192,7 @@ Result LinuxProcessLauncher::DoSetup() { } #endif // MOZ_WIDGET_GTK -#ifdef OS_POSIX +#ifdef XP_UNIX Result PosixProcessLauncher::DoSetup() { Result aError = BaseProcessLauncher::DoSetup(); if (aError.isErr()) { @@ -1348,7 +1348,7 @@ Result PosixProcessLauncher::DoSetup() { mChildArgv.push_back(ChildProcessType()); return Ok(); } -#endif // OS_POSIX +#endif // XP_UNIX #if defined(MOZ_WIDGET_ANDROID) RefPtr AndroidProcessLauncher::DoLaunch() { @@ -1357,7 +1357,7 @@ RefPtr AndroidProcessLauncher::DoLaunch() { } #endif // MOZ_WIDGET_ANDROID -#ifdef OS_POSIX +#ifdef XP_UNIX RefPtr PosixProcessLauncher::DoLaunch() { ProcessHandle handle = 0; Result aError = @@ -1381,7 +1381,7 @@ Result PosixProcessLauncher::DoFinishLaunch() { return Ok(); } -#endif // OS_POSIX +#endif // XP_UNIX #ifdef XP_MACOSX Result MacProcessLauncher::DoFinishLaunch() { diff --git a/ipc/glue/IPCMessageUtils.h b/ipc/glue/IPCMessageUtils.h index ab9b84e3ea83..416cf1eb5f8f 100644 --- a/ipc/glue/IPCMessageUtils.h +++ b/ipc/glue/IPCMessageUtils.h @@ -25,7 +25,7 @@ class PickleIterator; # pragma warning(disable : 4800) #endif -#if !defined(OS_POSIX) +#if !defined(XP_UNIX) // This condition must be kept in sync with the one in // ipc_message_utils.h, but this dummy definition of // base::FileDescriptor acts as a static assert that we only get one @@ -120,7 +120,7 @@ struct ParamTraits { } }; -#if !defined(OS_POSIX) +#if !defined(XP_UNIX) // See above re: keeping definitions in sync template <> struct ParamTraits { @@ -133,7 +133,7 @@ struct ParamTraits { return false; } }; -#endif // !defined(OS_POSIX) +#endif // !defined(XP_UNIX) template <> struct ParamTraits { diff --git a/ipc/glue/ProtocolUtils.cpp b/ipc/glue/ProtocolUtils.cpp index 51fb4d7e5690..b6c40407d16f 100644 --- a/ipc/glue/ProtocolUtils.cpp +++ b/ipc/glue/ProtocolUtils.cpp @@ -7,7 +7,7 @@ #include "base/process_util.h" #include "base/task.h" -#ifdef OS_POSIX +#ifdef XP_UNIX # include #endif #include @@ -77,7 +77,7 @@ void AnnotateSystemError() { int64_t error = 0; #if defined(XP_WIN) error = ::GetLastError(); -#elif defined(OS_POSIX) +#elif defined(XP_UNIX) error = errno; #endif if (error) { diff --git a/ipc/ipdl/test/cxx/IPDLUnitTests.template.cpp b/ipc/ipdl/test/cxx/IPDLUnitTests.template.cpp index 30eea428388e..875c3f9de1c5 100644 --- a/ipc/ipdl/test/cxx/IPDLUnitTests.template.cpp +++ b/ipc/ipdl/test/cxx/IPDLUnitTests.template.cpp @@ -54,7 +54,7 @@ const char* IPDLUnitTestName() { #if defined(OS_WIN) vector args = CommandLine::ForCurrentProcess()->GetLooseValues(); gIPDLUnitTestName = ::strdup(WideToUTF8(args[0]).c_str()); -#elif defined(OS_POSIX) +#elif defined(XP_UNIX) vector argv = CommandLine::ForCurrentProcess()->argv(); gIPDLUnitTestName = ::moz_xstrdup(argv[1].c_str()); #else diff --git a/ipc/ipdl/test/cxx/TestDemon.cpp b/ipc/ipdl/test/cxx/TestDemon.cpp index 811f6c33140a..396974bb567e 100644 --- a/ipc/ipdl/test/cxx/TestDemon.cpp +++ b/ipc/ipdl/test/cxx/TestDemon.cpp @@ -6,7 +6,7 @@ #include #include "IPDLUnitTests.h" // fail etc. -#if defined(OS_POSIX) +#if defined(XP_UNIX) # include # include #else @@ -27,7 +27,7 @@ static int gStackHeight = 0; static bool gFlushStack = false; static int Choose(int count) { -#if defined(OS_POSIX) +#if defined(XP_UNIX) return random() % count; #else return rand() % count; @@ -48,7 +48,7 @@ void TestDemonParent::Main() { QuitParent(); return; } -#if defined(OS_POSIX) +#if defined(XP_UNIX) srandom(time(nullptr)); #else srand(time(nullptr)); @@ -72,7 +72,7 @@ void TestDemonParent::ArtificialSleep() { if (Choose(2) == 0) { // Sleep for anywhere from 0 to 100 milliseconds. unsigned micros = Choose(100) * 1000; -# ifdef OS_POSIX +# ifdef XP_UNIX usleep(micros); # else Sleep(micros / 1000); @@ -218,7 +218,7 @@ TestDemonChild::TestDemonChild() : mIncoming(), mOutgoing() { TestDemonChild::~TestDemonChild() { MOZ_COUNT_DTOR(TestDemonChild); } mozilla::ipc::IPCResult TestDemonChild::RecvStart() { -#ifdef OS_POSIX +#ifdef XP_UNIX srandom(time(nullptr)); #else srand(time(nullptr)); @@ -235,7 +235,7 @@ void TestDemonChild::ArtificialSleep() { if (Choose(2) == 0) { // Sleep for anywhere from 0 to 100 milliseconds. unsigned micros = Choose(100) * 1000; -# ifdef OS_POSIX +# ifdef XP_UNIX usleep(micros); # else Sleep(micros / 1000); diff --git a/ipc/ipdl/test/cxx/TestHighestPrio.cpp b/ipc/ipdl/test/cxx/TestHighestPrio.cpp index e6715fba8eb5..499c352a5a4d 100644 --- a/ipc/ipdl/test/cxx/TestHighestPrio.cpp +++ b/ipc/ipdl/test/cxx/TestHighestPrio.cpp @@ -8,7 +8,7 @@ #include "TestHighestPrio.h" #include "IPDLUnitTests.h" // fail etc. -#if defined(OS_POSIX) +#if defined(XP_UNIX) # include #else # include diff --git a/ipc/ipdl/test/cxx/TestRPC.cpp b/ipc/ipdl/test/cxx/TestRPC.cpp index 404de01aa852..cf7a1b6c364e 100644 --- a/ipc/ipdl/test/cxx/TestRPC.cpp +++ b/ipc/ipdl/test/cxx/TestRPC.cpp @@ -1,7 +1,7 @@ #include "TestRPC.h" #include "IPDLUnitTests.h" // fail etc. -#if defined(OS_POSIX) +#if defined(XP_UNIX) # include #else # include diff --git a/ipc/ipdl/test/cxx/TestSyncWakeup.cpp b/ipc/ipdl/test/cxx/TestSyncWakeup.cpp index 4c99aa1bab43..90875b702b6f 100644 --- a/ipc/ipdl/test/cxx/TestSyncWakeup.cpp +++ b/ipc/ipdl/test/cxx/TestSyncWakeup.cpp @@ -1,4 +1,4 @@ -#if defined(OS_POSIX) +#if defined(XP_UNIX) # include // sleep() #endif @@ -35,7 +35,7 @@ mozilla::ipc::IPCResult TestSyncWakeupParent::RecvSync1() { // XXX ugh ... need to ensure that the async message and sync // reply come in "far enough" apart that this test doesn't pass on // accident -#if defined(OS_POSIX) +#if defined(XP_UNIX) // NB: can't use PR_Sleep (i.e. Sleep() on windows) because it's // only spec'd to block the current thread, not the current // process. We need the IO thread to sleep as well. @@ -49,7 +49,7 @@ mozilla::ipc::IPCResult TestSyncWakeupParent::RecvSync1() { mozilla::ipc::IPCResult TestSyncWakeupParent::RecvSync2() { if (!SendNote2()) fail("sending Note2()"); -#if defined(OS_POSIX) +#if defined(XP_UNIX) // see above sleep(5); puts(" (sleeping for 5 seconds. sorry!)"); diff --git a/ipc/ipdl/test/cxx/TestUrgency.cpp b/ipc/ipdl/test/cxx/TestUrgency.cpp index 5845f8210d35..840b9d71e939 100644 --- a/ipc/ipdl/test/cxx/TestUrgency.cpp +++ b/ipc/ipdl/test/cxx/TestUrgency.cpp @@ -1,7 +1,7 @@ #include "TestUrgency.h" #include "IPDLUnitTests.h" // fail etc. -#if defined(OS_POSIX) +#if defined(XP_UNIX) # include #else # include @@ -10,7 +10,7 @@ namespace mozilla { namespace _ipdltest { -#if defined(OS_POSIX) +#if defined(XP_UNIX) static void Sleep(int ms) { sleep(ms / 1000); } #endif diff --git a/ipc/ipdl/test/cxx/TestUrgentHangs.cpp b/ipc/ipdl/test/cxx/TestUrgentHangs.cpp index e6139e38c5dd..96227dd79174 100644 --- a/ipc/ipdl/test/cxx/TestUrgentHangs.cpp +++ b/ipc/ipdl/test/cxx/TestUrgentHangs.cpp @@ -5,7 +5,7 @@ #include "IPDLUnitTests.h" // fail etc. #include "prthread.h" -#if defined(OS_POSIX) +#if defined(XP_UNIX) # include #else # include