Commit Graph

211 Commits

Author SHA1 Message Date
Andreas Kling
2c5a378ccc Kernel+Userland: Add symlink() syscall and add "-s" flag to /bin/ln.
It's now possible to create symbolic links! :^)

This exposed an issue in Ext2FS where we'd write uninitialized data past
the end of an inode's content. Fix this by zeroing out the tail end of
the last block in a file.
2019-03-02 01:52:24 +01:00
Andreas Kling
1b16a29044 Kernel+Userland: Implement fchmod() syscall and use it to improve /bin/cp.
/bin/cp will now copy the permission bits from source to destination. :^)
2019-03-01 10:39:19 +01:00
Andreas Kling
1d2529b4a1 Add chown() syscall and a simple /bin/chown program. 2019-02-27 12:32:53 +01:00
Andreas Kling
e421c10735 More compat work towards porting vim.
It now builds and runs in the small-featureset configuration. :^)
2019-02-27 00:02:01 +01:00
Andreas Kling
424368034b LibC: Make errno codes be #defines instead of enum values.
It turns out that a lot of 3rd party software does things like:

    #ifdef EINTR
        ...
    #endif

This won't work if EINTR is an enum. So much for that nice idea.
2019-02-26 22:40:35 +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
a356746d04 Compat work towards porting vim. 2019-02-26 15:57:59 +01:00
Andreas Kling
e0c1541847 Compat work towards making bash-5.0 build with less patches.
Hacked implementations of sigsetjmp() and siglongjmp(). I didn't know about
these APIs until just now, but I hope I got them right.
2019-02-26 14:05:28 +01:00
Andreas Kling
4a5b474f1d LibC: Install crt0.o into /usr/lib 2019-02-26 13:36:26 +01:00
Andreas Kling
3f29a12d90 More compat work. Rename libraries from LibFoo.a => libfoo.a
This makes it more straightforward to build a cross-compiler toolchain.
Also move math stuff from LibC to LibM.
2019-02-26 13:30:57 +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
9624b54703 More moving towards using signed types.
I'm still feeling this out, but I am starting to like the general idea.
2019-02-25 22:06:55 +01:00
Andreas Kling
5af4e622b9 Kernel: Add KResult and KResultOr<T> classes.
The idea here is to combine a potential syscall error code with an arbitrary
type in the case of success. I feel like this will end up much less error
prone than returning some arbitrary type that kinda sorta has bool semantics
(but sometimes not really) and passing the error through an out-param.

This patch only converts a few syscalls to using it. More to come.
2019-02-25 20:50:22 +01:00
Andreas Kling
901b7d5d91 Fix a bunch of compiler warnings. Not all, but a lot. 2019-02-25 19:05:51 +01:00
Andreas Kling
0b957ed2b1 Some compat work towards making GCC's libstdc++ build. 2019-02-25 10:05:32 +01:00
Andreas Kling
93c0dfd1d7 LibC: A bunch of compat work towards porting GCC. 2019-02-24 15:20:07 +01:00
Andreas Kling
a7a456002e LibC: Enough compat work to make binutils-2.32 build and run. 2019-02-23 17:24:50 +01:00
Andreas Kling
d7753c7c8d Move over to building all of userspace with i686-pc-serenity-g++. 2019-02-22 14:45:14 +01:00
Andreas Kling
75b100673f Switch over to building everything with i686-elf-g++. 2019-02-22 10:45:32 +01:00
Andreas Kling
42342d2337 LibC: Tidy up _start a bit and rename compilation unit to "crt0" 2019-02-22 09:21:54 +01:00
Andreas Kling
6d3e12899b Kernel: Pass process arguments directly on the stack.
Get rid of the convoluted get_arguments and get_environment syscalls.
This patch also adds a simple /bin/env that just prints its environment.
2019-02-22 01:55:22 +01:00
Andreas Kling
920e8e58ed Kernel+Userland: Implement setuid() and setgid() and add /bin/su
Also show setuid and setgid bits in "ls -l" output. :^)
2019-02-21 23:38:10 +01:00
Andreas Kling
7d288aafb2 Kernel: Add link() syscall to create hard links.
This accidentally grew into a little bit of VFS cleanup as well.

Also add a simple /bin/ln implementation to exercise it.
2019-02-21 13:26:40 +01:00
Andreas Kling
0aaec6b19a Support resizing the Terminal app.
I set it up so that TIOCSWINSZ on a master PTY gets forwarded to the slave.
This feels intuitively right. Terminal can then use that to inform the shell
or whoever is inside the slave that the window size has changed.

TIOCSWINSZ also triggers the generation of a SIGWINCH signal. :^)
2019-02-20 23:38:20 +01:00
Andreas Kling
8eedbbc9ca Prune compiler flags a bit. Let's go with -march=i686 for now. 2019-02-17 15:17:21 +01:00
Andreas Kling
0730b3c15f Add ability to switch video modes from the system menu.
I had to change PhysicalPage around a bit for this. Physical pages can now
be instantiated for any arbitrary physical address without worrying that
such pages end up in the kernel page allocator when released.

Most of the pieces were already in place, I just glued everything together.
2019-02-17 13:12:59 +01:00
Andreas Kling
640360e958 Move WindowServer to userspace.
This is a monster patch that required changing a whole bunch of things.
There are performance and stability issues all over the place, but it works.
Pretty cool, I have to admit :^)
2019-02-17 00:13:47 +01:00
Andreas Kling
0b1b21d622 LibC: mmap() should not interpret high addresses as errors, oops! 2019-02-16 15:34:31 +01:00
Andreas Kling
4ea28bf0a5 Kernel: Add a simple shared memory API for two processes only.
And use this to implement shared bitmaps between WindowServer and clients.
2019-02-16 12:13:43 +01:00
Andreas Kling
cbfd416279 LibC: The standard C library needs to be able to build as pure C.
Looks like we can't use those comfy C++ attributes in this code then.
2019-02-15 22:37:20 +01:00
Andreas Kling
3b42db0b4c LibC: Fix busted realloc() implementation. 2019-02-15 22:36:59 +01:00
Andreas Kling
df6aaaeeef Enable -Wimplicit-fallthrough. 2019-02-15 12:39:16 +01:00
Andreas Kling
56f0a30f9b LibC: Actually, malloc() can return null so don't lie about that. 2019-02-15 12:38:49 +01:00
Andreas Kling
022f7790db Use modern C++ attributes instead of __attribute__ voodoo.
This is quite nice, although I wish [[gnu::always_inline]] implied inline.
Also "gnu::" is kind of a wart, but whatcha gonna do.
2019-02-15 12:30:48 +01:00
Andreas Kling
b20a7aca61 Kernel: More work on sockets. Fleshing out connect(). 2019-02-14 15:55:19 +01:00
Andreas Kling
a63e8839da LibC: Add socket(), bind(), listen(), accept() and connect(). 2019-02-14 15:26:06 +01:00
Andreas Kling
1d66670ad7 LibC: Remove obsolete errno codes for windowing syscalls. 2019-02-14 14:41:54 +01:00
Andreas Kling
77177dbb76 Kernel: Begin fleshing out bind() syscall. 2019-02-14 14:38:30 +01:00
Andreas Kling
2f35e54f80 Kernel: Begin implementing UNIX domain sockets. 2019-02-14 14:17:38 +01:00
Andreas Kling
f529b845ec WindowServer: Convert entire API to be message-based.
One big step towards userspace WindowServer. :^)
2019-02-14 01:21:32 +01:00
Andreas Kling
ef4e9860fd WindowServer: Convert the remaining menu APIs into messages. 2019-02-13 21:47:14 +01:00
Andreas Kling
cf432b4c3d WindowServer: Refactor more of the menu APIs to be message-based.
This is all pretty verbose but I can whittle it down later. :^)
2019-02-13 18:49:23 +01:00
Andreas Kling
4f98a35beb WindowServer: Begin refactoring towards a fully asynchronous protocol.
In order to move the WindowServer to userspace, I have to eliminate its
dependence on system call facilities. The communication channel with each
client needs to be message-based in both directions.
2019-02-13 17:54:30 +01:00
Andreas Kling
133706d697 Add API's and plumbing for WindowServer clients to make menus. 2019-02-12 00:52:19 +01:00
Andreas Kling
2def3d8d3f LibGUI: Start adding an automatic widget layout system.
My needs are really quite simple, so I'm just going to add what I need
as I go along. The first thing I needed was a simple box layout with
widgets being able to say whether they prefer fixed or fill for both
their vertical and horizontal sizes.

I also made a simple GStatusBar so FileManager can show how many bytes
worth of files are in the current directory.
2019-02-10 11:07:13 +01:00
Andreas Kling
8ae7be611a LibC: closedir() should free the readdir() buffer and the DIR itself. 2019-02-09 09:08:27 +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
c9aaf74e1d LibC: Add some more fake termcap entries to silence bash-5.0. 2019-02-08 17:49:25 +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
5158bee08c Don't use -mregparm=3 in userspace.
It's pretty comfy having arguments in registers in the kernel for now though.
2019-02-08 01:24:52 +01:00