mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-08 06:48:41 +00:00
rebase fixes
This commit is contained in:
committed by
Ryan Fleury
parent
1883649e18
commit
03180247c9
+17
-3
@@ -111,10 +111,14 @@ lnk_file_open_with_rename_permissions(String8 path)
|
|||||||
internal B32
|
internal B32
|
||||||
lnk_file_set_delete_on_close(File handle, B32 delete_file)
|
lnk_file_set_delete_on_close(File handle, B32 delete_file)
|
||||||
{
|
{
|
||||||
|
B32 is_set = 0;
|
||||||
#if OS_WINDOWS
|
#if OS_WINDOWS
|
||||||
FILE_DISPOSITION_INFO file_disposition = {0};
|
FILE_DISPOSITION_INFO file_disposition = {0};
|
||||||
file_disposition.DeleteFile = (BOOL)delete_file;
|
file_disposition.DeleteFile = (BOOL)delete_file;
|
||||||
B32 is_set = SetFileInformationByHandle((HANDLE)handle.u64[0], FileDispositionInfo, &file_disposition, sizeof(file_disposition));
|
is_set = SetFileInformationByHandle((HANDLE)handle.u64[0], FileDispositionInfo, &file_disposition, sizeof(file_disposition));
|
||||||
|
#elif OS_LINUX
|
||||||
|
// no equivalent
|
||||||
|
is_set = 1;
|
||||||
#else
|
#else
|
||||||
# error "TODO: file rename"
|
# error "TODO: file rename"
|
||||||
#endif
|
#endif
|
||||||
@@ -125,6 +129,7 @@ internal B32
|
|||||||
lnk_file_rename(File handle, String8 new_name)
|
lnk_file_rename(File handle, String8 new_name)
|
||||||
{
|
{
|
||||||
Temp scratch = scratch_begin(0,0);
|
Temp scratch = scratch_begin(0,0);
|
||||||
|
B32 is_renamed = 0;
|
||||||
#if OS_WINDOWS
|
#if OS_WINDOWS
|
||||||
String16 new_name16 = str16_from_8(scratch.arena, new_name);
|
String16 new_name16 = str16_from_8(scratch.arena, new_name);
|
||||||
|
|
||||||
@@ -137,9 +142,18 @@ lnk_file_rename(File handle, String8 new_name)
|
|||||||
rename_info->FileNameLength = new_name16.size * sizeof(new_name16.str[0]);
|
rename_info->FileNameLength = new_name16.size * sizeof(new_name16.str[0]);
|
||||||
MemoryCopy(rename_info->FileName, new_name16.str, new_name16.size * sizeof(new_name16.str[0]));
|
MemoryCopy(rename_info->FileName, new_name16.str, new_name16.size * sizeof(new_name16.str[0]));
|
||||||
|
|
||||||
B32 is_renamed = SetFileInformationByHandle((HANDLE)handle.u64[0], FileRenameInfo, buffer, buffer_size);
|
is_renamed = SetFileInformationByHandle((HANDLE)handle.u64[0], FileRenameInfo, buffer, buffer_size);
|
||||||
#else
|
#else
|
||||||
#error "TODO: file rename"
|
char fd_proc_path[128];
|
||||||
|
raddbg_snprintf(fd_proc_path, sizeof(fd_proc_path), "/proc/self/fd/%d", (int)handle.u64[0]);
|
||||||
|
|
||||||
|
U64 path_max = 4096;
|
||||||
|
char *path = push_array(scratch.arena, char, path_max);
|
||||||
|
ssize_t path_size = readlink(fd_proc_path, path, path_max);
|
||||||
|
|
||||||
|
if (path_size > 0) {
|
||||||
|
is_renamed = rename(path, (char *)push_cstr(scratch.arena, new_name).str) == 0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
scratch_end(scratch);
|
scratch_end(scratch);
|
||||||
return is_renamed;
|
return is_renamed;
|
||||||
|
|||||||
@@ -10513,10 +10513,10 @@ rd_ipc_make_reply_source_location_from_address(Arena *arena, U64 vaddr)
|
|||||||
{
|
{
|
||||||
Temp scratch = scratch_begin(&arena, 1);
|
Temp scratch = scratch_begin(&arena, 1);
|
||||||
|
|
||||||
D_Entity *process = d_entity_from_handle(&d_user_state->ctrl_entity_store->ctx, rd_base_regs()->process);
|
D_Entity *process = d_entity_from_handle(rd_base_regs()->process);
|
||||||
if(process == &d_entity_nil)
|
if(process == &d_entity_nil)
|
||||||
{
|
{
|
||||||
D_Entity *thread = d_entity_from_handle(&d_user_state->ctrl_entity_store->ctx, rd_base_regs()->thread);
|
D_Entity *thread = d_entity_from_handle(rd_base_regs()->thread);
|
||||||
process = d_entity_ancestor_from_kind(thread, D_EntityKind_Process);
|
process = d_entity_ancestor_from_kind(thread, D_EntityKind_Process);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user