Kenneth Myhra
cd5063555e
LibCore: Add syscall wrapper for getpwnam()
2021-12-11 15:10:42 -08:00
Kenneth Myhra
52a451dcff
LibCore: Add syscall wrapper for chown()
2021-12-11 15:10:42 -08:00
Ben Wiederhake
643ec03608
LibCore: Avoid implicitly copying ByteBuffer
2021-12-08 09:46:13 -08:00
Andreas Kling
81047d8f9c
LibCore: Make LocalServer::take_over_from_system_server() return ErrorOr
...
This allows us to use TRY() or MUST() when calling it.
2021-12-06 19:22:16 +01:00
Ben Wiederhake
70e96fb917
LibCore: Implement new ptrace_peekbuf wrapper for PT_PEEKBUF syscall
2021-12-05 22:59:09 +01:00
Kenneth Myhra
0d76d15f9d
LibCore: Add syscall wrapper for chmod()
2021-12-04 15:05:46 -08:00
Andreas Kling
1640445cb2
LibCore: Add lstat() syscall wrapper
2021-12-04 14:24:04 +01:00
Andreas Kling
354c4690d2
LibCore: Use LibCore syscall wrappers in get_password()
2021-11-30 23:34:40 +01:00
Andreas Kling
612eafea2c
LibCore: Add syscall wrappers for tcgetattr() and tcsetattr()
2021-11-30 23:34:40 +01:00
Andreas Kling
90aa1abfed
LibCore: Add ioctl() syscall wrapper
2021-11-30 23:34:40 +01:00
Andreas Kling
fe00393941
LibCore: Change Core::LocalServer::on_ready_to_accept => on_accept
...
Everyone used this hook in the same way: immediately accept() on the
socket and then do something with the newly accepted fd.
This patch simplifies the hook by having LocalServer do the accepting
automatically.
2021-11-30 23:34:40 +01:00
Arne Elster
cdaa179eeb
LibCore: Fix relative seeking in IODevice
...
The recently introduced read buffer in IODevice broke relative seeking.
The amount of data in the buffer wouldn't get taken into account.
2021-11-30 10:51:10 +01:00
Andreas Kling
83056efc1a
LibCore: Add syscall wrapper for dup()
2021-11-28 23:14:19 +01:00
Andreas Kling
cb9cac4e40
LibIPC+IPCCompiler+AK: Make IPC value decoders return ErrorOr<void>
...
This allows us to use TRY() in decoding helpers, leading to a nice
reduction in line count.
2021-11-28 23:14:19 +01:00
Andreas Kling
982ac34437
LibCore: Add syscall wrappers for sendfd() and recvfd()
2021-11-28 23:14:18 +01:00
Brian Gianforcaro
44ffe3e5bb
LibCore: Allow System::pledge execpromises argument to be omitted
...
It appears that we don't have almost no cases of a callers passing
exec promises when they call `pledge()`. To simplify the code a bit we
add a default parameter that will pass nullptr for us to `pledge()`.
2021-11-28 08:04:57 +01:00
Brian Gianforcaro
fcc00c9a27
LibCore+cat: Switch Core::System::read/write to take a Span of bytes
...
In the spirit of the Core::System name space having "modern" facades
for classically C functions / Kernel interfaces, it seems appropriate
that we should take Span's of data instead of raw pointer + length
arguments.
2021-11-28 08:04:57 +01:00
Kenneth Myhra
951d8a06d8
LibCore: Add syscall wrapper for gethostname()
2021-11-27 11:14:16 +01:00
Andreas Kling
f1cc3d0fc4
Userland: Use Core::ArgsParser's Vector<StringView> API everywhere
...
...and remove the Vector<String> variant since there are no remaining
users of this API.
2021-11-26 23:27:57 +01:00
Andreas Kling
395ba619d8
LibCore: Add Vector<StringView> variant of add_positional_argument()
2021-11-26 23:27:57 +01:00
Andreas Kling
748c8b4879
LibCore: Add syscall wrapper for ptsname()
2021-11-24 23:24:53 +01:00
Andreas Kling
a152b1f215
LibCore: Add syscall wrapper for dup2()
2021-11-24 23:07:31 +01:00
Andreas Kling
71bc9bee0a
LibCore: Add syscall wrapper for pipe2()
2021-11-24 23:07:31 +01:00
Andreas Kling
b81ce827b6
LibCore: Add Core::Object::try_add<T>(...)
...
This is a fallible version of add<T>(...) that returns ErrorOr<T>.
It can be used together with TRY() to handle allocation failures when
instantiating new Core::Objects.
2021-11-24 13:52:01 +01:00
Andreas Kling
8b7b726680
LibCore: Add kill() syscall wrapper
2021-11-24 00:25:22 +01:00
Timothy Flynn
7f780e43a6
LibCore: Allow moving, but not copying, DirIterator
...
An explicit move constructor is required to null-out the moved-from
directory descriptor. Otherwise, we would call closedir() twice when
using ErrorOr<DirIterator>::release_value().
2021-11-23 22:58:05 +01:00
Andreas Kling
5a3f5582ba
LibCore: Add try_create(...) helper to all Core::Object derived classes
...
This is like construct(...) but returns ErrorOr<NonnullRefPtr<T>>.
2021-11-23 15:44:59 +01:00
Andreas Kling
16356ca478
LibCore: Add syscall wrappers for read() and write()
2021-11-23 15:44:59 +01:00
Andreas Kling
3db9979e40
LibCore: Add syscall wrapper for stat()
2021-11-23 12:23:54 +01:00
Andreas Kling
4a213869f2
LibCore: Add syscall wrapper for ftruncate()
2021-11-23 12:23:54 +01:00
Andreas Kling
4bf08e4d52
LibCore: Add syscall wrapper for close()
2021-11-23 12:23:54 +01:00
Andreas Kling
0ed5f84bd9
LibCore: Use open() wrapper in Core::MappedFile :^)
2021-11-23 12:23:54 +01:00
Andreas Kling
50416c286d
LibCore: Add syscall wrapper for open()
2021-11-23 11:59:50 +01:00
Andreas Kling
094fa900a3
LibCore: Use mmap() and munmap() wrappers in Core::MappedFile
2021-11-23 11:51:46 +01:00
Andreas Kling
45842a5208
LibCore: Add syscall wrapper for munmap()
2021-11-23 11:51:11 +01:00
Andreas Kling
53e9b9758e
LibCore: Add syscall wrapper for mmap()
...
For convenience on SerenityOS, this also takes a custom alignment
request, and a memory region name. These are non-POSIX extensions.
2021-11-23 11:48:40 +01:00
Andreas Kling
a62d16fbe9
LibCore: Use syscall wrappers in MappedFile::map_from_fd_and_close()
2021-11-23 11:36:00 +01:00
Andreas Kling
58fb3ebf66
LibCore+AK: Move MappedFile from AK to LibCore
...
MappedFile is strictly a userspace thing, so it doesn't belong in AK
(which is supposed to be user/kernel agnostic.)
2021-11-23 11:33:36 +01:00
Andreas Kling
c1a3968c66
LibCore: Make LocalSocket takeover mechanism return ErrorOr<T>
2021-11-23 11:33:36 +01:00
Andreas Kling
c37a02341b
LibCore: Add Core::System wrappers for fstat() and fcntl()
2021-11-23 11:33:36 +01:00
Andreas Kling
21a5fb0fa2
LibCore+LibSystem: Move syscall wrappers from LibSystem to LibCore
...
With this change, System::foo() becomes Core::System::foo().
Since LibCore builds on other systems than SerenityOS, we now have to
make sure that wrappers work with just a standard C library underneath.
2021-11-23 11:33:36 +01:00
Mustafa Quraish
7720644ae2
LibCore: Let ArgsParser::parse() accept Main::Arguments
...
Instead of manually passing in `arguments.argc` and `arguments.argv`,
we can now just pass in the arguments directly.
2021-11-22 21:13:42 -08:00
qiu-x
c0a7e0ad23
LibCore: Fix LocalSocket.cpp
build on FreeBSD
...
This fixes the build on FreeBSD by chagning LOCAL_PEERPID to
LOCAL_PEERCRED inside a ifdef
2021-11-20 21:11:30 +00:00
Andreas Kling
216e21a1fa
AK: Convert AK::Format formatting helpers to returning ErrorOr<void>
...
This isn't a complete conversion to ErrorOr<void>, but a good chunk.
The end goal here is to propagate buffer allocation failures to the
caller, and allow the use of TRY() with formatting functions.
2021-11-17 00:21:13 +01:00
Andreas Kling
587f9af960
AK: Make JSON parser return ErrorOr<JsonValue> (instead of Optional)
...
Also add slightly richer parse errors now that we can include a string
literal with returned errors.
This will allow us to use TRY() when working with JSON data.
2021-11-17 00:21:10 +01:00
Benjamin S Osenbach
d82e41440c
LibCore: Don't include crypt.h in Account.cpp on FreeBSD
...
Fixes #10803 .
2021-11-16 19:06:13 +00:00
Andreas Kling
80d4e830a0
Everywhere: Pass AK::ReadonlyBytes by value
2021-11-11 01:27:46 +01:00
Andreas Kling
8b1108e485
Everywhere: Pass AK::StringView by value
2021-11-11 01:27:46 +01:00
Tim Schumacher
80cb44afae
Everywhere: Move shared library checks into a common function
...
While we're at it, unify the various different conditions that are
scattered accross the codebase.
2021-11-10 14:42:49 +01:00
Andreas Kling
0b0c4e82b9
LibCore: Replace Result<T, E> use with ErrorOr<T> in Core::FileWatcher
2021-11-08 00:35:27 +01:00