ipc/unixfd/UnixFileWatcher.cpp

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/ipc/unixfd/UnixFileWatcher.cpp	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,45 @@
     1.4 +/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
     1.5 +/* vim: set ts=2 et sw=2 tw=80: */
     1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#include <fcntl.h>
    1.11 +#include "UnixFileWatcher.h"
    1.12 +
    1.13 +namespace mozilla {
    1.14 +namespace ipc {
    1.15 +
    1.16 +UnixFileWatcher::~UnixFileWatcher()
    1.17 +{
    1.18 +}
    1.19 +
    1.20 +nsresult
    1.21 +UnixFileWatcher::Open(const char* aFilename, int aFlags, mode_t aMode)
    1.22 +{
    1.23 +  MOZ_ASSERT(MessageLoopForIO::current() == GetIOLoop());
    1.24 +  MOZ_ASSERT(aFlags & O_NONBLOCK);
    1.25 +
    1.26 +  int fd = TEMP_FAILURE_RETRY(open(aFilename, aFlags, aMode));
    1.27 +  if (fd < 0) {
    1.28 +    OnError("open", errno);
    1.29 +    return NS_ERROR_FAILURE;
    1.30 +  }
    1.31 +  SetFd(fd);
    1.32 +  OnOpened();
    1.33 +
    1.34 +  return NS_OK;
    1.35 +}
    1.36 +
    1.37 +UnixFileWatcher::UnixFileWatcher(MessageLoop* aIOLoop)
    1.38 +: UnixFdWatcher(aIOLoop)
    1.39 +{
    1.40 +}
    1.41 +
    1.42 +UnixFileWatcher::UnixFileWatcher(MessageLoop* aIOLoop, int aFd)
    1.43 +: UnixFdWatcher(aIOLoop, aFd)
    1.44 +{
    1.45 +}
    1.46 +
    1.47 +}
    1.48 +}

mercurial