I did something similar with TCL, the basis was using an extension I wrote to handle the UNIX stuff [0]. It operated an On-Premises cloud environment appliance, and `init` was just a TCL script (at one point it was a statically linked binary with the init script embedded, but that turned out to be overkill)
These things are essentially the opposite of one another. Bellard's project is a PC emulator in JavaScript. Compiling things to wasm is pretty trivial now, but jslinux was much more impressive when it came out. It actually still is, for reasons you can see in the technical notes: https://bellard.org/jslinux/tech.html
This project, on the other hand, is the opposite (and kind of a joke): a set of Linux utilities mostly written in JavaScript.
Reading the code, I was surprised to see that cd was implemented by calling out to the os library. I assumed that was something the shell or at least userspace handled. At what level does the concept of a “current directory” exist?
It's at the kernel level. Each process has its own current working directory. On Linux, these CWD values are exposed at `/proc/[...]/cwd`. This value affects the resolution of relative paths in filesystem operations at a syscall level.
Very cool. Good use of quickjs, although it would have been cool if it somehow didn’t need a libc and just used the syscall interface. Makes me want to give that a try.
I remember some core Unix utilities reimplemented in Perl, mainly done for Win32 systems back in the day. OFC the performance coudn't compete with the ones written in C, but it was good enough.
I guess there are related projects such as busybox which contain a collection of utilities implemented in a single binary. There are others such as toybox, and various alternatives in different languages, or with different licenses to choose from.
pointlessone|2 months ago
icpmoles|2 months ago
https://xkcd.com/1508/
rkeene2|2 months ago
[0] https://chiselapp.com/user/rkeene/repository/tuapi/doc/trunk...
tzury|2 months ago
https://bellard.org/jslinux/vm.html?url=alpine-x86.cfg&mem=1...
and
https://bellard.org/jslinux/
By the famous Fabrice Bellard who is the creator of QuickJS, QEMU, FFMPEG and many other brilliant and fascinating tools!
https://bellard.org/
mod50ack|2 months ago
This project, on the other hand, is the opposite (and kind of a joke): a set of Linux utilities mostly written in JavaScript.
kalterdev|2 months ago
zsoltkacsandi|2 months ago
I am working something similar in Go, and writing an educative blog post series about it: https://serversfor.dev/linux-inside-out/
lioeters|2 months ago
supermdguy|2 months ago
creatonez|2 months ago
lukeh|2 months ago
semiquaver|2 months ago
mos87|2 months ago
IshKebab|2 months ago
MobiusHorizons|2 months ago
anthk|2 months ago
stevekemp|2 months ago
https://github.com/briandfoy/PerlPowerTools
I guess there are related projects such as busybox which contain a collection of utilities implemented in a single binary. There are others such as toybox, and various alternatives in different languages, or with different licenses to choose from.
nxobject|2 months ago
andai|2 months ago
Making a micro Linux distro [for RISC-V]
https://popovicu.com/posts/making-a-micro-linux-distro/
hxbdbehd|2 months ago
This is the Linux Userland reimplemented in JavaScript
stx5|2 months ago
[deleted]
goodpoint|2 months ago
darkreader|2 months ago