Andreas Kling
8ad2dfb6e1
Rename FileDescriptor::has_data_available_for_reading() -> can_read().
2019-01-16 00:47:00 +01:00
Andreas Kling
10387beda7
Implement basic support for POSIX-style select().
...
Now we can block on both the PTY *and* the GUI event stream in Terminal.
2019-01-16 00:09:58 +01:00
Andreas Kling
e452303c66
Allow character devices to block write attempts until there is more space.
2019-01-15 09:17:22 +01:00
Andreas Kling
b0e3f73375
Start refactoring the windowing system to use an event loop.
...
Userspace programs can now open /dev/gui_events and read a stream of GUI_Event
structs one at a time.
I was stuck on a stupid problem where we'd reenter Scheduler::yield() due to
having one of the has_data_available_for_reading() implementations using locks.
2019-01-14 14:42:49 +01:00
Andreas Kling
7731aef7b2
Let the "reaped unparented process" messages go straight to the debugger.
2019-01-01 03:56:39 +01:00
Andreas Kling
033a42b580
The syncd loop can just be a lambda.
2018-12-24 23:10:48 +01:00
Andreas Kling
ec1c487dcd
Yet another pass of style fixes.
2018-12-21 02:10:45 +01:00
Andreas Kling
e7cc08226f
Implement basic support for times().
...
The kernel now bills processes for time spent in kernelspace and userspace
separately. The accounting is forwarded to the parent process in reap().
This makes the "time" builtin in bash work.
2018-12-03 01:14:19 +01:00
Andreas Kling
4bc87dc7b9
Share the "blocked-on file descriptor" number between read() and write().
...
A process can't be reading and writing at the same time, so it's fine for
them to share the variable for the blocked FD.
2018-12-03 00:42:48 +01:00
Andreas Kling
f6e27c2abe
More coding style changes.
2018-12-03 00:39:25 +01:00
Andreas Kling
f5a83c4d8a
Fix bug where a signal-interrupted waitpid() wouldn't return EINTR.
2018-11-28 23:30:49 +01:00
Andreas Kling
d90104f9e0
Let reap() communicate the dead process's exit status to the caller.
...
This way the scheduler doesn't need to plumb the exit status into the waiter.
We still plumb the waitee pid though, I don't love it but it can be fixed.
2018-11-28 22:01:24 +01:00
Andreas Kling
6cedb88153
Don't unblock a blocked process when it ignores a signal.
2018-11-16 21:14:25 +01:00
Andreas Kling
97c799576a
Add close-on-exec flag for file descriptors.
...
I was surprised to find that dup()'ed fds don't share the close-on-exec flag.
That means it has to be stored separately from the FileDescriptor object.
2018-11-13 01:36:31 +01:00
Andreas Kling
f1404aa948
Add primitive FIFO and hook it up to sys$pipe().
...
It's now possible to do this in bash:
cat kernel.map | fgrep List
This is very cool! :^)
2018-11-12 01:28:46 +01:00
Andreas Kling
d5d45d1088
Rage hacking to get bash to run. It finally runs. So cool! :^)
2018-11-11 15:38:07 +01:00
Andreas Kling
e71cb1c56b
Fix some paging related bugs exposed by the spawn stress test.
...
- Process::exec() needs to restore the original paging scope when called
on a non-current process.
- Add missing InterruptDisabler guards around g_processes access.
- Only flush the TLB when modifying the active page tables.
2018-11-09 01:25:31 +01:00
Andreas Kling
e287f8ef3a
The colonel task already had a halt loop.
...
Also don't reap() current in the scheduler, just wait until it's not current.
2018-11-08 00:30:35 +01:00
Andreas Kling
ac1d12465f
Move timer tick handling into Scheduler.
2018-11-08 00:26:04 +01:00
Andreas Kling
1dbc340da8
Get rid of the undertaker and have waitpid() be the reaper.
...
For dead orphans, the scheduler calls reap().
2018-11-07 23:59:49 +01:00
Andreas Kling
f792349853
Unbreak sys$sigreturn() after colonel process changes.
2018-11-07 23:21:32 +01:00
Andreas Kling
43f40a3050
Finally unbreak the colonel process and make it the true idle process.
2018-11-07 23:14:56 +01:00
Andreas Kling
440029c9d1
Reduce number of passes in the scheduler by 2.
2018-11-07 22:24:20 +01:00
Andreas Kling
39d2fcbbee
Move the scheduler code to its own class.
...
This is very mechanical.
2018-11-07 22:15:02 +01:00