ipc/unixfd/UnixFileWatcher.cpp

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

michael@0 1 /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
michael@0 2 /* vim: set ts=2 et sw=2 tw=80: */
michael@0 3 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 #include <fcntl.h>
michael@0 8 #include "UnixFileWatcher.h"
michael@0 9
michael@0 10 namespace mozilla {
michael@0 11 namespace ipc {
michael@0 12
michael@0 13 UnixFileWatcher::~UnixFileWatcher()
michael@0 14 {
michael@0 15 }
michael@0 16
michael@0 17 nsresult
michael@0 18 UnixFileWatcher::Open(const char* aFilename, int aFlags, mode_t aMode)
michael@0 19 {
michael@0 20 MOZ_ASSERT(MessageLoopForIO::current() == GetIOLoop());
michael@0 21 MOZ_ASSERT(aFlags & O_NONBLOCK);
michael@0 22
michael@0 23 int fd = TEMP_FAILURE_RETRY(open(aFilename, aFlags, aMode));
michael@0 24 if (fd < 0) {
michael@0 25 OnError("open", errno);
michael@0 26 return NS_ERROR_FAILURE;
michael@0 27 }
michael@0 28 SetFd(fd);
michael@0 29 OnOpened();
michael@0 30
michael@0 31 return NS_OK;
michael@0 32 }
michael@0 33
michael@0 34 UnixFileWatcher::UnixFileWatcher(MessageLoop* aIOLoop)
michael@0 35 : UnixFdWatcher(aIOLoop)
michael@0 36 {
michael@0 37 }
michael@0 38
michael@0 39 UnixFileWatcher::UnixFileWatcher(MessageLoop* aIOLoop, int aFd)
michael@0 40 : UnixFdWatcher(aIOLoop, aFd)
michael@0 41 {
michael@0 42 }
michael@0 43
michael@0 44 }
michael@0 45 }

mercurial