this repo has no description
1
fork

Configure Feed

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

Simple fork & wait now works

+38 -9
+1 -1
src/kernel/emulation/linux/process/wait4.c
··· 10 10 11 11 linux_options = waitopts_bsd_to_linux(options); 12 12 13 - ret = LINUX_SYSCALL(__NR_wait4, status, linux_options, rusage); 13 + ret = LINUX_SYSCALL(__NR_wait4, pid, status, linux_options, rusage); 14 14 if (ret < 0) 15 15 return errno_linux_to_bsd(ret); 16 16
+8
src/kernel/libsyscall/mach/mig_reply_port.c
··· 1 + // Modofied by Lubos Dolezel for Darling 1 2 /* 2 3 * Copyright (c) 2010 Apple Inc. All rights reserved. 3 4 * ··· 89 90 mig_put_reply_port(mach_port_t reply_port __unused) 90 91 { 91 92 } 93 + 94 + __attribute__((visibility("default"))) 95 + void 96 + _mig_fork_child(void) 97 + { 98 + _mig_set_reply_port(MACH_PORT_NULL); 99 + }
+11
src/kernel/libsyscall/sys/__fork.S
··· 83 83 LEAF(___fork, 0) 84 84 subq $24, %rsp // Align the stack, plus room for local storage 85 85 86 + #ifndef DARLING 86 87 movl $ SYSCALL_CONSTRUCT_UNIX(SYS_fork),%eax; // code for fork -> rax 87 88 UNIX_SYSCALL_TRAP // do the system call 88 89 jnc L1 // jump if CF==0 90 + #else 91 + movl $ SYS_fork, %eax 92 + call __darling_bsd_syscall@PLT 93 + cmpq $0, %rax 94 + jnb L1 95 + #endif 89 96 90 97 movq %rax, %rdi 91 98 CALL_EXTERN(_cerror) ··· 94 101 ret 95 102 96 103 L1: 104 + #ifndef DARLING 97 105 orl %edx,%edx // CF=OF=0, ZF set if zero result 106 + #else 107 + testl %eax,%eax 108 + #endif 98 109 jz L2 // parent, since r1 == 0 in parent, 1 in child 99 110 100 111 //child here...
+11
src/kernel/libsyscall/sys/__vfork.S
··· 112 112 cmpxchgl %ecx, (%rdx) 113 113 jne 0b 114 114 popq %rdi // return address in %rdi 115 + #ifndef DARLING 115 116 movq $ SYSCALL_CONSTRUCT_UNIX(SYS_vfork), %rax // code for vfork -> rax 116 117 UNIX_SYSCALL_TRAP // do the system call 117 118 jnb L1 // jump if CF==0 119 + #else 120 + movl $ SYS_vfork, %eax 121 + call __darling_bsd_syscall@PLT 122 + cmpq $0, %rax 123 + jnb L1 124 + #endif 118 125 pushq %rdi // put return address back on stack for cerror 119 126 movq __current_pid@GOTPCREL(%rip), %rcx 120 127 lock ··· 123 130 BRANCH_EXTERN(_cerror) 124 131 125 132 L1: 133 + #ifndef DARLING 126 134 testl %edx, %edx // CF=OF=0, ZF set if zero result 135 + #else 136 + testl %eax, %eax 137 + #endif 127 138 jz L2 // parent, since r1 == 0 in parent, 1 in child 128 139 xorq %rax, %rax // zero rax 129 140 jmp *%rdi
+2 -8
src/kernel/libsyscall/wrappers/ioctl.c
··· 28 28 # define ioctl __real_ioctl 29 29 #endif 30 30 31 - #include <sys/ioctl.h> 31 + //#include <sys/ioctl.h> 32 32 #include <stdarg.h> 33 33 34 34 int __ioctl(int, unsigned long, void *); ··· 38 38 * This is for LP64 only. 39 39 */ 40 40 int 41 - ioctl(int d, unsigned long request, ...) 41 + ioctl(int d, unsigned long request, void* arg) 42 42 { 43 - va_list ap; 44 - void *arg; 45 - 46 - va_start(ap, request); 47 - arg = va_arg(ap, void *); 48 - va_end(ap); 49 43 return (__ioctl(d, request, arg)); 50 44 } 51 45
+5
src/libsystem/init.c
··· 57 57 extern void _cthread_fork_child(void); 58 58 extern void _cthread_fork_child_postinit(void); 59 59 60 + extern void _mig_fork_child(void); 60 61 extern void _mach_fork_child(void); 61 62 extern void _cproc_fork_child(void); 62 63 extern void _libc_fork_child(void); ··· 161 162 162 163 void libSystem_atfork_child(void) 163 164 { 165 + // Mach ports are not inherited across fork except for the Bootstrap. 166 + // So why is the following line not needed on OS X? 167 + _mig_fork_child(); 168 + 164 169 _dyld_fork_child(); 165 170 _cthread_fork_child(); 166 171