this repo has no description
1
fork

Configure Feed

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

Revert trying to preserve /dev/mach fd across fork

This reverts commits d2a9f7c1f2dcba742dfa916731b259ce1130614a, bd41bf0c13dd3ca6505194b2796100135a6fae28 and 7d27170108ed735ba2af6dd86475d9175136a2b1.

+2 -15
+2 -15
src/kernel/mach_server/client/lkm.c
··· 3 3 #include <fcntl.h> 4 4 #include <unistd.h> 5 5 6 - #define LINUX_O_CLOEXEC 02000000 7 - 8 6 int driver_fd = -1; 9 7 10 8 extern int __real_ioctl(int fd, int cmd, void* arg); 11 9 12 10 void mach_driver_init(void) 13 11 { 14 - int new_driver_fd; 15 - 16 12 if (driver_fd != -1) 17 13 close(driver_fd); 18 14 19 - new_driver_fd = open("/dev/mach", O_RDWR | O_CLOEXEC); 20 - if (new_driver_fd == -1) 15 + driver_fd = open("/dev/mach", O_RDWR | O_CLOEXEC); 16 + if (driver_fd == -1) 21 17 { 22 18 const char* msg = "Cannot open /dev/mach. Aborting.\nMake sure you have loaded the darling-mach kernel module.\n"; 23 19 24 20 write(2, msg, strlen(msg)); 25 21 abort(); 26 22 } 27 - 28 - // Ensure we get the same fd number, even if lower ones are available 29 - if (driver_fd != -1 && driver_fd != new_driver_fd) 30 - { 31 - dup3(new_driver_fd, driver_fd, LINUX_O_CLOEXEC); // native Linux syscall 32 - close(new_driver_fd); 33 - } 34 - else 35 - driver_fd = new_driver_fd; 36 23 37 24 if (__real_ioctl(driver_fd, NR_get_api_version, 0) != DARLING_MACH_API_VERSION) 38 25 {