diff options
author | Sven Göthel <[email protected]> | 2024-05-10 17:32:15 +0200 |
---|---|---|
committer | Sven Göthel <[email protected]> | 2024-05-10 17:32:15 +0200 |
commit | 80df82c729f730a35d1c84971b8a38792eaf506d (patch) | |
tree | d2e4655c921dfcbee4b5ba3f69050a39854499cf /src | |
parent | 2223a879819d4941538db8c4961cdc8a84710827 (diff) |
WebAssembly (emscripten) Patches
Diffstat (limited to 'src')
-rw-r--r-- | src/cpuid.cpp | 5 | ||||
-rw-r--r-- | src/file_util.cpp | 14 | ||||
-rw-r--r-- | src/os_support.cpp | 17 | ||||
-rw-r--r-- | src/unix/user_info.cpp | 11 |
4 files changed, 33 insertions, 14 deletions
diff --git a/src/cpuid.cpp b/src/cpuid.cpp index 3e636f2..5c334ca 100644 --- a/src/cpuid.cpp +++ b/src/cpuid.cpp @@ -66,8 +66,9 @@ static void append_bitstr(std::string& out, T mask, T bit, const std::string& bi X(cpu_family,mips_64) \ X(cpu_family,superh_32) \ X(cpu_family,superh_64) \ - X(cpu_family,wasm) - + X(cpu_family,wasm_32) \ + X(cpu_family,wasm_64) + std::string jau::cpu::to_string(const cpu_family v) noexcept { switch(v) { CPUFAMILY_ENUM(CASE_TO_STRING) diff --git a/src/file_util.cpp b/src/file_util.cpp index 53d5768..84accbe 100644 --- a/src/file_util.cpp +++ b/src/file_util.cpp @@ -2108,7 +2108,11 @@ mount_ctx jau::fs::mount(const std::string& source, const std::string& target, c (void)fs_options_cstr; const int mount_res = -1; #else - #warning Add OS support + #if !defined(JAU_OS_TYPE_WASM) + #warning Add OS support + #endif + (void)flags; + (void)fs_options_cstr; const int mount_res = -1; #endif if( 0 != mount_res ) { @@ -2163,7 +2167,9 @@ bool jau::fs::umount(const mount_ctx& context, const umountflags_t flags) #elif defined(__FreeBSD__) const int umount_res = ::unmount(target_stats.path().c_str(), flags); #else - #warning Add OS support + #if !defined(JAU_OS_TYPE_WASM) + #warning Add OS support + #endif const int umount_res = -1; #endif if( 0 != umount_res ) { @@ -2247,7 +2253,9 @@ bool jau::fs::umount(const std::string& target, const umountflags_t flags) #elif defined(__FreeBSD__) const int umount_res = ::unmount(target_stats.path().c_str(), flags); #else - #warning Add OS support + #if !defined(JAU_OS_TYPE_WASM) + #warning Add OS support + #endif const int umount_res = -1; #endif if( 0 == umount_res ) { diff --git a/src/os_support.cpp b/src/os_support.cpp index 66404a9..fa38e34 100644 --- a/src/os_support.cpp +++ b/src/os_support.cpp @@ -52,6 +52,7 @@ std::string jau::os::to_string(const os_type v) noexcept { case os_type::Darwin: return "Darwin"; case os_type::QnxNTO: return "QNX-NTO"; case os_type::WebAsm: return "WebAsm"; + case os_type::UnixWasm: return "UnixWasm"; } return "undef"; } @@ -80,8 +81,10 @@ std::string jau::os::to_string(const abi_type v) noexcept { case abi_type::eabi_gnu_armel: return "gnu_armel_abi"; case abi_type::eabi_gnu_armhf: return "gnu_armhf_abi"; case abi_type::eabi_aarch64: return "aarch64_abi"; - case abi_type::wasm_abi_undef: return "wasm_undef_abi"; - case abi_type::wasm_abi_emscripten: return "wasm_emscripten_abi"; + case abi_type::wasm32_abi_undef: return "wasm32_undef_abi"; + case abi_type::wasm32_abi_emscripten: return "wasm32_emscripten_abi"; + case abi_type::wasm64_abi_undef: return "wasm64_undef_abi"; + case abi_type::wasm64_abi_emscripten: return "wasm64_emscripten_abi"; } return "undef"; } @@ -135,6 +138,12 @@ std::string jau::os::get_os_and_arch(const os_type os, const jau::cpu::cpu_famil case jau::cpu::cpu_family::superh_64: _and_arch_tmp = "superh64"; break; + case jau::cpu::cpu_family::wasm_32: + _and_arch_tmp = "wasm32"; + break; + case jau::cpu::cpu_family::wasm_64: + _and_arch_tmp = "wasm64"; + break; default: _and_arch_tmp = "undef_arch"; break; @@ -169,6 +178,10 @@ std::string jau::os::get_os_and_arch(const os_type os, const jau::cpu::cpu_famil os_ = "webasm"; _and_arch_final = _and_arch_tmp; break; + case os_type::UnixWasm: + os_ = "unixwasm"; + _and_arch_final = _and_arch_tmp; + break; default: os_ = "undef_os"; _and_arch_final = _and_arch_tmp; diff --git a/src/unix/user_info.cpp b/src/unix/user_info.cpp index 6a90f01..389516e 100644 --- a/src/unix/user_info.cpp +++ b/src/unix/user_info.cpp @@ -31,9 +31,6 @@ #include <grp.h> #include <pwd.h> #include <sys/types.h> - #include <sys/mount.h> - #include <sys/capability.h> - #include <sys/prctl.h> } using namespace jau; @@ -58,12 +55,12 @@ } bool UserInfo::set_groups(const std::vector<id_t>& list) noexcept { - ::gid_t n_list[list.size()+1]; - size_t i=0; + std::vector<::gid_t> n_list; + n_list.reserve(list.size()+1); for(const id_t& gid : list) { - n_list[i++] = (::gid_t)gid; + n_list.push_back( (::gid_t)gid ); } - if( 0 > ::setgroups(list.size(), n_list) ) { + if( 0 > ::setgroups(n_list.size(), n_list.data()) ) { ERR_PRINT("setgroups failed"); return false; } |