mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-07 19:58:30 +00:00
Make fixes and improvements
- Introduce __assert_disable global - Improve strsignal() thread safety - Make system call tracing thread safe - Fix SO_RCVTIMEO / SO_SNDTIMEO on Windows - Refactor DescribeFoo() functions into one place - Fix fork() on Windows when TLS and MAP_STACK exist - Round upwards in setsockopt(SO_RCVTIMEO) on Windows - Disable futexes on OpenBSD which seem extremely broken - Implement a better kludge for monotonic time on Windows
This commit is contained in:
parent
5d837c4e7c
commit
fbc053e018
186 changed files with 1836 additions and 1325 deletions
|
@ -28,9 +28,10 @@
|
|||
|
||||
textwindows int sys_setsockopt_nt(struct Fd *fd, int level, int optname,
|
||||
const void *optval, uint32_t optlen) {
|
||||
int64_t ms;
|
||||
int64_t ms, micros;
|
||||
struct timeval *tv;
|
||||
struct linger *linger;
|
||||
struct SockFd *sockfd;
|
||||
union {
|
||||
uint32_t millis;
|
||||
struct linger_nt linger;
|
||||
|
@ -47,7 +48,8 @@ textwindows int sys_setsockopt_nt(struct Fd *fd, int level, int optname,
|
|||
optlen == sizeof(struct timeval)) {
|
||||
tv = optval;
|
||||
if (__builtin_mul_overflow(tv->tv_sec, 1000, &ms) ||
|
||||
__builtin_add_overflow(ms, tv->tv_usec / 1000, &ms) ||
|
||||
__builtin_add_overflow(tv->tv_usec, 999, µs) ||
|
||||
__builtin_add_overflow(ms, micros / 1000, &ms) ||
|
||||
(ms < 0 || ms > 0xffffffff)) {
|
||||
u.millis = 0xffffffff;
|
||||
} else {
|
||||
|
@ -55,6 +57,14 @@ textwindows int sys_setsockopt_nt(struct Fd *fd, int level, int optname,
|
|||
}
|
||||
optval = &u.millis;
|
||||
optlen = sizeof(u.millis);
|
||||
sockfd = (struct SockFd *)fd->extra;
|
||||
if (optname == SO_RCVTIMEO) {
|
||||
sockfd->rcvtimeo = u.millis;
|
||||
}
|
||||
if (optname == SO_SNDTIMEO) {
|
||||
sockfd->sndtimeo = u.millis;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue