@@ -61,7 +61,7 @@ index 000000000..825143f00
61
61
+
62
62
+ llvm::Expected<std::unique_ptr<llvm::orc::SimpleRemoteEPC>>
63
63
+ launchExecutor(llvm::StringRef ExecutablePath, bool UseSharedMemory,
64
- + llvm::StringRef SlabAllocateSizeString, int stdin_fd = STDIN_FILENO, int stdout_fd = STDOUT_FILENO, int stderr_fd = STDERR_FILENO );
64
+ + llvm::StringRef SlabAllocateSizeString, std::function<void()> CustomizeFork = nullptr );
65
65
+
66
66
+ /// Create a JITLinkExecutor that connects to the given network address
67
67
+ /// through a TCP socket. A valid NetworkAddress provides hostname and port,
@@ -265,7 +265,7 @@ index 000000000..8324aeaaf
265
265
+
266
266
+ Expected<std::unique_ptr<SimpleRemoteEPC>>
267
267
+ launchExecutor(StringRef ExecutablePath, bool UseSharedMemory,
268
- + llvm::StringRef SlabAllocateSizeString, int stdin_fd, int stdout_fd, int stderr_fd ) {
268
+ + llvm::StringRef SlabAllocateSizeString, std::function<void()> CustomizeFork ) {
269
269
+ #ifndef LLVM_ON_UNIX
270
270
+ // FIXME: Add support for Windows.
271
271
+ return make_error<StringError>("-" + ExecutablePath +
@@ -307,28 +307,8 @@ index 000000000..8324aeaaf
307
307
+ // Close the parent ends of the pipes
308
308
+ close(ToExecutor[WriteEnd]);
309
309
+ close(FromExecutor[ReadEnd]);
310
- +
311
- + if (stdin_fd != STDIN_FILENO) {
312
- + dup2(stdin_fd, STDIN_FILENO);
313
- +
314
- + close(stdin_fd);
315
- + }
316
- +
317
- + if (stdout_fd != STDOUT_FILENO) {
318
- + dup2(stdout_fd, STDOUT_FILENO);
319
- +
320
- + close(stdout_fd);
321
- +
322
- + setvbuf(stdout, NULL, _IONBF, 0);
323
- + }
324
- +
325
- + if (stderr_fd != STDERR_FILENO) {
326
- + dup2(stderr_fd, STDERR_FILENO);
327
- +
328
- + close(stderr_fd);
329
- +
330
- + setvbuf(stderr, NULL, _IONBF, 0);
331
- + }
310
+ + if (CustomizeFork)
311
+ + CustomizeFork();
332
312
+
333
313
+ // Execute the child process.
334
314
+ std::unique_ptr<char[]> ExecutorPath, FDSpecifier;
0 commit comments