Commit graph

821 commits

Author SHA1 Message Date
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
Andreas Kling f83a94ca39 Kernel: Remove outdated FIXME. 2019-01-28 22:53:31 +01:00
Andreas Kling 7455f5ea42 Expose the kernel log buffer through /proc/dmesg.
Also add a /bin/dmesg program for convenience.
2019-01-28 22:40:55 +01:00
Andreas Kling 442351a5f8 Tweak .gitignore. 2019-01-28 20:38:53 +01:00
Andreas Kling dbeac6e093 LibGUI: Reduce overdraw in GListBox. 2019-01-28 20:38:13 +01:00
Andreas Kling c95228b128 Add support for removing directories.
It's really only supported in Ext2FS since SynthFS doesn't really want you
mucking around with its files. This is pretty neat though :^)

I ran into some trouble with HashMap while working on this but opted to work
around it and leave that for a separate investigation.
2019-01-28 04:16:01 +01:00
Andreas Kling 031c62a21e .bochsrc: Toggle mouse grab with ctrl-alt (works nicer on 1-button mice.) 2019-01-28 02:34:09 +01:00
Andreas Kling 83228d03d8 LibGUI: GButton should only react to the left mouse button (for pushing.) 2019-01-27 20:26:45 +01:00
Andreas Kling 35c06f1520 LibGUI: More work on GCheckBox.
- Make it track the mouse cursor just like GButton does so that changes only
  get committed if the mouseup event happens while inside the widget rect.

- Draw a focus rect around the box when appropriate.

- When focused, support toggling the checked state with the space bar.
2019-01-27 20:22:06 +01:00
Andreas Kling 90e898b771 GTextBox: Avoid one instance of overdraw + naming cleanup. 2019-01-27 15:12:33 +01:00
Andreas Kling 0e73aa36c8 Kernel: Unbreak symbolication yet another time. 2019-01-27 10:17:56 +01:00
Andreas Kling 6d351bb326 Kernel: Move RAM size detection to MemoryManager and use what we learn. 2019-01-27 10:17:27 +01:00
Andreas Kling c4c475b49d /bin/cp: Handle partial write() case. 2019-01-27 10:04:53 +01:00