Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade uvwasi to 0.0.12 #802

Merged
merged 3 commits into from
May 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions cmake/ProjectUVWASI.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,24 @@ endif()
ExternalProject_Add(uvwasi
EXCLUDE_FROM_ALL 1
PREFIX ${prefix}
DOWNLOAD_NAME uvwasi-0.0.10.tar.gz
DOWNLOAD_NAME uvwasi-0.0.12.tar.gz
DOWNLOAD_DIR ${prefix}/downloads
SOURCE_DIR ${source_dir}
BINARY_DIR ${binary_dir}
URL https://github.com/nodejs/uvwasi/archive/v0.0.10.tar.gz
URL_HASH SHA256=39135f4dd4a44013399ceed7166391ffc5c09655e4bfbf851da2be039e6985df
URL https://github.com/nodejs/uvwasi/archive/v0.0.12.tar.gz
URL_HASH SHA256=f310a628d2657b9ed523a19284f58e4a407466f2e17efb2250d2e58524d02c53
CMAKE_ARGS
${toolchain_file}
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DBUILD_SHARED_LIBS=OFF
-DUVWASI_DEBUG_LOG=OFF
-DCODE_COVERAGE=OFF
-DASAN=OFF
-DUVWASI_BUILD_TESTS=OFF
# packaged libuv version depends on this
-DCMAKE_POSITION_INDEPENDENT_CODE=TRUE
BUILD_BYPRODUCTS ${uvwasi_library} ${uv_library}
)

Expand Down
17 changes: 4 additions & 13 deletions tools/wasi/uvwasi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,33 +13,24 @@ class UVWASIImpl final : public UVWASI
{
/// UVWASI state.
uvwasi_t m_state{};
bool m_inited = false;

public:
~UVWASIImpl() final
{
if (m_inited)
uvwasi_destroy(&m_state);
}
~UVWASIImpl() final { uvwasi_destroy(&m_state); }

uvwasi_errno_t init(uvwasi_size_t argc, const char** argv) noexcept final
{
if (m_inited)
uvwasi_destroy(&m_state);
uvwasi_destroy(&m_state);

// Initialisation settings.
// TODO: Make const after https://github.com/nodejs/uvwasi/pull/155 is merged.
uvwasi_options_t options = {
const uvwasi_options_t options = {
3, // sizeof fd_table
0, nullptr, // NOTE: no remappings
argc, argv,
nullptr, // TODO: support env
0, 1, 2,
nullptr, // NOTE: no special allocator
};
const auto ret = uvwasi_init(&m_state, &options);
m_inited = (ret == UVWASI_ESUCCESS);
return ret;
return uvwasi_init(&m_state, &options);
}

uvwasi_errno_t proc_exit(uvwasi_exitcode_t exit_code) noexcept final
Expand Down