[orbis-kernel] Fix sys_namedobj_delete+

This commit is contained in:
Ivan Chikish 2023-07-15 17:00:47 +03:00
parent 9ccf27ae2e
commit 3eb73b5534
4 changed files with 7 additions and 7 deletions

View File

@ -645,7 +645,7 @@ SysResult sys_osem_post(Thread *thread /* TODO */);
SysResult sys_osem_cancel(Thread *thread /* TODO */);
SysResult sys_namedobj_create(Thread *thread, ptr<const char[32]> name,
ptr<void> object, uint16_t type);
SysResult sys_namedobj_delete(Thread *thread, uint16_t id, uint16_t type);
SysResult sys_namedobj_delete(Thread *thread, uint id, uint16_t type);
SysResult sys_set_vm_container(Thread *thread /* TODO */);
SysResult sys_debug_init(Thread *thread /* TODO */);
SysResult sys_suspend_process(Thread *thread, pid_t pid);

View File

@ -48,6 +48,6 @@ struct Process {
// Named objects for debugging
utils::shared_mutex namedObjMutex;
utils::kmap<void *, utils::kstring> namedObjNames;
utils::OwningIdMap<NamedObjInfo, std::uint16_t, 65535, 1> namedObjIds;
utils::OwningIdMap<NamedObjInfo, uint, 65535, 1> namedObjIds;
};
} // namespace orbis

View File

@ -333,11 +333,9 @@ orbis::SysResult orbis::sys_namedobj_create(Thread *thread,
thread->retval[0] = id;
return {};
}
orbis::SysResult orbis::sys_namedobj_delete(Thread *thread, uint16_t id,
orbis::SysResult orbis::sys_namedobj_delete(Thread *thread, uint id,
uint16_t type) {
ORBIS_LOG_NOTICE(__FUNCTION__, id, type);
if (id == 0)
return ErrorCode::SRCH;
if (type < 0x101 || type > 0x104) {
if (type != 0x107)
ORBIS_LOG_ERROR(__FUNCTION__, id, type);

View File

@ -5,9 +5,9 @@
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <type_traits>
#include <immintrin.h>
#include <sys/ucontext.h>
#include <type_traits>
namespace orbis {
using int8_t = std::int8_t;
@ -81,7 +81,9 @@ template <typename T> [[nodiscard]] ErrorCode uwrite(ptr<T> pointer, T data) {
return uwriteRaw(pointer, &data, sizeof(T));
}
template <typename T, typename U> requires (std::is_arithmetic_v<T> && std::is_arithmetic_v<U> && sizeof(T) > sizeof(U) && !std::is_same_v<std::remove_cv_t<T>, bool>)
template <typename T, typename U>
requires(std::is_arithmetic_v<T> && std::is_arithmetic_v<U> &&
sizeof(T) > sizeof(U) && !std::is_same_v<std::remove_cv_t<T>, bool>)
[[nodiscard]] ErrorCode uwrite(ptr<T> pointer, U data) {
T converted = data;
return uwriteRaw(pointer, &converted, sizeof(T));