зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1835185 - Replace OS_*BSD with equivalent macros in ipc code. r=ipc-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D180049
This commit is contained in:
Родитель
55ec63d832
Коммит
6195df0b79
|
@ -49,7 +49,7 @@ class DirReaderBSD {
|
|||
bool Next() {
|
||||
if (size_) {
|
||||
struct dirent* dirent = reinterpret_cast<struct dirent*>(&buf_[offset_]);
|
||||
#ifdef OS_DRAGONFLY
|
||||
#ifdef __DragonFly__
|
||||
offset_ += _DIRENT_DIRSIZ(dirent);
|
||||
#else
|
||||
offset_ += dirent->d_reclen;
|
||||
|
|
|
@ -22,7 +22,9 @@
|
|||
|
||||
#if defined(XP_LINUX)
|
||||
# include "base/dir_reader_linux.h"
|
||||
#elif defined(OS_BSD) && !defined(__GLIBC__)
|
||||
#elif (defined(__DragonFly__) || defined(XP_FREEBSD) || defined(XP_NETBSD) || \
|
||||
defined(XP_OPENBSD)) && \
|
||||
!defined(__GLIBC__)
|
||||
# include "base/dir_reader_bsd.h"
|
||||
#else
|
||||
# include "base/dir_reader_fallback.h"
|
||||
|
@ -32,7 +34,9 @@ namespace base {
|
|||
|
||||
#if defined(XP_LINUX)
|
||||
typedef DirReaderLinux DirReaderPosix;
|
||||
#elif defined(OS_BSD) && !defined(__GLIBC__)
|
||||
#elif (defined(__DragonFly__) || defined(XP_FREEBSD) || defined(XP_NETBSD) || \
|
||||
defined(XP_OPENBSD)) && \
|
||||
!defined(__GLIBC__)
|
||||
typedef DirReaderBSD DirReaderPosix;
|
||||
#else
|
||||
typedef DirReaderFallback DirReaderPosix;
|
||||
|
|
|
@ -26,7 +26,8 @@
|
|||
#if defined(XP_UNIX)
|
||||
# include "base/message_pump_libevent.h"
|
||||
#endif
|
||||
#if defined(XP_LINUX) || defined(OS_BSD)
|
||||
#if defined(XP_LINUX) || defined(__DragonFly__) || defined(XP_FREEBSD) || \
|
||||
defined(XP_NETBSD) || defined(XP_OPENBSD)
|
||||
# if defined(MOZ_WIDGET_GTK)
|
||||
# include "base/message_pump_glib.h"
|
||||
# endif
|
||||
|
@ -279,7 +280,8 @@ MessageLoop::MessageLoop(Type type, nsISerialEventTarget* aEventTarget)
|
|||
if (type_ == TYPE_UI) {
|
||||
# if defined(XP_DARWIN)
|
||||
pump_ = base::MessagePumpMac::Create();
|
||||
# elif defined(XP_LINUX) || defined(OS_BSD)
|
||||
# elif defined(XP_LINUX) || defined(__DragonFly__) || defined(XP_FREEBSD) || \
|
||||
defined(XP_NETBSD) || defined(XP_OPENBSD)
|
||||
pump_ = new base::MessagePumpForUI();
|
||||
# endif // XP_LINUX
|
||||
} else if (type_ == TYPE_IO) {
|
||||
|
|
|
@ -24,11 +24,11 @@ typedef void* PlatformThreadHandle; // HANDLE
|
|||
#elif defined(XP_UNIX)
|
||||
# include <pthread.h>
|
||||
typedef pthread_t PlatformThreadHandle;
|
||||
# if defined(XP_LINUX) || defined(OS_OPENBSD) || defined(XP_SOLARIS) || \
|
||||
# if defined(XP_LINUX) || defined(XP_OPENBSD) || defined(XP_SOLARIS) || \
|
||||
defined(__GLIBC__)
|
||||
# include <unistd.h>
|
||||
typedef pid_t PlatformThreadId;
|
||||
# elif defined(OS_BSD)
|
||||
# elif defined(__DragonFly__) || defined(XP_FREEBSD) || defined(XP_NETBSD)
|
||||
# include <sys/types.h>
|
||||
typedef lwpid_t PlatformThreadId;
|
||||
# elif defined(XP_DARWIN)
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
#if defined(XP_DARWIN)
|
||||
# include <mach/mach.h>
|
||||
#elif defined(OS_NETBSD)
|
||||
#elif defined(XP_NETBSD)
|
||||
# include <lwp.h>
|
||||
#elif defined(XP_LINUX)
|
||||
# include <sys/syscall.h>
|
||||
|
@ -22,7 +22,8 @@
|
|||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if defined(OS_BSD) && !defined(OS_NETBSD) && !defined(__GLIBC__)
|
||||
#if (defined(__DragonFly__) || defined(XP_FREEBSD) || defined(XP_OPENBSD)) && \
|
||||
!defined(__GLIBC__)
|
||||
# include <pthread_np.h>
|
||||
#endif
|
||||
|
||||
|
@ -51,13 +52,13 @@ PlatformThreadId PlatformThread::CurrentId() {
|
|||
return port;
|
||||
#elif defined(XP_LINUX)
|
||||
return syscall(__NR_gettid);
|
||||
#elif defined(OS_OPENBSD) || defined(XP_SOLARIS) || defined(__GLIBC__)
|
||||
#elif defined(XP_OPENBSD) || defined(XP_SOLARIS) || defined(__GLIBC__)
|
||||
return (intptr_t)(pthread_self());
|
||||
#elif defined(OS_NETBSD)
|
||||
#elif defined(XP_NETBSD)
|
||||
return _lwp_self();
|
||||
#elif defined(OS_DRAGONFLY)
|
||||
#elif defined(__DragonFly__)
|
||||
return lwp_gettid();
|
||||
#elif defined(OS_FREEBSD)
|
||||
#elif defined(XP_FREEBSD)
|
||||
return pthread_getthreadid_np();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -127,7 +127,8 @@ void CloseSuperfluousFds(void* aCtx, bool (*aShouldPreserve)(void*, int)) {
|
|||
#elif defined(XP_DARWIN)
|
||||
static const rlim_t kSystemDefaultMaxFds = 256;
|
||||
static const char kFDDir[] = "/dev/fd";
|
||||
#elif defined(OS_BSD)
|
||||
#elif defined(__DragonFly__) || defined(XP_FREEBSD) || defined(XP_NETBSD) || \
|
||||
defined(XP_OPENBSD)
|
||||
// the getrlimit below should never fail, so whatever ..
|
||||
static const rlim_t kSystemDefaultMaxFds = 1024;
|
||||
// at least /dev/fd will exist
|
||||
|
|
|
@ -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(XP_UNIX) && \
|
||||
#elif defined(XP_OPENBSD) || defined(XP_UNIX) && \
|
||||
defined(_POSIX_MONOTONIC_CLOCK) && \
|
||||
_POSIX_MONOTONIC_CLOCK >= 0
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
# include "mozilla/UniquePtrExtensions.h"
|
||||
# include "chrome/common/mach_ipc_mac.h"
|
||||
#endif
|
||||
#if defined(XP_DARWIN) || defined(OS_NETBSD)
|
||||
#if defined(XP_DARWIN) || defined(XP_NETBSD)
|
||||
# include <sched.h>
|
||||
#endif
|
||||
#include <stddef.h>
|
||||
|
@ -692,7 +692,7 @@ bool Channel::ChannelImpl::ProcessOutgoingMessages() {
|
|||
// Not an error; the sendmsg would have blocked, so return to the
|
||||
// event loop and try again later.
|
||||
break;
|
||||
#if defined(XP_DARWIN) || defined(OS_NETBSD)
|
||||
#if defined(XP_DARWIN) || defined(XP_NETBSD)
|
||||
// (Note: this comment is copied from https://crrev.com/86c3d9ef4fdf6;
|
||||
// see also bug 1142693 comment #73.)
|
||||
//
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#if defined(XP_WIN)
|
||||
# include "mozilla/UniquePtrExtensions.h"
|
||||
#endif
|
||||
#if !defined(XP_WIN) && !defined(OS_NETBSD) && !defined(OS_OPENBSD)
|
||||
#if !defined(XP_WIN) && !defined(XP_NETBSD) && !defined(XP_OPENBSD)
|
||||
# include <pthread.h>
|
||||
# include "mozilla/ipc/SharedMemoryBasic.h"
|
||||
# include "mozilla/Atomics.h"
|
||||
|
@ -38,7 +38,7 @@ struct ParamTraits;
|
|||
namespace mozilla {
|
||||
#if defined(XP_WIN)
|
||||
typedef mozilla::UniqueFileHandle CrossProcessMutexHandle;
|
||||
#elif !defined(OS_NETBSD) && !defined(OS_OPENBSD)
|
||||
#elif !defined(XP_NETBSD) && !defined(XP_OPENBSD)
|
||||
typedef mozilla::ipc::SharedMemoryBasic::Handle CrossProcessMutexHandle;
|
||||
#else
|
||||
// Stub for other platforms. We can't use uintptr_t here since different
|
||||
|
@ -103,7 +103,7 @@ class CrossProcessMutex {
|
|||
|
||||
#if defined(XP_WIN)
|
||||
HANDLE mMutex;
|
||||
#elif !defined(OS_NETBSD) && !defined(OS_OPENBSD)
|
||||
#elif !defined(XP_NETBSD) && !defined(XP_OPENBSD)
|
||||
RefPtr<mozilla::ipc::SharedMemoryBasic> mSharedBuffer;
|
||||
pthread_mutex_t* mMutex;
|
||||
mozilla::Atomic<int32_t>* mCount;
|
||||
|
|
|
@ -1207,7 +1207,8 @@ Result<Ok, LaunchError> PosixProcessLauncher::DoSetup() {
|
|||
MOZ_ASSERT(gGREBinPath);
|
||||
nsCString path;
|
||||
NS_CopyUnicodeToNative(nsDependentString(gGREBinPath), path);
|
||||
# if defined(XP_LINUX) || defined(OS_BSD)
|
||||
# if defined(XP_LINUX) || defined(__DragonFly__) || defined(XP_FREEBSD) || \
|
||||
defined(XP_NETBSD) || defined(XP_OPENBSD)
|
||||
const char* ld_library_path = PR_GetEnv("LD_LIBRARY_PATH");
|
||||
nsCString new_ld_lib_path(path.get());
|
||||
|
||||
|
@ -1217,7 +1218,7 @@ Result<Ok, LaunchError> PosixProcessLauncher::DoSetup() {
|
|||
}
|
||||
mLaunchOptions->env_map["LD_LIBRARY_PATH"] = new_ld_lib_path.get();
|
||||
|
||||
# elif XP_DARWIN // defined(XP_LINUX) || defined(OS_BSD)
|
||||
# elif XP_DARWIN
|
||||
// With signed production Mac builds, the dynamic linker (dyld) will
|
||||
// ignore dyld environment variables preventing the use of variables
|
||||
// such as DYLD_LIBRARY_PATH and DYLD_INSERT_LIBRARIES.
|
||||
|
@ -1245,7 +1246,7 @@ Result<Ok, LaunchError> PosixProcessLauncher::DoSetup() {
|
|||
mLaunchOptions->env_map["OS_ACTIVITY_MODE"] = "disable";
|
||||
}
|
||||
# endif // defined(MOZ_SANDBOX)
|
||||
# endif // defined(XP_LINUX) || defined(OS_BSD)
|
||||
# endif
|
||||
}
|
||||
|
||||
FilePath exePath;
|
||||
|
@ -1304,7 +1305,9 @@ Result<Ok, LaunchError> PosixProcessLauncher::DoSetup() {
|
|||
mChildArgv.push_back(mPidString);
|
||||
|
||||
if (!CrashReporter::IsDummy()) {
|
||||
# if defined(XP_LINUX) || defined(OS_BSD) || defined(XP_SOLARIS)
|
||||
# if defined(MOZ_WIDGET_COCOA)
|
||||
mChildArgv.push_back(CrashReporter::GetChildNotificationPipe());
|
||||
# elif defined(XP_UNIX)
|
||||
int childCrashFd, childCrashRemapFd;
|
||||
if (NS_WARN_IF(!CrashReporter::CreateNotificationPipeForChild(
|
||||
&childCrashFd, &childCrashRemapFd))) {
|
||||
|
@ -1320,10 +1323,7 @@ Result<Ok, LaunchError> PosixProcessLauncher::DoSetup() {
|
|||
// "false" == crash reporting disabled
|
||||
mChildArgv.push_back("false");
|
||||
}
|
||||
# elif defined(MOZ_WIDGET_COCOA) /* defined(XP_LINUX) || defined(OS_BSD) || \
|
||||
defined(XP_SOLARIS) */
|
||||
mChildArgv.push_back(CrashReporter::GetChildNotificationPipe());
|
||||
# endif // defined(XP_LINUX) || defined(OS_BSD) || defined(XP_SOLARIS)
|
||||
# endif
|
||||
}
|
||||
|
||||
int fd = PR_FileDesc2NativeHandle(mCrashAnnotationWritePipe);
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
#include <pthread.h>
|
||||
|
||||
#if !defined(OS_NETBSD)
|
||||
#if !defined(XP_NETBSD)
|
||||
# include <pthread_np.h>
|
||||
#endif
|
||||
|
||||
|
@ -16,7 +16,7 @@ namespace mozilla {
|
|||
namespace ipc {
|
||||
|
||||
void SetThisProcessName(const char* aName) {
|
||||
#if defined(OS_NETBSD)
|
||||
#if defined(XP_NETBSD)
|
||||
pthread_setname_np(pthread_self(), "%s", (void*)aName);
|
||||
#else
|
||||
pthread_set_name_np(pthread_self(), aName);
|
||||
|
|
Загрузка…
Ссылка в новой задаче