this repo has no description
1
fork

Configure Feed

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

Fix SO_RCVTIMEO (#766)

+25
+9
src/kernel/emulation/linux/network/getsockopt.c
··· 7 7 #include "duct.h" 8 8 #include <sys/ucred.h> 9 9 #include <sys/un.h> 10 + #include "../time/gettimeofday.h" 10 11 11 12 #define LINGER_TICKS_PER_SEC 100 // Is this the right number of ticks per sec? 12 13 ··· 48 49 int* err = (int*) optval; 49 50 if (err && *err) 50 51 *err = errno_linux_to_bsd(*err); 52 + } 53 + else if (optname == BSD_SO_RCVTIMEO) 54 + { 55 + // This only makes a difference on big-endian (PPC) 56 + struct linux_timeval ltv = *((struct linux_timeval*) optval); 57 + struct bsd_timeval* btv = (struct bsd_timeval*) optval; 58 + btv->tv_sec = ltv.tv_sec; 59 + btv->tv_usec = ltv.tv_usec; 51 60 } 52 61 } 53 62 }
+16
src/kernel/emulation/linux/network/setsockopt.c
··· 5 5 #include <linux-syscalls/linux.h> 6 6 #include <stddef.h> 7 7 #include "../../../../../platform-include/sys/errno.h" 8 + #include "../time/gettimeofday.h" 8 9 #include "duct.h" 9 10 10 11 #define LINGER_TICKS_PER_SEC 100 // Is this the right number of ticks per sec? ··· 22 23 23 24 if (ret != 0 || !linux_optname) 24 25 return ret; 26 + 27 + if (level == BSD_SOL_SOCKET) 28 + { 29 + if (optname == BSD_SO_RCVTIMEO) 30 + { 31 + const struct bsd_timeval* tv = (const struct bsd_timeval*) optval; 32 + struct linux_timeval* ltv = (struct linux_timeval*) __builtin_alloca(sizeof(struct linux_timeval)); 33 + 34 + ltv->tv_sec = tv->tv_sec; 35 + ltv->tv_usec = tv->tv_usec; 36 + 37 + optval = ltv; 38 + optlen = sizeof(*ltv); 39 + } 40 + } 25 41 26 42 #ifdef __NR_socketcall 27 43 ret = LINUX_SYSCALL(__NR_socketcall, LINUX_SYS_SETSOCKOPT,