Commit graph

56 commits

Author SHA1 Message Date
Callum Attryde
267672efee Userland: Add wc program (#228)
Fixes #159.
2019-06-16 14:13:57 +02:00
Andreas Kling
46527b72d7 LibC: Run clang-format on everything. 2019-06-07 11:49:03 +02:00
Andreas Kling
98eeb8f22d AK: Rename printf.cpp to PrintfImplementation.h. 2019-06-07 11:41:11 +02:00
Andreas Kling
ccc6e69a29 LibC: Implement popen() and pclose().
I feel reasonably confident that I might have gotten these right. :^)
2019-06-03 21:17:58 +02:00
Andreas Kling
e388808479 LibC: Some compat fixes for GNU make. 2019-05-22 13:21:49 +02:00
Andreas Kling
e20aecefba LibC: Don't clobber errno in dbgprintf(). 2019-05-16 16:24:22 +02:00
Robin Burchell
b2dd12daac LibC: Change putenv (and getenv) to not copy, but directly return the environ values.
This is in keeping with how putenv should function. It does mean that
the shell's export command now leaks, but that's not a difficult fix.

Contributes to #29.
2019-05-16 14:32:09 +02:00
Andreas Kling
d3fb0a56ed LibC: Make fwrite() buffered.
This is a really naive implementation that makes fwrite() call fputc()
internally, but it still performs a lot better due to avoiding the write()
syscall every time.
2019-04-27 17:32:47 +02:00
Andreas Kling
100cb2a237 LibC: Various stdio correctness fixes. 2019-04-27 16:19:11 +02:00
Andreas Kling
8effdc807a LibC: Update stdio stream error state in more places. 2019-04-26 00:41:37 +02:00
Andreas Kling
0c898e3c2c Put assertions behind a DEBUG flag to make it easy to build without them. 2019-04-23 21:52:02 +02:00
Andreas Kling
58240fdb33 Do a pass of compiler warning fixes.
This is really making me question not using 64-bit integers more.
2019-04-23 13:00:53 +02:00
Andreas Kling
9ef06e2117 LibC: stddbg should be opened with O_CLOEXEC. 2019-04-18 22:20:01 +02:00
Andreas Kling
3817f5f619 Kernel+LibC: Add a DebugLogDevice that forwards everything to I/O port 0xe9.
This is then used to implement the userspace dbgprintf() in a far more
efficient way than what we had before. :^)
2019-04-18 16:08:52 +02:00
Andreas Kling
37ae00a4dd Kernel+Userland: Add the rename() syscall along with a basic /bin/mv. 2019-04-07 23:35:26 +02:00
Andreas Kling
f1a2cb0882 LibC: Fix fread() EOF behavior with ungetc(). 2019-03-27 05:13:28 +01:00
Andreas Kling
d1e55fb4d9 LibC: Add ungetc() and automatically flush streams on fclose(). 2019-03-27 01:40:55 +01:00
Andreas Kling
f2773e05e5 LibC: fread() should return the number of elements (not bytes) read. 2019-03-26 00:10:58 +01:00
Andreas Kling
cdb82f6fbb LibC: Fix bug in scanf() family where we'd capture invalid data. 2019-03-20 15:29:04 +01:00
Andreas Kling
2c3cf22bc9 LibC: A whole bunch of compat work towards porting Lynx. 2019-03-14 15:18:15 +01:00
Andreas Kling
83e78648e4 LibC: fgets() should return null on 0-length EOF reads. 2019-02-26 22:32:51 +01:00
Andreas Kling
cccc8d8aeb More compat work.
Move syscall to int 0x82 since using int 0x80 was kinda prone to fork bombs
when building things on Linux. :^)
2019-02-26 12:57:02 +01:00
Andreas Kling
93c0dfd1d7 LibC: A bunch of compat work towards porting GCC. 2019-02-24 15:20:07 +01:00
Andreas Kling
b365ad4aef LibC: fgetc() and pals should return EOF on error or EOF.
This was the reason that "uname | figlet" wasn't working. There was nothing
wrong with the pipe like I kept thinking.
2019-02-08 17:49:54 +01:00
Andreas Kling
736e852525 LibC: Implement enough missing stuff to get bash-5.0 running. :^) 2019-02-08 02:38:21 +01:00
Andreas Kling
c2adfd0e2d LibC: Implement various things to get GNU bc building and running.
Looks like that's all we needed, and bc now runs. :^)
2019-02-03 04:32:31 +01:00
Andreas Kling
76f53b40f4 LibC: Add some things needed to build GNU bc.
This patch adds vprintf(), sig_atomic_t, random() and strdup().
bc doesn't build yet, but it will.
2019-02-01 16:03:21 +01:00
Andreas Kling
ffab6897aa Big, possibly complete sweep of naming changes. 2019-01-31 17:31:23 +01:00
Andreas Kling
1483af406f LibC: fputs() shouldn't add a trailing newline, only puts(). 2019-01-23 16:24:39 +01:00
Andreas Kling
69a3aecf6b LibC: Add vsnprintf(), snprintf(), execvp() and abs(). 2019-01-23 06:35:34 +01:00
Andreas Kling
b673c1a77d Build Painter & friends into LibC. Use it in the GUI test app. 2019-01-14 20:02:51 +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
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
303577df16 Various stubs while trying to get an old coreutils to build. 2018-11-17 15:56:09 +01:00
Andreas Kling
9d05f6b7a7 Make bash-2.05b build with minimal changes.
This is really neat. :^)
2018-11-17 00:14:07 +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
e48182d91b Add setvbuf(), setlinebuf(), setbuf(). 2018-11-11 10:11:09 +01:00
Andreas Kling
da3857b0c2 Add some simple write buffering to LibC's stdio.
Plumb it all the way to the VirtualConsole. Also fix /bin/cat to write()
the whole chunks we get from read() directly to stdout.
2018-11-08 01:23:47 +01:00
Andreas Kling
d7a41579e5 Miscellaneous compat work while seeing if GNU coreutils would build. 2018-11-07 10:23:16 +01:00
Andreas Kling
9f2b9c82bf More work towards getting bash to build.
Implemented some syscalls: dup(), dup2(), getdtablesize().
FileHandle is now a retainable, since that's needed for dup()'ed fd's.
I didn't really test any of this beyond a basic smoke check.
2018-11-05 19:01:59 +01:00
Andreas Kling
60a8144b68 Add stub fflush(). 2018-11-05 14:56:05 +01:00
Andreas Kling
4605b549d6 perror() should send output to stderr. 2018-10-31 21:37:09 +01:00
Andreas Kling
8f6998c902 Add SpinLock to IDE disk access.
This forces serialization of accesses. This driver needs to be redesigned.
2018-10-31 21:33:27 +01:00
Andreas Kling
9886b27d9c Add getpwent() family of functions to LibC.
Also add a little /etc/passwd database. There's just me in there.
2018-10-31 19:54:25 +01:00
Andreas Kling
819ce91395 Enough compatibility work to make figlet build and run!
I ran out of steam writing library routines and imported two
BSD-licensed libc routines: sscanf() and getopt().

I will most likely rewrite them sooner or later. For now
I just wanted to see figlet running.
2018-10-31 17:52:59 +01:00
Andreas Kling
9160fd0d47 More LibC portability work while trying to get figlet building. 2018-10-31 10:14:56 +01:00
Andreas Kling
bb90c8ecab A bunch of LibC boilerplate stuff added while trying to get figlet to build. 2018-10-31 02:09:11 +01:00
Andreas Kling
555c10a1f8 Minor cleanup. 2018-10-31 00:26:22 +01:00
Andreas Kling
7a7956a595 Virtual consoles kinda work!
We now make three VirtualConsoles at boot: tty0, tty1, and tty2.
We launch an instance of /bin/sh in each one.
You switch between them with Alt+1/2/3

How very very cool :^)
2018-10-30 15:33:37 +01:00