mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 08:07:11 +00:00
d0295c873c
Fuchsia requires the ability to sandbox Isolates w.r.t. file IO. When a new Isolate starts, Fuchsia will pass the Isolate an object called a namespace. We can translate the namespace object into a file descriptor suitable for passing to the *at() family of POSIX file system calls. The file system calls will then have visibility only into the specified namespace. We also plumb Namespaces through on all the other platforms as well to make the change easier to test and so that in the future we can implement e.g. per-isolate cwds. This change adds a new internal class to dart:io called _Namespace, which is implemented in a patch file. See: sdk/lib/io/namespace_impl.dart runtime/bin/namespace_patch.dart The embedder can set up a non-default namespace by calling _Namespace._setupNamespace during Isolate setup. Instances of _Namespace have a native field that holds a pointer to a native Namespace object. See: runtime/bin/namespace.h Calls from e.g. file_impl.dart are now also passed a _Namespace object. The implementations in e.g. file.cc and file_linux.cc then extract the namespace, and use it to compute a file descriptor and path suitable for passing to e.g. openat(). related US-313 R=asiva@google.com, rmacnak@google.com Review-Url: https://codereview.chromium.org/3007703002 .
51 lines
1.2 KiB
C++
51 lines
1.2 KiB
C++
// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
#include "platform/globals.h"
|
|
#if defined(HOST_OS_FUCHSIA)
|
|
|
|
#include "bin/file_system_watcher.h"
|
|
|
|
namespace dart {
|
|
namespace bin {
|
|
|
|
Dart_Handle FileSystemWatcher::ReadEvents(intptr_t id, intptr_t path_id) {
|
|
UNIMPLEMENTED();
|
|
return DartUtils::NewDartOSError();
|
|
}
|
|
|
|
intptr_t FileSystemWatcher::GetSocketId(intptr_t id, intptr_t path_id) {
|
|
UNIMPLEMENTED();
|
|
return -1;
|
|
}
|
|
|
|
bool FileSystemWatcher::IsSupported() {
|
|
return false;
|
|
}
|
|
|
|
void FileSystemWatcher::UnwatchPath(intptr_t id, intptr_t path_id) {
|
|
UNIMPLEMENTED();
|
|
}
|
|
|
|
intptr_t FileSystemWatcher::Init() {
|
|
return 0;
|
|
}
|
|
|
|
void FileSystemWatcher::Close(intptr_t id) {
|
|
UNIMPLEMENTED();
|
|
}
|
|
|
|
intptr_t FileSystemWatcher::WatchPath(intptr_t id,
|
|
Namespace* namespc,
|
|
const char* path,
|
|
int events,
|
|
bool recursive) {
|
|
UNIMPLEMENTED();
|
|
return -1;
|
|
}
|
|
|
|
} // namespace bin
|
|
} // namespace dart
|
|
|
|
#endif // defined(HOST_OS_FUCHSIA)
|