|
[dart:io] Namespaces for file IO
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
Committed: https://github.com/dart-lang/sdk/commit/d0295c873c906567d0739a906950874380bafdbb
Total comments: 22
Total comments: 1
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+3572 lines, -1706 lines) |
Patch |
|
M |
pkg/dev_compiler/tool/input_sdk/patch/io_patch.dart
|
View
|
1
2
|
5 chunks |
+51 lines, -29 lines |
0 comments
|
Download
|
|
M |
runtime/bin/dartutils.h
|
View
|
1
|
1 chunk |
+2 lines, -1 line |
0 comments
|
Download
|
|
M |
runtime/bin/dartutils.cc
|
View
|
|
3 chunks |
+17 lines, -2 lines |
0 comments
|
Download
|
|
M |
runtime/bin/directory.h
|
View
|
|
10 chunks |
+29 lines, -14 lines |
0 comments
|
Download
|
|
M |
runtime/bin/directory.cc
|
View
|
|
8 chunks |
+180 lines, -138 lines |
0 comments
|
Download
|
|
M |
runtime/bin/directory_android.cc
|
View
|
1
|
13 chunks |
+158 lines, -106 lines |
0 comments
|
Download
|
|
M |
runtime/bin/directory_fuchsia.cc
|
View
|
1
|
10 chunks |
+239 lines, -132 lines |
0 comments
|
Download
|
|
M |
runtime/bin/directory_linux.cc
|
View
|
1
|
14 chunks |
+113 lines, -67 lines |
0 comments
|
Download
|
|
M |
runtime/bin/directory_macos.cc
|
View
|
|
6 chunks |
+16 lines, -23 lines |
0 comments
|
Download
|
|
M |
runtime/bin/directory_patch.dart
|
View
|
|
2 chunks |
+13 lines, -9 lines |
0 comments
|
Download
|
|
M |
runtime/bin/directory_test.cc
|
View
|
|
4 chunks |
+28 lines, -25 lines |
0 comments
|
Download
|
|
M |
runtime/bin/directory_win.cc
|
View
|
|
7 chunks |
+17 lines, -29 lines |
0 comments
|
Download
|
|
M |
runtime/bin/file.h
|
View
|
|
2 chunks |
+37 lines, -20 lines |
0 comments
|
Download
|
|
M |
runtime/bin/file.cc
|
View
|
|
23 chunks |
+541 lines, -500 lines |
0 comments
|
Download
|
|
M |
runtime/bin/file_android.cc
|
View
|
1
|
17 chunks |
+200 lines, -86 lines |
0 comments
|
Download
|
|
M |
runtime/bin/file_fuchsia.cc
|
View
|
1
|
16 chunks |
+182 lines, -100 lines |
0 comments
|
Download
|
|
M |
runtime/bin/file_linux.cc
|
View
|
1
|
16 chunks |
+171 lines, -76 lines |
0 comments
|
Download
|
|
M |
runtime/bin/file_macos.cc
|
View
|
|
14 chunks |
+50 lines, -33 lines |
0 comments
|
Download
|
|
M |
runtime/bin/file_patch.dart
|
View
|
|
3 chunks |
+28 lines, -18 lines |
0 comments
|
Download
|
|
M |
runtime/bin/file_system_entity_patch.dart
|
View
|
|
1 chunk |
+7 lines, -4 lines |
0 comments
|
Download
|
|
M |
runtime/bin/file_system_watcher.h
|
View
|
|
2 chunks |
+2 lines, -0 lines |
0 comments
|
Download
|
|
M |
runtime/bin/file_system_watcher.cc
|
View
|
|
4 chunks |
+10 lines, -7 lines |
0 comments
|
Download
|
|
M |
runtime/bin/file_system_watcher_android.cc
|
View
|
|
3 chunks |
+7 lines, -1 line |
0 comments
|
Download
|
|
M |
runtime/bin/file_system_watcher_fuchsia.cc
|
View
|
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
|
M |
runtime/bin/file_system_watcher_linux.cc
|
View
|
|
3 chunks |
+4 lines, -0 lines |
0 comments
|
Download
|
|
M |
runtime/bin/file_system_watcher_macos.cc
|
View
|
|
3 chunks |
+4 lines, -1 line |
0 comments
|
Download
|
|
M |
runtime/bin/file_system_watcher_win.cc
|
View
|
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
|
M |
runtime/bin/file_test.cc
|
View
|
|
4 chunks |
+4 lines, -4 lines |
0 comments
|
Download
|
|
M |
runtime/bin/file_win.cc
|
View
|
|
18 chunks |
+40 lines, -23 lines |
0 comments
|
Download
|
|
M |
runtime/bin/gen_snapshot.cc
|
View
|
|
4 chunks |
+4 lines, -4 lines |
0 comments
|
Download
|
|
M |
runtime/bin/io_impl_sources.gni
|
View
|
|
1 chunk |
+7 lines, -0 lines |
0 comments
|
Download
|
|
M |
runtime/bin/io_natives.cc
|
View
|
|
2 chunks |
+44 lines, -41 lines |
0 comments
|
Download
|
|
M |
runtime/bin/io_sources.gni
|
View
|
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
|
M |
runtime/bin/main.cc
|
View
|
1
|
11 chunks |
+29 lines, -7 lines |
0 comments
|
Download
|
|
A |
runtime/bin/namespace.h
|
View
|
1
|
1 chunk |
+96 lines, -0 lines |
0 comments
|
Download
|
|
A |
runtime/bin/namespace.cc
|
View
|
1
|
1 chunk |
+138 lines, -0 lines |
0 comments
|
Download
|
|
A |
runtime/bin/namespace_android.cc
|
View
|
1
|
1 chunk |
+103 lines, -0 lines |
0 comments
|
Download
|
|
A |
runtime/bin/namespace_fuchsia.cc
|
View
|
|
1 chunk |
+103 lines, -0 lines |
0 comments
|
Download
|
|
A |
runtime/bin/namespace_linux.cc
|
View
|
1
|
1 chunk |
+103 lines, -0 lines |
0 comments
|
Download
|
|
A |
runtime/bin/namespace_macos.cc
|
View
|
|
1 chunk |
+66 lines, -0 lines |
0 comments
|
Download
|
|
A |
runtime/bin/namespace_patch.dart
|
View
|
|
1 chunk |
+45 lines, -0 lines |
0 comments
|
Download
|
|
A |
runtime/bin/namespace_win.cc
|
View
|
|
1 chunk |
+67 lines, -0 lines |
0 comments
|
Download
|
|
M |
runtime/bin/platform_android.cc
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
runtime/bin/platform_fuchsia.cc
|
View
|
|
2 chunks |
+6 lines, -6 lines |
0 comments
|
Download
|
|
M |
runtime/bin/platform_linux.cc
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
runtime/bin/platform_macos.cc
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
runtime/bin/platform_win.cc
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
runtime/bin/process.h
|
View
|
|
2 chunks |
+3 lines, -1 line |
0 comments
|
Download
|
|
M |
runtime/bin/process.cc
|
View
|
|
10 chunks |
+25 lines, -22 lines |
0 comments
|
Download
|
|
M |
runtime/bin/process_android.cc
|
View
|
|
11 chunks |
+26 lines, -13 lines |
0 comments
|
Download
|
|
M |
runtime/bin/process_fuchsia.cc
|
View
|
|
8 chunks |
+20 lines, -9 lines |
0 comments
|
Download
|
|
M |
runtime/bin/process_linux.cc
|
View
|
|
10 chunks |
+56 lines, -14 lines |
0 comments
|
Download
|
|
M |
runtime/bin/process_macos.cc
|
View
|
|
2 chunks |
+3 lines, -1 line |
0 comments
|
Download
|
|
M |
runtime/bin/process_patch.dart
|
View
|
|
3 chunks |
+3 lines, -0 lines |
0 comments
|
Download
|
|
M |
runtime/bin/process_win.cc
|
View
|
|
1 chunk |
+2 lines, -1 line |
0 comments
|
Download
|
|
M |
runtime/bin/security_context.cc
|
View
|
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
runtime/bin/security_context_fuchsia.cc
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
runtime/bin/security_context_linux.cc
|
View
|
|
1 chunk |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
runtime/bin/snapshot_utils.cc
|
View
|
|
4 chunks |
+4 lines, -4 lines |
0 comments
|
Download
|
|
M |
runtime/vm/benchmark_test.cc
|
View
|
|
3 chunks |
+3 lines, -3 lines |
0 comments
|
Download
|
|
M |
sdk/lib/_internal/js_runtime/lib/io_patch.dart
|
View
|
1
2
|
5 chunks |
+51 lines, -29 lines |
0 comments
|
Download
|
|
M |
sdk/lib/io/directory_impl.dart
|
View
|
|
14 chunks |
+40 lines, -28 lines |
0 comments
|
Download
|
|
M |
sdk/lib/io/file_impl.dart
|
View
|
|
18 chunks |
+61 lines, -41 lines |
0 comments
|
Download
|
|
M |
sdk/lib/io/file_system_entity.dart
|
View
|
|
9 chunks |
+16 lines, -15 lines |
0 comments
|
Download
|
|
M |
sdk/lib/io/io.dart
|
View
|
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
|
M |
sdk/lib/io/io_sources.gni
|
View
|
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
|
M |
sdk/lib/io/link.dart
|
View
|
|
6 chunks |
+12 lines, -9 lines |
0 comments
|
Download
|
|
A |
sdk/lib/io/namespace_impl.dart
|
View
|
1
|
1 chunk |
+23 lines, -0 lines |
0 comments
|
Download
|
|
M |
tests/standalone/io/directory_test.dart
|
View
|
|
2 chunks |
+17 lines, -0 lines |
0 comments
|
Download
|
|
A |
tests/standalone/io/namespace_test.dart
|
View
|
|
1 chunk |
+232 lines, -0 lines |
0 comments
|
Download
|
|
M |
tests/standalone/standalone.status
|
View
|
1
|
1 chunk |
+0 lines, -1 line |
0 comments
|
Download
|
Total messages: 11 (4 generated)
|