This allows us to check code for syntax errors without relying on
Function(), which can lead to false negatives as certain things are
valid in a function context, but not outside one.
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.
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 :)
> function f(){f()}f()
Uncaught exception: [RuntimeError]: Call stack size limit exceeded
-> f
1234 more calls
-> (global execution context)
> function a(x){if(x>0){a(x-1)}else{throw Error()}}function b(x){if(x>0){b(x-1)}else{a(5)}}function c(){b(2)}c()
Uncaught exception: [Error]
-> a
5 more calls
-> b
-> b
-> b
-> c
-> (global execution context)
You can now do things like "kill -STOP pid" :^)
The getsignalbyname() helper function should probably move to LibC
or somewhere where it can be used by other signal related programs.
`snprintf` returns the number of characters that would have been written
had the buffer been large enough.
It's a common trick to call `snprintf(nullptr, 0, ...)` to measure how
large a buffer has to be.
Thus the return value is not zero but fourteen.
Add an implementation for uniq. While it will be nice in the future to
make more hardened versions of sort and uniq in the future, this
implementation of uniq is compatible with the current version of sort
and its buffer sizes.
This version supports optional input and output files along with stdin
and stdout.
From https://youtu.be/YNSAZIW3EM0?t=1474:
"Hmm... I don't think that name is right! From the perspective of
userspace, this is a file descriptor. File description is what the
kernel internally keeps track of, but as far as userspace is concerned,
he just has a file descriptor. [...] Maybe that name should be changed."
Core::File even has a member of this enum type... called
m_should_close_file_descriptor - so let's just rename it :^)