Bumping manifests a=b2g-bump
[gecko.git] / ipc / unixfd / UnixFileWatcher.cpp
blob67e247b5b2b0bc6adea3f4d7eb680feac8ca02dd
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()
17 nsresult
18 UnixFileWatcher::Open(const char* aFilename, int aFlags, mode_t aMode)
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;
28 SetFd(fd);
29 OnOpened();
31 return NS_OK;
34 UnixFileWatcher::UnixFileWatcher(MessageLoop* aIOLoop)
35 : UnixFdWatcher(aIOLoop)
39 UnixFileWatcher::UnixFileWatcher(MessageLoop* aIOLoop, int aFd)
40 : UnixFdWatcher(aIOLoop, aFd)