Commit Graph

37 Commits

Author SHA1 Message Date
Adam Barth 57d256377c [fuchsia] Update for port API change
zx_port_wait and zx_port_queue no longer take an unused count parameter.

Change-Id: I62f03871282d076638c51527603473252821d316
Reviewed-on: https://dart-review.googlesource.com/56705
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Adam Barth <abarth@google.com>
2018-05-25 19:43:15 +00:00
Garret Kelly 7ff1a22d3d Call zx_port_{wait,queue} with correct count
In the near future zx_port_{wait,queue} will not accept a count of zero.
Change all callers to call these functions with a count of one.

Change-Id: If37933344e07b96f07504e2837c0c12133a7cb4e
Reviewed-on: https://dart-review.googlesource.com/51500
Reviewed-by: Zach Anderson <zra@google.com>
2018-04-17 15:53:08 +00:00
Sean Klein e4b72146ca Reduce usage of LP_CLONE_FDIO_CWD
To pass a CWD to a child through launchpad, simply set
the PWD environment variable, and the child will open
their CWD relative to their root handle when they initialize.

Change-Id: I24cd01c05e705c5a0ec2dfbaae4dbe8de42d7ed4
Reviewed-on: https://dart-review.googlesource.com/15421
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2017-10-20 03:50:27 +00:00
Ryan Macnak 3609522166 printf format checking is a compiler feature, not a platform feature.
Change-Id: Ib3e0beb814b5cae6f2b4be13f055069f682674f5
Reviewed-on: https://dart-review.googlesource.com/11645
Reviewed-by: Zach Anderson <zra@google.com>
2017-10-09 22:26:01 +00:00
George Kulakowski daa92a9401 [fuchsia] Remove some unneeded reinterpret_casts around port syscalls
Shortly, the zx_port_queue and zx_port_wait system calls will take
pointers to zx_port_packet_t instead of void. They currently take void
as the last vestiges of the ports v1 and v2 compatibility story.

All callers are passing actual pointers to zx_port_packet_t, so there
is no real code change.

Change-Id: I8f61791846c7693d70edc8c37c1973e8637949bb
Reviewed-on: https://dart-review.googlesource.com/9796
Reviewed-by: Zach Anderson <zra@google.com>
2017-10-02 18:02:14 +00:00
George Kulakowski 5923ff4900 Reorder Fuchsia file headers and gn format
These were left out of order by the mechanical changes that were part
of Fuchsia's Magenta->Zircon rename.

Change-Id: I41c81eb889c6076ffe82102018721e5abc74e7ac
Reviewed-on: https://dart-review.googlesource.com/6165
Reviewed-by: Zach Anderson <zra@google.com>
2017-09-15 20:28:49 +00:00
George Kulakowski 7800d2a995 Rename Magenta to Zircon, along with related abbreviations
Change-Id: Ic4215ceb00f5a60d21ec1398fd398a9f78a9eb94
Reviewed-on: https://dart-review.googlesource.com/6100
Reviewed-by: Zach Anderson <zra@google.com>
2017-09-15 14:54:18 +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 747868f2b1 [dart:io] Remove DART_IO_DISABLED
This was only used by Dartium.

Review-Url: https://codereview.chromium.org/3009523002 .
2017-08-24 11:17:52 -07:00
Zachary Anderson e8eebba056 [Fuchsia] Fix Process exit code handler
There was a bug in the logic for maintaining the array of handles to
wait on. Using the ports API instead removes the need to maintain an
array of handles.

R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2992803002 .
2017-08-01 13:57:41 -07:00
Zachary Anderson 4b752eaf05 [Fuchsia] Fixes and cleanup for launchpad_vmo_from_file() deprecation
R=rmacnak@google.com, swetland@google.com

Review-Url: https://codereview.chromium.org/2986803002 .
2017-07-24 13:32:15 -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 9bbfd08910 [fuchsia] Use 0 instead of the deprecated MX_PORT_OPT_V2 option
Magenta has removed ports v1, and subsequently deprecated the need for
the MX_PORT_OPT_V2 option.

R=zra@google.com

Review-Url: https://codereview.chromium.org/2973893002 .
2017-07-07 10:00:16 -07:00
Zachary Anderson 10d343f295 [Fuchsia] Fix definition of Process::ClearSignalHandler()
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2960233003 .
2017-06-28 15:55:26 -07:00
Zachary Anderson 2a9d570f4d Use POLL* rather than EPOLL* event bits on Fuchsia
Fuchsia defines these bits identically. We are removing epoll from
Fuchsia shortly, so use the <poll.h> ones.

R=zra@google.com

Review-Url: https://codereview.chromium.org/2955023003 .
2017-06-26 14:21:27 -07:00
Adam Barth 2e55f22810 Use LP_CLONE_MXIO_NAMESPACE instead of LP_CLONE_MXIO_ROOT
The new name reflects MXIO_ROOT being deprecated.
2017-06-26 12:07:53 -07:00
Zachary Anderson bad6b64062 [Fuchsia] EventHandler: epoll -> ports v2
This CL rewrites the EventHandler on Fuchsia to use
the low-level ports system call API instead of the
epoll() emulation in musl. This will allow the
Magenta team to remove the epoll() emulation and
the deprecated system call API it is based on.

The new ports API doesn't provide epoll()-like
edge-triggering that clients of the EventHandler
expect. Therefore, this CL emulates it by adding
a level of indirection through a new "IOHandle"
object, which the socket code now uses instead
of file descriptors. This is similar to what we do
on Windows. See the comment at the top of
eventhandler_fuchsia.cc for more details.

Fuchsia issue US-251

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2910853002 .
2017-06-23 10:41:21 -07:00
Zachary Anderson a834e6dcf3 Update Fuchsia-specific code to use the new MX_ error names
R=zra@google.com

Review-Url: https://codereview.chromium.org/2935483002 .
2017-06-09 13:19:54 -07:00
James Robinson d32e55e17b [fuchsia] Replace use of epoll with mx_ primitives in process_fuchsia
process_fuchsia.cc has the ability to drain stdout, stderr, and exit
status from a child process. It was using epoll to multiplex these
streams which worked but required complicated emulation in libc which
we'd like to unwind as well as some tricky locking. This replaces the
epoll with a direct mx_object_wait_many() call that waits on the
Magenta handles backing the streams.

R=zra@google.com

Review-Url: https://codereview.chromium.org/2903373003 .
2017-05-30 13:59:07 -07:00
Zachary Anderson 9779e2db96 [Fuchsia] Calculate RSS using new task stat fields
mem_committed_bytes is deprecated and will go away.

R=zra@google.com

Review-Url: https://codereview.chromium.org/2906943002 .
2017-05-26 15:15:50 -07:00
Zachary Anderson 9ce608e89d [dart:io] Adds ProcessInfo.{max,current}Rss. Adds OS::MaxRSS on Fuchsia.
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2822943002 .
2017-04-17 14:41:40 -07:00
Zachary Anderson 6756e4d3ce [fuchsia] Fix shutdown crash
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2812753002 .
2017-04-10 15:46:08 -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
Zach Anderson c6b5c19347 [Fuchsia] Use magenta/process.h for mx_job_default, mx_vmar_root_self
Those symbols will soon be removed from magenta/syscalls.h.

BUG=
R=zra@google.com

Review-Url: https://codereview.chromium.org/2711273003 .
2017-02-24 08:00:49 -08:00
Zachary Anderson de63e4fa94 [Fuchsia] Update to the newest spelling of launchpad calls
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2713523005 .
2017-02-22 15:41:40 -08:00
Zach Anderson 063ae12ffc Fuchsia's message pipes are called channels for a while now
R=zra@google.com

Review-Url: https://codereview.chromium.org/2692853014 .
2017-02-17 07:43:53 -08:00
Zachary Anderson cbcc1a9f5f Use the new mx_object_wait_* name
R=zra@google.com, abarth@google.com

BUG=

Review-Url: https://codereview.chromium.org/2688303003 .
2017-02-10 21:53:36 -08:00
Zachary Anderson 3cb96e98a8 [Fuchsia] Cleanup process launching for updated launchpad API
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2681003004 .
2017-02-09 09:26:00 -08:00
Zachary Anderson c7d2f8276d Fuchsia: Fix deprecated jobs call
Review-Url: https://codereview.chromium.org/2628213002 .
2017-01-12 08:44:04 -08:00
Zachary Anderson 245e62280e Fuchsia: Pass a job to launchpad_create()
This API will change soon such that passing 0 for the
job handle will prevent spawned processes from creating
new processes themselves.

R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2621783003 .
2017-01-10 11:01:09 -08:00
Zachary Anderson a5d8a2f365 Fuchsia: Adds support for Process.kill()
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2619233003 .
2017-01-09 15:57:41 -08:00
Zach Anderson 2b48261764 Fix Process.runSync error handling.
Now, failing to allocate a buffer for stderr or stdout will generate
an ENOMEM OSError exception.

Also previously, read() returning an error would cause buffers for
stderr and stdout to leak. After this change, they'll be reclaimed.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2596543002 .
2016-12-21 09:10:40 -08:00
Zachary Anderson 918b90ba46 Fuchsia: implement Process::Wait() for Process.runSync()
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2591473004 .
2016-12-20 09:30:00 -08:00
Zachary Anderson 32e5ef787d Fuchsia: dart:io Processes
This change adds support for non-detached processes
spawned with Process.run and Process.start (but not Process.runSync).

R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2563463002 .
2016-12-13 11:09:55 -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
Ryan Macnak 4d65db8a95 Don't use IsolateData for the exit hook as multiple embedders share the dart/bin while using different isolate data structures.
Issue flutter/flutter#6506

R=asiva@google.com

Review URL: https://codereview.chromium.org/2463923002 .
2016-10-31 15:56:25 -07:00
Zachary Anderson 53374c3b99 Fuchsia: Build standalone VM. Make it run "Hello, World!".
This CL adds targets to the GN build that build the standalone Dart VM
without the observatory, and with dart:io enabled but with most of the
functionality stubbed out as UNIMPLEMENTED(). It also adds a simple
eventhandler for Fuchsia for implementing Timers.

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

Review URL: https://codereview.chromium.org/2168193002 .
2016-07-22 14:00:31 -07:00