Bug 1835185 - Replace OS_POSIX with XP_UNIX in ipc code. r=ipc-reviewers,mccr8

Differential Revision: https://phabricator.services.mozilla.com/D180043
This commit is contained in:
Mike Hommey 2023-06-06 21:05:31 +00:00
Родитель bc6e2d89d2
Коммит eb02cb32ad
35 изменённых файлов: 81 добавлений и 81 удалений

Просмотреть файл

@ -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"

Просмотреть файл

@ -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);

Просмотреть файл

@ -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<std::string>& 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<std::string>& 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<std::string> argv_;

Просмотреть файл

@ -71,7 +71,7 @@
#include "base/lock.h"
#include "build/build_config.h"
#if defined(OS_POSIX)
#if defined(XP_UNIX)
# include <pthread.h>
#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

Просмотреть файл

@ -18,7 +18,7 @@
#include "build/build_config.h"
#if defined(OS_POSIX)
#if defined(XP_UNIX)
# include <errno.h>
@ -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_

Просмотреть файл

@ -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.

Просмотреть файл

@ -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

Просмотреть файл

@ -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.

Просмотреть файл

@ -12,7 +12,7 @@
#if defined(OS_WIN)
# include <windows.h>
#elif defined(OS_POSIX)
#elif defined(XP_UNIX)
# include <pthread.h>
#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

Просмотреть файл

@ -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,

Просмотреть файл

@ -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<base::MessagePumpWin*>(pump_.get());
}
#elif defined(OS_POSIX)
#elif defined(XP_UNIX)
base::MessagePumpLibevent* pump_libevent() {
return static_cast<base::MessagePumpLibevent*>(pump_.get());
}
@ -527,7 +527,7 @@ class MessageLoopForIO : public MessageLoop {
return static_cast<base::MessagePumpForIO*>(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

Просмотреть файл

@ -8,7 +8,7 @@
#include <errno.h>
#include <fcntl.h>
#if defined(ANDROID) || defined(OS_POSIX)
#if defined(ANDROID) || defined(XP_UNIX)
# include <unistd.h>
#endif

Просмотреть файл

@ -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

Просмотреть файл

@ -21,7 +21,7 @@
# include <windows.h>
typedef DWORD PlatformThreadId;
typedef void* PlatformThreadHandle; // HANDLE
#elif defined(OS_POSIX)
#elif defined(XP_UNIX)
# include <pthread.h>
typedef pthread_t PlatformThreadHandle;
# if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(OS_SOLARIS) || \

Просмотреть файл

@ -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;

Просмотреть файл

@ -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<HANDLE> 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<Ok, LaunchError> 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<Ok, LaunchError> 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`).

Просмотреть файл

@ -9,7 +9,7 @@
#include "build/build_config.h"
#if defined(OS_POSIX)
#if defined(XP_UNIX)
# include <sys/types.h>
# include <semaphore.h>
#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

Просмотреть файл

@ -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);

Просмотреть файл

@ -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

Просмотреть файл

@ -54,7 +54,7 @@
#if defined(OS_WIN)
# include <windows.h>
#elif defined(OS_POSIX)
#elif defined(XP_UNIX)
# include <pthread.h>
#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

Просмотреть файл

@ -9,7 +9,7 @@
#include "base/basictypes.h"
#if defined(OS_POSIX)
#if defined(XP_UNIX)
# include <pthread.h>
#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

Просмотреть файл

@ -15,7 +15,7 @@
#else
# include <time.h>
#endif
#if defined(ANDROID) || defined(OS_POSIX)
#if defined(ANDROID) || defined(XP_UNIX)
# include <unistd.h>
#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

Просмотреть файл

@ -13,7 +13,7 @@
# include <windows.h>
#endif
#if defined(OS_POSIX)
#if defined(XP_UNIX)
# include <list>
# include <utility>
# include "base/condition_variable.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.

Просмотреть файл

@ -36,7 +36,7 @@ typedef std::map<NativeEnvironmentString, NativeEnvironmentString>
NativeEnvironmentString AlterEnvironment(const wchar_t* env,
const EnvironmentMap& changes);
#elif defined(OS_POSIX)
#elif defined(XP_UNIX)
typedef std::string NativeEnvironmentString;
typedef std::map<NativeEnvironmentString, NativeEnvironmentString>

Просмотреть файл

@ -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<Ok, LaunchError> LinuxProcessLauncher::DoSetup() {
}
#endif // MOZ_WIDGET_GTK
#ifdef OS_POSIX
#ifdef XP_UNIX
Result<Ok, LaunchError> PosixProcessLauncher::DoSetup() {
Result<Ok, LaunchError> aError = BaseProcessLauncher::DoSetup();
if (aError.isErr()) {
@ -1348,7 +1348,7 @@ Result<Ok, LaunchError> PosixProcessLauncher::DoSetup() {
mChildArgv.push_back(ChildProcessType());
return Ok();
}
#endif // OS_POSIX
#endif // XP_UNIX
#if defined(MOZ_WIDGET_ANDROID)
RefPtr<ProcessHandlePromise> AndroidProcessLauncher::DoLaunch() {
@ -1357,7 +1357,7 @@ RefPtr<ProcessHandlePromise> AndroidProcessLauncher::DoLaunch() {
}
#endif // MOZ_WIDGET_ANDROID
#ifdef OS_POSIX
#ifdef XP_UNIX
RefPtr<ProcessHandlePromise> PosixProcessLauncher::DoLaunch() {
ProcessHandle handle = 0;
Result<Ok, LaunchError> aError =
@ -1381,7 +1381,7 @@ Result<Ok, LaunchError> PosixProcessLauncher::DoFinishLaunch() {
return Ok();
}
#endif // OS_POSIX
#endif // XP_UNIX
#ifdef XP_MACOSX
Result<Ok, LaunchError> MacProcessLauncher::DoFinishLaunch() {

Просмотреть файл

@ -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<uint8_t> {
}
};
#if !defined(OS_POSIX)
#if !defined(XP_UNIX)
// See above re: keeping definitions in sync
template <>
struct ParamTraits<base::FileDescriptor> {
@ -133,7 +133,7 @@ struct ParamTraits<base::FileDescriptor> {
return false;
}
};
#endif // !defined(OS_POSIX)
#endif // !defined(XP_UNIX)
template <>
struct ParamTraits<mozilla::void_t> {

Просмотреть файл

@ -7,7 +7,7 @@
#include "base/process_util.h"
#include "base/task.h"
#ifdef OS_POSIX
#ifdef XP_UNIX
# include <errno.h>
#endif
#include <type_traits>
@ -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) {

Просмотреть файл

@ -54,7 +54,7 @@ const char* IPDLUnitTestName() {
#if defined(OS_WIN)
vector<wstring> args = CommandLine::ForCurrentProcess()->GetLooseValues();
gIPDLUnitTestName = ::strdup(WideToUTF8(args[0]).c_str());
#elif defined(OS_POSIX)
#elif defined(XP_UNIX)
vector<string> argv = CommandLine::ForCurrentProcess()->argv();
gIPDLUnitTestName = ::moz_xstrdup(argv[1].c_str());
#else

Просмотреть файл

@ -6,7 +6,7 @@
#include <stdlib.h>
#include "IPDLUnitTests.h" // fail etc.
#if defined(OS_POSIX)
#if defined(XP_UNIX)
# include <sys/time.h>
# include <unistd.h>
#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);

Просмотреть файл

@ -8,7 +8,7 @@
#include "TestHighestPrio.h"
#include "IPDLUnitTests.h" // fail etc.
#if defined(OS_POSIX)
#if defined(XP_UNIX)
# include <unistd.h>
#else
# include <windows.h>

Просмотреть файл

@ -1,7 +1,7 @@
#include "TestRPC.h"
#include "IPDLUnitTests.h" // fail etc.
#if defined(OS_POSIX)
#if defined(XP_UNIX)
# include <unistd.h>
#else
# include <windows.h>

Просмотреть файл

@ -1,4 +1,4 @@
#if defined(OS_POSIX)
#if defined(XP_UNIX)
# include <unistd.h> // 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!)");

Просмотреть файл

@ -1,7 +1,7 @@
#include "TestUrgency.h"
#include "IPDLUnitTests.h" // fail etc.
#if defined(OS_POSIX)
#if defined(XP_UNIX)
# include <unistd.h>
#else
# include <windows.h>
@ -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

Просмотреть файл

@ -5,7 +5,7 @@
#include "IPDLUnitTests.h" // fail etc.
#include "prthread.h"
#if defined(OS_POSIX)
#if defined(XP_UNIX)
# include <unistd.h>
#else
# include <windows.h>