jart/cosmopolitan
View on GitHub ↗ ★ 21,431 C
build-once run-anywhere c library
293 mentions on Hacker News by 135 people: 24 stories, 269 comments · first 2020-06-20 · latest 2026-10-11
20082026
-
…convert to/from the old constants during runtime is too much. Look at the list of constants here: https://github.com/jart/cosmopolitan/blob/master/libc/sysv/c... Every time I used any of these constants, I'd have to load a whole bunch of…
comment by ahgamut · 2023-07-14 · in Patching GCC to build Actually Portable Executables -
There seems to be a standard socket API in the Cosmopolitan clib though: https://github.com/jart/cosmopolitan/tree/master/libc/sock ..and that also seems to have WinSock support: https://github.com/jart/cosmopolitan/blob/master/libc/sock/c.…
comment by flohofwoe · 2023-07-14 · in Patching GCC to build Actually Portable Executables -
…to inject a SECCOMP filter. Then you can block execve(). See https://justine.lol/pledge/ and https://github.com/jart/cosmopolitan/blob/master/tool/build/...
comment by jart · 2023-07-07 · in List of Unix binaries that can be used to bypass local security restrictions -
…you pass a pipe into the whole (server) process, instead of having it open its own sockets? (In https://github.com/jart/cosmopolitan/blob/48b2afb192ec18eca4... , I gather?) I haven't followed cosmopolitan / Linux pledge() too closely; but…
comment by JoachimSchipper · 2023-06-19 · in Redbean Systems -
See https://github.com/jart/cosmopolitan/commit/48b2afb192ec18ec... and https://twitter.com/JustineTunney/status/1670600564164657154
comment by jart · 2023-06-19 · in Redbean Systems -
…datagrams so it can blackhole your IP address in the RAW PREROUTING iptable if you DDOS the system. https://github.com/jart/cosmopolitan/blob/f10845ab9f847e4cad... You can't ban someone's IP without root. So we have two choices: (1) create…
comment by jart · 2023-06-18 · in Redbean Systems -
I'd love to understand more about what the ".verynice()" call does. Source is here: https://github.com/jart/cosmopolitan/blob/f10845ab9f847e4cad... What are the effects of limiting a process priority?
comment by maxmcd · 2023-06-18 · in Redbean Systems -
…which maintains support for old file formats. You can build and use it as follows: git clone https://github.com/jart/cosmopolitan cd cosmopolitan # cross-compile on x86-64-linux for x86-64 linux+windows+macos+freebsd+openbsd+netbsd make…
comment by jart · 2023-06-06 · in GGML – AI at the Edge -
I bet it wouldn't be too extremely hard to port Vim to https://github.com/jart/cosmopolitan and run it without an OS (BIOS mode in cosmopolitan).
comment by etaioinshrdlu · 2023-04-22 · in Boot to Vim, Vim as Pid 1 (2014) -
Cosmopolitan[0] is indeed worth mentioning here. It's an amazing project. [0] https://github.com/jart/cosmopolitan
comment by loupol · 2023-02-12 · in How to create portable Linux binaries -
…Worth noting that we do have Google's outstanding double-conversion library in the cosmo codebase https://github.com/jart/cosmopolitan/tree/master/third_party... as well as gdtoa (which is what we use for printf's floating point support)…
comment by jart · 2023-02-03 · in Blink virtual machine now supports running GUI programs -
…appear to be. The comments in the code say it can do floats, but the comments are mistaken.) [1] https://github.com/jart/cosmopolitan/blob/master/libc/fmt/vc... [2] https://github.com/jart/cosmopolitan/issues/456
comment by smcameron · 2023-02-03 · in Blink virtual machine now supports running GUI programs -
…(a 'minimal vfprintf()') with the one in cosmopolitan starting at https://github.com/jart/cosmopolitan/blob/master/libc/stdio/... . Right away we can see nolibc places many functions in the same file while Cosmopolitan uses
comment by eesmith · 2023-01-22 · in Nolibc: A minimal C-library replacement shipped with the kernel -
…I recommend obtaining Python from the Comsopolitan mono repo: git clone https://github.com/jart/cosmopolitan make -j8 o//third_party/python/python.com That'll easily give you a static Python 3.6 binary that can be run under Blink.
comment by jart · 2023-01-06 · in Emulating an emulator inside itself. Meet Blink -
…really nice `cosmocc` toolchain that makes building POSIX software with Cosmo easier than ever. See https://github.com/jart/cosmopolitan/blob/master/tool/script... and https://github.com/jart/cosmopolitan/blob/master/tool/script...
comment by jart · 2023-01-04 · in Emulating an emulator inside itself. Meet Blink -
…I wrote in C (with a focus on readability) which runs https://ipv4.games/ You can read the code at https://github.com/jart/cosmopolitan/blob/master/net/turfwar... This web server runs on a single VM. It was handling about 300 write…
comment by jart · 2022-12-18 · in Ask HN: Resources for Building a Webserver in C? -
Cosmopolitan Libc uses a musl-cross-make toolchain. https://github.com/jart/cosmopolitan/tree/master/third_party... Its primary developer also runs Alpine. Cosmopolitan is closely related to Musl as far as C libraries go. You could think…
comment by jart · 2022-12-15 · in Actually Portable Perl -
Another example: https://github.com/jart/cosmopolitan/issues/426
comment by comex · 2022-11-10 · in Why is Rosetta 2 fast? -
But python is also universal? You can just bundle jc inside https://github.com/jart/cosmopolitan/tree/master/third_party... and it's as universal as it gets.
comment by ElectricalUnion · 2022-11-03 · in JC – JSONifies the output of many CLI tools -
…rejoice. But it gets better. If you build Python in the Cosmopolitan Libc repository: git clone https://github.com/jart/cosmopolitan cd cosmopolitan build/bootstrap/make.com -j8 o//third_party/python/python.com Then you can use…
comment by jart · 2022-11-03 · in Dozens of malicious PyPI packages discovered targeting developers -
Actually Portable Executables / Cosmopolitan https://justine.lol/ape.html https://github.com/jart/cosmopolitan
comment by smcameron · 2022-10-31 · in Ask HN: What piece of code/codebase blew your mind when you saw it? -
Oh yes. A good place to start would be our c++ toolchain. https://github.com/jart/cosmopolitan/blob/master/tool/script...
comment by jart · 2022-10-24 · in Debugging C with Cosmopolitan Libc -
…our system call support. Look here, all we need to support a XNU system call is 16-bits of a word. https://github.com/jart/cosmopolitan/blob/2.1/libc/sysv/sysc...
comment by jart · 2022-09-21 · in Can I use a system call? -
Love your naming of the magic numbers headers. https://github.com/jart/cosmopolitan/blob/1.0/libc/sysv/cons...
comment by davedx · 2022-09-21 · in Can I use a system call? -
…to work here) Sadly, it was considered, and XFF is ignored from non-private source addresses: https://github.com/jart/cosmopolitan/blob/155b378a3962e4d291... With private addresses defined as: https://github.com/jart/cosmopolitan/blob/7ab15…
comment by progval · 2022-09-11 · in IPv4 Turf War -
…anything other than educational purposes, at least not until they've been more battle tested. [0]: https://github.com/jart/cosmopolitan/issues/72
comment by coder543 · 2022-09-08 · in Caddyhttp: Enable HTTP/3 by Default -
https://github.com/jart/cosmopolitan/issues/140 https://github.com/golang/go/issues/51900 & from what I gather, APE is tightly-bound to x86_64, & depends on an embedded emulator for other architectures: > All we have to do embed an ARM…
comment by georgia_peach · 2022-08-30 · in How fat does a fat binary need to be? (2021) -
https://github.com/jart/cosmopolitan/blob/master/ape/ape.S https://github.com/jart/cosmopolitan/blob/master/libc/sysv/s... https://github.com/jart/cosmopolitan/blob/master/libc/sysv/s... We do everything static. Even on Apple x86 and M1.
comment by jart · 2022-08-23 · in A general overview of what happens before main() (2019) -
…to define kernel syscalls like how Cosmopolitan [0] uses for building things like RedBean [1]. 0. https://github.com/jart/cosmopolitan 1. https://redbean.dev/
comment by adolph · 2022-08-23 · in A general overview of what happens before main() (2019) -
Don't forget the linker script: https://github.com/jart/cosmopolitan/blob/master/ape/ape.lds It has a longform explanation in the comment at the top.
comment by jart · 2022-08-20 · in Cosmopolitan Libc v2.0 -
…you're looking for a write-up/blog, however, if you haven't peeked at ape.S you absolutely must: https://github.com/jart/cosmopolitan/blob/master/ape/ape.S It is very commented, in a good way.
comment by grimgrin · 2022-08-20 · in Cosmopolitan Libc v2.0 -
…at the moment. However we'd be happy to see them be included. Most of our modules e.g. unix https://github.com/jart/cosmopolitan/blob/master/third_party... only really depend on Lua and POSIX which is available everywhere. You can build…
comment by jart · 2022-08-17 · in Redbean web server debugging with ZeroBrane Studio -
…runs on M1 Macs with ARM. Daniil Kulchenko pulled off an impressive hack to make that possible. https://github.com/jart/cosmopolitan/issues/429 Redbean also works great on Windows ARM https://youtu.be/CQ7Npip88Yw As for Linux ARM, we're…
comment by jart · 2022-08-16 · in Redbean web server debugging with ZeroBrane Studio -
…because the difficulty in making graphics cross-platform [0]. Maybe Cosmopolitan circa 2032? [0]: https://github.com/jart/cosmopolitan/issues/35#issuecomment-... .
comment by actuallyalys · 2022-08-16 · in Win32 Is the Only Stable ABI on Linux? -
…seeing something I helped with on the front page of HN[1]. Thanks for the shoutout Justine! [1] https://github.com/jart/cosmopolitan/pull/490
comment by Toaster-King · 2022-08-07 · in Using Landlock to Sandbox GNU Make -
…how to approach implementing this feature. - https://news.ycombinator.com/item?id=32376870 From https://github.com/jart/cosmopolitan#support-vector , supported platforms are Windows, Linux, Mac OS X, FreeBSD, OpenBSD, and NetBSD, on AMD…
comment by yjftsjthsd-h · 2022-08-07 · in Using Landlock to Sandbox GNU Make -
Cosmopolitan Libc Makefile fixes this. And it does it with plain ordinary GNU Make. https://github.com/jart/cosmopolitan/blob/master/Makefile It even has Landlock LSM based sandboxing for strict dependency checking.…
comment by jart · 2022-08-05 · in Keeping a project bisectable -
…Windows' approach always seemed more sensible in the first place. But it's a step worth noting. [1] https://github.com/jart/cosmopolitan/issues/426 [2] https://man7.org/linux/man-pages/man7/vdso.7.html [3]…
comment by comex · 2022-07-29 · in Linux RNG RFC Patch: implement getrandom() in vDSO -
…systems unmodified. Cosmopolitan is an incredibly cool project that does more than you think. https://github.com/jart/cosmopolitan
comment by DenseComet · 2022-07-28 · in Rust is actually portable -
…to me. The library this is built on does have a bit of a weakness with respect to GUI software https://github.com/jart/cosmopolitan/issues/35 if this can be fixed this will be an amazing tool for building simple cross platform utilities…
comment by techdragon · 2022-07-28 · in Rust is actually portable -
…format headers (a genius hack nonetheless from Justine) Its a lot more then that. Look at the code. https://github.com/jart/cosmopolitan You compile an executable with flags --nostdlib and --nostdinc because it includes cross platform…
comment by ActorNightly · 2022-07-27 · in Python is Actually Portable -
…uses a polyglot to tell if the processor is running in real mode or long mode within its DOS stub. https://github.com/jart/cosmopolitan/blob/066ed2b2b229dce4d1... APE is also a legal EXE file because it has the MZ header. However... I…
comment by jart · 2022-07-27 · in Python is Actually Portable -
Here's the latest update on TLS https://github.com/jart/cosmopolitan/blob/master/libc/runtim... We need to rewrite the x86 binary code at runtime in order to support it on Mac/Windows. I managed to speed it up from 30ms down to 1ms of…
comment by jart · 2022-07-27 · in Python is Actually Portable -
…the tool to make the default virtual memory limit equal to the total amount of physical ram. https://github.com/jart/cosmopolitan/commit/7f966de48987f79a... I hope this addresses your concern. No default limit is going to be perfect. Some…
comment by jart · 2022-07-15 · in Show HN: Porting OpenBSD Pledge() to Linux -
As you wish. I've just pushed a change removing the restriction on MAP_POPULATE. https://github.com/jart/cosmopolitan/commit/ccd057a85daf0d2d... Now that we have -n (maximum niceness flag) I doubt anyone will object. If your app is public…
comment by jart · 2022-07-14 · in Show HN: Porting OpenBSD Pledge() to Linux -
…FreeBSD behavior which we polyfill on Linux using MAP_GROWSDOWN. See our docs for further details. https://github.com/jart/cosmopolitan/blob/0a589add4167c1b587...
comment by jart · 2022-07-14 · in Show HN: Porting OpenBSD Pledge() to Linux -
…person on earth who's written a libc for that many platforms. Here's what I learned. If you look at https://github.com/jart/cosmopolitan/blob/master/libc/sysv/s... you can see that there's a point in history where consensus between systems…
comment by jart · 2022-07-14 · in Show HN: Porting OpenBSD Pledge() to Linux -
…NOPs into function calls at runtime for all locking operations as soon as clone() is called. https://github.com/jart/cosmopolitan/blob/5df3e4e7a898d223ce... The big ugly macro that makes it work is here…
comment by jart · 2022-07-06 · in Python 3.11 vs 3.10 performance -
The code is interesting: https://github.com/jart/cosmopolitan/blob/master/tool/viz/me... Feels really old school. Looks like something from people used to write DOS programs.
comment by marcodiego · 2022-07-05 · in Memzoom – view/monitor the raw memory of processes/files in your UTF-8 terminal -
I use chibicc to generate the documentation for cosmopolitan. https://github.com/jart/cosmopolitan/blob/master/third_party... I added many of the GNU extensions too, including an assembler. https://github.com/jart/cosmopolitan/blob/master/t…
comment by jart · 2022-07-01 · in OpenBSD has two new C compilers: chibicc and kefir