1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-19 00:45:08 +00:00
Commit graph

485 commits

Author SHA1 Message Date
Andreas Kling
aa7e8b5797 LibCore: Add syscall wrapper for mkstemp() 2021-12-16 22:48:17 +01:00
Andreas Kling
2637a64130 LibCore: Add syscall wrapper for fork() 2021-12-16 22:48:17 +01:00
Andreas Kling
01c2756e9a LibCore: Add syscall wrapper for mkdir() 2021-12-16 22:48:17 +01:00
Andreas Kling
f69bd3bd46 LibCore: Add syscall wrapper for mount() 2021-12-16 22:48:17 +01:00
Andreas Kling
ad37ca4815 LibCore: Add syscall wrapper for setgroups() 2021-12-16 22:48:17 +01:00
Andreas Kling
92e6532bf1 LibCore: Add syscall wrapper for isatty() 2021-12-16 22:48:17 +01:00
Andreas Kling
2c3699e257 LibCore: Add syscall wrappers for setuid/seteuid/setgid/setegid 2021-12-16 22:48:17 +01:00
sin-ack
e0e8fd6384 LibCore: Remove LocalServer::on_ready_to_accept
This is never called in LocalServer and someone might accidentally use
it -- I did. :^)
2021-12-16 22:21:35 +03:30
sin-ack
dfdb52efa7 LibCore+Userland: Convert TCPServer to use the Serenity Stream API
This is intended as a real-usecase test of the Serenity Stream API, and
seemed like a good candidate due to its low amount of users.
2021-12-16 22:21:35 +03:30
sin-ack
19e13117ad LibCore: Implement the Serenity Stream API classes
The Serenity Stream API is the name for the new set of classes intended
to replace IODevice and its descendants. It provides more flexibility
for subclasses by allowing each subclass to override all the possible
functionalities according to their wishes.

Stream is the base class which implements majority of the functionality
expected from a readable and writable stream. SeekableStream adds
seeking on top, and provides a couple utility methods which derive from
seek. Socket adds a couple of BSD socket utility functions such as
checking whether there is data available to read and checking the
pending bytes on the socket.

As for the concrete classes, there is File which is a SeekableStream and
is intended to operate on file-like objects; and TCPSocket, UDPSocket
and LocalSocket, which handle TCP, UDP and UNIX sockets respectively.

The concrete classes do not do buffering by default. For buffering
functionality, a set of augmentative classes named BufferedSeekable and
BufferedSocket have been implemented, intended to wrap a SeekableStream
and a Socket, respectively.
2021-12-16 22:21:35 +03:30
sin-ack
0cca6cef95 LibCore+LookupServer: Implement and use UDPServer::send 2021-12-16 22:21:35 +03:30
Kenneth Myhra
11578c623c LibCore: Add waitpid() wrapper that return ErrorOr<pid_t> 2021-12-16 02:10:47 -08:00
Kenneth Myhra
123e49994d LibCore: Add posix_spawnp() wrapper that return ErrorOr<pid_t> 2021-12-16 02:10:47 -08:00
Sahan Fernando
2c43eaa50c LibCore: Add support for range-based for loops on LineIterators 2021-12-12 14:06:38 +03:30
Sahan Fernando
6d948c1a92 LibCore: Fix bug in IODevice::LineIterator causing skipped lines 2021-12-12 14:06:38 +03:30
Kenneth Myhra
7b13f22f96 LibCore: Add syscall wrapper for clock_settime() 2021-12-11 15:10:42 -08:00
Kenneth Myhra
c4bd46023b LibCore: Add syscall wrapper for getgrnam() 2021-12-11 15:10:42 -08:00
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