Commit graph

502 commits

Author SHA1 Message Date
Justine Tunney
6c724c0f1a Update experiment with tty audio 2022-07-15 23:07:32 -07:00
Justine Tunney
aa34340f3d Add pipelining to cocmd 2022-07-15 20:47:20 -07:00
Justine Tunney
b4e38851ff Fix pthread isystem reference
Fixes #489
2022-07-15 18:48:24 -07:00
Justine Tunney
13d67fed38 Add latest Linux syscalls including landlock
See #485
2022-07-15 18:29:49 -07:00
Justine Tunney
2e3958c6dc Make some touchups 2022-07-15 18:07:34 -07:00
Justine Tunney
ccd057a85d Permit MAP_POPULATE with pledge() 2022-07-14 13:04:28 -07:00
Justine Tunney
0a589add41 Third time's a charm with stack remaining checker 2022-07-14 07:38:44 -07:00
Justine Tunney
28b9d9f781 Fix C stack remaining check in MODE=tiny 2022-07-14 07:23:15 -07:00
Justine Tunney
4901e1b8cb Fix MODE=tiny build 2022-07-14 05:42:24 -07:00
Justine Tunney
1d744ea11b Improve upon the new pledge command 2022-07-14 04:39:45 -07:00
Justine Tunney
60164a7266 Add assimilate.com command for APE binaries 2022-07-13 20:56:24 -07:00
Justine Tunney
1d490fcb94 Add pledge.com for launching commands in a sandbox 2022-07-13 04:31:46 -07:00
Justine Tunney
e3cd476a9b Improve Lua and JSON serialization 2022-07-12 23:35:11 -07:00
Justine Tunney
3027d67037 Import more Musl math 2022-07-12 15:55:12 -07:00
Justine Tunney
7965ed0232 Fix MODE=tiny build 2022-07-11 23:40:34 -07:00
Justine Tunney
6ee18986e4 Further improve JSON serialization 2022-07-11 23:06:49 -07:00
Justine Tunney
4814b6bdf8 Use ARM's faster math functions on non-tiny builds 2022-07-11 18:34:10 -07:00
Justine Tunney
694a0da990 Make function call tracing lockless 2022-07-11 08:04:58 -07:00
Justine Tunney
3f015b1e51 Make some minor fixups to bug reporting, etc. 2022-07-11 05:58:24 -07:00
Justine Tunney
5fa77f1e8f Make _Thread_local more seamlessly working 2022-07-10 08:27:50 -07:00
Justine Tunney
5f4f6b0e69 Make _Thread_local work across platforms
We now rewrite the binary image at runtime on Windows and XNU to change
mov %fs:0,%reg instructions to use %gs instead. There's also simpler
threading API introduced by this change and it's called _spawn() and
_join(), which has replaced most clone() usage.
2022-07-10 04:01:17 -07:00
Justine Tunney
ee82cee432 Further improve json / lua serialization 2022-07-09 16:27:26 -07:00
Justine Tunney
2189877856 Implement new JSON parser for redbean 2022-07-09 11:44:19 -07:00
Justine Tunney
727d9cbf56 Bump redbean to 2.0.9 2022-07-09 05:50:05 -07:00
Justine Tunney
c9e68b0ebc Make redbean serialization deterministic 2022-07-09 04:09:51 -07:00
Justine Tunney
1c83670229 Write more redbean unit tests
- Fix DescribeSigset()
- Introduce new unix.rmrf() API
- Fix redbean sigaction() doc example code
- Fix unix.sigaction() w/ more than two args
- Improve redbean re module API (non-breaking)
- Enhance Lua with Python string multiplication
- Make third parameter of unix.socket() default to 0
2022-07-08 23:10:02 -07:00
Justine Tunney
c5b9902ac9 Add ansi terminal audio prototype
It's never worked very well having nesemu1.com and printvideo.com
spawning an ffmpeg or sox subprocess and streaming audio samples via
pipes. Since these programs don't work very well for that purpose, and
if you're SSH'ing into the cloud, the speaker could be very far away.

This change is part of an experiment to instead patch desktop terminals
such as PuTTY, KiTTY, gnome-terminal, etc. to support receiving inband
audio samples as ANSI code, and then playing them on the speakers of the
local machine that's being used. This way we can use printf() as a cross
platform audio playback library.
2022-07-08 15:11:46 -07:00
Justine Tunney
853b6c3864 Improve system calls
- Wrap clock_getres()
- Wrap sched_setscheduler()
- Make sleep() api conformant
- Polyfill sleep() using select()
- Improve clock_gettime() polyfill
- Make nanosleep() POSIX conformant
- Slightly improve some DNS functions
- Further strengthen pledge() sandboxing
- Improve rounding of timeval / timespec
- Allow layering of pledge() calls on Linux
- Polyfill sched_yield() using select() on XNU
- Delete more system constants we probably don't need
2022-07-08 06:42:03 -07:00
Daniil Kulchenko
9f8e6c10dd
Work around Rosetta clobbering startup registers on M1 Macs (issue #429) (#453)
Rosetta doesn't correctly respect the startup registers as defined in LC_UNIXTHREAD
which makes platform detection go awry. But at least Rosetta appears to consistently
set rbx to 0x00000000ffffffff and rdx to 0x0000000000000001 at startup for every
x64 executable I could get my hands on. So we use that to detect Rosetta's presence
and set up the correct registers for XNU.
2022-06-27 16:28:59 -07:00
Justine Tunney
5297897ba1 Add fixups for previous change 2022-06-27 15:00:51 -07:00
Justine Tunney
3c92adfd6e Strengthen the pledge() polyfill 2022-06-27 13:02:17 -07:00
Gautham
a6f65eea7c
Scan fixed-width integers in vcscanf (#424)
When a format string like %2x is provided, the width parameter was read
correctly as 2, but it was not used when decoding the number from the
input string (ie instead of reading 2 characters from the input string,
vcscanf read all the characters).

This change uses the value of width within the number decoding loop to
read fixed number of digits correctly. if width is zero (not provided),
the default of width is set as bits.

Fixes #423
2022-06-26 21:27:07 -07:00
Paul Kulchenko
32eec7df4c
Update FATALF to exit without stack trace (#452) 2022-06-26 21:25:02 -07:00
Justine Tunney
f6dab99f44 Release redbean 2.0.8 2022-06-26 17:25:54 -07:00
Justine Tunney
893cc06fc2 Fix libunwind stubs 2022-06-26 05:29:25 -07:00
Justine Tunney
5cd0e876bd Scrub double-conversion and add quick wrapper 2022-06-26 05:03:25 -07:00
Justine Tunney
61257d48d4 Make some quick fixes and cleanup 2022-06-26 02:58:36 -07:00
Justine Tunney
fbc053e018 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
2022-06-25 21:09:09 -07:00
Gautham
5d837c4e7c
Add complex math from musl (#422) 2022-06-23 18:56:10 -07:00
Justine Tunney
e4258015b7 Improve detection of getrandom / getentropy
It's been reported that the 500th system call getentropy() isn't present
on Darwin Kernel Version 15.6.0 virtual machines. We work around this by
ignoring SIGSYS temporarily.
2022-06-23 14:09:32 -07:00
Justine Tunney
44da16255a Show crash reports on SIGSYS
This will help make it easier to troubleshoot ABI breakages with on
operating systems that, unlike Linux don't have ironclad guarantees
to not break userspace.
2022-06-23 13:01:01 -07:00
Justine Tunney
a4601a24d3 Perform some code cleanup 2022-06-23 10:21:07 -07:00
Justine Tunney
3fc23c6cbc Add getcontext() and setcontext()
Fixes #413
2022-06-23 06:01:44 -07:00
Justine Tunney
17cbe73411 Add finger demo to redbean and fix regression
This change fixes a regression in unix.connect() caused by the recent
addition of UNIX domain sockets. The BSD finger command has been added
to third_party for fun and profit. A new demo has been added to redbean
showing how a protocol as simple as finger can be implemented.
2022-06-23 03:42:05 -07:00
Justine Tunney
2415afab0e Don't use vfork() on XNU (#426) 2022-06-23 01:18:47 -07:00
Justine Tunney
9545062175 Add pthread tls api 2022-06-22 07:08:17 -07:00
Justine Tunney
fc097ac275 Add unix domain socket support to redbean 2022-06-22 03:04:25 -07:00
Jules Bertholet
4b23985b7f
Reformat libc README.md (#437) 2022-06-21 07:50:42 -07:00
Justine Tunney
ff28e38ef1 Close more superfluous file descriptors
GitHub Actions leaks file descriptors with numbers greater than a
hundred. But our test runner only checked for FDs up to 64.
2022-06-21 07:42:07 -07:00
Justine Tunney
b8e9f71d33 Add futexes for OpenBSD 2022-06-21 07:17:05 -07:00