this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #1150 from trungnt2910/darlingserver

feat: Manage executable path in darlingserver

authored by

Ariel Abreu and committed by
GitHub
7da8f613 0fe24aca

+16 -10
+11 -10
src/kernel/emulation/linux/misc/proc_info.c
··· 645 645 646 646 static long _proc_pidinfo_pathinfo(int32_t pid, void* buffer, int32_t bufsize) 647 647 { 648 - char path[64]; 649 648 struct vchroot_unexpand_args args; 649 + uint64_t fullLength; 650 650 651 - __simple_sprintf(path, "/proc/%d/exe", pid); 651 + int rv = dserver_rpc_get_executable_path(pid, args.path, sizeof(args.path), &fullLength); 652 652 653 - memset(buffer, 0, bufsize); 654 - int rv = sys_readlink(path, buffer, bufsize - 1); 655 - 656 - if (rv < 0) 657 - return rv; 653 + if (rv < 0) 654 + { 655 + __simple_printf("dserver_rpc_get_executable_path failed internally: %d\n", rv); 656 + __simple_abort(); 657 + } 658 + else if (rv > 0) 659 + { 660 + return -rv; 661 + } 658 662 659 - ((char*)buffer)[rv] = 0; 660 - 661 - strcpy(args.path, buffer); 662 663 rv = vchroot_unexpand(&args); 663 664 if (rv != 0) 664 665 return rv;
+5
src/startup/mldr/mldr.c
··· 188 188 exit(1); 189 189 } 190 190 191 + if (dserver_rpc_set_executable_path(filename, strlen(filename)) < 0) { 192 + fprintf(stderr, "Failed to tell darlingserver about our executable path\n"); 193 + exit(1); 194 + } 195 + 191 196 start_thread(&mldr_load_results); 192 197 193 198 __builtin_unreachable();