ipc/unixfd/UnixFileWatcher.cpp

Wed, 31 Dec 2014 06:55:46 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:46 +0100
changeset 1
ca08bd8f51b2
permissions
-rw-r--r--

Added tag TORBROWSER_REPLICA for changeset 6474c204b198

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

mercurial