Commit Graph

6745 Commits

Author SHA1 Message Date
Andreas Kling
c0cffe1134 Add a /bin/top program for process table monitoring.
It automagically computes %CPU usage based on the number of times a process
has been scheduled between samples. The colonel task is used as idle timer.
This is pretty cool. :^)
2019-02-04 10:28:12 +01:00
Andreas Kling
31f44481f3 Add /dev/{stdin,stdout,stderr} as symlinks to /proc/self/fd/{0,1,2}
Also change /bin/cat to open /dev/stdin if no arguments are provided.
2019-02-03 12:38:03 +01:00
Andreas Kling
0c9a2b1430 Kernel: Oops, I mixed up st_dev and st_rdev in struct stat. 2019-02-03 06:23:10 +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
dd931f136e guitest2: Stop showing the font test window by default. 2019-02-03 03:36:10 +01:00
Andreas Kling
e2f27aa7b5 Userland: Make /bin/date pretty-print the date, too. 2019-02-03 02:47:37 +01:00
Andreas Kling
10fde0d707 Userland: Pretty-print modification times in /bin/ls. 2019-02-03 02:14:41 +01:00
Andreas Kling
6fc3c38324 Start working on a simple graphical font editor.
Editing fonts by editing text files is really slow and boring.
A simple font editor seems like a good way to take LibGUI for a spin.
2019-02-02 08:07:06 +01:00
Andreas Kling
5e0b7f1a56 Add basic automatic dependency management to Makefiles. 2019-02-02 04:41:59 +01:00
Andreas Kling
9153666e72 Userland: /bin/ls shouldn't display inode numbers by default.
Added the -i option to ls which turns on inode number display.
2019-01-31 17:34:24 +01:00
Andreas Kling
ffab6897aa Big, possibly complete sweep of naming changes. 2019-01-31 17:31:23 +01:00
Andreas Kling
e04ba0a83c Add a simple clock window to guitest2.
This is driven by mousedown events right now, since there are no timers.
2019-01-31 16:37:43 +01:00
Andreas Kling
c4fce9b3f9 Make stat() work on device files again.
FileDescriptor will now keep a pointer to the original inode even after
opening it resolves to a character device.

Fixed up /bin/ls to display major and minor device numbers instead of size
for device files.
2019-01-31 05:05:57 +01:00
Andreas Kling
37ab7b7a8c LibGUI: Implement destroying individual windows without exiting the process. 2019-01-30 20:03:52 +01:00
Andreas Kling
e9b948103d Add a /dev/pts filesystem and make PTY allocation dynamic.
You can now open as many PTY pairs as you like. Well, it's actually capped
at 8 for now, but it's just a constant and trivial to change.

Unregistering a PTY pair is untested because I didn't want to start
mucking with that in Terminal right now.
2019-01-30 00:49:20 +01:00
Andreas Kling
c30e2c8d44 Implement basic chmod() syscall and /bin/chmod helper.
Only raw octal modes are supported right now.
This patch also changes mode_t from 32-bit to 16-bit to match the on-disk
type used by Ext2FS.

I also ran into EPERM being errno=0 which was confusing, so I inserted an
ESUCCESS in its place.
2019-01-29 04:55:08 +01:00
Andreas Kling
7455f5ea42 Expose the kernel log buffer through /proc/dmesg.
Also add a /bin/dmesg program for convenience.
2019-01-28 22:40:55 +01:00
Andreas Kling
c95228b128 Add support for removing directories.
It's really only supported in Ext2FS since SynthFS doesn't really want you
mucking around with its files. This is pretty neat though :^)

I ran into some trouble with HashMap while working on this but opted to work
around it and leave that for a separate investigation.
2019-01-28 04:16:01 +01:00
Andreas Kling
35c06f1520 LibGUI: More work on GCheckBox.
- Make it track the mouse cursor just like GButton does so that changes only
  get committed if the mouseup event happens while inside the widget rect.

- Draw a focus rect around the box when appropriate.

- When focused, support toggling the checked state with the space bar.
2019-01-27 20:22:06 +01:00
Andreas Kling
c4c475b49d /bin/cp: Handle partial write() case. 2019-01-27 10:04:53 +01:00
Andreas Kling
15fad649ea Userland: Make a simple /bin/cp for copying files. 2019-01-27 07:18:26 +01:00
Andreas Kling
de2423de5f LibGUI: Flesh out focus implementation and more GTextBox work. 2019-01-26 11:24:16 +01:00
Andreas Kling
d72575d196 LibGUI: Start bringing up GTextBox in the standalone world. 2019-01-26 06:39:13 +01:00
Andreas Kling
7cf3c7461c Refactor GUI rendering model to be two-phased.
Instead of clients painting whenever they feel like it, we now ask that they
paint in response to a paint message.

After finishing painting, clients notify the WindowServer about the rect(s)
they painted into and then flush eventually happens, etc.

This stuff leaves us with a lot of badly named things. Need to fix that.
2019-01-26 05:20:32 +01:00
Andreas Kling
a54848f451 Let's not auto-start guitest. guitest2 is so much more useful. 2019-01-25 15:52:55 +01:00
Andreas Kling
6e5db34b2e sh: Discard the current line on interrupt. 2019-01-25 15:49:54 +01:00
Andreas Kling
92c14ba887 Terminal: Support VKILL and VERASE. Also ignore null characters. 2019-01-25 15:34:21 +01:00
Andreas Kling
6cc1a9d90a sh: Support basic backspacing on the command line.
It's weird that I didn't do this sooner. I don't know how many tims
I've had to retype a misspelled command. :^)
2019-01-25 15:11:56 +01:00
Andreas Kling
5adaeeaa3b Terminal: Support setting the window title using Xterm escape sequences.
Use this in the /bin/sh prompt to keep the window title in sync with the
shell's working directory. :^)
2019-01-25 05:52:16 +01:00
Andreas Kling
86eae0f8df Let userland retain the window backing store while drawing into it.
To start painting, call:
gui$get_window_backing_store()

Then finish up with:
gui$release_window_backing_store()

Process will retain the underlying GraphicsBitmap behind the scenes.
This fixes racing between the WindowServer and GUI clients.

This patch also adds a WSWindowLocker that is exactly what it sounds like.
2019-01-24 23:44:19 +01:00
Andreas Kling
8d36c8f0d8 LibC: Tweak execvp() and execve() prototypes. 2019-01-23 17:09:00 +01:00
Andreas Kling
bda0c935c2 Add unlink() syscall and /bin/rm.
This patch adds most of the plumbing for working file deletion in Ext2FS.
Directory entries are removed and inode link counts updated.
We don't yet update the inode or block bitmaps, I will do that separately.
2019-01-22 07:03:44 +01:00
Andreas Kling
f70136a324 Kernel: Support open() with O_CREAT.
It's now possible to create zero-length files! :^)
Also hook up the new functionality in /bin/touch.
2019-01-22 00:58:56 +01:00
Andreas Kling
6127d33cee guitest2: Add a launcher button for guitest. 2019-01-21 02:56:25 +01:00
Andreas Kling
786b903d62 WindowServer: Don't invalidate already frontmost window for moving to front. 2019-01-21 02:19:08 +01:00
Andreas Kling
d66b0f7dd8 LibGUI: Mass coding style fixes. 2019-01-21 00:54:35 +01:00
Andreas Kling
6c4f1bad09 guitest2: Add a simple launcher so I can easily spawn more Terminals.
Also update GButton coding style.
2019-01-21 00:31:48 +01:00
Andreas Kling
ea6678b7b3 LibGUI: Hook up GWindow event dispatch for paint and mouse events. 2019-01-20 07:03:38 +01:00
Andreas Kling
dbe83f3a83 Make it possible for userspace to alter window title/geometry.
I'm not in love with this syscall API but it allows me to make progress.
2019-01-20 06:04:13 +01:00
Andreas Kling
8eae89a405 Start bringing up LibGUI properly (formerly Widgets.) 2019-01-20 05:48:43 +01:00
Andreas Kling
7e5b81fe48 Make a SharedGraphics directory for classes shared between Kernel and LibGUI. 2019-01-19 23:22:46 +01:00
Andreas Kling
7e044cf293 Add a simple /bin/sysctl that wraps the files in /proc/sys. 2019-01-18 15:35:38 +01:00
Andreas Kling
dff70021ab Make it possible to invalidate only a portion of a window.
Use this in Terminal to only invalidate rows where anything changed.
2019-01-18 04:37:49 +01:00
Andreas Kling
dad58db757 Add WindowActivated and WindowDeactivated events.
Use this to implement different looking Terminal cursors depending on
the window active state.
2019-01-17 17:38:04 +01:00
Andreas Kling
49b63281a0 Make it possible for a process to switch controlling terminals.
Via the TIOCSCTTY and TIOCNOTTY ioctls.
2019-01-15 08:49:24 +01:00
Andreas Kling
6d8043767e Start working on a graphical Terminal program. 2019-01-15 04:30:55 +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
0c5ecd303c Share GraphicsBitmaps between the windowing server and the client process.
This is pretty cool. :^)

GraphicsBitmaps are now mapped into both the server and the client address
space (usually at different addresses but that doesn't matter.)

Added a GUI syscall for getting a window's backing store, and another one
for invalidating a window so that the server redraws it.
2019-01-14 15:25:34 +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
1d914cbd84 Minor GUI API things + make Button corners properly transparent. 2019-01-13 06:26:20 +01:00
Andreas Kling
f7261d7b26 Let's use the existing Rect and Color types in the GUI API.
Any type that doesn't depend on indirect data can probably be used here.
2019-01-13 05:31:07 +01:00
Andreas Kling
8f8c8d1ca3 Start working on a GUI kernel API. 2019-01-13 02:02:34 +01:00
Andreas Kling
c088529cd8 Fix broken "make clean" in Userland. 2019-01-08 22:28:58 +01:00
Andreas Kling
2239ab96e7 Tweak /bin/id output slightly. 2018-12-29 03:44:37 +01:00
Andreas Kling
36bd53b36a Add a simple /bin/more. 2018-12-21 02:42:30 +01:00
Andreas Kling
4dd50b1f6d Get rid of three test utilities that I no longer need. 2018-12-21 02:22:21 +01:00
Andreas Kling
ec1c487dcd Yet another pass of style fixes. 2018-12-21 02:10:45 +01:00
Andreas Kling
ed7ae6c02c Add sync() syscall and a /bin/sync.
It walks all the live Inode objects and flushes pending metadata changes
wherever needed.

This could be optimized by keeping a separate list of dirty Inodes,
but let's not get ahead of ourselves.
2018-12-20 00:39:29 +01:00
Andreas Kling
038d8641f9 Implement utime() along with a naive /bin/touch.
This synchronous approach to inodes is silly, obviously. I need to rework
it so that the in-memory CoreInode object is the canonical inode, and then
we just need a sync() that flushes pending changes to disk.
2018-12-19 21:14:55 +01:00
Andreas Kling
5d7ba9640c sh: Restore termios after a child process exits.
This avoids the annoying situation that occurs when a spawned process
messes with the termios and then doesn't exit cleanly.
2018-12-07 01:26:07 +01:00
Andreas Kling
829bf94de1 Fix /bin/ls usage string. 2018-12-07 01:19:39 +01:00
Andreas Kling
ca6847b5bb Import a simple text editor I started working on. 2018-12-04 00:27:16 +01:00
Andreas Kling
aff89d2fd7 Yet more coding style fixes. 2018-12-03 01:38:22 +01:00
Andreas Kling
ac7a60225e Add TIOCGWINSZ ioctl so userland can determine terminal geometry.
(Don't) use this to implement short-form output in ls.
I'm too tired to make a nice column formatting algorithm.
I just wanted something concise when I type "ls".
2018-11-29 03:45:23 +01:00
Andreas Kling
de4604ac95 Finally hook up the mkdir code to a syscall.
Added a /bin/mkdir that makes directories. How very neat :^)
There are various limitations because of missing functionality.
2018-11-18 15:02:16 +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
e440c3fa87 Support "ls <path>" rather than just "ls" :^) 2018-11-17 01:04:00 +01:00
Andreas Kling
19b9401487 Reduce kmalloc() traffic in directory iteration.
Pass the file name in a stack-allocated buffer instead of using an AK::String
when iterating directories. This dramatically reduces the amount of cycles
spent traversing the filesystem.
2018-11-13 00:17:30 +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
18e3ddf605 Add a naive /bin/fgrep for testing pipes. 2018-11-11 20:42:41 +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
36b3dc6c32 Add /proc/PID/cwd, a symlink to the process's current directory. 2018-11-10 18:16:21 +01:00
Andreas Kling
8605711f4b Make /bin/clear work again.
After I made stdio buffered, we were dropping anything unflushed on exit.
Since /bin/clear just prints out some escape sequences without a newline,
the entire buffer was being discarded.

Also add VirtualConsole::clear() that handles clearing of background VC's.
2018-11-10 00:56:10 +01:00
Andreas Kling
4914f3b837 Build LibC and Userland with clang as well. 2018-11-09 14:29:00 +01:00
Andreas Kling
7b3b5f745f Move <utsname.h> to <sys/utsname.h> for correctness. 2018-11-09 10:24:41 +01:00
Andreas Kling
8249c086c3 Get rid of redundant sys$spawn now that we have fork+exec. 2018-11-09 10:22:27 +01:00
Andreas Kling
3e0a0dd7ed Fix all current build warnings in the userland. 2018-11-09 10:19:33 +01:00
Andreas Kling
3b2dcd5929 Add a VMO pointer to VNode.
This way, if anyone tries to map an already mapped file, we share the VMO.
2018-11-08 15:39:26 +01:00
Andreas Kling
3c8064a787 Support basic mmap'ing of a file!
All right, we can now mmap() a file and it gets magically paged in from fs
in response to an NP page fault. This is really cool :^)

I need to refactor this to support sharing of read-only file-backed pages,
but it's cool to just have something working.
2018-11-08 12:59:16 +01:00
Andreas Kling
41a751c90c Minor tweak to /bin/kill. 2018-11-08 02:07:08 +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
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
03a8357e84 Implement sending signals to blocked-in-kernel processes.
This is dirty but pretty cool! If we have a pending, unmasked signal for
a process that's blocked inside the kernel, we set up alternate stacks
for that process and unblock it to execute the signal handler.

A slightly different return trampoline is used here: since we need to
get back into the kernel, a dedicated syscall is used (sys$sigreturn.)

This restores the TSS contents of the process to the state it was in
while we were originally blocking in the kernel.

NOTE: There's currently only one "kernel resume TSS" so signal nesting
definitely won't work.
2018-11-07 21:19:47 +01:00
Andreas Kling
c8b308910e Signals to processes in userspace now work again.
Ugh, how am I going to dispatch signals to processes in the kernel?
2018-11-07 19:03:44 +01:00
Andreas Kling
678882e020 Rework process states to make a bit more sense.
Processes are either alive (with many substates), dead or forgiven.
A dead process is forgiven when the parent waitpid()s on it.
Dead orphans are also forgiven.

There's a lot of work to be done around this.
2018-11-07 18:34:37 +01:00
Andreas Kling
a7f1d892a9 Add some basic setgroups(), getgroups() and initgroups().
Also teach /bin/id to print the user's supplemental groups.
2018-11-07 01:38:51 +01:00
Andreas Kling
90bab5ea71 Add getgrent() family of functions. 2018-11-06 22:27:51 +01:00
Andreas Kling
7c3746592b Add strsignal() and improve sharing signal numbers between LibC and kernel. 2018-11-06 15:45:16 +01:00
Andreas Kling
153ea704af Add some basic signal support.
It only works for sending a signal to a process that's in userspace code.

We implement reception by synthesizing a PUSHA+PUSHF in the receiving process
(operating on values in the TSS.)
The TSS CS:EIP is then rerouted to the signal handler and a tiny return
trampoline is constructed in a dedicated region in the receiving process.

Also hacked up /bin/kill to be able to send arbitrary signals (kill -N PID)
2018-11-06 10:56:41 +01:00
Andreas Kling
72cdc62155 Replace zones with individually tracked physical pages.
It's just a simple struct { ref_count, paddr }.
This will allow me to implement lazy zeroing and COW pages.
2018-11-05 10:23:00 +01:00
Andreas Kling
da13c9a264 Map pages in read-only ELF sections as non-writable.
This is so cool! :^) Now you'll crash if you try to write into your
.text or .rodata segments.
2018-11-03 11:36:45 +01:00
Andreas Kling
20fb1fc377 Fix some bugs in execve() and make sh use it for process launching.
Interrupting children of sh now always works with ^C :^)
2018-11-03 02:08:06 +01:00
Andreas Kling
202bdb553c Implemented sys$execve().
It's really crufty, but it basically works!
2018-11-03 01:51:42 +01:00
Andreas Kling
8accc92c3c Implement fork()!
This is quite cool! The syscall entry point plumbs the register dump
down to sys$fork(), which uses it to set up the child process's TSS
in order to resume execution right after the int 0x80 fork() call. :^)

This works pretty well, although there is some problem with the kernel
alias mappings used to clone the parent process's regions. If I disable
the MM::release_page_directory() code, there's no problem. Probably there's
a premature freeing of a physical page somehow.
2018-11-02 20:41:58 +01:00
Andreas Kling
10b666f69a Basic ^C interrupt implementation.
For testing, I made cat put itself into a new process group.
This should eventually be done by sh between fork() and exec().
2018-11-02 14:06:48 +01:00
Andreas Kling
621217ffeb Add tcsetpgrp()+tcgetpgrp().
One more step on the path to being able to ^C a runaway process. :^)
2018-11-02 13:14:25 +01:00
Andreas Kling
d8f0dd6f3b Start working on sessions and process groups. 2018-11-02 12:56:51 +01:00
Andreas Kling
90ddbca127 Free physical pages allocated for a process's page directory on exit.
Also use a ProcessPagingScope instead of region aliasing to implement
create-process ELF loading.
2018-11-01 23:08:10 +01:00
Andreas Kling
cddd2f37e9 Have sh print out which signal terminated a child process. 2018-11-01 01:11:00 +01:00
Andreas Kling
c7d5ce6b5a Add a /bin/tty command that prints the current tty.
Also fix ttyname() syscall to include "/dev/" in the name.
2018-10-31 21:46:05 +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
71c9b09e8c Fix ls build. 2018-10-31 15:52:24 +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
511ed4c4de Snazz up the sh prompt a bit. Add the current tty to it. 2018-10-31 01:21:56 +01:00
Andreas Kling
3218f00099 Implement basic sys$kill() and add a /bin/kill
All it can do right now is send SIGKILL which just murders the target task.
2018-10-31 01:06:57 +01:00
Andreas Kling
00c21d1590 Add sys$ttyname_r and ttyname_r() + ttyname().
And print a greeting when sh starts up so we know which TTY we're on.
2018-10-30 22:03:02 +01:00
Andreas Kling
7a85384e47 sh should read from fd 0 (stdin) instead of /dev/keyboard. 2018-10-30 16:17:34 +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
Andreas Kling
0f20be05a6 Implement sys$getcwd properly.
Also fixed broken strcpy that didn't copy the null terminator.
2018-10-30 00:06:31 +01:00
Andreas Kling
e6284a8774 Fix broken SpinLock.
The SpinLock was all backwards and didn't actually work. Fixing it exposed
how wrong most of the locking here is.

I need to come up with a better granularity here.
2018-10-29 22:04:26 +01:00
Andreas Kling
97726862dd Add basic symlink support.
- sys$readlink + readlink()
- Add a /proc/PID/exe symlink to the process's executable.
- Print symlink contents in ls output.
- Some work on plumbing options into VFS::open().
2018-10-28 14:11:51 +01:00
Andreas Kling
c76dc9a047 Add /proc/mm and a /bin/mm utility that just dumps it.
This shows some info about the MM. Right now it's just the zone count
and the number of free physical pages. Lots more can be added.

Also added "exit" to sh so we can nest shells and exit from them.

I also noticed that we were leaking all the physical pages, so fixed that.
2018-10-28 10:28:21 +01:00
Andreas Kling
e904f193c1 Canonicalize the path used by sh.
With a bunch of LibC work to support the feature. LibC now initializes
AK::StringImpl by default. It's now fine to use AK in LibC/Userland! :^)
2018-10-28 09:36:21 +01:00
Andreas Kling
43475f248b Add save/unsave cursor escape sequences.
Also added a little terminal test program called /bin/tst.
2018-10-28 01:44:53 +02:00
Andreas Kling
e2dbdd14aa Colorize ls output. 2018-10-28 01:17:48 +02:00
Andreas Kling
52c19136f2 Give the shell a nice, colorful prompt.
The cwd looks like crap, I need to write some code to strip out ".."
and extra slashes from the path string.
2018-10-28 01:08:01 +02:00
Andreas Kling
cc7e3519a6 Add a /bin/clear that prints the clear terminal escape sequence.
It doesn't work yet, but it will!
2018-10-27 17:39:08 +02:00
Andreas Kling
8f91a47aeb Add some basic field width support to printf().
Use it to make "ls" output a bit better. Also sys$spawn now fails with EACCES
if the path is not a file that's executable by the current uid/gid.
2018-10-27 16:43:03 +02:00
Andreas Kling
9a71c7759a Implement loading of linked ELF executables.
This took me a couple hours. :^)

The ELF loading code now allocates a single region for the entire
file and creates virtual memory mappings for the sections as needed.

Very nice!
2018-10-27 14:56:52 +02:00
Andreas Kling
ec07761d0f Implement waitpid() support for getting the waitee's exit code. 2018-10-27 01:24:22 +02:00
Andreas Kling
2716a9e2d7 Greatly improve /proc/PID/stack by tracing the ebp frame chain.
I also added a generator cache to FileHandle. This way, multiple
reads to a generated file (i.e in a synthfs) can transparently
handle multiple calls to read() without the contents changing
between calls.

The cache is discarded at EOF (or when the FileHandle is destroyed.)
2018-10-27 00:14:24 +02:00
Andreas Kling
c928b06218 Add a very hackish /proc/PID/stack.
It walks the stack and identifies anything that looks like a kernel symbol.
This could be a lot more sophisticated.
2018-10-26 22:33:15 +02:00
Andreas Kling
63e5583c18 Properly null-terminate the argv list created by sh. 2018-10-26 15:04:20 +02:00
Andreas Kling
1c45b28da6 Add sys$uname() and a /bin/uname utility. 2018-10-26 14:57:26 +02:00
Andreas Kling
2749e7f1c2 Implement sys$chdir() and teach sh+ls to cd around and browse different dirs. 2018-10-26 14:24:11 +02:00
Andreas Kling
df87dda63c Implement argc/argv support for spawned tasks.
Celebrate the new functionality with a simple /bin/cat implementation. :^)
2018-10-26 11:16:56 +02:00
Andreas Kling
53abfa7ea1 Add sys$gethostname and /bin/hostname 2018-10-26 09:54:29 +02:00
Andreas Kling
3faaa3e04a Add /bin/false and /bin/true for fun. :^) 2018-10-25 21:39:37 +02:00
Andreas Kling
dc6f57f19c Add gettimeofday() syscall and LibC wrappers gettimeofday() and time().
This only has second accuracy right now, I'll work out subseconds later.
2018-10-25 17:36:18 +02:00
Andreas Kling
5978185242 Add a "sleep" syscall that sleeps for N seconds. 2018-10-25 13:56:03 +02:00
Andreas Kling
260b14e505 Implement errno in LibC.
This also meant I had to implement BSS (SHT_NOBITS) sections in ELFLoader.
I also added an strerror() so we can print out what the errors are.
2018-10-25 12:06:50 +02:00
Andreas Kling
16f318408d ELFLoader should fail with an error message for unresolved symbols. 2018-10-25 10:02:04 +02:00
Andreas Kling
ec1d16b307 Add a "pwd" utility to userland.
It's implemented as a separate process. How cute is that.
Tasks now have a current working directory. Spawned tasks inherit their
parent task's working directory.
Currently everyone just uses "/" as there's no way to chdir().
2018-10-24 14:28:22 +02:00
Andreas Kling
5f36a5f22e Add an lstat() syscall and use it to make "ls" nicer. 2018-10-24 13:19:36 +02:00
Andreas Kling
bca4b71bfa Lots of hacking to make a very simple "ls" utility.
I added a dead-simple malloc that only allows allocations < 4096 bytes.
It just forwards the request to mmap() every time.

I also added simplified versions of opendir() and readdir().
2018-10-24 12:50:07 +02:00
Andreas Kling
9a296d63f3 Add simplified mmap() and munmap() syscalls. 2018-10-24 09:48:41 +02:00
Andreas Kling
3253a23b91 Add a simplified waitpid() so that sh can wait on spawned commands. 2018-10-24 00:20:34 +02:00
Andreas Kling
c80a1f39ce Minor userland tweaks. 2018-10-23 13:57:17 +02:00
Andreas Kling
71ed63c91d Assume commands are binaries in /bin for now. 2018-10-23 13:05:50 +02:00
Andreas Kling
ed2422d7af Start adding a basic /proc filesystem and a "ps" utility. 2018-10-23 12:04:03 +02:00
Andreas Kling
fe237ee215 Lots of hacking:
- Turn Keyboard into a CharacterDevice (85,1) at /dev/keyboard.
- Implement MM::unmapRegionsForTask() and MM::unmapRegion()
- Save SS correctly on interrupt.
- Add a simple Spawn syscall for launching another process.
- Move a bunch of IO syscall debug output behind DEBUG_IO.
- Have ASSERT do a "cli" immediately when failing.
  This makes the output look proper every time.
- Implement a bunch of syscalls in LibC.
- Add a simple shell ("sh"). All it can do now is read a line
  of text from /dev/keyboard and then try launching the specified
  executable by calling spawn().

There are definitely bugs in here, but we're moving on forward.
2018-10-23 10:12:50 +02:00
Andreas Kling
befeabd8fe Okay, with some mucking around, there is now a /bin/id and it runs!
It statically links against everything in LibC that it needs.
This will work just fine for a long time to come!
2018-10-22 14:41:54 +02:00
Andreas Kling
38a621c721 Link "id" against the LibC.
We can now produce what should essentially be a runnable Serenity executable.
2018-10-22 14:13:17 +02:00
Andreas Kling
63764b3a65 Import very modest Userland. 2018-10-22 14:06:22 +02:00