Commit graph

62783 commits

Author SHA1 Message Date
Andreas Kling 2d17fe58bc Kernel: Remove unnecessary assertion in page_in_from_inode().
Turns out I had confused myself about the situation. Just because a page
has been paged in by another process doesn't mean that the *current*
process's page directory has the present bit set! D'oh. :^)
2019-02-03 03:04:40 +01:00
Andreas Kling 3eeff0dd14 Kernel: Improve crash info if page_in_from_inode() is called redundantly. 2019-02-03 02:49:59 +01:00
Andreas Kling c63d476da2 Kernel: Let's have cli() and sti() clobber memory.
I don't like the idea of the compiler reordering anything around either
cli() or sti(), so let's make sure it doesn't.
2019-02-03 02:47:55 +01:00
Andreas Kling e2f27aa7b5 Userland: Make /bin/date pretty-print the date, too. 2019-02-03 02:47:37 +01:00
Andreas Kling 7e4376d469 Kernel: When entering page_in_from_inode(), assert that !physical_page.
It would be really weird to enter here with a physical page already present
in the VMObject's page slot. Let's assert that this doesn't happen.
2019-02-03 02:33:47 +01:00
Andreas Kling d8a172609c FontEditor: Add a grid to the glyph editor widget. 2019-02-03 02:20:30 +01:00
Andreas Kling e97fea3169 Liza8x10: Tweak some glyphs. 2019-02-03 02:20:12 +01:00
Andreas Kling 10fde0d707 Userland: Pretty-print modification times in /bin/ls. 2019-02-03 02:14:41 +01:00
Andreas Kling 5751063c63 Load the default font from disk in the kernel as well. 2019-02-03 01:44:08 +01:00
Andreas Kling abe3f515b1 Make font loading use mmap().
This exposed a serious race condition in page_in_from_inode().
Reordered the logic and added a paging lock to VMObject.
Now, only one process can page in from a VMObject at a time.
There are definitely ways to optimize this, for instance by making
the locking be per-page instead. It's not something that I'm going
to worry about right now though.
2019-02-03 01:36:25 +01:00
Andreas Kling 7f91aec25c Support font files.
This only works with the userspace build of SharedGraphics so far.
It's also very slow at loading fonts, but that's easy to fix.

Let's put fonts in /res/fonts/.
2019-02-02 23:13:12 +01:00
Andreas Kling 655753c557 SharedGraphics: Fix Font.cpp kernel build. 2019-02-02 17:42:16 +01:00
Andreas Kling 6fc3c38324 Start working on a simple graphical font editor.
Editing fonts by editing text files is really slow and boring.
A simple font editor seems like a good way to take LibGUI for a spin.
2019-02-02 08:07:06 +01:00
Andreas Kling 5e0b7f1a56 Add basic automatic dependency management to Makefiles. 2019-02-02 04:41:59 +01:00
Andreas Kling 7e64154d3f Remove Editor/ since I wasn't maintaining or trying to develop it. 2019-02-02 04:28:45 +01:00
Andreas Kling 76f53b40f4 LibC: Add some things needed to build GNU bc.
This patch adds vprintf(), sig_atomic_t, random() and strdup().
bc doesn't build yet, but it will.
2019-02-01 16:03:21 +01:00
Andreas Kling feed67ede2 Kernel: VFS::open/create should take base Inode& instead of InodeIdentifier. 2019-02-01 15:36:45 +01:00
Andreas Kling 6618411fba Kernel: mkdir() should use the containing directory's FS for inode creation. 2019-02-01 15:29:11 +01:00
Andreas Kling 33e7df5955 Kernel: mkdir() should fail if the pathname is empty. 2019-02-01 15:29:05 +01:00
Andreas Kling 240b5fe677 Terminal: Draw the cursor by reversing foreground/background color.
This makes the cursor pleasantly see-through.
2019-02-01 05:40:27 +01:00
Andreas Kling b7967d1292 SharedGraphics: Make Painter::fill_rect() respect the current DrawOp. 2019-02-01 05:23:05 +01:00
Andreas Kling 95c3442d59 Implement event loop timers.
GObjects can now register a timer with the GEventLoop. This will eventually
cause GTimerEvents to be dispatched to the GObject.

This needed a few supporting changes in the kernel:

- The PIT now ticks 1000 times/sec.
- select() now supports an arbitrary timeout.
- gettimeofday() now returns something in the tv_usec field.

With these changes, the clock window in guitest2 finally ticks on its own.
2019-02-01 03:50:06 +01:00
Andreas Kling 9153666e72 Userland: /bin/ls shouldn't display inode numbers by default.
Added the -i option to ls which turns on inode number display.
2019-01-31 17:34:24 +01:00
Andreas Kling ffab6897aa Big, possibly complete sweep of naming changes. 2019-01-31 17:31:23 +01:00
Andreas Kling 27fa09aee4 LibC: Add mktime(). 2019-01-31 16:51:27 +01:00
Andreas Kling e04ba0a83c Add a simple clock window to guitest2.
This is driven by mousedown events right now, since there are no timers.
2019-01-31 16:37:43 +01:00
Andreas Kling 2dc9c86bad Kernel: Make Process a Weakable class.
Use this to fix a use-after-free in ~GraphicsBitmap(). We'd hit this when
the WindowServer was doing a deferred destruction of a WSWindow whose
backing store referred to a now-reaped Process.
2019-01-31 07:02:40 +01:00
Andreas Kling fc0b63ca3c Kernel: Include absolute paths of mount points in /proc/mounts 2019-01-31 06:13:55 +01:00
Andreas Kling 34e745b0b4 Add uid and gid to CharacterDevices.
The vast majority of them will be owned by 0:0 (the default.)
However, PTY pairs will now be owned by the uid:gid of the opening process.
2019-01-31 05:55:30 +01:00
Andreas Kling c4fce9b3f9 Make stat() work on device files again.
FileDescriptor will now keep a pointer to the original inode even after
opening it resolves to a character device.

Fixed up /bin/ls to display major and minor device numbers instead of size
for device files.
2019-01-31 05:05:57 +01:00
Andreas Kling c3cc318028 Ext2FS: Remove an unnecessary heap allocation in create_inode(). 2019-01-31 04:17:16 +01:00
Andreas Kling 0932efe72e Kernel: Actually zero-fill eagerly committed regions.
Previously, calling Region::commit() would make sure to allocate any missing
physical pages, but they would contain uninitialized data. This was very
obvious when allocating GraphicsBitmaps as they would have garbage pixels
rather than being filled with black.

The MM quickmap mechanism didn't work when operating on a non-active page
directory (which happens when we're in the middle of exec, for example.)
This patch changes quickmap to reside in the shared kernel page directory.

Also added some missing clobber lists to inline asm that I stumbled on.
2019-01-31 04:03:05 +01:00
Andreas Kling 6b88025dda Remove the last remaining #ifndef SERENITY blocks. 2019-01-31 02:56:54 +01:00
Andreas Kling 2c6a3f1907 Terminal: Oops, escape sequences for the left and right keys were swapped. 2019-01-30 21:20:44 +01:00
Andreas Kling 56b6fb198a Add support for keyboard arrow keys.
Also have them send the appropriate escape sequences in Terminal.
Basic history browsing now works in bash. How nice! :^)
2019-01-30 21:18:13 +01:00
Andreas Kling f176af7cd1 Terminal: Implement 'J' escape "clear from cursor to end of screen." 2019-01-30 21:04:49 +01:00
Andreas Kling d1b805172d Rename the default user to "anon" and give him a home directory. 2019-01-30 20:40:41 +01:00
Andreas Kling 2a7af0eacf Kernel: Don't try to dump invalid code memory in page fault handler. 2019-01-30 20:18:50 +01:00
Andreas Kling 3ebbefd916 LibC: Oops, setjmp() and longjmp() were not exported. 2019-01-30 20:07:08 +01:00
Andreas Kling 37ab7b7a8c LibGUI: Implement destroying individual windows without exiting the process. 2019-01-30 20:03:52 +01:00
Andreas Kling 5c25f0c4db Destroy all remaining windows in a process when it dies. 2019-01-30 19:35:38 +01:00
Andreas Kling 3a4207b863 Fix dumb bug in HashTable::clear().
We forgot to clear the m_buckets pointer. This meant that multiple calls to
clear() would cause trouble.
2019-01-30 19:32:54 +01:00
Andreas Kling 2b4374d08e Let the slave PTY keep the master PTY alive.
This ownership model is a bit confusing. There's a retain cycle between
MasterPTY and SlavePTY, but it's broken when the SlavePTY is closed, meaning
that there are no more FileDescriptors referring to it.
2019-01-30 19:05:59 +01:00
Andreas Kling 45fba60ab5 Kernel: select() should fail with EBADF if any set contains an invalid fd. 2019-01-30 19:01:31 +01:00
Andreas Kling b4e478aa50 Deallocate PTY's when they close.
This required a fair bit of plumbing. The CharacterDevice::close() virtual
will now be closed by ~FileDescriptor(), allowing device implementations to
do custom cleanup at that point.

One big problem remains: if the master PTY is closed before the slave PTY,
we go into crashy land.
2019-01-30 18:47:18 +01:00
Andreas Kling 027d26cd5d Add a String::format() and use that in place of ksprintf() in the Kernel.
You're never gonna be right 100% of the time when guessing how much buffer
space you need. This avoids having to make that type of decision in a bunch
of cases. :^)
2019-01-30 16:28:51 +01:00
Andreas Kling e9b948103d Add a /dev/pts filesystem and make PTY allocation dynamic.
You can now open as many PTY pairs as you like. Well, it's actually capped
at 8 for now, but it's just a constant and trivial to change.

Unregistering a PTY pair is untested because I didn't want to start
mucking with that in Terminal right now.
2019-01-30 00:49:20 +01:00
Andreas Kling c30e2c8d44 Implement basic chmod() syscall and /bin/chmod helper.
Only raw octal modes are supported right now.
This patch also changes mode_t from 32-bit to 16-bit to match the on-disk
type used by Ext2FS.

I also ran into EPERM being errno=0 which was confusing, so I inserted an
ESUCCESS in its place.
2019-01-29 04:55:08 +01:00
Andreas Kling ad53f6afd3 LibC: Move Stopwatch thingy into a <serenity.h> header.
This thing is extremely useful for performance testing so let's put it here.
2019-01-28 23:01:47 +01:00
Andreas Kling cc906a2897 VFS: Resolve FIXME in Inode::read_entire() about using dynamic allocation. 2019-01-28 22:55:55 +01:00