9#include <zircon/errors.h>
10#include <zircon/status.h>
11#include <zircon/syscalls.h>
13#include "flutter/fml/logging.h"
17constexpr char kTmpPath[] =
"/tmp";
28 fdio_flat_namespace_t* rootns;
29 if (zx_status_t status = fdio_ns_export_root(&rootns); status != ZX_OK) {
31 << zx_status_get_string(status);
35 zx_handle_t tmp_dir_handle;
36 for (
size_t i = 0;
i < rootns->count;
i++) {
37 if (std::string_view{rootns->path[
i]} == kTmpPath) {
38 tmp_dir_handle = std::exchange(rootns->handle[
i], ZX_HANDLE_INVALID);
41 fdio_ns_free_flat_ns(rootns);
43 if (zx_status_t status = fdio_ns_bind(ns, kTmpPath, tmp_dir_handle);
45 zx_handle_close(tmp_dir_handle);
46 FML_LOG(
ERROR) <<
"Failed to bind /tmp directory into isolate namespace: "
47 << zx_status_get_string(status);
#define FML_LOG(severity)
void BindTemp(fdio_ns_t *ns)