Commit Graph

67 Commits

Author SHA1 Message Date
Ryan Macnak 971f4845d7 [build] Remove last platform -> vm and bin -> vm dependencies. Fix some ODR violations.
Change some static_libraries to source_sets to make ODR violations link-time errors.

This is needed to enable (stop suppressing) -fvisibility=hidden in Fuchsia product builds.

Change-Id: I699cec8d4b516beab9cebf9db0a522a7ff99e004
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99822
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-04-22 20:15:43 +00:00
Zachary Anderson d0295c873c [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

Review-Url: https://codereview.chromium.org/3007703002 .
2017-08-30 09:34:36 -07:00
Zachary Anderson 6cd8a79078 VM: Re-format to use at most one newline between functions
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2974233002 .
2017-07-13 08:08:37 -07:00
Erik Corry 029b1cb948 Spelling fixes e to i.
R=kevmoo@google.com
BUG=

Review-Url: https://codereview.chromium.org/2957593002 .
2017-06-24 13:41:39 +02:00
Ryan Macnak 877284947b Rename TARGET_OS_* to HOST_OS_*.
Like HOST_ARCH_*, HOST_OS_* describes the OS the VM is running on, which may be different from the OS the VM is generating code for during AOT compilation.

Currently we conflate the two when emitting AOT as assembly, and we get away with it because Flutter only uses assembly for targeting iOS and one can only target iOS from a Mac, but we expect to use assembly for Android as well so native tools can unwind Dart frames.

R=zra@google.com

Review-Url: https://codereview.chromium.org/2750843003 .
2017-03-15 13:11:05 -07:00
Zachary Anderson 479a97b129 clang-format runtime/bin
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2480793002 .
2016-11-04 12:30:56 -07:00
Zach Anderson b6ea87c444 [windows] Make most file_win.cc functions use malloc for string conversions.
They have been using Dart_ScopeAllocate(), which makes them impossible
to use outside of a scope.

Also turn on inlining in the GN Debug windows build to match the gyp build
and speed things up a bit.

R=asiva@google.com, rmacnak@google.com

Review URL: https://codereview.chromium.org/2439173002 .
2016-10-21 14:55:37 -07:00
Zachary Anderson c75a817ee0 Fixes some memory leaks in //runtime/bin
Also some style cleanups.

Decided to fix these leaks by using Dart_ScopeAllocate
instead of malloc and new. Leaks are noted in the CL.

I haven't finished looking over all the code in
//runtime/bin yet, but this CL was getting big.

Review URL: https://codereview.chromium.org/1781883002 .
2016-03-14 11:08:52 -07:00
Soren Gjesse 0415d9271d Improve the encoding/decoding to/from system encoding on Windows
On Windows the dart:io SYSTEM_ENCODING is now also working with strings
which have null characters in them. Previously the string would be
terminated at the null character.

BUG=https://github.com/dart-lang/sdk/issues/23295
R=kustermann@google.com, lrn@google.com

Review URL: https://codereview.chromium.org//1194883002.
2015-06-24 10:36:05 +02:00
ajohnsen@google.com 13efa12329 Clean up recursive deletion on windows.
BUG=
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//276593005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35900 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-08 10:31:33 +00:00
ajohnsen@google.com 5aa521fa7b Report the correct error, when recursive delete fails on Windows.
BUG=
R=ricow@google.com

Review URL: https://codereview.chromium.org//227913007

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34933 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-10 17:13:02 +00:00
ajohnsen@google.com eba430a424 Allow paths up to 32767 characters on Windows (so '\\?\' can be used).
BUG=https://code.google.com/p/dart/issues/detail?id=16264
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//145623011

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32308 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-05 07:28:02 +00:00
ajohnsen@google.com daa4a59dbc Really fix Windows build.
BUG=

Review URL: https://codereview.chromium.org//130973005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31654 260f80e4-7a28-3924-810f-c04153c831b5
2014-01-09 11:23:01 +00:00
ajohnsen@google.com d04f006cdd Fix Windows impl.
BUG=

Review URL: https://codereview.chromium.org//131403002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31653 260f80e4-7a28-3924-810f-c04153c831b5
2014-01-09 10:38:11 +00:00
ajohnsen@google.com 754c1d2b2a Fix listing of '' and '/'.
BUG=https://code.google.com/p/dart/issues/detail?id=15966
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//131373002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31652 260f80e4-7a28-3924-810f-c04153c831b5
2014-01-09 10:33:56 +00:00
ajohnsen@google.com c3a9f33ef8 Fix directory-listing to return a future on cancel.
This also fixes an issue where we would leake FDs/HANDLEs if the listing was interrupted.

Add new pause-resume-cancel test of directory listing.

BUG=https://code.google.com/p/dart/issues/detail?id=10163
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//45833003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29454 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-29 15:04:59 +00:00
whesse@google.com 3c0c99a3b9 Add Directory.systemTemp getter to replace createSystemTemp().
BUG=dartbug.com/12496
R=rnystrom@google.com, sgjesse@google.com

Review URL: https://codereview.chromium.org//25720002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28215 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-03 12:55:30 +00:00
whesse@google.com b221c702a3 dart:io | Add Directory.CreateSystemTemp(template) and change Directory.CreateTemp(template).
BUG=dartbug.com/12496
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//25279003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28097 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-01 15:38:01 +00:00
whesse@google.com 27600274c8 Fix error handling when current working directory is deleted.
BUG=
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//23702037

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27433 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-12 14:30:23 +00:00
iposva@google.com 55f0303ff3 - Fix PATH_MAX vs MAX_PATH confusion.
Review URL: https://codereview.chromium.org//17190005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24150 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-18 16:24:20 +00:00
iposva@google.com 7769854d0d - Do NOT mix malloc/free and new/delete!
R=sgjesse@google.com, sigmund@google.com

Review URL: https://codereview.chromium.org//16929007

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24145 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-18 15:44:21 +00:00
ajohnsen@google.com 1b83d3b52e Make Directory.list pull-based, making it possible to pause, resume and cancel directory listing.
BUG=https://code.google.com/p/dart/issues/detail?id=10163,
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//16813006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24074 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-17 07:27:19 +00:00
asiva@google.com dee399907b Fix windows build.
Review URL: https://codereview.chromium.org//14680010

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@22515 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-08 16:58:32 +00:00
sgjesse@google.com 2ef54d314a Add the ability to change the working directory
Directory.current have been changed from a factory constructor to a
getter and setter. The getter returns a Direcotry object holding the
current working directory. The setter changes the current working
directory of the Dart process.

R=whesse@google.com

BUG=https://code.google.com/p/dart/issues/detail?id=6316, https://code.google.com/p/dart/issues/detail?id=8893

Review URL: https://codereview.chromium.org//13896034

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@22116 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-29 12:43:53 +00:00
smok@google.com ebbc2020a2 Put everything in runtime/bin into '::dart::bin' namespace.
Review URL: https://codereview.chromium.org//14341015

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@22032 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-25 14:22:30 +00:00
whesse@google.com 7c56d46086 dart:io | Ensure that Directory.list terminates even when symbolic links create loops in the file system.
BUG=

Review URL: https://codereview.chromium.org//13818010

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21199 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-10 13:07:08 +00:00
ajohnsen@google.com 1bae12223b Fix recursive directory-deletion of top-level files/links.
BUG=

Review URL: https://codereview.chromium.org//13771010

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21060 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-08 11:30:33 +00:00
ajohnsen@google.com 9a3e62e09a Report same error-code on windows for all not-found cases.
BUG=

Review URL: https://codereview.chromium.org//13638028

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21047 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-08 07:58:46 +00:00
ajohnsen@google.com e75df511a6 Change how File/Directory/Link .delete works.
Now:
- File.delete works iff path is File or Link.
- Directory.delete works iff path is Directory or Link.
- Link.delete works iff path Link.

This now matches .exists.

BUG=

Review URL: https://codereview.chromium.org//13654002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21045 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-08 07:44:18 +00:00
ajohnsen@google.com 578331c57e Fix directory-listing, directory-deletion and file deletion, when links are involved.
BUG=https://code.google.com/p/dart/issues/detail?id=4928,https://code.google.com/p/dart/issues/detail?id=9278,https://code.google.com/p/dart/issues/detail?id=9504

Review URL: https://codereview.chromium.org//13578003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20929 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-04 17:30:17 +00:00
whesse@google.com d2ea504b60 dart:io | Add "followLinks" optional parameter to Directory.list, let it return Link objects when false.
BUG=dartbug.com/7720

Review URL: https://codereview.chromium.org//12638039

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20370 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-22 09:56:14 +00:00
iposva@google.com 9046a44a37 Prepare for removal of source_filter.gypi:
- Guard OS-dependent source files with #if TARGET_OS_* in a similar
  fashion to the architecture dependent sources.
Review URL: https://codereview.chromium.org//12282051

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18786 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-20 21:17:38 +00:00
whesse@google.com f15afd86b2 dart:io Directory.list: Fix use of snprintf return value to work with both C99, Windows, and pre-C99 versions of snprintf.
BUG=

Review URL: https://codereview.chromium.org//12326007

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18754 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-20 13:34:50 +00:00
whesse@google.com a2bd479106 IO v2: Use a single PathBuffer in Directory.list on Windows, and stop rewriting paths during listing.
Review URL: https://codereview.chromium.org//12212194

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18740 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-20 09:42:28 +00:00
whesse@google.com acd03abf83 dart:io: Use PathBuffer class for Directory.list on Windows platform.
BUG=https://code.google.com/p/dart/issues/detail?id=7505

Review URL: https://codereview.chromium.org//12252006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18448 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-13 15:00:55 +00:00
whesse@google.com 1a4082724c Revert changes to directory listing on Windows, to diagnose pub problems.
TBR=nweiz@google.com

BUG=

Review URL: https://codereview.chromium.org//12210086

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18260 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-08 16:47:33 +00:00
whesse@google.com 58e8b94008 Use a PathBuffer class in dart:io directory lister.
This simplifies the code, and avoids buffer overflow errors
by encapsulating snprintf.

BUG=

Review URL: https://codereview.chromium.org//12220034

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18247 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-08 11:58:12 +00:00
whesse@google.com 7f499abb04 Fix race condition in Directory.create.
BUG=https://code.google.com/p/dart/issues/detail?id=7679

Review URL: https://codereview.chromium.org//11794048

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16842 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-09 09:59:14 +00:00
ager@google.com b54f69bc18 Use unicode versions of all directory system calls on Windows.
R=sgjesse@google.com
BUG=

Review URL: https://codereview.chromium.org//11550014

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16043 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-12 15:01:48 +00:00
ager@google.com 8a14c1c319 Use FormatMessageW for Windows error messages to handle internationalized messages correctly.
R=sgjesse@google.com
BUG=dartbug.com/6986

Review URL: https://codereview.chromium.org//11558012

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16041 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-12 14:39:21 +00:00
gram@google.com 3601944836 Revised CL for customisable logging (replacing printfs).
Review URL: https://codereview.chromium.org//11312242

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15096 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-19 17:38:15 +00:00
ager@google.com 28b43144e5 Update dart:io to convert strings between UTF8 and current code page
when interacting with the system.

What we get from and need to hand to the VM is utf8. What we
get from and need to hand to the system is in the current
code page.

R=sgjesse@google.com
BUG=

Review URL: https://codereview.chromium.org//11275281

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14851 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-13 15:03:23 +00:00
ager@google.com ccced31671 Change Directory.create to not fail on existing directory with that name.
The new semantics is to ensure that a directory with that name
exists. There is no way to reliably guard a create call against
existing directories in an async program.

R=sgjesse@google.com
BUG=

Review URL: https://codereview.chromium.org//11175054

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@13933 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-23 09:15:01 +00:00
ager@google.com d2d65ee3b5 Fix for Directory.exists on Windows using GetFileAttributes
based on patch from Alexander Aprelev.

Discriminate different reasons for not being able to get
the file attributes. Currently this makes no difference since
both DOES_NOT_EXIST and UNKNOWN turn into a false return value
from Directory.existsSync().

R=sgjesse@google.com
BUG=3914

Review URL: https://chromiumcodereview.appspot.com//10916206

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12106 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-10 10:38:46 +00:00
rnystrom@google.com f65d68a677 When a directory contains read-only files, try to make them writable when recursively deleting on Windows.
Review URL: https://chromiumcodereview.appspot.com//10867003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@11175 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-22 16:46:21 +00:00
rnystrom@google.com 1e14772bb0 Don't traverse through junctions when recursively deleting on Windows.
Review URL: https://chromiumcodereview.appspot.com//10825413

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@11005 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-20 23:25:13 +00:00
ager@google.com 0d58bde8be Add support for directory renaming to dart:io.
R=sgjesse@google.com
BUG=dartbug:3104
TEST=standalone/io/directory*

Review URL: https://chromiumcodereview.appspot.com//10414046

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7848 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-22 12:46:25 +00:00
ager@google.com c278f6da23 Fix directory listing to actually have the semantics intended.
The directory listing will continue on error (such as broken links)
and the boolean indication when listing is complete will signal
if all operations succeeded.

R=sgjesse@google.com
BUG=dartbug.com/3031
TEST=standalone/io/file_system_links_test.dart

Review URL: https://chromiumcodereview.appspot.com//10381150

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7655 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-15 14:33:17 +00:00
sgjesse@google.com 471f1c772c Add error handling to directory
The directory object now has error handling like the rest of the
dart:io. The added tests to some extend overlaps with some of the
tests in DirectpryTest.dart, but I found it better to have error tests
in a single place.

I removed a few type checks sitting in the C++ code for the native
functions as for file we currently don't have them. I have opened
issue 2305 regarding where to do type checks for dart:io native
functions.

R=ager@google.com

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9773018

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5866 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-27 08:50:35 +00:00
sgjesse@google.com 84836f8c56 Error reporting on File in dart:io
This implements consistent error reporting on all methods on File in dart:io. The async onError method is called with an exception argument which is the same exception as would have been thrown from the corresponding sync method.

The one method on Directory which already did this has been updated as well.

R=ager@google.com

BUG=none
TEST=tests/standalone/src/io/FileTest.dart, tests/standalone/src/io/FileInvalidArgumentsTest.dart

Review URL: https://chromiumcodereview.appspot.com//9630012

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5396 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-13 13:00:47 +00:00