Commit Graph

573 Commits

Author SHA1 Message Date
Ben Wiederhake
d9c1162a20 nproc: Avoid making StringView of temporary ByteBuffer 2021-09-11 13:22:51 +03:00
Timothy Flynn
cf1923edeb js: Implement pretty-printing of Intl.NumberFormat 2021-09-11 11:05:50 +01:00
Andreas Kling
6ad427993a Everywhere: Behaviour => Behavior 2021-09-07 13:53:14 +02:00
Liav A
25ea7461a0 Kernel/PCI: Simplify the entire subsystem
A couple of things were changed:
1. Semantic changes - PCI segments are now called PCI domains, to better
match what they are really. It's also the name that Linux gave, and it
seems that Wikipedia also uses this name.
We also remove PCI::ChangeableAddress, because it was used in the past
but now it's no longer being used.
2. There are no WindowedMMIOAccess or MMIOAccess classes anymore, as
they made a bunch of unnecessary complexity. Instead, Windowed access is
removed entirely (this was tested, but never was benchmarked), so we are
left with IO access and memory access options. The memory access option
is essentially mapping the PCI bus (from the chosen PCI domain), to
virtual memory as-is. This means that unless needed, at any time, there
is only one PCI bus being mapped, and this is changed if access to
another PCI bus in the same PCI domain is needed. For now, we don't
support mapping of different PCI buses from different PCI domains at the
same time, because basically it's still a non-issue for most machines
out there.
2. OOM-safety is increased, especially when constructing the Access
object. It means that we pre-allocating any needed resources, and we try
to find PCI domains (if requested to initialize memory access) after we
attempt to construct the Access object, so it's possible to fail at this
point "gracefully".
3. All PCI API functions are now separated into a different header file,
which means only "clients" of the PCI subsystem API will need to include
that header file.
4. Functional changes - we only allow now to enumerate the bus after
a hardware scan. This means that the old method "enumerate_hardware"
is removed, so, when initializing an Access object, the initializing
function must call rescan on it to force it to find devices. This makes
it possible to fail rescan, and also to defer it after construction from
both OOM-safety terms and hotplug capabilities.
2021-09-07 13:47:37 +02:00
Timothy Flynn
1a7443bec7 js: Implement pretty-printing of Intl.ListFormat 2021-09-06 23:49:56 +01:00
Linus Groh
fd895c7a24 js: Include calendar in pretty-printing output of more Temporal objects
We were only showing it for ZonedDateTime so far.
2021-09-06 23:10:16 +01:00
Linus Groh
cc8644ce34 js: Implement pretty-printing of Temporal.PlainMonthDay objects 2021-09-06 23:10:16 +01:00
Linus Groh
651feb6866 js: Implement pretty-printing of Temporal.PlainYearMonth objects 2021-09-06 23:10:16 +01:00
Ali Mohammad Pur
97e97bccab Everywhere: Make ByteBuffer::{create_*,copy}() OOM-safe 2021-09-06 01:53:26 +02:00
Ali Mohammad Pur
3a9f00c59b Everywhere: Use OOM-safe ByteBuffer APIs where possible
If we can easily communicate failure, let's avoid asserting and report
failure instead.
2021-09-06 01:53:26 +02:00
Brian Gianforcaro
3e45c3ed90 Userland: Switch static_assert of type sizes to AK::AssertSize 2021-09-05 20:08:57 +02:00
Ralf Donau
4f0e2f2584 Utilities: Modernize output and comparison in the sort utility
Use the comparison operator of AK/String instead of strcmp(3) and
replace fput* by outln.
2021-09-05 00:15:26 +02:00
Karol Kosek
791309a3d2 Utilities: Support grepping recursively from paths in the argument
Previously, the recursive flag always searched for file contents from
the current directory, ignoring the path argument entirely.
2021-09-04 15:36:31 +04:30
Timothy Flynn
128779938d js: Implement pretty-printing of Intl.Locale 2021-09-02 17:56:42 +01:00
sin-ack
c93c54c656 js: Use CodepointOriented spans and use the codepoint length of token
We were previously using byte-oriented spans. This would work if not for
token.line_column() being in codepoints.
2021-09-01 23:04:26 +02:00
Andreas Kling
51ae913bfe LibIMAP: Stop leaking a Core::Promise<bool> in IMAP::Client::connect() 2021-09-01 23:02:18 +02:00
Peter Elliott
33d7fdca28 Everywhere: Use my cool new @serenityos.org email address 2021-09-01 11:37:25 +04:30
Mustafa Quraish
b0bd4be59a Config CLI: Handle missing config values correctly
If the domain/group/key doesn't exist in the config, exit with
non-zero status and don't print out anything.

Previously the CLI would print a single empty line if the config
value was not found with LibConfig. Now, we use the proper
`Config::Client::the().read_string()` API which can return an
`Optional` type indicating failure.`
2021-08-31 16:52:58 +02:00
TheFightingCatfish
c9b384da92 echo: Support octal, hexadecimal and unicode escape sequences 2021-08-31 16:49:45 +02:00
Jesse Buhagiar
59eab8148d Kernel/Userland: Expose usb device address and use it in lsusb
We now expose the `USBDevice`'s address in the SysFS object. This means
that device addresses are no longer determined by the name of the file
in the `/bus/usb/` directory. This was an incorrect way of determining
device address, as a standard PC can have multiple USB controllers
(and hence multiple buses) that can have overlapping device IDs.
2021-08-31 16:38:49 +02:00
Mahmoud Mandour
ac7c83689b ps: Sort using input order in case of -q
Now the output of `ps -q <list>` is sorted according to the order the
user specified.
2021-08-28 15:08:00 +04:30
Mahmoud Mandour
259ecb3d11 ps: Select specific processes by their PIDs
This adds a `-q` option, which expects a comma-separated list of PIDs as
a value. On using it, only the processes associated with the supplied
PIDs are output.
2021-08-28 15:08:00 +04:30
Ralf Donau
e36931fffe Utilities: Add a command line client for ConfigServer
This is an alternative to the ini utility which accesses the
configuration files through the newly introduced ConfigServer.
2021-08-28 08:24:48 +01:00
Mustafa Quraish
2dea772d48 shot: Get only cropped region from WindowServer
Previously, we were always getting the full screen(s) bitmap from
the WindowServer and cropping it manually. The `get_screen_bitmap`
function already took in a `crop_region`, so we are now utilizing
that.
2021-08-28 08:18:41 +01:00
kleines Filmröllchen
7d7d310df6 Base+Utilities: Add the asctl audio utility, replacing avol
The new asctl (audio server control) utility expands on avol with a
completely new command line interface (documented in the man page) that
supports retrieving and setting all exposed audio server settings, like
volume and sample rate. This is currently the only user-facing way of
changing the sample rate.
2021-08-27 23:35:27 +04:30
kleines Filmröllchen
d049626f40 Userland+LibAudio: Make audio applications support dynamic sample rate
All audio applications (aplay, Piano, Sound Player) respect the ability
of the system to have theoretically any sample rate. Therefore, they
resample their own audio into the system sample rate.

LibAudio previously had its loaders resample their own audio, even
though they expose their sample rate. This is now changed. The loaders
output audio data in their file's sample rate, which the user has to
query and resample appropriately. Resampling code from Buffer, WavLoader
and FlacLoader is removed.

Note that these applications only check the sample rate at startup,
which is reasonable (the user has to restart applications when changing
the sample rate). Fully dynamic adaptation could both lead to errors and
will require another IPC interface. This seems to be enough for now.
2021-08-27 23:35:27 +04:30
Timothy Flynn
1c2ac69e3c js: Implement pretty-printing of Intl.DisplayNames 2021-08-26 22:04:09 +01:00
Itamar
f5b69dce0b Utilities: Add -d option to gzip
This option specifies that we should perform decompression instead of
compression.
2021-08-22 16:51:18 +02:00
Ralf Donau
60a4da8e20 Utilities: Use File.error_string() instead of perror(3) in cpp-* 2021-08-22 02:01:58 +02:00
networkException
acde7d12b0 Everywhere: Rename get in ConfigFile::get_for_{lib,app,system} to open
This patch brings the ConfigFile helpers for opening lib, app and system
configs more inline with the regular ConfigFile::open functions.
2021-08-22 01:32:25 +02:00
networkException
938051feb8 Everywhere: Use Core::ConfigFile::AllowWriting::Yes to allow writing 2021-08-22 01:32:25 +02:00
Itamar
f91974677c LibCpp: Use lex_iterable() where applicable 2021-08-21 22:09:56 +02:00
Itamar
feab5e8a3e Utilities: Add cpp-lexer 2021-08-21 22:09:56 +02:00
Jan de Visser
9e43508d30 Utilities: Some minor changes in sql REPL tool
- Added a connection banner
- Added '.quit' synonym for '.exit'
- Do not display updated/created/deleted banner if there were no changes
2021-08-21 22:03:30 +02:00
Timothy Flynn
02e3633b7f AK: Move FormatParser definition from header to implementation file
This is primarily to be able to remove the GenericLexer include out of
Format.h as well. A subsequent commit will add AK::Result to
GenericLexer, which will cause naming conflicts with other structures
named Result. This can be avoided (for now) by preventing nearly every
file in the system from implicitly including GenericLexer.

Other changes in this commit are to add the GenericLexer include to
files where it is missing.
2021-08-19 23:49:25 +02:00
Andrew Kaster
332b29c741 LibTest+Utilities: Print a start message before each test in run-tests
It can sometimes be difficult to tell from the debug.log and test stdout
which test was the last to run before the test runner hangs or exits the
QEMU instance unexpectedly.

Print out a start message before each test is executed, along with a
progress message indicating which test out of how many tests we're about
to run.
2021-08-19 18:42:34 +02:00
Jean-Baptiste Boric
5a8de62a1a Utilities: Remove memset calls inside ls 2021-08-18 20:30:46 +02:00
Jean-Baptiste Boric
58cebf1b6f Utilities: Implement -p flag for cp 2021-08-18 20:30:46 +02:00
Jean-Baptiste Boric
91bcff2994 Utilities: Properly sort files in ls 2021-08-18 20:30:46 +02:00
kleines Filmröllchen
a9cbdcbcd0 Utilities: Make aplay respect loader errors
aplay would previously just retry a couple of times when the loader
encountered an error, even though there is a standard mechanism for
loaders to report errors. Now, aplay outputs these errors to the user
and exits.
2021-08-18 18:16:48 +02:00
Sergey Bugaev
6c9343e262 Userland: Also cache d_type in find(1)
Since readdir() actually gives us the file type, we don't have
to stat it again to know whether it's a directory! This means that
'find /' can process the majority of files without ever calling
stat() on them, simply by reading directories.

In addition, the TypeCommand (-t) can make use of this info too,
so, for instance, a 'find / -t d' does not need to stat anything
either.

This gives us a final huge speedup :^)
2021-08-18 18:13:59 +02:00
Sergey Bugaev
548a880310 Userland: Cache stat in find(1)
We have multiple commands that are implemented in terms of stat.
Let's cache the stat in FileData after we query it once.

This gives us another large speed-up :^)
2021-08-18 18:13:59 +02:00
Sergey Bugaev
d4232d5ee2 Userland: Simplify recursion in find(1)
Now walk_tree() itself checks whether it should descend into a file
(if the file is a directory) or not.
2021-08-18 18:13:59 +02:00
Sergey Bugaev
ad15d0c880 Userland: Ditch Core::DirIterator for readdir() in find(1)
While Core::DirIterator is nice C++ API, we want more low-level
control here. In particular, we want to open the directory using
openat(), to also not pay the cost of re-traversing the path
components we have already resolved previously.

This gives us another nice speedup :^)

Also, in the future commits this will allow us to make use of more
data from the returned struct dirent, to speed things up even further.
2021-08-18 18:13:59 +02:00
Sergey Bugaev
4c126ea908 Userland: Use fstatat() in find(1)
This speeds things up noticeably :^)

The idea here is that a directory fd is a way to hold onto
the results of path resolution that the kernel has already done
for us. This way we don't ask the kernel to resolve the same
parent directories over and over.
2021-08-18 18:13:59 +02:00
Sergey Bugaev
e526a7641f Userland: Wrap path a into struct in find(1)
Also, replace the raw string by a LexicalPath.

Both are weird changes to make on their own; but they set
the stage for what's to come next.
2021-08-18 18:13:59 +02:00
Nico Weber
9fd2f97d27 echo: Implement -e flag
This lets you do things like `echo -e '\e[31mhello\e[m'` to print
red text, without having to resort to the tyranny of printf(1).
2021-08-17 19:59:23 +01:00
pyunbiwi
68d07320cf Userland: Add as-user execution to the pls utility
Commands may be executed as a specific user by passing the user's UID to
the '-u' flag in pls.
2021-08-16 21:16:30 +02:00
davidot
7613c22b06 LibJS: Add a mode to parse JS as a module
In a module strict mode should be enabled at the start of parsing and we
allow import and export statements.
2021-08-15 23:51:47 +01:00
Andreas Kling
1b739a72c2 Kernel+Userland: Remove chroot functionality
We are not using this for anything and it's just been sitting there
gathering dust for well over a year, so let's stop carrying all this
complexity around for no good reason.
2021-08-15 12:44:35 +02:00