Commit graph

2623 commits

Author SHA1 Message Date
Justine Tunney
a8bc7ac119
Import some Chromium Zlib changes 2024-10-11 07:04:02 -07:00
Justine Tunney
d8fac40f55
Attempt to fix Emacs spawning issue 2024-10-11 06:09:46 -07:00
Justine Tunney
000d6dbb0f
Make getentropy() faster 2024-10-10 18:45:15 -07:00
Justine Tunney
17a85e4790
Release Cosmopolitan v3.9.3 2024-10-08 19:58:32 -07:00
Justine Tunney
ad11fc32ad
Avoid an --ftrace crash on Windows 2024-10-07 18:39:25 -07:00
Justine Tunney
dcf9596620
Make more fixups and quality assurance 2024-10-07 15:29:53 -07:00
Justine Tunney
85c58be942
Fix an async signal delivery flake on Windows 2024-10-02 04:55:06 -07:00
Justine Tunney
e4d6eb382a
Make memchr() and memccpy() faster 2024-09-30 05:54:34 -07:00
Justine Tunney
fef24d622a
Work around copy_file_range() bug in eCryptFs
When programs like ar.ape and compile.ape are run on eCryptFs partitions
on Linux, copy_file_range() will fail with EINVAL which is wrong because
eCryptFs which doesn't support this system call, should raise EOPNOTSUPP

See https://github.com/jart/cosmopolitan/discussions/1305
2024-09-29 16:35:38 -07:00
Justine Tunney
12cc2de22e
Make contended mutexes 30% faster on aarch64
On Raspberry Pi 5, benchmark_mu_contended takes 359µs in *NSYNC upstream
and in Cosmopolitan it takes 272µs.
2024-09-26 09:24:25 -07:00
Justine Tunney
70603fa6ea
Fix makedev() prototype
Fixes #1281
2024-09-26 04:42:41 -07:00
Justine Tunney
9255113011
Delete some magic numbers 2024-09-26 04:27:51 -07:00
Gabriel Ravier
333c3d1f0a
Add the uppercase B conversion specifier to printf (#1300)
The (uppercase) B conversion specifier is specified by the C standard to
have the same behavior as the (lowercase) b conversion specifier, except
that whenever the # flag is used, the (uppercase) B conversion specifier
alters a nonzero result by prefixing it with "0B", instead of with "0b".

This commit adds this conversion specifier alongside a few tests for it.
2024-09-26 04:27:45 -07:00
Justine Tunney
518eabadf5
Further optimize poll() on Windows 2024-09-22 22:28:59 -07:00
Justine Tunney
556a294363
Improve Windows mode bits
We were too zealous about security before by only setting the owner bits
and that would cause issues for projects like redbean that check "other"
bits to determine if it's safe to serve a file. Since that doesn't exist
on Windows, it's better to have things work than not work. So what we'll
do instead is return modes like 0664 for files and 0775 for directories.
2024-09-22 16:51:57 -07:00
Justine Tunney
80804ccfff
Upgrade to cosmocc v3.9.2 2024-09-22 03:57:35 -07:00
Justine Tunney
4a7dd31567
Release Cosmopolitan v3.9.2 2024-09-22 01:40:51 -07:00
Justine Tunney
d730fc668c
Make NESEMU1 demo more reliable
This program was originally ported to Cosmopolitan before we had threads
so it was designed to use a single thread. That caused issues for people
with slower computers, like an Intel Core i5, where Gyarados would go so
slow that the audio would skip. I would also get audio skipping when the
terminal was put in full screen mode. Now we use two threads and smarter
timing, so NESEMU1 should go reliably fast on everyone's computer today.
2024-09-22 01:21:10 -07:00
Justine Tunney
e975245102
Upgrade to superconfigure z0.0.56 2024-09-22 01:21:10 -07:00
Justine Tunney
126a44dc49
Write more tests attempting to break windows
This time I haven't succeeded in breaking anything which is a good sign.
2024-09-22 01:21:10 -07:00
Gabriel Ravier
476926790a
Make printf %La test-case work properly on AArch64 (#1298)
As the size of long double changes between x86 and AArch64, this results
in one of the printf a conversion specifier test-cases getting different
output between the two. Note that both outputs (and a few more) are 100%
standards-conforming, but the testcase currently only expects a specific
one - the one that had been seen on x86 when initially writing the test.

This patch fixes the testcase so it accepts either of those two outputs.
2024-09-22 01:21:03 -07:00
Justine Tunney
dd8c4dbd7d
Write more tests for signal handling
There's now a much stronger level of assurance that signaling on Windows
will be atomic, low-latency, low tail latency, and shall never deadlock.
2024-09-21 05:24:56 -07:00
Justine Tunney
0e59afb403
Fix conflicting RTTI related symbol 2024-09-19 20:34:43 -07:00
Justine Tunney
f68fc1f815
Put more thought into new signaling code 2024-09-19 20:21:33 -07:00
Justine Tunney
6107eb38f9
Fix m=tinylinux build 2024-09-19 04:25:34 -07:00
Justine Tunney
d50f4c02f6
Make revision to previous change 2024-09-19 03:29:39 -07:00
Justine Tunney
0d74673213
Introduce interprocess signaling on Windows
This change gets rsync working without any warning or errors. On Windows
we now create a bunch of C:\var\sig\x\y.pid shared memory files, so sigs
can be delivered between processes. WinMain() creates this file when the
process starts. If the program links signaling system calls then we make
a thread at startup too, which allows asynchronous delivery each quantum
and cancelation points can spot these signals potentially faster on wait

See #1240
2024-09-19 03:02:13 -07:00
Justine Tunney
8527462b95
Fix ECHILD with WNOHANG on Windows
This change along with a patch for rsync's safe_write() function that'll
that'll soon be added to superconfigure, gets rsync working. There's one
remaining issue (which isn't a blocker) which is how rsync logs an error
about abnormal process termination since there's currently no way for us
to send non-fatal signals between processes. rsync in cosmos is restored

Fixes #1240
2024-09-18 23:26:02 -07:00
Justine Tunney
8313dca982
Show file descriptors on crash on Windows 2024-09-18 21:53:09 -07:00
Justine Tunney
87a6669900
Make more Windows socket fixes and improvements
This change makes send() / sendto() always block on Windows. It's needed
because poll(POLLOUT) doesn't guarantee a socket is immediately writable
on Windows, and it caused rsync to fail because it made that assumption.
The only exception is when a SO_SNDTIMEO is specified which will EAGAIN.

Tests are added confirming MSG_WAITALL and MSG_NOSIGNAL work as expected
on all our supported OSes. Most of the platform-specific MSG_FOO magnums
have been deleted, with the exception of MSG_FASTOPEN. Your --strace log
will now show MSG_FOO flags as symbols rather than numbers.

I've also removed cv_wait_example_test because it's 0.3% flaky with Qemu
under system load since it depends on a process being readily scheduled.
2024-09-18 20:29:42 -07:00
Justine Tunney
ce2fbf9325
Write network audio programs 2024-09-18 17:17:02 -07:00
Steven Dee (Jōshin)
1bfb348403
Add weak self make_shared variant (#1299)
This extends the CTL version of make_shared with functionality not found
in the STL, with inspiration taken from Rust's Rc class.
2024-09-17 15:46:23 -07:00
Justine Tunney
aaed879ec7
Release Cosmopolitan v3.9.1 2024-09-17 02:55:07 -07:00
Justine Tunney
8201ef2b3d
Fix regression in package.ape build tool 2024-09-17 02:54:17 -07:00
Justine Tunney
b1c9801897
Support more TCP socket options on Windows 2024-09-17 02:46:05 -07:00
Justine Tunney
f7754ab608
Fix strace result code for recv() 2024-09-17 02:16:56 -07:00
Justine Tunney
96abe91c29
Reveal another Qemu bug 2024-09-17 01:31:55 -07:00
Justine Tunney
bb7942e557
Improve socket option story 2024-09-17 01:17:07 -07:00
Justine Tunney
b14dddcc18
Emulate Linux socket timeout signaling on Windows 2024-09-17 00:24:08 -07:00
Justine Tunney
65e425fbca
Slightly optimize iovec on Windows 2024-09-16 21:36:22 -07:00
Justine Tunney
774c67fcd3
Make send() block in non-blocking mode 2024-09-16 21:09:28 -07:00
Justine Tunney
3c58ecd00c
Fix bug with send() on Windows in O_NONBLOCK mode
There is a bug in WIN32 where using CancelIoEx() on an overlapped i/o op
initiated by WSASend() will cause WSAGetOverlappedResult() to report the
operation failed when it actually succeeded. We now work around that, by
having send and sendto initially consult WSAPoll() on O_NONBLOCK sockets
2024-09-16 20:49:58 -07:00
Justine Tunney
5aa970bc4e
Fix strace logging of ipv6 port 2024-09-16 02:19:17 -07:00
Justine Tunney
56ca00b022
Release Cosmopolitan v3.9.0 2024-09-15 22:39:09 -07:00
Justine Tunney
ecbf453464
Upgrade to superconfigure z0.0.55 2024-09-15 22:29:49 -07:00
Justine Tunney
c3482af66d
Fix file descriptor assignment issues on Windows 2024-09-15 22:16:38 -07:00
Justine Tunney
b73673e984
Freshen bootstrap binaries 2024-09-15 20:37:32 -07:00
Gabriel Ravier
e260d90096
Fix 0 before decimal-point in hex float printf fns (#1297)
The C standard specifies that, upon handling the a conversion specifier,
the argument is converted to a string in which "there is one hexadecimal
digit (which is nonzero [...]) before the decimal-point character", this
being a requirement which cosmopolitan does not currently always handle,
sometimes printing numbers like "0x0.1p+5", where a correct output would
have been e.g. "0x1.0p+1" (despite both representing the same value, the
first one illegally has a '0' digit before the decimal-point character).
2024-09-15 18:02:47 -07:00
Gabriel Ravier
81bc8d0963
Fix printing decimal-point character on printf %#a (#1296)
The C standard indicates that when processing the a conversion specifier
"if the precision is zero *and* the # flag is not specified, no decimal-
point character appears.". This means that __fmt needs to ensure that it
prints the decimal-point character not only when the precision is non-0,
but also when the # flag is specified - cosmopolitan currently does not.

This patch fixes this, along with adding a few tests for this behaviour.
2024-09-15 16:42:51 -07:00
Steven Dee (Jōshin)
ef62730ae4
Enable STL-style enable_shared_from_this (#1295) 2024-09-15 16:32:13 -07:00