Commit Graph

42 Commits

Author SHA1 Message Date
Dan Field eb73f132c1 [vm] Add macro for fallthrough annotations
Internal builds in Google are catching this as an error.

I'm guarding it because I assume we might support building using other
compilers.

Change-Id: I665099cace9c6a40d737c471dd1b0fdb326fea39
Reviewed-on: https://dart-review.googlesource.com/c/91162
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-02-15 01:12:01 +00:00
Zachary Anderson 732bb45c45 [dart:io] Remove double-close from recursive directory delete
closedir() closes the file descriptor wrapped by the DIR, so we
shouldn't close it again.

R=bkonyi@google.com

Review-Url: https://codereview.chromium.org/3005883002 .
2017-08-30 12:49:05 -07: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
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 a919399031 Fix directory existence query error
fixes #28147

R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2580133002 .
2016-12-16 20:58:52 -08:00
Zachary Anderson 4b9087f9f5 Handle non-regular files in recursive delete
Fix is similar to the fix for directory listing from last week.

R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2573143002 .
2016-12-14 12:54:59 -08:00
Zachary Anderson 4f04970a13 Handle non-regular file types in the directory lister
fixes #28015

R=floitsch@google.com

Review URL: https://codereview.chromium.org/2556313002 .
2016-12-08 10:02:04 -08: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
John McCutchan b6e17330ed Fix DevFS on Android devices
- [x] Allow a system temporary directory to be set on Android.
- [x] This is set on Flutter's engine startup path which fixes DevFS on Android devices.

Related to https://github.com/dart-lang/sdk/issues/4413

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2156243002 .
2016-07-18 10:45:53 -07:00
Zachary Anderson 88ad41c959 Fix Android build warnings
R=regis@google.com

Review URL: https://codereview.chromium.org/1809743002 .
2016-03-16 11:17:53 -07:00
Zachary Anderson 45661a7091 Cleanup in //runtime/bin
R=iposva@google.com

Review URL: https://codereview.chromium.org/1800863002 .
2016-03-16 10:01:00 -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
Zachary Anderson 7c2c02d6a6 Fix x86-64 Android build.
R=iposva@google.com, johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1761953002 .
2016-03-03 11:11:31 -08:00
ajohnsen@google.com df14081452 Make opendir test for EINTR again and make NO_RETRY_EXPECTED check in release mode.
BUG=
R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35352 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-24 06:38:16 +00:00
ajohnsen@google.com ab53006509 Fix recursive directory deletion, to not leak file descriptors (and pointers).
BUG=
R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35310 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-23 12:09:12 +00:00
ajohnsen@google.com 0c157cd31e Move signal_blocker to platform and use it by default in TEMP_FAILURE_RETRY.
BUG=http://code.google.com/p/dart/issues/detail?id=16927
R=johnmccutchan@google.com, sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33745 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-17 13:51: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 545455cccb Undo some of the large-file changes on Android, as only some of them are implemented.
BUG=
R=zra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30415 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-19 16:24:10 +00:00
ajohnsen@google.com 7fef1ff77a Add support for working with large files on unix systems, in dart:io.
BUG=
R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30399 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-19 11:38:20 +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
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
whesse@google.com a76b78a26e dart:io | Fix a few bugs in the Android port of dart:io.
BUG=
R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@23260 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-28 12:58:30 +00:00
whesse@google.com 169df28d14 Fix some errors in the Android compilation of standalone Dart.
BUG=
R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@23138 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-24 12:34:01 +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 0693221741 dart:io | Directory.list: Add some missing lines to macos and android versions of implementation.
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21201 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-10 13:47:22 +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 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 25e5ba7f5f Change Directory.list to use the input path, and not resolve it to a full path.
All paths reported by Directory.list are now extensions of the input path.

The Windows platform equivalent change will be committed in a separate CL.

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18739 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-20 09:27:08 +00:00
whesse@google.com 45e351e689 Add string.h header file to directory listing implementations.
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18248 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-08 12:21:56 +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
jackpal@google.com e060b66a3e Add _android files for building DartVM on Android
Split directory_posix -> directory_(android|linux|macos)
  This allows us to cleanly make Android-specific changes to
  directory_android.cc

Copy all _linux files to _android files and edit as needed to account
for the differences between Linux and Android:

 + getcwd(0, NULL) doesn't work on Android, have to emulate
 + Android doesn't have a '/tmp' directory, have to emulate
 + Android doesn't provide mkdtemp(), have to emulate.
 + Small differences in the available system include files.
 + Use pthread_cond_timedwait_monotonic instead of
   pthread_condattr_setclock

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10613 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-13 23:06:52 +00:00