this repo has no description
1
fork

Configure Feed

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

Several improvements: bash now loads ~/.dprefixrc, true argv[0] is transferred to Mach-O binaries etc.

+33 -5
+9 -1
src/CoreServices/DateTimeUtils.cpp
··· 1 1 /* 2 2 This file is part of Darling. 3 3 4 - Copyright (C) 2012-2013 Lubos Dolezel 4 + Copyright (C) 2012-2016 Lubos Dolezel 5 5 6 6 Darling is free software: you can redistribute it and/or modify 7 7 it under the terms of the GNU General Public License as published by ··· 19 19 20 20 #include "DateTimeUtils.h" 21 21 #include <climits> 22 + #include <ctime> 22 23 23 24 UTCDateTime Darling::time_tToUTC(time_t t) 24 25 { ··· 97 98 } 98 99 } 99 100 101 + void GetDateTime(unsigned long* secs) 102 + { 103 + time_t t; 104 + time(&t); 105 + 106 + *secs = t + 2082844800l; 107 + }
+3
src/CoreServices/DateTimeUtils.h
··· 52 52 OSErr UCConvertCFAbsoluteTimeToSeconds(CFAbsoluteTime in, uint32_t* out); 53 53 OSErr UCConvertCFAbsoluteTimeToLongDateTime(CFAbsoluteTime in, int64_t* out); 54 54 55 + // Seconds since 1.1.1904 56 + void GetDateTime(unsigned long* secs); 57 + 55 58 } 56 59 57 60 namespace Darling
+8 -1
src/dyld/dyld-multilib.c
··· 50 50 int fd = -1; 51 51 const char* target = "64"; 52 52 bool reg; 53 + char *progfile, *pos; 53 54 54 55 if (argc == 2 && (reg = !strcmp(argv[1], "--register") || !strcmp(argv[1], "--deregister"))) 55 56 return registerDeregister(argv[0], reg); 56 57 58 + progfile = argv[1]; 59 + if ((pos = strchr(progfile, '!')) != NULL) 60 + { 61 + progfile = strdup(argv[1]); 62 + progfile[pos - argv[1]] = '\0'; 63 + } 57 64 if (argc > 1) 58 - fd = open(argv[1], O_RDONLY | O_CLOEXEC); 65 + fd = open(progfile, O_RDONLY | O_CLOEXEC); 59 66 60 67 // We let real dyld output all serious error messages 61 68 // not to duplicate the functionality.
+3 -1
src/dyld/dyld.cpp
··· 120 120 "kernel extensions and other Mach-O files cannot be executed with dyld"); 121 121 } 122 122 123 - if (!unprefixed_argv0.empty()) 123 + if (pretendArgv0 != nullptr) 124 + argv[1] = (char*) pretendArgv0; 125 + else if (!unprefixed_argv0.empty()) 124 126 argv[1] = (char*) unprefixed_argv0.c_str(); 125 127 126 128 obj->setCommandLine(argc-1, &argv[1], envp);
+10 -2
src/kernel/emulation/linux/process/execve.c
··· 40 40 uint32_t magic; 41 41 char magic_array[256]; 42 42 } m; 43 - 43 + 44 44 // Ideally, if everybody used binfmt_misc to allow direct 45 45 // execution of Mach-O binaries under Darling, this wouldn't 46 46 // be necessary. But we cannot rely on that. ··· 95 95 // It is a Mach-O file 96 96 int len, i; 97 97 char** modargvp; 98 + char *translated, *buf; 98 99 99 100 len = __prefix_get_dyld_path(dyld_path, sizeof(dyld_path)-1); 100 101 if (len < 0) ··· 116 117 // Allocate a new argvp, execute dyld_path 117 118 modargvp = (char**) __builtin_alloca(sizeof(void*) * (len+1)); 118 119 modargvp[0] = dyld_path; 119 - modargvp[1] = (char*) __prefix_translate_path_link(fname); 120 + 121 + translated = (char*) __prefix_translate_path_link(fname); 122 + buf = __builtin_alloca(strlen(translated) + 2 + strlen(argvp[0])); 123 + 124 + strcpy(buf, translated); 125 + strcat(buf, "!"); 126 + strcat(buf, argvp[0]); 127 + modargvp[1] = buf; 120 128 121 129 for (i = 2; i < len+1; i++) 122 130 modargvp[i] = argvp[i-1];