Commit graph

3574 commits

Author SHA1 Message Date
Andreas Kling
b62a12c687 JsonParser: Some minor optimizations
- Return more specific types from parse_array() and parse_object().
- Don't create a throwaway String in extract_while().
- Use a StringView in parse_number() to avoid a throwaway String.
2019-08-04 11:47:21 +02:00
Andreas Kling
93596dc00d JsonObject: Add move constructors for JsonObject(Json{Array,Object}&&)
This also helps avoid JsonValue copying during parse.
2019-08-04 11:46:31 +02:00
Andreas Kling
82826104e0 Json: Add efficient copy and move constructors for Json{Array,Object}
This helps avoid copying JsonValues during parsing.
2019-08-04 11:45:16 +02:00
Andreas Kling
cce2ea9bb0 AK: Add StringView::to_int()
This is a shameless copy-paste of String::to_int(). We should find some
way to share this code between String and StringView instead of having
two duplicate copies like this.
2019-08-04 11:44:20 +02:00
Andreas Kling
c55129e573 JsonParser: Use Vector<char, 1024> instead of StringBuilder in parsing
This is a 10-12% speedup on the 4chan thread catalog JSON.
2019-08-04 10:38:15 +02:00
Andreas Kling
e38f78faf5 ChanViewer: Show the time of each post in the thread catalog 2019-08-04 10:15:06 +02:00
Andreas Kling
030891531b ChanViewer: Start working on a simple read-only 4Chan viewer
Since they are nice enough to provide a JSON API over HTTP, this makes
for a perfect way to exercise our networking code a bit. :^)
2019-08-04 10:10:38 +02:00
Andreas Kling
210550d4b3 JsonArray: Expose the value vector to the outside for convenience
Sometimes it's easier to just work with a const Vector<JsonValue>&,
so give clients the option of doing that.
2019-08-04 10:05:02 +02:00
Andreas Kling
675aa550a4 Kernel: Put IPv4 and TCP related debug spam behind flags
...and turn those flags off for now, to make it possible to write some
networking code without being spammed to death.
2019-08-04 10:04:06 +02:00
Andreas Kling
273d9d6cf5 CHttpJob: If no "Content-Length" header was received, read until EOF
Instead of aborting after receiving the first chunk, we have to keep
reading until EOF.
2019-08-04 09:26:08 +02:00
Andreas Kling
6797f71e73 JsonParser: When encountering \uXXXX, just emit a "?" for now. 2019-08-04 08:58:45 +02:00
Andreas Kling
f37c8f618b Terminal: Paint bold text with a bold font.
This was really straightforward since all the necessary pieces were
already in place. This patch just passes a bold font to draw_glyphs()
for buffer cells with the bold attribute set. :^)
2019-08-04 08:15:30 +02:00
Andreas Kling
7d08116a6d LibDraw: Add Font::default_bold_fixed_width_font()
We need a way to get a bold version of the default fixed-width font.
2019-08-04 08:14:53 +02:00
Andreas Kling
116d551f82 IPCCompiler: Don't generate "OwnPtr<void>" as a handle() return type
This was happening for async (response-less) messages, since they were
returning void and were were always just wrapping the return type in
an OwnPtr no matter what.
2019-08-03 21:34:08 +02:00
Andreas Kling
3100e8dee5 IPCCompiler+AudioServer: Accept "//"-style comments in IPC defintions 2019-08-03 21:29:09 +02:00
Andreas Kling
0f0b00dc1f Lagom: Add a simple IPC client and server for host-side testing
Add LibIPC to the Lagom build, and also implement two little test apps
so we can run IPC tests on other systems.
2019-08-03 20:57:57 +02:00
Andreas Kling
8e684f0959 AudioServer: Port to the new generated IPC mechanism
Fork the IPC Connection classes into Server:: and Client::ConnectionNG.
The new IPC messages are serialized very snugly instead of using the
same generic data structure for all messages.

Remove ASAPI.h since we now generate all of it from AudioServer.ipc :^)
2019-08-03 19:49:19 +02:00
Andreas Kling
3519b6c201 IPCCompiler: More work towards AudioServer bringup
- Add IEndpoint::handle(IMessage), a big switch table on message type.
  handle() will return a response message for synchronous messages,
  and return nullptr otherwise.
- Use i32 instead of int for everything
- Make IMessage::encode() const
- Make IEndpoint::decode_message() static, this allows template code to
  decode messages without an endpoint instance on hand.
2019-08-03 19:24:08 +02:00
Andreas Kling
18aeda2e0d BufferStream: It's not an error to read up to the very end of a buffer
Don't signal an error before we've reached the very end of the buffer.
2019-08-03 19:20:05 +02:00
Andreas Kling
6e956f2a0b BufferStream: Add operator<<(const char*) overload
Ext2FS was relying on the presence of a (StringView) overload here and
when I added a (bool) overload, it started choosing that for literals.
2019-08-03 19:02:48 +02:00
Andreas Kling
3c1bad99a2 AudioServer: Link against LibIPC
We're not using any of the functionality yet, but soon...
2019-08-03 17:25:54 +02:00
Andreas Kling
8dd07c3075 IPCCompiler: Emit message parameter getters
For simplicity's sake, they are all "const type& name() const"
2019-08-03 17:24:47 +02:00
Andreas Kling
c255cedd7a IPCCompiler: Make decode_message() return nullptr for unknown messages 2019-08-03 17:06:24 +02:00
Andreas Kling
925c8f42f8 IPCCompiler: Generate message decoding functions
An endpoint now knows how to decode a ByteBuffer into an IMessage.
2019-08-03 17:03:44 +02:00
Andreas Kling
b04dae7faa BufferStream: Support "bool" as a streaming type 2019-08-03 17:02:42 +02:00
Andreas Kling
659ddddd20 IPCCompiler: Emit IEndpoint::name() overrides 2019-08-03 16:44:27 +02:00
Andreas Kling
4fc15c9e6e AudioServer: The EnqueueBuffer response needs a success boolean
This was already in the current version of the code, I'm just updating
the soon-to-be-current IPC protocol version of it. :^)
2019-08-03 16:41:58 +02:00
Andreas Kling
36b352554e IPCCompiler: Emit message constructors + include ID in serialization 2019-08-03 16:35:49 +02:00
Andreas Kling
05e08afcd8 IPCCompiler: Generate getters for message ID's and message names
Each endpoint namespace will have an enum class MessageID where you can
find all of its messages.
2019-08-03 16:19:14 +02:00
Andreas Kling
fae3091999 IPCCompiler: Typedef the response message types as "ResponseType"
Each message will now have a typedef called ResponseType as an alias
for the expected response type. This will aid in implementing the sync
messaging code.
2019-08-03 16:06:40 +02:00
Andreas Kling
016335edde IPCCompiler: Generate endpoint and message classes
These are not entirely finished but it's starting to take shape. :^)
2019-08-03 15:50:16 +02:00
Andreas Kling
a40e763b2a LibIPC: Start fleshing out a separate IPC library
This will be a place to put object serialization/deserialization logic,
message parsing, endpoint management, etc.
2019-08-03 15:29:40 +02:00
Andreas Kling
aa8a3d4a89 IPCCompiler: Start working on a simple IPC definition language
Instead of doing everything manually in C++, let's do some codegen.
This patch adds a crude but effective IPC definition parser, along
with two initial definition files for the AudioServer's client and
server endpoints.
2019-08-03 15:17:41 +02:00
Andreas Kling
c5903ec4bb AK: Remove two redundant RefPtr constructors.
We already have constructors for "const T*" and "const T&" so we don't
need to have non-const variants.
2019-08-03 14:16:05 +02:00
Andreas Kling
69281c22d4 FontEditor(UI): Update the groupbox to have the right background color 2019-08-03 11:39:34 +02:00
Andreas Kling
47511b5930 GWidget: Implement set_backcolor() and set_forecolor()
These are set-color-from-string variants used by the VisualBuilder's
code generator.
2019-08-03 11:35:10 +02:00
Andreas Kling
54c77cb714 GVariant: Try to do color string parsing in GVariant::to_color()
If the underlying variant type is a String, try to parse out a color
when to_color() is called.

This makes VisualBuilder apply the saved colors when loading forms.
2019-08-03 11:34:02 +02:00
Andreas Kling
e43b27a3fa LibDraw: Add Color::from_string(StringView)
This parses hex colors in either #RRGGBBAA or #RRGGBB format.
No other formats are supported at the moment.
2019-08-03 11:33:34 +02:00
Andreas Kling
f511421aaa Kernel+ProcessManager: Add some more info to /proc/PID/fds
- "seekable": whether the fd is seekable or sequential.
- "class": which kernel C++ class implements this File.
- "offset": the current implicit POSIX API file offset.
2019-08-03 08:42:40 +02:00
Andreas Kling
7f25959fa2 LibCore: Make get_current_user_home_path() return String & close passwd
This API was returning a "const char*" and it was unclear who took care
of the underlying memory. Returning a String makes that obvious.

Also make sure we close the /etc/passwd file when we're done with it.
2019-08-03 08:32:07 +02:00
Andreas Kling
8a703c0076 ProcessManager: Add a new per-proces "open files" view showing open FDs
This uses the data from /proc/PID/fds with ease now that it's JSON. :^)
2019-08-03 08:26:45 +02:00
Conrad Pankoff
45c5a91afc Piano: Add mouse support for playing notes
Fixes #332
2019-08-03 07:59:41 +02:00
rhin123
c02868f000 LibGUI: Allow setting window icon before show(). 2019-08-02 21:18:21 +02:00
Andreas Kling
33b0c4cfaf LibAudio: Explicitly ignore IPC postprocessing requests
We don't need to do any IPC postprocessing in LibAudio (yet.)
This is the mechanism used by LibGUI to do repaint coalescing etc.
2019-08-02 19:57:30 +02:00
Andreas Kling
7c7343de98 Kernel: mount() should fail if the provided device is not a disk device
In the future, we should allow mounting any block device. At the moment
there is too much filesystem code that depends on the underlying device
being a DiskDevice.
2019-08-02 19:31:59 +02:00
Andreas Kling
a6fb055028 Kernel: Generalize VFS metadata lookup and use it in mount() and stat()
Refactored VFS::stat() into VFS::lookup_metadata(), which can now be
used for general VFS metadata lookup by path.
2019-08-02 19:28:18 +02: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
Andreas Kling
31de5dee26 Kernel: Some improvements to the mount syscall
- You must now have superuser privileges to use mount().
- We now verify that the mount point is a valid path first, before
  trying to find a filesystem on the specified device.
- Convert some dbgprintf() to dbg().
2019-08-02 19:03:50 +02:00
Andreas Kling
c76668644b Build: Add /dev/{hda,hdb,hdc,hdd} files
Now that we can mount additional hard drives, let's actually have some
more device files in /dev so you can use them. :^)
2019-08-02 18:33:00 +02:00
Jesse
401c87a0cc Kernel: mount system call (#396)
It is now possible to mount ext2 `DiskDevice` devices under Serenity on
any folder in the root filesystem. Currently any user can do this with
any permissions. There's a fair amount of assumptions made here too,
that might not be too good, but can be worked on in the future. This is
a good start to allow more dynamic operation under the OS itself.

It is also currently impossible to unmount and such, and devices will
fail to mount in Linux as the FS 'needs to be cleaned'. I'll work on
getting `umount` done ASAP to rectify this (as well as working on less
assumption-making in the mount syscall. We don't want to just be able
to mount DiskDevices!). This could probably be fixed with some `-t`
flag or something similar.
2019-08-02 15:18:47 +02:00