Commit graph

1736 commits

Author SHA1 Message Date
Justine Tunney
ebf784d4f5
Make improvements
- Introduce ualarm() function
- Make rename() report EISEMPTY on Windows
- Always raise EINVAL upon open(O_RDONLY|O_TRUNC)
- Add macro so ./configure will detect SOCK_CLOEXEC
- Fix O_TRUNC without O_CREAT not working on Windows
- Let fcntl(F_SETFL) change O_APPEND status on Windows
- Make sure pwrite() / pread() report ESPIPE on sockets
- Raise ESPIPE on Windows when pwrite() is used on pipe
- Properly compute O_APPEND CreateFile() flags on Windows
- Don't require O_DIRECTORY to open directories on Windows
- Fix more instances of Windows reporting EISDIR and ENOTDIR
- Normalize EFTYPE and EMLINK to ELOOP on NetBSD and FreeBSD
- Make unlink() / rmdir() work on read-only files on Windows
- Validate UTF-8 on Windows paths to fix bug with overlong NUL
- Always print signal name to stderr when crashing due to SIG_DFL
- Fix Windows bug where denormalized paths >260 chars didn't work
- Block signals on BSDs when thread exits before trashing its own stack
2023-08-21 02:34:17 -07:00
Justine Tunney
ec957491ea
Make posix_spawn faster on Windows 2023-08-20 02:50:07 -07:00
michalbiesek
d6f72aa4a6
Extend pr.h header with recent options (#881) 2023-08-20 02:49:58 -07:00
michalbiesek
4f517503e4
Add PTRACE_SECCOMP_GET_METADATA (#882)
see
  linux commit: 26500475ac1b499d8636ff281311d633909f5d20
  ptrace, seccomp: add support for retrieving seccomp metadata
2023-08-20 02:49:22 -07:00
Justine Tunney
610e0d95cb
Fix the MODE=tinylinux build 2023-08-19 06:56:05 -07:00
Justine Tunney
965516e313
Make improvements for Actually Portable Emacs
- Get SIGWINCH working again on the New Technology
- Correctly handle O_NOFOLLOW in open() on Windows
- Implement synthetic umask() functionality on Windows
- Do a better job managing file execute access on Windows
- Fill in `st_uid` and `st_gid` with username hash on Windows
- Munge UNICODE control pictures into control codes on Windows
- Do a better job ensuring Windows console settings are restored
- Introduce KPRINTF_LOG environment variable to log kprintf to a file
2023-08-19 06:44:58 -07:00
Justine Tunney
9c7b81ee0f
Give Emacs another performance boost 2023-08-18 09:34:14 -07:00
Justine Tunney
5b42c810a5
Add filesystem index to ZipOS
This change brings the /zip/... read-only filesystem into performance
parity with the native Linux filesystem which doesn't use compression
therefore, imagine how much faster this could be with bloom filtering
rather than simple binary search, and if we used zstd instead of zlib
2023-08-18 07:11:48 -07:00
Justine Tunney
7100b1cf91
Get Fat Emacs working in Windows Console 2023-08-18 05:00:30 -07:00
Justine Tunney
bf835de612
Get Fat Emacs working on Apple Silicon 2023-08-17 22:01:42 -07:00
Justine Tunney
3f9b39883f
Make fat ape binaries smaller again 2023-08-17 11:15:58 -07:00
Justine Tunney
1d8937d528
Mint APE Loader v1.7
This change reduces the memory requirements of your APE Loader by 10x,
in terms of virtual memory size, thanks to the help of alloca(). We're
also now creating argument blocks with the same layout across systems.
2023-08-17 09:04:50 -07:00
Paul Kulchenko
d967a94c9a
Update ProgramDirectory to prepend Lua path instead of appending (#862). (#864)
* Update ProgramDirectory to prepend Lua path instead of appending (#862).

* Update redbean ProgramDirectory to raise Lua error for easier handling

* Update redbean default Lua path handling to simplify
2023-08-17 00:43:11 -07:00
Paul Kulchenko
d0d027810a
Add OnServerReload to replace /.reload.lua with a bit more flexibility (#851) 2023-08-17 00:42:23 -07:00
Justine Tunney
3a9cac4892
Fix small matters and improve sysconf()
- Fix mkdeps.com out of memory error
- Remove static memory from __get_cpu_count()
- Add support for passing hyphen to cat in cocmd
- Change more ZipOS errors from ENOTSUP to EROFS
- Specify mem_unit in sysinfo() output on BSD OSes
2023-08-17 00:32:11 -07:00
Gautham
eebc24b9cd
get rsync to build (#886) 2023-08-16 21:41:36 -07:00
Justine Tunney
04bd488da7
Introduce COSMOPOLITAN_DISABLE_ZIPOS environ var 2023-08-16 21:04:16 -07:00
Justine Tunney
8d1c81ac9f
Emulate ENOTDIR better 2023-08-16 20:11:23 -07:00
Justine Tunney
b76b2be2d0
Improve zip read-only filesystem
readdir() will now always yield an inode that's consistent with stat()
on ZipOS and Windows in general. More APIs have been updated to return
the appropriate error code when inappropriately trying to do ops, like
sockets, with a zip file descriptor. The path normalization algorithms
are now fully fleshed out. Some socket APIs have been fixed so they'll
raise EBADF vs. ENOTSOCK appropriately. Lastly seekdir() will now work
properly on NetBSD and FreeBSD (not sure why anyone would even use it)
2023-08-16 17:52:12 -07:00
Justine Tunney
dc6c67256f
Remove old stack code and improve dirstream 2023-08-16 07:54:40 -07:00
Justine Tunney
74caabb823
Fix getopt again 2023-08-15 20:06:19 -07:00
Justine Tunney
507d7a0b0b
Fix stack memory, undefined behavior, etc. 2023-08-15 19:10:08 -07:00
Justine Tunney
110559ce6a
Make ZipOS and Qemu work better
This change improves the dirstream library in a lot of respects,
especially for /zip/... files. Also turn off MAP_STACK on Aarch64
because Qemu seems to implement it differently than Linux and it's
probably responsible for a lot of mysterious crashes.
2023-08-15 18:32:50 -07:00
Justine Tunney
4658ae539f
Remove old Windows thread hack from Redbean 2023-08-15 06:06:43 -07:00
Justine Tunney
de3f3a9e5a
Allocate explicit stack on aarch64 2023-08-15 04:40:19 -07:00
Justine Tunney
0e586c834a
Refactor fatcosmocc into a single file 2023-08-14 22:26:17 -07:00
Justine Tunney
b494d56549
Fix the cosmocc ar commands 2023-08-14 20:12:51 -07:00
Gautham
f5b39e9f31
Fix typo in cosmocc (#884) 2023-08-13 23:31:39 -07:00
Justine Tunney
2b67e15b3d
Fix MODE=tinylinux build 2023-08-13 22:59:56 -07:00
Justine Tunney
9c0821def7
Make stdin pollable on Windows
You can now play Super Mario Bros in CMD.EXE using Cosmopolitan! This is
thanks to a new worker thread that's spawned on Windows whenever any one
of poll(), select(), or ioctl(FIONREAD) is linked.
2023-08-13 22:42:25 -07:00
Justine Tunney
ef6387ee5e
Polyfill the 32-bit _bsr() function 2023-08-13 21:13:32 -07:00
Justine Tunney
c776a32f75
Replace COSMO define with _COSMO_SOURCE
This change might cause ABI breakages for /opt/cosmos. It's needed to
help us better conform to header declaration practices.
2023-08-13 20:55:04 -07:00
Justine Tunney
a033b65a33
Fix apelink shell script corruption bug
We were using a shell heredoc value '@' to terminate the dos stub, but
that's not sufficiently safe. We found out sh doesn't consider control
characters as contributing to the start of a line, and had the unlucky
chance of the linker choosing the number 2624 for e_lfanew, and that's
"@\n" in ASCII, which compromised the APE shell script.

We now use the heredoc 'justineXXXXXX' with 31 bits of entropy, that's
determistically generated by hashing apelink inputs w/ crc32 / blake2b
2023-08-13 17:42:11 -07:00
Justine Tunney
2366848db5
Perform some more touchups to toolchain 2023-08-13 15:03:09 -07:00
Justine Tunney
d1b937bf1d
Make cosmocc capable of cross compilation 2023-08-13 14:40:22 -07:00
Justine Tunney
504a4bbf84
Fix --ftrace with cosmocc 2023-08-13 08:25:36 -07:00
Justine Tunney
5d5b4ce691
Add ANSI version of bsr/bsf 2023-08-13 08:19:00 -07:00
Justine Tunney
b40d41085d
Fix the build 2023-08-13 07:17:40 -07:00
Justine Tunney
6942d7b820
Fix bug with temporary files on Windows 2023-08-13 07:10:33 -07:00
Justine Tunney
ab9a284640
Further improve fatcosmocc 2023-08-13 01:51:39 -07:00
Justine Tunney
3f2f0e3a74
Make fatcosmocc good enough to build ncurses 6.4 2023-08-12 22:30:05 -07:00
Justine Tunney
399d14aadf
Make fatcosmocc good enough to build Lua 5.4.6
make all test CC=fatcosmocc AR='fatcosmoar rcu'

This change introduces a program named mktemper.com which provides more
reliable and secure temporary file name generation for scripts. It also
makes our ar.com program more permissive in what commands it'll accept.
The cosmocc command is improved by this change too.
2023-08-12 16:44:04 -07:00
Justine Tunney
566cb5963f
Make assimilate.com better
It's now safer to run. It'll now remove FreeBSD from the ELF os/abi so
that GDB is happier.
2023-08-12 07:46:24 -07:00
Justine Tunney
f491276b62
Add support for C++ thread safe statics 2023-08-12 07:45:32 -07:00
Justine Tunney
60f2ea36ca
Make default localtime() zone /etc/localtime 2023-08-12 07:44:15 -07:00
Justine Tunney
e11fa30791
Move zipos into runtime package
This way complex runtime features (e.g. ftrace, symbol tables) can
always yoink zipos support. This is important now that apelink.com
automates embedding symbol tables for multiple cpus.
2023-08-11 23:14:02 -07:00
Justine Tunney
d53c335a45
Introduce new fatcosmocc command
This new script is an alternative to the `cosmocc` command. It's still a
work in progress. It abstracts all the gory details of building separate
copies of your executable and then running the apelink.com program.
2023-08-11 22:52:11 -07:00
Justine Tunney
8fc778162e
Make stderr go faster
This change makes _IONBF (unbuffered) stdio handles go 20x faster for
certain kinds of formatting directives by being smarter about buffers
2023-08-11 11:56:35 -07:00
Justine Tunney
2cbd09b4d4
Fix the build 2023-08-11 09:49:39 -07:00
Justine Tunney
0105e3e2b6
Introduce new linker for fat ape binaries 2023-08-11 04:39:19 -07:00