rebase fixes

This commit is contained in:
Nikita Smith
2026-06-02 12:10:38 -07:00
committed by Ryan Fleury
parent 1883649e18
commit 03180247c9
3 changed files with 158 additions and 144 deletions
+17 -3
View File
@@ -111,10 +111,14 @@ lnk_file_open_with_rename_permissions(String8 path)
internal B32
lnk_file_set_delete_on_close(File handle, B32 delete_file)
{
B32 is_set = 0;
#if OS_WINDOWS
FILE_DISPOSITION_INFO file_disposition = {0};
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
# error "TODO: file rename"
#endif
@@ -125,6 +129,7 @@ internal B32
lnk_file_rename(File handle, String8 new_name)
{
Temp scratch = scratch_begin(0,0);
B32 is_renamed = 0;
#if OS_WINDOWS
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]);
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
#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
scratch_end(scratch);
return is_renamed;
+2 -2
View File
@@ -10513,10 +10513,10 @@ rd_ipc_make_reply_source_location_from_address(Arena *arena, U64 vaddr)
{
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)
{
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);
}