this repo has no description
1
fork

Configure Feed

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

Launchd seems to bootstrap properly now

+76 -3
+10
src/kernel/emulation/linux/ioctl/socket.c
··· 1 + #include "socket.h" 2 + #include <sys/errno.h> 3 + 4 + int handle_socket(int fd, unsigned int cmd, void* arg, int* retval) 5 + { 6 + // BEWARE: This function is not yet wired into the logic and the build 7 + return IOCTL_PASS; 8 + } 9 + 10 +
+8
src/kernel/emulation/linux/ioctl/socket.h
··· 1 + #ifndef EMU_SOCKET_H 2 + #define EMU_SOCKET_H 3 + #include "ioctl.h" 4 + 5 + int handle_socket(int fd, unsigned int cmd, void* arg, int* retval); 6 + 7 + #endif 8 +
+2 -1
src/kernel/emulation/linux/ioctl/termios.c
··· 214 214 return IOCTL_HANDLED; 215 215 } 216 216 default: 217 + { 217 218 __simple_printf("Passing thru unhandled ioctl 0x%x on fd %d\n", cmd, fd); 218 - __builtin_trap(); 219 219 return IOCTL_PASS; 220 + } 220 221 } 221 222 } 222 223
+28
src/kernel/emulation/linux/misc/sysctl_kern.c
··· 29 29 static sysctl_handler(handle_osrelease); 30 30 static sysctl_handler(handle_version); 31 31 static sysctl_handler(handle_maxproc); 32 + static sysctl_handler(handle_netboot); 33 + static sysctl_handler(handle_safeboot); 32 34 33 35 extern int _sysctl_proc(int what, int flag, struct kinfo_proc* out, unsigned long* buflen); 34 36 extern int _sysctl_procargs(int pid, char* buf, unsigned long* buflen); ··· 41 43 { .oid = KERN_PROCARGS2, .type = CTLTYPE_STRUCT, .exttype = "", .name = "procargs2", .handler = handle_procargs32 }, 42 44 { .oid = KERN_ARGMAX, .type = CTLTYPE_INT, .exttype = "I", .name = "argmax", .handler = handle_argmax }, 43 45 { .oid = KERN_MAXPROC, .type = CTLTYPE_INT, .exttype = "I", .name = "maxproc", .handler = handle_maxproc }, 46 + { .oid = KERN_NETBOOT, .type = CTLTYPE_INT, .exttype = "I", .name = "netboot", .handler = handle_netboot }, 47 + { .oid = KERN_SAFEBOOT, .type = CTLTYPE_INT, .exttype = "I", .name = "safeboot", .handler = handle_safeboot }, 44 48 { .oid = KERN_BOOTTIME, .type = CTLTYPE_STRUCT, .exttype = "S,timeval", .name = "boottime", .handler = handle_boottime }, 45 49 { .oid = KERN_OSTYPE, .type = CTLTYPE_STRING, .exttype = "S", .name = "ostype", .handler = handle_ostype }, 46 50 { .oid = KERN_HOSTNAME, .type = CTLTYPE_STRING, .exttype = "S", .name = "hostname", .handler = handle_hostname }, ··· 226 230 227 231 return 0; 228 232 } 233 + 234 + sysctl_handler(handle_netboot) 235 + { 236 + int* ovalue = (int*) old; 237 + 238 + if (!oldlen || *oldlen < sizeof(int)) 239 + return -EINVAL; 240 + *ovalue = 0; 241 + 242 + return 0; 243 + } 244 + 245 + sysctl_handler(handle_safeboot) 246 + { 247 + int* ovalue = (int*) old; 248 + 249 + if (!oldlen || *oldlen < sizeof(int)) 250 + return -EINVAL; 251 + *ovalue = 0; 252 + 253 + return 0; 254 + } 255 + 256 +
+14 -2
src/kernel/emulation/linux/network/getsockopt.c
··· 3 3 #include "../errno.h" 4 4 #include <linux-syscalls/linux.h> 5 5 #include <stddef.h> 6 - #include "../../../../../platform-include/sys/errno.h" 6 + #include <sys/errno.h> 7 7 #include "duct.h" 8 + #include <sys/ucred.h> 9 + #include <sys/un.h> 8 10 9 11 #define LINGER_TICKS_PER_SEC 100 // Is this the right number of ticks per sec? 10 12 13 + extern void* memset(void*, int, __SIZE_TYPE__); 14 + 11 15 long sys_getsockopt(int fd, int level, int optname, void* optval, int* optlen) 12 16 { 13 17 int ret, linux_level, linux_optname; ··· 15 19 linux_level = level; 16 20 linux_optname = optname; 17 21 18 - ret = sockopt_bsd_to_linux(&linux_level, &linux_optname, NULL, NULL); 22 + ret = sockopt_bsd_to_linux(&linux_level, &linux_optname, NULL, optval); 19 23 20 24 if (ret != 0 || !linux_optname) 21 25 return ret; ··· 47 51 48 52 int sockopt_bsd_to_linux(int* level, int* optname, void** optval, void* optbuf) 49 53 { 54 + if (*optname == LOCAL_PEERCRED) 55 + { 56 + struct xucred* c = (struct xucred*) optbuf; 57 + // Simulate euid 0 58 + memset(c, 0, sizeof(*c)); 59 + *optname = 0; 60 + return 0; 61 + } 50 62 if (*level == BSD_SOL_SOCKET) 51 63 { 52 64 *level = LINUX_SOL_SOCKET;
+13
src/kernel/emulation/linux/simple.c
··· 127 127 LINUX_SYSCALL3(__NR_write, 1, buffer, __simple_strlen(buffer)); 128 128 } 129 129 130 + void __simple_fprintf(int fd, const char* format, ...) 131 + { 132 + char buffer[512]; 133 + va_list vl; 134 + 135 + va_start(vl, format); 136 + __simple_vsprintf(buffer, format, vl); 137 + va_end(vl); 138 + 139 + LINUX_SYSCALL3(__NR_write, fd, buffer, __simple_strlen(buffer)); 140 + } 141 + 142 + 130 143 void __simple_sprintf(char *buffer, const char* format, ...) 131 144 { 132 145 va_list vl;
+1
src/kernel/emulation/linux/simple.h
··· 2 2 #define LINUX_DEBUG_H 3 3 4 4 void __simple_printf(const char* format, ...); 5 + void __simple_fprintf(int fd, const char* format, ...); 5 6 void __simple_sprintf(char *buffer, const char* format, ...); 6 7 int __simple_strlen(const char* str); 7 8