6#if defined(DART_HOST_OS_FUCHSIA)
10#include <fuchsia/kernel/cpp/fidl.h>
11#include <lib/fdio/directory.h>
12#include <lib/zx/resource.h>
14#include <sys/utsname.h>
16#include <zircon/process.h>
17#include <zircon/status.h>
18#include <zircon/syscalls.h>
28const char* Platform::executable_name_ =
nullptr;
29int Platform::script_index_ = 1;
30char** Platform::argv_ =
nullptr;
37 return sysconf(_SC_NPROCESSORS_CONF);
42 int ret = uname(&
info);
46 const char*
kFormat =
"%s %s %s";
48 snprintf(
nullptr, 0, kFormat,
info.sysname,
info.release,
info.version);
72 if (lang ==
nullptr) {
79 return gethostname(
buffer, buffer_length) == 0;
87 while (*(tmp++) !=
nullptr) {
93 for (intptr_t current = 0; current < i; current++) {
94 result[current] = environ[current];
100 if (executable_name_ !=
nullptr) {
101 return executable_name_;
104 zx_status_t status = zx_object_get_property(zx_process_self(), ZX_PROP_NAME,
105 name, ZX_MAX_NAME_LEN);
106 if (status != ZX_OK) {
114 if (executable_name ==
nullptr) {
117 if ((executable_name[0] ==
'/') &&
File::Exists(
nullptr, executable_name)) {
120 if (strchr(executable_name,
'/') !=
nullptr) {
127 if (path ==
nullptr) {
129 path =
"/system/bin:/system/apps:/boot/bin";
133 char* save =
nullptr;
134 while ((pathcopy = strtok_r(pathcopy,
":", &save)) !=
nullptr) {
153 zx_object_set_property(zx_process_self(), ZX_PROP_NAME,
name,
173zx_handle_t Platform::GetVMEXResource() {
174 zx::resource vmex_resource;
175 fuchsia::kernel::VmexResourceSyncPtr vmex_resource_svc;
176 zx_status_t status = fdio_service_connect(
177 "/svc/fuchsia.kernel.VmexResource",
178 vmex_resource_svc.NewRequest().TakeChannel().release());
180 status = vmex_resource_svc->Get(&vmex_resource);
182 return vmex_resource.release();
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
static T Minimum(T x, T y)
static void RestoreConfig()
static char * ScopedCopyCString(const char *str)
static char * ScopedCString(intptr_t length)
static const char * GetCanonicalPath(Namespace *namespc, const char *path, char *dest=nullptr, int dest_size=0)
static bool Exists(Namespace *namespc, const char *path)
static const uint8_t buffer[]
DART_EXPORT void Dart_PrepareToAbort()
DART_EXPORT uint8_t * Dart_ScopeAllocate(intptr_t size)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path