Commit graph

71 commits

Author SHA1 Message Date
Andreas Kling
dc8333067f CHttpJob: Block until we can actually read during State::InBody.
Also move to State::Finished once we've received >= Content-Length.
2019-06-22 23:10:05 +02:00
Andreas Kling
6d5633904f CIODevice: Don't discard already-buffered data when there's no more to read.
When we had some data already in the CIODevice buffer, we should make sure
we always return that data, even if the attempt to ::read() even more data
fails. This was causing us to lose partial HTTP payloads.
2019-06-22 23:07:42 +02:00
Andreas Kling
ec99f7f721 CHttpRequest: Okay let's go back to HTTP/1.0 for now..
I don't want to deal with sessions staying alive at the moment.
2019-06-22 23:04:31 +02:00
Andreas Kling
af75ccee65 CNetworkJob: Automatically delete finished jobs after on_finish.
Also, pretty-print any failure messages.
2019-06-22 22:46:05 +02:00
Andreas Kling
db2980c848 CHttpRequest: Use the correct newline format ('\r\n').
Also let's say HTTP/1.1 instead of HTTP/1.0. :^)
2019-06-22 22:10:43 +02:00
Andreas Kling
7e1cb86da7 LibHTML: Make it possible to build LibHTML on the host.
- "make" builds the normal Serenity libhtml.a
- "make -f Makefile.host" builds a test program for the host machine.
2019-06-22 21:21:57 +02:00
Andreas Kling
5980007e44 Userland: Fix many compiler warnings. 2019-06-22 15:47:08 +02:00
Andreas Kling
d343fb2429 AK: Rename Retainable.h => RefCounted.h. 2019-06-21 18:58:45 +02:00
Andreas Kling
550b0b062b AK: Rename RetainPtr.h => RefPtr.h, Retained.h => NonnullRefPtr.h. 2019-06-21 18:45:59 +02:00
Andreas Kling
90b1354688 AK: Rename RetainPtr => RefPtr and Retained => NonnullRefPtr. 2019-06-21 18:37:47 +02:00
Andreas Kling
77b9fa89dd AK: Rename Retainable => RefCounted.
(And various related renames that go along with it.)
2019-06-21 15:30:03 +02:00
Andreas Kling
d9a48b5916 AK: Move IPv4Address from Kernel/Net/ to AK/ since it's quite useful. 2019-06-18 11:28:48 +02:00
Andreas Kling
39d1a9ae66 Meta: Tweak .clang-format to not wrap braces after enums. 2019-06-07 17:13:23 +02:00
Andreas Kling
0ed89440f1 ProcessManager+top: Rename "linear" size to "virtual" size.
I originally called it "linear" because that's how the Intel manual names
virtual addresses in many cases. I'm ready to accept that most people know
this as "virtual" so let's just call it that.
2019-06-07 12:44:29 +02:00
Andreas Kling
7770d6a09d LibCore: Run clang-format on everything. 2019-06-07 11:46:37 +02:00
Andreas Kling
98eeb8f22d AK: Rename printf.cpp to PrintfImplementation.h. 2019-06-07 11:41:11 +02:00
Andreas Kling
08cd75ac4b Kernel: Rename FileDescriptor to FileDescription.
After reading a bunch of POSIX specs, I've learned that a file descriptor
is the number that refers to a file description, not the description itself.
So this patch renames FileDescriptor to FileDescription, and Process now has
FileDescription* file_description(int fd).
2019-06-07 09:36:51 +02:00
Andreas Kling
29a9430246 AK: Make timeval_add() and timeval_sub() take references. 2019-06-06 18:02:28 +02:00
Andreas Kling
800242ed4e CEventLoop: Don't bother looking through fds when select() returns 0.
If it returns 0 that just means we hit the timeout. I suppose we could skip
the timer checks if there are a non-zero number of fds marked as well, but
I'm not sure that's a great idea since it will add some latency.
2019-06-05 01:57:28 -07:00
Andreas Kling
ae4ac524ad CIODevice: Update m_error if a write() fails. 2019-06-02 15:18:27 +02:00
Robin Burchell
7bce096afd Take StringView in more places
We should work towards a pattern where we take StringView as function
arguments, and store String as member, to push the String construction
to the last possible moment.
2019-06-02 12:55:51 +02:00
Robin Burchell
e74b5975e4 Userland: Use CFile inside sysctl
Also add a StringView overload to CIODevice::write
2019-06-02 12:55:51 +02:00
Andreas Kling
b8e705da0e LibCore: CObjects without is<T> specialization shouldn't LARP as others. 2019-06-01 14:11:31 +02:00
Andreas Kling
fdf3608c8a Update Badge<T> instantiations to simply be {}. 2019-05-31 15:44:04 +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
cbd858544d LibC: Move struct timeval to sys/time.h. #POSIX 2019-05-28 13:48:06 +02:00
Christopher Dumas
c23882dde1 can now tile background and made sure the IRC choose server popup still works 2019-05-27 21:40:53 +02:00
Christopher Dumas
50154a23cb most apps now begin in the correct directory 2019-05-27 21:40:53 +02:00
Christopher Dumas
d4a16d6031 Network stack is now configurable, and resolution is also configurable, but loading cursors causes a page-fault? 2019-05-27 21:40:53 +02:00
Robin Burchell
9d2b08e06e LibCore: Add CDirIterator, and use it in everything rather than readdir 2019-05-27 15:27:23 +02:00
Andreas Kling
3873c51781 LibCore: Add CObject::for_each_child_of_type<T>()
Use this to iterate over all the GRadioButtons in a group.
2019-05-27 04:18:24 +02:00
Andreas Kling
0c85d3dba9 LibCore+LibGUI: Add is<T>(CObject&) and to<T>(CObject&) helpers. 2019-05-27 04:06:01 +02:00
Andreas Kling
906fde8f8c LibCore: Add CObject::for_each_child(callback). 2019-05-27 03:52:19 +02:00
Robin Burchell
8df3e2516f CEventLoop: Make it possible to determine running/quit state without using exec()
... by removing a redundant member that nothing uses (running), and
exposing whether or not quit has been requested.
2019-05-26 18:17:40 +02:00
Robin Burchell
d791bce6af CEventLoop: Allow manually driving the event loop
Move the bulk of exec() into a new pump(). Since SDL wants to drive the
event loop itself, this is a requirement. We also add a WaitMode flag to
allow for immediately pumping events -- again, this is required because
SDL wants to be in full control of the event loop, and not let us wait.
2019-05-20 03:03:48 +02:00
Robin Burchell
df74a9222f Kernel: Fix timeout support in select
The scheduler expects m_select_timeout to act as a deadline. That is, it
should contain the time that a task should wake at -- but we were
directly copying the time from userspace, which meant that it always
returned virtually immediately.

At the same time, fix CEventLoop to not rely on the broken select behavior
by subtracting the current time from the time of the nearest timer.
2019-05-18 02:57:38 +02:00
Robin Burchell
5babcac289 Build: Install most headers to Root (and libcore.a/libgui.a)
This makes out-of-tree linking possible. And at the same time, add a
CMakeToolchain.txt file that can be used to build arbitrary cmake-using
applications on Serenity by pointing to the CMAKE_TOOLCHAIN_FILE when
running cmake:

    -DCMAKE_TOOLCHAIN_FILE=~/code/serenity/Toolchain/CMakeToolchain.txt
2019-05-17 21:59:48 +02:00
Robin Burchell
77dfd419e9 LibCore: Move AK/ArgsParser to LibCore/CArgsParser
Also rename the classes to match LibCore naming style.
This means that it's no longer incorrectly linked into LibC and Kernel.
2019-05-17 15:49:37 +02:00
Robin Burchell
c8fda23a03 LibCore/Userland: Introduce a simple tail implementation
Also introduce more seek modes on CIODevice, and an out param to find
the current position inside the file -- this means less syscalls (and
less potential races) than requesting it through a separate pos()
accessor or something.
2019-05-17 14:28:13 +02:00
GuillaumeGas
0ba4ceb2cd Added CProcessStatisticsReader to avoid having to parse /proc/all (#35)
* Added CProcessStatisticsReader to avoid having to parse /proc/all

* Took @awesomekling's feedbacks into account

* Fixed indentation and replaced tabs by spaces
2019-05-16 18:47:47 +02:00
Andreas Kling
1e0f9d325c LibCore: Avoid a big malloc in CIODevice's internal buffering.
This heap allocation was totally avoidable and can be replaced by a stack
buffer instead. Dodges a bunch of mmap() traffic.
2019-05-14 16:36:29 +02:00
Andreas Kling
dbf7878998 LibCore: Using printf() inside CIODevices will now call CIODevice::printf().
Well this was confusing. Obviously this code should never be calling outside
to ::printf() anyway, so just use dbgprintf() instead.
2019-05-10 18:20:54 +02:00
Andreas Kling
7ce3b10568 CIODevice: Add some basic output facilities: write() and printf().
Being able to do file.printf() is extremely comfy, I have to say. :^)
2019-05-08 04:38:41 +02:00
Andreas Kling
dd299fe51a CObject: add_child() should set the child's parent. 2019-05-05 01:09:49 +02:00
Andreas Kling
202e922ce8 CLock: Remove a redundant call to gettid(). 2019-05-01 19:11:08 +02:00
Andreas Kling
65f2f19b41 CEventLoop: Protect the message queue with a Lock. 2019-04-29 15:57:49 +02:00
Andreas Kling
0a68e0046f LibCore: Make it possible to create a CFile for an existing file descriptor. 2019-04-26 02:22:21 +02:00
Andreas Kling
57da00b731 Include Makefile.common in all other Makefiles. 2019-04-21 04:09:39 +02:00
Andreas Kling
ab94a6be00 AK: Add String::copy(BufferType) helper.
This will create a String from any BufferType that has data() and size().
2019-04-20 14:13:40 +02:00
Andreas Kling
5eedb22834 Sprinkle use of AK::Vector in various places.
Some of these are less helpful than others. Avoiding a bunch of mallocs
in the event loop wakeup code is definitely nice.
2019-04-20 14:02:19 +02:00