michael@0: /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */ michael@0: /* vim: set ts=2 et sw=2 tw=80: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include michael@0: #include "UnixFileWatcher.h" michael@0: michael@0: namespace mozilla { michael@0: namespace ipc { michael@0: michael@0: UnixFileWatcher::~UnixFileWatcher() michael@0: { michael@0: } michael@0: michael@0: nsresult michael@0: UnixFileWatcher::Open(const char* aFilename, int aFlags, mode_t aMode) michael@0: { michael@0: MOZ_ASSERT(MessageLoopForIO::current() == GetIOLoop()); michael@0: MOZ_ASSERT(aFlags & O_NONBLOCK); michael@0: michael@0: int fd = TEMP_FAILURE_RETRY(open(aFilename, aFlags, aMode)); michael@0: if (fd < 0) { michael@0: OnError("open", errno); michael@0: return NS_ERROR_FAILURE; michael@0: } michael@0: SetFd(fd); michael@0: OnOpened(); michael@0: michael@0: return NS_OK; michael@0: } michael@0: michael@0: UnixFileWatcher::UnixFileWatcher(MessageLoop* aIOLoop) michael@0: : UnixFdWatcher(aIOLoop) michael@0: { michael@0: } michael@0: michael@0: UnixFileWatcher::UnixFileWatcher(MessageLoop* aIOLoop, int aFd) michael@0: : UnixFdWatcher(aIOLoop, aFd) michael@0: { michael@0: } michael@0: michael@0: } michael@0: }