Commit graph

14302 commits

Author SHA1 Message Date
Tom
3c1ef744f6 AK: Add RefPtrTraits to allow implementing custom null pointers
This adds the ability to implement custom null states that allow
storing state in null pointers.
2020-11-10 19:11:52 +01:00
Brendan Coles
4dd104607d LaunchServer: Add hsp=/bin/HackStudio file association to config 2020-11-10 19:04:24 +01:00
Brendan Coles
e62b604ec5 Base: remove unnecessary Game config files from /home/anon/.config/ 2020-11-10 19:03:59 +01:00
Nico Weber
8d9d3c9425 ntpquery: Add a '-a' flag that makes it use adjtime
With this, `ntpquery` can adjust the system time without
making it jump.

A fun activity with this in:

0. Boot
1. Run `su`
2. Run `ntpquery -a` to adjust the time offset after boot
   (usually around a second)
3. Keep running `ntpquery ; adjtime` to see how the offset
   behind NTP and the remaining adjtime both shrink.
   adjtime adjustment is large enough to make the time offset
   go down by a bit, but we currently lose time quickly enough
   that by the time adjtime is done, we've only corrected the
   clock about halfway, and not all the way to zero. Goto 2.

So this isn't all that great yet, but I think it's good enough
to think about turning this into a permanently running service next.
2020-11-10 19:03:08 +01:00
Nico Weber
5fcd34b810 Userland: Add an "adjtime" utility
It's a thin userland wrapper around adjtime(2). It can be used
to view current pending time adjustments, and root can use it to
smoothly adjust the system time.

As far as I can tell, other systems don't have a userland utility
for this, but it seems useful. Useful enough that I'm adding it to
the lagom build so I can use it on my linux box too :)
2020-11-10 19:03:08 +01:00
Nico Weber
323e727a4c Kernel+LibC: Add adjtime(2)
Most systems (Linux, OpenBSD) adjust 0.5 ms per second, or 0.5 us per
1 ms tick. That is, the clock is sped up or slowed down by at most
0.05%.  This means adjusting the clock by 1 s takes 2000 s, and the
clock an be adjusted by at most 1.8 s per hour.

FreeBSD adjusts 5 ms per second if the remaining time adjustment is
>= 1 s (0.5%) , else it adjusts by 0.5 ms as well. This allows adjusting
by (almost) 18 s per hour.

Since Serenity OS can lose more than 22 s per hour (#3429), this
picks an adjustment rate up to 1% for now. This allows us to
adjust up to 36s per hour, which should be sufficient to adjust
the clock fast enough to keep up with how much time the clock
currently loses. Once we have a fancier NTP implementation that can
adjust tick rate in addition to offset, we can think about reducing
this.

adjtime is a bit old-school and most current POSIX-y OSs instead
implement adjtimex/ntp_adjtime, but a) we have to start somewhere
b) ntp_adjtime() is a fairly gnarly API. OpenBSD's adjfreq looks
like it might provide similar functionality with a nicer API. But
before worrying about all this, it's probably a good idea to get
to a place where the kernel APIs are (barely) good enough so that
we can write an ntp service, and once we have that we should write
a way to automatically evaluate how well it keeps the time adjusted,
and only then should we add improvements ot the adjustment mechanism.
2020-11-10 19:03:08 +01:00
Brendan Coles
28abfd6290 Userland: ls: Add -d / --directory flag 2020-11-10 18:56:27 +01:00
Brendan Coles
9b79ea78d3 LibC: Add POSIX1 minimum limits to limits.h 2020-11-10 14:39:38 +01:00
Linus Groh
518481086b js: Use new string formatting functions 2020-11-10 14:33:48 +01:00
Andreas Kling
626c17d284 Breakout: Add simple menu and about dialog :^) 2020-11-10 14:32:45 +01:00
Andreas Kling
51e7c6e348 Breakout: Set the window icon 2020-11-10 14:32:45 +01:00
Andreas Kling
8c88bf31ed Breakout: Turn off double-buffering 2020-11-10 14:32:45 +01:00
Andreas Kling
959038d410 Breakout: Change ball x velocity depending on where it hits paddle
This makes the game less deterministic and more fun. The "physics"
definitely feel a little goofy, and I'm sure they can be greatly
improved, but still it's already better. :^)
2020-11-10 14:32:45 +01:00
Andreas Kling
844c2e1f3b Breakout: Stop paddle movement when resetting it 2020-11-10 14:32:45 +01:00
Andreas Kling
d05d519b0d Breakout: Use floating point coordinates 2020-11-10 14:32:45 +01:00
Brendan Coles
3f7b2c83d3 Tests: Add Kernel tests for unveil system call 2020-11-10 14:23:19 +01:00
Brendan Coles
7e0204fb41 Userland: ls: Add -o and -B / --ignore-backups flags
* `-B`, --ignore-backups`: Do not list implied entries ending with ~
* `-o`, In long format, do not show group information
2020-11-10 14:22:49 +01:00
marprok
5fae567008 Userland: Basic statistics for ping
After ping is terminated, the min/avg/max time
as well as information about the number of successful
packets received are printed on the screen.
2020-11-10 12:06:04 +01:00
Brendan Coles
0058d28a73 Base: Add ls man page documentation 2020-11-10 12:04:26 +01:00
Brendan Coles
51f49ec73f ls: Add -A flag to show dot files excluding implied . and .. directories 2020-11-10 12:04:12 +01:00
Andreas Kling
07a2d22c33 HackStudio: Scroll embedded terminals to bottom upon command execution
It was kinda annoying that you had to scroll down manually every time
you started a new build while looking at some error in the scrollback.
2020-11-10 11:55:18 +01:00
Andreas Kling
9475427d5d LibVT: Add TerminalWidget::scroll_to_bottom() API
(And use this internally when scrolling to bottom on non-modifier
keydown events.)
2020-11-10 11:55:12 +01:00
AmusedNetwork
eac0344ef0 LibGUI: Limit the height of item text in IconView
Set the max height of the text_rect to be the height difference
between two icons. Calculate the number of text lines that can be
displayed in this height, and display only that many.
2020-11-10 09:54:18 +01:00
Jack Byrne
1041ab88ca
TextEditor: Go-to-line now shows line in middle of view (#4008) 2020-11-10 09:53:50 +01:00
Jesse Buhagiar
940380c986 Kernel: Prevent unveil returning ENOENT with cpath permissions
This addresses the issue first enountered in #3644. If a path is
first unveiled with "c" permissions, we should NOT return ENOENT
if the node does not exist on the disk, as the program will most
likely be creating it at a later time.
2020-11-10 09:53:18 +01:00
Lenny Maiorani
c5b26a0df8 IPv4Address: Unit tests
Problem:
- There is no direct unit testing of the IPv4Address functionality
  which makes refactoring difficult.

Solution:
- Add unit tests to cover the current functionality of
  IPv4Address. This will allow future refactorings with confidence.
2020-11-10 09:30:39 +01:00
Brendan Coles
7fbf890717 Ports: Add GNU indent 2020-11-09 16:22:52 +01:00
asynts
32957745fb AK: Add formatters for floating point numbers. 2020-11-09 16:21:29 +01:00
asynts
3b3edbc4d2 AK: Rename new_out to out and new_warn to warn. 2020-11-09 16:21:29 +01:00
asynts
74438e6fdc AK: Remove out() and warn(). 2020-11-09 16:21:29 +01:00
bcoles
74d9616bec
Base: Add Breakout game to system menu (#4006) 2020-11-09 16:21:05 +01:00
Andreas Kling
0bf927a824 Breakout: Use the pending new ball rect for brick collision testing
Otherwise the ball will bounce one frame *after* hitting a brick.
2020-11-09 13:34:27 +01:00
Andreas Kling
8e4e77fcf4 Breakout: Add a very simple breakout game :^)
Made with HackStudio! This needs some love to feel like a proper game,
but the basics are here.
2020-11-09 13:34:27 +01:00
Luke
e2e6b03a45 LibWeb: Add support for reflected boolean values
Also throw in some missing reflected DOMString values
2020-11-09 09:51:22 +01:00
Brendan Coles
e7173e946f ls: print inodes in short output format when -i arg is supplied 2020-11-09 07:56:56 +01:00
Andreas Kling
744af11991 LibDebug: Use move semantics when populating abbreviations map 2020-11-08 23:05:34 +01:00
Andreas Kling
c66434e085 LibDebug: Avoid copying AttributeSpecifications when iterating them 2020-11-08 22:52:22 +01:00
Andreas Kling
9af1a4b9b1 UserspaceEmulator: Support the first two levels of CPUID
GCC uses these when deciding which memcpy implementation to use.
2020-11-08 22:47:02 +01:00
Andreas Kling
fc948ea3df LibDebug: Shrink some of the high-volume data structures
We quickly allocate a *ton* of these when loading large executables.
2020-11-08 22:39:39 +01:00
Andreas Kling
81b7c072ed AK: Use reference algorithms for LEB128 parsing
This fixes a bug in signed LEB128 parsing (sign extension stage)
which would sometimes cause debug info to look very strange.
2020-11-08 22:38:27 +01:00
AnotherTest
a2cfb7eb94 LibGUI: Prevent multiple drag initiations while drag messages are passed 2020-11-08 21:46:13 +01:00
AnotherTest
e99c2261e3 Spreadsheet: Add support for copying ranges of cells to other cells
Now the entire range is copied to the area around the target cell,
translating the current cursor to the target.
2020-11-08 21:46:13 +01:00
AnotherTest
7878596532 Spreadsheet: Update the view when using the cell editor 2020-11-08 21:46:13 +01:00
AnotherTest
6d1e47e7dd LibGUI+WindowServer: Make DragOperation hold a MimeData instance
...instead of maybe bitmap + a single mime type and its corresponding data.
This allows drag&drop operations to hold multiple different kinds of
data, and the views/applications to choose between those.
For instance, Spreadsheet can keep the structure of the dragged cells,
and still provide text-only data to be passed to different unrelated editors.
2020-11-08 21:46:13 +01:00
AnotherTest
c930e02624 LibIPC: Add support for passing around ByteBuffers and HashMap<K, V>
It should be noted that using a shared buffer should still be preferred
over passing a raw ByteBuffer over the wire.
2020-11-08 21:46:13 +01:00
AnotherTest
705ad670f3 LibGfx: Add methods to serialise and deserialise a Bitmap
Unlike `to_shared_buffer()` and co, these methods do *not* require extra
metadata about the bitmap.
2020-11-08 21:46:13 +01:00
Peter Nelson
e23daa90a3 LibGfx: remove debug printfs from GIFLoader 2020-11-08 21:40:47 +01:00
Peter Nelson
cd38fab63f LibGfx: add erroneous cases to GIF test suite 2020-11-08 21:40:47 +01:00
Peter Nelson
fa57083552 LibGfx: gracefully handle GIFs with frame decode errors
GIFLoader now tracks the state of errors during the decoding process
and will fall back to displaying the first frame of the GIF if any of
the subsequent frames fail to decode.
2020-11-08 21:40:47 +01:00
Nico Weber
7480034942 seq: Check start, step, end for NaN 2020-11-08 21:40:18 +01:00