Skip to content

Commit 0c45b7e

Browse files
BreakthroughCommit Queue
authored andcommitted
[runtime] Transition to new fdio functions
This should allow Dart to start targeting Fuchsia API level 28. TEST=ci Bug: b/434220174 Change-Id: Id55deb491122be85d9a5731be2c7571b0126dcd8 Cq-Include-Trybots: luci.dart.try:vm-fuchsia-release-arm64-try,vm-fuchsia-release-x64-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/448260 Commit-Queue: Ben Konyi <[email protected]> Reviewed-by: Ben Konyi <[email protected]>
1 parent b407814 commit 0c45b7e

File tree

3 files changed

+15
-22
lines changed

3 files changed

+15
-22
lines changed

runtime/bin/directory_fuchsia.cc

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,14 @@
77

88
#include "bin/directory.h"
99

10-
#include <dirent.h> // NOLINT
11-
#include <errno.h> // NOLINT
12-
#include <fcntl.h> // NOLINT
13-
#include <lib/fdio/namespace.h> // NOLINT
14-
#include <stdlib.h> // NOLINT
15-
#include <string.h> // NOLINT
16-
#include <sys/param.h> // NOLINT
17-
#include <sys/stat.h> // NOLINT
18-
#include <unistd.h> // NOLINT
10+
#include <dirent.h> // NOLINT
11+
#include <errno.h> // NOLINT
12+
#include <fcntl.h> // NOLINT
13+
#include <stdlib.h> // NOLINT
14+
#include <string.h> // NOLINT
15+
#include <sys/param.h> // NOLINT
16+
#include <sys/stat.h> // NOLINT
17+
#include <unistd.h> // NOLINT
1918

2019
#include "bin/crypto.h"
2120
#include "bin/dartutils.h"

runtime/bin/process_fuchsia.cc

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -586,24 +586,18 @@ class ProcessStarter {
586586
NamespaceScope ns(namespc_, path_);
587587
int pathfd = -1;
588588
zx_status_t status;
589+
constexpr fuchsia::io::Flags kFlags =
590+
fuchsia::io::PERM_READABLE | fuchsia::io::PERM_EXECUTABLE;
589591
if (ns.fd() == AT_FDCWD) {
590-
status = fdio_open_fd(
591-
ns.path(),
592-
static_cast<uint32_t>(fuchsia::io::OpenFlags::RIGHT_READABLE |
593-
fuchsia::io::OpenFlags::RIGHT_EXECUTABLE),
594-
&pathfd);
592+
status = fdio_open3_fd(ns.path(), uint64_t{kFlags}, &pathfd);
595593
} else {
596-
status = fdio_open_fd_at(
597-
ns.fd(), ns.path(),
598-
static_cast<uint32_t>(fuchsia::io::OpenFlags::RIGHT_READABLE |
599-
fuchsia::io::OpenFlags::RIGHT_EXECUTABLE),
600-
&pathfd);
594+
status = fdio_open3_fd_at(ns.fd(), ns.path(), uint64_t{kFlags}, &pathfd);
601595
}
602596
if (status != ZX_OK) {
603597
close(exit_pipe_fds[0]);
604598
close(exit_pipe_fds[1]);
605599
ReportStartError(
606-
"Failed to load executable for process start (fdio_open_fd_at %s).",
600+
"Failed to load executable for process start (fdio_open3_fd_at %s).",
607601
zx_status_get_string(status));
608602
return status;
609603
}

runtime/platform/utils.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,10 +306,10 @@ void* Utils::LoadDynamicLibrary(const char* library_path,
306306
if (handle == nullptr) {
307307
// Fuchsia's search path is different.
308308
// https://fuchsia.dev/fuchsia-src/concepts/process/program_loading#zircons_standard_elf_dynamic_linker
309-
fuchsia::io::Flags flags =
309+
constexpr fuchsia::io::Flags kFlags =
310310
fuchsia::io::PERM_READABLE | fuchsia::io::PERM_EXECUTABLE;
311311
int fd = -1;
312-
zx_status_t status = fdio_open3_fd(library_path, uint64_t{flags}, &fd);
312+
zx_status_t status = fdio_open3_fd(library_path, uint64_t{kFlags}, &fd);
313313
if (status != ZX_OK) {
314314
*error = strdup(zx_status_get_string(status));
315315
return nullptr;

0 commit comments

Comments
 (0)