Implement __cxa_atexit and __cxa_finalize per the Itanium spec,
and convert stdlib's atexit and exit() to to call them instead of
a custom 'C-only' atexit implementation.
We always want to put crt0.o in the location where it can get picked
up by the i686-pc-serenity toolchain.
This feels a bit hackish but should get the build working again. :^)
Use simple stack cookies to try to provoke an assertion failure on
stack overflow.
This is far from perfect, since we use a constant cookie instead of
generating a random one on startup, but it can still help us catch
bugs, which is the primary concern right now. :^)
Allow everything to be built from the top level directory with just
'make', cleaned with 'make clean', and installed with 'make
install'. Also support these in any particular subdirectory.
Specifying 'make VERBOSE=1' will print each ld/g++/etc. command as
it runs.
Kernel and early host tools (IPCCompiler, etc.) are built as
object.host.o so that they don't conflict with other things built
with the cross-compiler.
These fields are intended to carry the real meat of a drag operation,
and the "text" is just for what we show on screen (alongside the cursor
during the actual drag.)
The data field is just a String for now, but in the future we should
make it something more flexible.
Now that Frame knows the visible viewport rect, it can easily ignore
repaint requests from e.g <blink> elements that are not currently
scrolled into view. :^)
When the visible viewport rect changes, we walk the layout tree and
check where each LayoutImage is in relation to the viewport rect.
Images outside have their bitmaps marked as volatile.
Note that the bitmaps are managed by ImageDecoder objects. If a bitmap
is purged by the kernel while volatile, we construct a new ImageDecoder
next time we need pixels for the image.
A client that only ever does synchronous IPC calls from its side would
never actually process incoming asynchronous messages since they would
arrive while waiting for a synchronous response and then end up sitting
forever in the "unhandled messages" queue.
We now always handle unhandled messages using a deferred invocation.
This fixes the bug where Audio.MenuApplet didn't learn that the muted
state changed in response to its own request to change it. :^)
Instead of implementing menu applets as their own thing, they are now
WSWindows of WSWindowType::MenuApplet.
This makes it much easier to work with them on the client side, since
you can just create a GWindow with the right type and you're in the
menubar doing applet stuff :^)
This patch adds a single "kernel info page" that is mappable read-only
by any process and contains the current time of day.
This is then used to implement a version of gettimeofday() that doesn't
have to make a syscall.
To protect against race condition issues, the info page also has a
serial number which is incremented whenever the kernel updates the
contents of the page. Make sure to verify that the serial number is the
same before and after reading the information you want from the page.
Currently only Ext2FS and TmpFS supports InodeWatchers. We now fail
with ENOTSUPP if watch_file() is called on e.g ProcFS.
This fixes an issue with FileManager chewing up all the CPU when /proc
was opened. Watchers don't keep the watched Inode open, and when they
close, the watcher FD will EOF.
Since nothing else kept /proc open in FileManager, the watchers created
for it would EOF immediately, causing a refresh over and over.
Fixes#879.
This logic is all taken care of by GAbstractColumnView now, so we can
simply delete GTreeView::context_menu_event(). :^)
Fixes an issue mentioned in #826
4KB gets pretty mmap/munmap heavy when downloading larger files,
so bump this a bit to reduce time spent in memory allocation.
This can be improved in various ways, but I'm not sure what the
best way forward is at the moment.
This makes GTreeView able to support multi-column models!
Only one column can be the "tree column", this is column 0 by default
but can be changed by overriding GModel::tree_column().
When the filesystem model is updated, it is rebuilt. This means dangling
indexes inside the TreeView metadata table will have old information and random
directories will toggle open. Clearing the table alleviates this issue.
The kernel now supports basic profiling of all the threads in a process
by calling profiling_enable(pid_t). You finish the profiling by calling
profiling_disable(pid_t).
This all works by recording thread stacks when the timer interrupt
fires and the current thread is in a process being profiled.
Note that symbolication is deferred until profiling_disable() to avoid
adding more noise than necessary to the profile.
A simple "/bin/profile" command is included here that can be used to
start/stop profiling like so:
$ profile 10 on
... wait ...
$ profile 10 off
After a profile has been recorded, it can be fetched in /proc/profile
There are various limits (or "bugs") on this mechanism at the moment:
- Only one process can be profiled at a time.
- We allocate 8MB for the samples, if you use more space, things will
not work, and probably break a bit.
- Things will probably fall apart if the profiled process dies during
profiling, or while extracing /proc/profile
When a GAction is activated by a menu, or by a toolbar button, you can
now use GAction::activator() to get a pointer to whomever activated it.
This can be used to implement context-specific behaviors in situations
where the same action is exposed through multiple paths.
This addresses an issue that was brought up in #826.
We now take advantage of SharedBuffers being purgeable memory by
setting the volatile flag on window back buffers while not painting
into them.
This means that one of the two backing stores used by each window
is purgeable+volatile most of the time, allowing the kernel to purge
it to recover memory if needed.
Note that this is only relevant when double-buffering is turned on,
but since that is the default, this does affect most apps. :^)
This patch makes SharedBuffer use a PurgeableVMObject as its underlying
memory object.
A new syscall is added to control the volatile flag of a SharedBuffer.
This patch exposes some fields about purgeable memory regions.
We now also show total purgeable volatile and non-volatile memory in
the big process table.
It's now possible to get purgeable memory by using mmap(MAP_PURGEABLE).
Purgeable memory has a "volatile" flag that can be set using madvise():
- madvise(..., MADV_SET_VOLATILE)
- madvise(..., MADV_SET_NONVOLATILE)
When in the "volatile" state, the kernel may take away the underlying
physical memory pages at any time, without notifying the owner.
This gives you a guilt discount when caching very large things. :^)
Setting a purgeable region to non-volatile will return whether or not
the memory has been taken away by the kernel while being volatile.
Basically, if madvise(..., MADV_SET_NONVOLATILE) returns 1, that means
the memory was purged while volatile, and whatever was in that piece
of memory needs to be reconstructed before use.
Using int was a mistake. This patch changes String, StringImpl,
StringView and StringBuilder to use size_t instead of int for lengths.
Obviously a lot of code needs to change as a result of this.
This bitmap is displayed alongside the dragged text underneath the
mouse cursor while dragging.
This will be a perfect fit for dragging e.g files around. :^)
This function returns the bitmap itself if it's already backed by a
SharedBuffer object, otherwise it creates a shareable copy of itself
and returns that.
This patch enables basic drag&drop between applications.
You initiate a drag by creating a GDragOperation object and calling
exec() on it. This creates a nested event loop in the calling program
that only returns once the drag operation has ended.
On the receiving side, you get a call to GWidget::drop_event() with
a GDropEvent containing information about the dropped data.
The only data passed right now is a piece of text that's also used
to visually indicate that a drag is happening (by showing the text in
a little box that follows the mouse cursor around.)
There are things to fix here, but we're off to a nice start. :^)
These should be the last thing needed to make SDL build with threads
support. I think we can survive just fine with stubs of these for now,
especially given that the kernel doesn't care super much about thread
priorities anyway.
This patch adds pthread_key_create() and pthread_{get,set}specific().
There's a maximum of 64 thread-specific keys for simplicity.
Key destructors are not invoked on thread exit.
This feels like a pretty naive implementation, but I think it can work.
Basically each waiter creates an object on its stack that is then
added to a linked list inside by the pthread_cond_t.
Signalling is then done by walking the list and unsetting the "waiting"
flag on as many of the waiters as you like.
Instead of passing the PIDs back and forth in a handshake "Greet"
message, just use getsockopt(SO_PEERCRED) on both sides to get the same
information from the kernel.
This is a nice little simplification of the IPC protocol, although it
does not get rid of the handshake since we still have to pass the
"client ID" from the server to each client so they know how to refer
to themselves. This might not be necessary and we might be able to get
rid of this later on.
This extends the opportunistic protection of empty-but-kept-around to
also cover BigAllocationBlocks. Since we only cache 4KB BAB's at the
moment, this sees limited use, but it does work.
We now keep a separate queue of empty ChunkedBlocks in each allocator.
The underlying memory for each block is mprotect'ed with PROT_NONE to
provoke crashes on use-after-free.
This is not going to catch *all* use-after-frees, but if it catches
some, that's still pretty nice. :^)
The malloc memory region names are now updated to reflect their reuse
status: "malloc: ChunkedBlock(size) (free/reused)"
If a client sends an invalid window ID or similar to the WindowServer,
we'll now immediately mark them as misbehaving and disconnect them.
This might be too aggressive in some cases (window management, ...)
but it's just a place to start.
When draining the socket in IServerConnection, we would previously
handle each incoming (local endpoint) message as it came in.
This would cause unexpected things to happen while blocked waiting
for a synchronous response. That's definitely not what we want,
so this patch puts all of the incoming messages in a queue and does
a separate pass over the queue to handle everything in order.
This matches what we're already calling the server-side subclasses
better, though we'll probably want to find some better names for the
client-side classes eventually.
This patch introduces code generation for the WindowServer IPC with
its clients. The client/server endpoints are defined by the two .ipc
files in Servers/WindowServer/: WindowServer.ipc and WindowClient.ipc
It now becomes significantly easier to add features and capabilities
to WindowServer since you don't have to know nearly as much about all
the intricate paths that IPC messages take between LibGUI and WSWindow.
The new system also uses significantly less IPC bandwidth since we're
now doing packed serialization instead of passing fixed-sized structs
of ~600 bytes for each message.
Some repaint coalescing optimizations are lost in this conversion and
we'll need to look at how to implement those in the new world.
The old CoreIPC::Client::Connection and CoreIPC::Server::Connection
classes are removed by this patch and replaced by use of ConnectionNG,
which will be renamed eventually.
Goodbye, old WindowServer IPC. You served us well :^)
This patch adds these I/O counters to each thread:
- (Inode) file read bytes
- (Inode) file write bytes
- Unix socket read bytes
- Unix socket write bytes
- IPv4 socket read bytes
- IPv4 socket write bytes
These are then exposed in /proc/all and seen in SystemMonitor.
We never want to alpha blend when rendering the terminal buffer, so we
can just use clear_rect() and avoid trouble.
This fixes an issue with inconsistent translucency in the terminal app
when setting a custom background opacity.
This patch adds InsertTextCommand and RemoveTextCommand.
These two commands are used to ... insert and remove text :^)
The bulk of the logic is moved into GTextDocument, and we now use the
command's redo() virtual to perform the action. Or in other words, when
you type into the text editor, we create an InsertTextCommand, push it
onto the undo stack, and call redo() on it immediately. That's how the
text gets inserted.
This makes it quite easy to implement more commands, as there is no
distinction between a redo() and the initial application.
This patch converts the undo stack from GTextDocument into GUndoStack,
and GTextDocumentUndoCommand now inherits from GCommand.
Let's turn this into a generic mechanism that can be used to implement
undo/redo in any application. :^)
Callers of draw_pixel() are not expecting it to apply translation since
they will have already done that themselves.
This was causing draw_line() with thickness>1 to have an offset applied
in case the painter was already translated.
It's now possible to load a .o file into the kernel via a syscall.
The kernel will perform all the necessary ELF relocations, and then
call the "module_init" symbol in the loaded module.
Painter::draw_line() now has an optional "bool dotted" parameter that
causes it to only render every other pixel.
Note that this only works with horizontal and vertical lines at the
moment and we'll assert if called with dotted=true for a diagonal line.
This is going to be quite boring to do by hand for every single CSS
property. We'll probably want to come up with a way to auto-generate
some/most of the shorthand expansion code.
This patch moves the Selector object model closer to the specification
objects in Selectors Level 4.
A "Selector" in LibHTML is now a { Vector<ComplexSelector> }, which is
a { Relation, CompoundSelector }. A CompoundSelector is really just
a Vector<SimpleSelector>, and SimpleSelector is "Component" renamed.
This makes a lot more selectors actually match on the Ubuntu Apache2
default homepage. :^)
After resorting, we now re-map every selected index so it matches the
new row mappings. This makes the process table view in SystemMonitor
behave normally again :^)
Turns out we can use abi::__cxa_demangle() for this, and all we need to
provide is sprintf(), realloc() and free(), so this patch exposes them.
We now have fully demangled C++ backtraces :^)
Previously it was not possible to see what each thread in a process was
up to, or how much CPU it was consuming. This patch fixes that.
SystemMonitor and "top" now show threads instead of just processes.
"ps" is gonna need some more fixing, but it at least builds for now.
Fixes#66.
SystemServer can now create sockets on behalf of services before spawning any
of them, and pass the open socket fd as fd 3. CLocalServer gains a method to
complete the takeover and listen on the passed fd.
This is not used by any services at the moment.
Long ago, there was a fourth stdio default stream, stddbg, connected to the
debug console. It has since been replaced by the dbgputstr() and dbgputch()
syscalls.
3fce2fb205
Remove the last remains of stddbg, as fd 3 is soon going to be reused for socket
takeover.
This patch adds "submit" inputs and default (text box) inputs, as well
as form elements that can be submitted.
Layout of input elements is implemented via a new LayoutWidget class
that allows you to put an arbitrary GWidget in the layout tree.
At the moment, the DOM node sets the initial size of the LayoutWidget,
and then the positioning is done by the normal layout algorithm.
We also now support submitting a <form method="GET">, which does a full
replacing load with a URL based on the form's action + a query string
built from the name/value of input elements within the submitted form.
This is pretty neat! :^)
Before this patch, all of the excess spacing caused by line-height was
"padding" the line boxes below the text.
To fix this, we make line box fragments use the font height as their
height, and then let the inline layout algorithm adjust the Y positions
to distribute the vertical space.
Always paint border edges so they join nicely with their buddy edges.
This makes borders look nice even if all sides have different widths.
Also switch the border code to using floating point numbers since
otherwise things get very ugly very fast.
The borders still look very wrong with any border-width other than 1,
but at least we can see that they have the right color, and end up in
mostly the right place :^)
I broke semi-transparent terminals when I added support for alpha
blending to Painter::fill_rect().
When we fill the terminal widget background, we don't want blending to
take place, we're just looking to replace with an exact color, so now
we can use Painter::clear_rect() for that.
LibProtocol::Client::start_download() now gives you a Download object
with convenient hooks (on_finish & on_progress).
Also, the IPC handshake is snuck into the Client constructor, so you
don't need to perform it after instantiating a Client.
This makes using LibProtocol much more pleasant. :^)
The DownloadFinished message from the server now includes a buffer ID
that can be mapped into the client program.
To avoid prematurely destroying the buffer, the server will hang on to
it until the client lets it know that they're all good. That's what the
ProtocolServer::DisownSharedBuffer message is about.
In the future it would be nice if the kernel had a mechanism to allow
passing ownership of a shared buffer along with an IPC message somehow.
This patch adds ProtocolServer, a server that handles network requests
on behalf of its clients. The first protocol implemented is HTTP.
The idea here is to use a plug-in architecture where any number of
protocols can be added and implemented without having to mess around
with each client program that wants to use the protocol.
A simple client API is provided through LibProtocol::Client. :^)
Here comes the first part of a GIF decoder. It decodes up to the point
of gathering all the LZW-compressed data. The next step is to implement
decompression, and then turn the decompressed data into a bitmap using
the color maps, etc.
Client-side connection objects must now provide both client and server
endpoint types. When a message is received from the server side, we try
to decode it using both endpoint types and then send it to the right
place for handling.
This now makes it possible for AudioServer to send unsolicited messages
to its clients. This opens up a ton of possibilities :^)
This patch adds muting to ASMixer, which works by substituting what we
would normally send to the sound card with zero-filled memory instead.
We do it this way to ensure that the queued sample buffers keep getting
played (silently.)
This is obviously not the perfect way of doing this, and in the future
we should improve on this, and also find a way to utilize any hardware
mixing functions in the sound card.
This patch adds a[foo] and a[foo=bar] attribute selectors.
Note that an attribute selector is an optional part of a selector
component, and not a component on its own.
We were not producing the correct DOM attribute in either of those
cases. "<div attr>" would produce no attribute, and the other would
produce an attribute with null value (instead of an empty value.)
Previously they would resort based on the column immediately when you
mousedown on them. Now we track the click event and show the header
in a pressed state, etc. The usual button stuff :^)
Instead of implicitly copying whatever you select, and pasting when you
middle-click, let's have traditional copy and paste actions bound to
Ctrl+Shift+C and Ctrl+Shift+V respectively.
This code was using the text from the DOM as a reference for how much
whitespace to remove from the end of a line box.
Since the DOM may contain uncollapsed whitespace, it would sometimes
be out of sync with the collapsed text used by the rest of the layout
system.
This works for C++ syntax highlighted text documents by caching the C++
token type in a new "arbitrary data" member of GTextDocumentSpan.
When the cursor is placed immediately before a '{' or immediately after
a '}', we highlight both of these brace buddies by changing their
corresponding spans to have a different background color.
..and spans can also now have a custom background color. :^)
Instead of trying to build the host-side code generator helpers right
before we need them in the LibHTML build process, just build them ahead
of time in makeall.sh, like we already do for {IPC,Form}Compiler.
It's no longer possible to build LibHTML on the host machine since it
depends on LibGUI now. This patch gets rid of the dual Makefiles in
LibHTML since we only support Serenity builds anyway.
Also clean the code generator directory before building it.
These CSS properties constrain the computed width of a block-level box
to a maximum, followed by a minimum value.
This makes the "better mother fricken website" look more like it's
intended to (which helps makes the author's point, I suppose.)