This is a pretty big commit, so let's run through it in parts:
- All of the userspace changes are to switch away from syscall_wait
Mostly, this is to waitpid; some things were tweaked to do things
"properly" instead of waiting for particular processes. Init has
been fixed to do a proper spin wait.
- syscall_wait is gone - as are its uses. newlib bindings have been
using just waitpid for a while now.
- waitpid now performs like a Unix waitpid
- process reaping is no longer a "do this on next change thing":
it happens when a process is waited on, like it should
(That means we can have real zombies: terminated processes that
have not yet been waited on)
- Reparenting of children to init has been implemented, so you
can fork-daemonize!
Overall, this is pretty big... So I hope it doesn't break everything.
We weren't freeing old page directories on exec, so regardless of the
actual size needed for the new process, we ended up with a huge address
space usage. Now, all of the memory from the other process is going to
be copied on the fork, and we can't do anything about that (beyond
writing a separate syscall that forks+replaces without the copy, or
implementing CoW, the latter being preferred) but that's at least a
well-know "problem".
This is a bit of a hack. /dev is presented as a new pseudo file type
until I finish the VFS overhaul. This fake file presents a directory
with entries for all of the VFS nodes that are children of it. The
future VFS will do this on its own, thus making this superfluous.
WARNING: THIS BREAKS PARTITIONS
Until I get partition maps and can produce device entries like
/dev/hda1, partitions will be broken, so DON'T TRY TO BUILD AN IMAGE
WITH THE IMAGE BUILDER.
Hopefully this is all rectified in under 24 hours...
Still need to do proper loading of the ELF sections somewhere, but other
than that, we've got a standard interface now. Needs a syscall so we can
write an insmod or something like that.
- Tasklets are essentially kernel threads. Still working on passing
arguments to them, but they essentially just run functions and have
special names like [[kttydebug]]. Eventually, I want disk scheduling
and various (non-interrupt-driven) drivers running on these, but I'm
still not sure how stable they are.
- Fix the scheduler so it supports not having anything to run. This took
some tracking of what's running, and then inserting some liberal
sleeps. Doesn't appear to break anything. Makes the system work when
you try to sleep with only one process "running", so that's good.
- Start working on reimplementing the old kernel shell, but this time as
a tasklet running in the background over serial. Probably going to try
to add all the same features as before (tab completion, history, rich
editing), but it may take some time to get it all in there. This
console is mostly focused on helping with debugging EXT2 and other
future stuff.