Commit Graph

14 Commits

Author SHA1 Message Date
Andreas Kling
a356e48150 Kernel: Move all code into the Kernel namespace 2020-02-16 01:27:42 +01:00
Andreas Kling
2f82d4fb31 Kernel: Add KResultOr<T>::result()
This is just a handy way to get either an error or a KSuccess, even if
there is a T present.
2020-02-08 11:57:53 +01:00
Andreas Kling
94ca55cefd Meta: Add license header to source files
As suggested by Joshua, this commit adds the 2-clause BSD license as a
comment block to the top of every source file.

For the first pass, I've just added myself for simplicity. I encourage
everyone to add themselves as copyright holders of any file they've
added or modified in some significant way. If I've added myself in
error somewhere, feel free to replace it with the appropriate copyright
holder instead.

Going forward, all new source files should include a license header.
2020-01-18 09:45:54 +01:00
Andreas Kling
08cfcb888c Kernel: Add KResult::error() to make it look symmetrical with KResultOr 2020-01-06 12:08:27 +01:00
Andrew Kaster
bae8e21a8b Kernel: Add move assign operator to KResultOr 2019-12-29 23:01:27 +01:00
Andreas Kling
ae4d707684 Kernel: Align the KResult value storage appropriately.
We should figure out how to convert this code to using AK::Result.
2019-08-02 19:22:48 +02:00
Sergey Bugaev
d211307547 Kernel: Fix KResultOr move constructor not copying errors. 2019-06-14 06:24:02 +02:00
Andreas Kling
39d1a9ae66 Meta: Tweak .clang-format to not wrap braces after enums. 2019-06-07 17:13:23 +02:00
Robin Burchell
0dc9af5f7e Add clang-format file
Also run it across the whole tree to get everything using the One True Style.
We don't yet run this in an automated fashion as it's a little slow, but
there is a snippet to do so in makeall.sh.
2019-05-28 17:31:20 +02:00
Andreas Kling
60a819c14a Kernel: Yet more work on bringing up POSIX SHM. 2019-04-09 02:37:38 +02:00
Andreas Kling
028afabf6b Kernel: Port more code to KResult and KResultOr<T>. 2019-03-06 22:14:31 +01:00
Andreas Kling
5b27f11b97 Kernel: Use KResult in unlink() and rmdir(). 2019-02-27 14:11:25 +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
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