Commit graph

4374 commits

Author SHA1 Message Date
Sergey Bugaev
127d168def AK: Add a keep_empty argument to String[View]::substring{_view} 2019-09-28 18:29:42 +02:00
Conrad Pankoff
07ca753124 Kernel: Fix BIOS date/time on hardware
It turns out some BIOS vendors don't support non-BCD date/time mode, but
we were relying on it being available. We no longer do this, but instead
check whether the BIOS claims to provide BCD or regular binary values for
its date/time data.
2019-09-28 13:59:49 +02:00
Conrad Pankoff
b03a0534e0 Userland: Add disk_benchmark program to test read/write speeds 2019-09-28 09:29:10 +02:00
Conrad Pankoff
062218b4cf Kernel: Support writing doubly-indirect ext2 blocks 2019-09-28 09:29:10 +02:00
Conrad Pankoff
fa20a447a9 Kernel: Repair unaligned regions supplied by the boot loader
We were just blindly trusting that the bootloader would only give us
page-aligned memory regions. This is apparently not always the case,
so now we can try to repair those regions.

Fixes #601
2019-09-28 09:23:52 +02:00
Dan MacDonald
24a51136fa Meta: Spread the ccache joy far and wide! 2019-09-27 23:03:41 +02:00
Andreas Kling
2584636d19 Kernel: Fix partial munmap() deallocating still-in-use VM
We were always returning the full VM range of the partially-unmapped
Region to the range allocator. This caused us to re-use those addresses
for subsequent VM allocations.

This patch also skips creating a new VMObject in partial munmap().
Instead we just make split regions that point into the same VMObject.

This fixes the mysterious GCC ICE on large C++ programs.
2019-09-27 20:21:52 +02:00
Andreas Kling
d5f3972012 Kernel: No need to manually deallocate kernel stack Region in ~Thread()
Since we're keeping this Region in an OwnPtr, it will be torn down when
we get to ~OwnPtr anyway.
2019-09-27 19:10:52 +02:00
Andreas Kling
57e73e4533 Point: Add operator+=, operator-=, and Point+Point 2019-09-27 18:59:50 +02:00
Dan MacDonald
8b38518d0e Meta: Add instructions for debugging boot issues via serial console from Linux 2019-09-27 18:02:12 +02:00
Andreas Kling
c58455fb63 Kernel: Tweak SlabAllocator size classes
Shrink the 52 class down to 48 since it was mostly made for Region,
and Region just shrank to 48 :^)
2019-09-27 14:25:42 +02:00
Andreas Kling
7f9a33dba1 Kernel: Make Region single-owner instead of ref-counted
This simplifies the ownership model and makes Region easier to reason
about. Userspace Regions are now primarily kept by Process::m_regions.

Kernel Regions are kept in various OwnPtr<Regions>'s.

Regions now only ever get unmapped when they are destroyed.
2019-09-27 14:25:42 +02:00
Andreas Kling
7a7f6a24e9 Kernel: Fix bitrotted FORK_DEBUG logging code 2019-09-27 14:25:39 +02:00
Andreas Kling
9c3c117f05 ELF: Make code a little more buildable on other platforms
Patch from Anonymous.
2019-09-27 13:30:23 +02:00
Andreas Kling
0b59c0d0dc LibC: Make div() and ldiv() behave according to the C standard 2019-09-27 10:15:42 +02:00
Andreas Kling
b009f8522c LibC: Make system() behave according to POSIX
- system(nullptr) returns non-zero to indicate the presence of a shell
- Failure to fork() returns -1
- Failure to exec() in the child returns 127
2019-09-27 10:15:42 +02:00
Andreas Kling
676af444ca LibC: Clear any ungetc()'ed data in fflush() 2019-09-27 10:15:42 +02:00
Andreas Kling
9470db92f4 LibC: realpath() should assume the buffer is PATH_MAX bytes 2019-09-27 10:15:42 +02:00
Larkin Nickle
f28fa616eb Toolchain/BuildIt.sh: Use curl instead of wget
We already use curl for ports, so let's be consistent.
2019-09-26 20:52:13 +02:00
Dan MacDonald
13c6400018 Meta: Add note regarding partial SATA support to INSTALL.md 2019-09-24 15:57:38 +02:00
Larkin Nickle
8060749d04 Ports: Update uninstall function to use $SERENITY_ROOT
Now uninstalling should just work once we have plists in place.
2019-09-24 15:39:35 +02:00
Dan MacDonald
b08b2e116b Meta: Add link to INSTALL.md in the ReadMe 2019-09-24 08:57:19 +02:00
Larkin
18249b5996 Ports: Switch to new ports system (#594)
Much redundancy is removed from package scripts with this system.
It also supports simple dependency management, uninstalling (through
BSD ports style plist files), cleaning up after itself (with clean,
clean_dist, clean_all commands), etc.
2019-09-24 08:56:39 +02:00
Andreas Kling
d5f1c57fe2 Inspector: Fix bad RemoteObjectGraphModel::parent_index()
We were returning bogus indices and also failing to handle parents that
are roots.

This was visible in the broken line trees drawn by GTreeView.
2019-09-23 20:29:03 +02:00
Andreas Kling
797e132d0c ifconfig: Allow setting an adapter's IPv4 address
You can now do things like "ifconfig e1k0 192.168.1.2" to set the
IPv4 address of e1k0. Pretty neat!
2019-09-23 19:06:53 +02:00
Andreas Kling
2482fc3538 IPv4: Implement socket ioctls SIOCGIFADDR and SIOCSIFADDR
This allows userspace programs to get and set (superuser-only) the IPv4
address of a network adapter. :^)
2019-09-23 19:06:03 +02:00
Andreas Kling
a3575f3c60 LibC: Fix warnings in sys/cdefs.h if __BEGIN_DECLS is already defined 2019-09-23 18:58:12 +02:00
Dan MacDonald
54c5c1d50f Meta: Add minimum hardware requirements to install guide (#592) 2019-09-23 14:18:49 +02:00
Andreas Kling
87e768f0e3 Userland: Unbreak "copy" and "paste" after GEventLoop removal
Have these programs instantiate a GApplication to ensure they get a
connection to the WindowServer, otherwise the clipboard will not work.

Sorry Sergey! :^)
2019-09-23 09:36:25 +02:00
Andreas Kling
a1907011b2 CSocket: Don't create the read notifier until after we've connected
This makes it so that "on_connected" always gets called first.
Since accepted sockets are connected before construction, they have
to manually set CSocket::m_connected.
2019-09-22 21:46:46 +02:00
Andreas Kling
65409e8f04 LocalSocket: Teach recvfrom() how to block if needed, and simplify it
If we can't already read when we enter recvfrom() on a LocalSocket,
we'll now block the current thread until we can.

Also added a buffer_for(FileDescription&) helper so that the client
and server can share some of the code. :^)
2019-09-22 21:30:30 +02:00
Andreas Kling
34d0e96aec LibCore+LibGUI: Remove GEventLoop and use CEventLoop everywhere
GEventLoop was just a dummy subclass of CEventLoop anyway. The only
thing it actually did was make sure a GWindowServerConnectionw was
instantiated. We now take care of that in GApplication instead.

CEventLoop is now non-virtual and a little less confusing. :^)
2019-09-22 20:50:39 +02:00
Andreas Kling
edac8704de LibC: Fix dumb off-by-two in fgets() :^)
"Play C games, win C prizes."
2019-09-22 20:03:02 +02:00
Andreas Kling
64948fa701 LibC: ungetc(EOF) should fail (and return EOF) 2019-09-22 19:51:39 +02:00
Andreas Kling
bba24b09f7 Kernel: Avoid creating a temporary String("mmap") for every mmap() call 2019-09-22 19:47:00 +02:00
Andreas Kling
804df54296 LibC: Let's assert in rewind() that fseek()ing to the beginning worked 2019-09-22 19:41:21 +02:00
Andreas Kling
e364846622 Ext2FS: Don't allocate blocks until we're committed to a new inode
Otherwise we would leak the blocks in case we returned earlier than
expected. :^)
2019-09-22 18:50:24 +02:00
Andreas Kling
bd7c38e7b6 Ext2FS: Oops, fix wrong ENOSPC in create_inode() 2019-09-22 18:44:05 +02:00
Andreas Kling
bff59eff4b Ext2FS: Fix two bugs in block allocation:
1) Off-by-one in block allocation when block size != 1 KB

Due to a quirk in the on-disk layout of ext2, file systems with a block
size of 1 KB have block #1 as their first block, while all others start
on block #0.

2) We had no fallback mechanism when the preferred group was full

We now allocate blocks from the preferred block group as long as it's
possible, and fall back to a simple scan through all groups when the
preferred one is full.
2019-09-22 18:37:17 +02:00
Andreas Kling
9c549c178a Kernel: Pad virtual address space allocations with guard pages
Put one unused page on each side of VM allocations to make invalid
accesses more likely to generate crashes.

Note that we will not add this guard padding for mmap() at a specific
memory address, only to "mmap it anywhere" requests.
2019-09-22 15:12:29 +02:00
Andreas Kling
bd1e8bf166 GDialog: Remove self from parent when the nested event loop returns
This ensures that we close (and don't leak) the dialog during the
typical usage pattern.
2019-09-22 00:46:29 +02:00
Andreas Kling
e61aa01745 WindowServer: Remove debug spam about child window removals 2019-09-22 00:44:18 +02:00
Andreas Kling
5614cdf308 LibCore: Remove leftover debug spam in CObject::remove_child() 2019-09-22 00:42:20 +02:00
Andreas Kling
df837562ad Taskbar: Remove window buttons from the taskbar when appropriate 2019-09-22 00:41:52 +02:00
Andreas Kling
f614081b83 LibCore: Add CObject::remove_from_parent()
This is a convenient shorthand for:

    if (object.parent())
        object.parent()->remove_child(object);
2019-09-22 00:41:01 +02:00
Andreas Kling
d6abfbdc5a LibCore: Remove ObjectPtr in favor of RefPtr
Now that CObject is fully ref-counted, just use RefPtr everywhere! :^)
2019-09-22 00:31:54 +02:00
Andreas Kling
bc319d9e88 LibCore: Make CObject reference-counted
Okay, I've spent a whole day on this now, and it finally kinda works!
With this patch, CObject and all of its derived classes are reference
counted instead of tree-owned.

The previous, Qt-like model was nice and familiar, but ultimately also
outdated and difficult to reason about.

CObject-derived types should now be stored in RefPtr/NonnullRefPtr and
each class can be constructed using the forwarding construct() helper:

    auto widget = GWidget::construct(parent_widget);

Note that construct() simply forwards all arguments to an existing
constructor. It is inserted into each class by the C_OBJECT macro,
see CObject.h to understand how that works.

CObject::delete_later() disappears in this patch, as there is no longer
a single logical owner of a CObject.
2019-09-22 00:25:25 +02:00
Andreas Kling
0c72e0c09f AK: Add AK_MAKE_NONMOVABLE 2019-09-22 00:17:29 +02:00
Andreas Kling
8d550c174e LibCore: Convert CFile to ObjectPtr 2019-09-21 20:50:06 +02:00
Andreas Kling
31b38ed88f LibGUI: Don't create GMessageBox and GInputBox on the stack
We need to get rid of all instances of widgets-on-the-stack since that
will no longer work in the ref-counting world.
2019-09-21 20:32:31 +02:00