Commit Graph

1200 Commits

Author SHA1 Message Date
brapru
1297f81ddf route: Add the flags column 2022-05-26 16:33:10 +02:00
Andrew Kaster
ca42da23c2 Meta+Userland: Add jakt as an optional Lagom Tool
We can now use ENABLE_JAKT to pull jakt as a host tool and use it to
pre-process .jakt files into .cpp files for use in serenity applications
2022-05-23 23:05:45 +02:00
Ariel Don
a2c34554cd touch: Support custom timestamps
Previously, `touch` remained limited to creating files and updating
their current access and modifications time to the current time. It's
now capable of accepting two different timestamp formats with flags `-d`
and `-t` and referencing timestamps of other files with flag `-r`.

`touch` can also update only the last access time with `-a`, only the
last access time with `-m`, or update both as usual. `touch` updates
both left unspecified.

With `-c`, `touch` does not create a file if it doesn't already exist.
2022-05-21 18:15:00 +02:00
Ali Mohammad Pur
1830996ac9 xml: Avoid UAF in Error return from serenity_main()
ErrorOr<int> cannot own a string, and the string is scrubbed when freed,
so we'd get garbage when errors were printed.
2022-05-08 16:34:58 +02:00
Tim Schumacher
89da0f2da5 LibELF: Name library maps with the full file path 2022-05-07 20:02:00 +02:00
Luke Wilde
05748ed607 LibJS: Convert Console to use MarkedVector<Value>
Using a Vector<Value> is unsafe as GC cannot see the stored values.
This is then vended to outside users of ConsoleClient, e.g. LibWeb and
WebContent, which is then outside of LibJS's control.

An example issue is if the client stores it for later use and forgets
to visit the stored values, meaning they can be destroyed at any time.
We can save the client from this by vending a MarkedVector<Value> to
them.
2022-05-07 01:22:09 +02:00
Linus Groh
88f637a505 js: Print different type for each kind of ECMAScript function object
Instead of just printing 'ECMAScriptFunctionObject' (and leaking an
implementation detail in the process - this is not a public facing name)
let's instead print a different type string for each function kind, and
only keep the old class_name() printing for other JS::FunctionObject
subclasses.
2022-05-05 22:42:10 +02:00
Linus Groh
2ad9641315 js: Implement pretty-printing of generator objects 2022-05-05 22:40:57 +02:00
Liav A
e301af8352 Everywhere: Purge all support and usage of framebuffer devices
Long live the DisplayConnector object!
2022-05-05 20:55:57 +02:00
Liav A
d2e93ec50a Everywhere: Rename FB prefix name ioctls => GRAPHICS 2022-05-05 20:55:57 +02:00
Undefine
4054c35e9a su: Change the HOME enviroment variable on login 2022-05-05 20:49:18 +02:00
kleines Filmröllchen
ab49fcfb7c LibAudio+Userland: Remove Audio::LegacyBuffer
The file is now renamed to Queue.h, and the Resampler APIs with
LegacyBuffer are also removed. These changes look large because nobody
actually needs Buffer.h (or Queue.h). It was mostly transitive
dependencies on the massive list of includes in that header, which are
now almost all gone. Instead, we include common things like Sample.h
directly, which should give faster compile times as very few files
actually need Queue.h.
2022-05-03 23:09:20 +02:00
Kenneth Myhra
b8de830683 base64: Replace char pointer with StringView 2022-05-02 22:18:27 +02:00
Kenneth Myhra
bd81e15bc9 base64: Use TRY() instead of VERIFY(!result.is_error()) 2022-05-02 22:18:27 +02:00
Kenneth Myhra
ec1f5fd20f base64: Use Core::File standard_input() standard_output() 2022-05-02 22:18:27 +02:00
Patrick Meyer
0bd131ad06 Kernel: Stop requiring working malloc for syscall.h includes
Fixes #13869
2022-05-02 12:44:34 +02:00
Andrew Kaster
9b041786ac readelf: Don't error out on invalid interpreter path
This lets us inspect ELF binaries with un-loadable program interpreters,
same as binutils and llvm-readelf.
2022-05-02 01:45:49 +02:00
Maciej
06c90b35ec ifconfig: Stop supporting setting/displaying default gateway
The `route` command allows more sophiscated control over routing tables
now, and supporting this in ifconfig is no longer meaningful.
2022-05-01 13:34:27 +02:00
Daniel Bertalan
484f70fb43 readelf: Add printing for STT_GNU_IFUNC 2022-05-01 12:42:01 +02:00
brapru
0866a0cd1e Kernel+route: Support global routing table deletion 2022-04-30 16:24:33 +02:00
brapru
19912a0b32 Kernel+Utilities: Add the route utility
This exposes the global routing table in the /proc directory and adds
the userspace utility to query dynamically add from the table.
2022-04-28 08:41:11 -07:00
Tim Schumacher
a87c85f401 unzip: Create parent directory before extracting files 2022-04-27 11:54:57 +02:00
Ralf Donau
e11fb83bb7 config: Allow setting a key to the empty string 2022-04-26 22:42:54 +02:00
Ralf Donau
69a896cb82 ini: Use String for arguments 2022-04-25 10:47:56 +02:00
kleines Filmröllchen
49b087f3cd LibAudio+Userland: Use new audio queue in client-server communication
Previously, we were sending Buffers to the server whenever we had new
audio data for it. This meant that for every audio enqueue action, we
needed to create a new shared memory anonymous buffer, send that
buffer's file descriptor over IPC (+recfd on the other side) and then
map the buffer into the audio server's memory to be able to play it.
This was fine for sending large chunks of audio data, like when playing
existing audio files. However, in the future we want to move to
real-time audio in some applications like Piano. This means that the
size of buffers that are sent need to be very small, as just the size of
a buffer itself is part of the audio latency. If we were to try
real-time audio with the existing system, we would run into problems
really quickly. Dealing with a continuous stream of new anonymous files
like the current audio system is rather expensive, as we need Kernel
help in multiple places. Additionally, every enqueue incurs an IPC call,
which are not optimized for >1000 calls/second (which would be needed
for real-time audio with buffer sizes of ~40 samples). So a fundamental
change in how we handle audio sending in userspace is necessary.

This commit moves the audio sending system onto a shared single producer
circular queue (SSPCQ) (introduced with one of the previous commits).
This queue is intended to live in shared memory and be accessed by
multiple processes at the same time. It was specifically written to
support the audio sending case, so e.g. it only supports a single
producer (the audio client). Now, audio sending follows these general
steps:
- The audio client connects to the audio server.
- The audio client creates a SSPCQ in shared memory.
- The audio client sends the SSPCQ's file descriptor to the audio server
  with the set_buffer() IPC call.
- The audio server receives the SSPCQ and maps it.
- The audio client signals start of playback with start_playback().
- At the same time:
  - The audio client writes its audio data into the shared-memory queue.
  - The audio server reads audio data from the shared-memory queue(s).
  Both sides have additional before-queue/after-queue buffers, depending
  on the exact application.
- Pausing playback is just an IPC call, nothing happens to the buffer
  except that the server stops reading from it until playback is
  resumed.
- Muting has nothing to do with whether audio data is read or not.
- When the connection closes, the queues are unmapped on both sides.

This should already improve audio playback performance in a bunch of
places.

Implementation & commit notes:
- Audio loaders don't create LegacyBuffers anymore. LegacyBuffer is kept
  for WavLoader, see previous commit message.
- Most intra-process audio data passing is done with FixedArray<Sample>
  or Vector<Sample>.
- Improvements to most audio-enqueuing applications. (If necessary I can
  try to extract some of the aplay improvements.)
- New APIs on LibAudio/ClientConnection which allows non-realtime
  applications to enqueue audio in big chunks like before.
- Removal of status APIs from the audio server connection for
  information that can be directly obtained from the shared queue.
- Split the pause playback API into two APIs with more intuitive names.

I know this is a large commit, and you can kinda tell from the commit
message. It's basically impossible to break this up without hacks, so
please forgive me. These are some of the best changes to the audio
subsystem and I hope that that makes up for this :yaktangle: commit.

:yakring:
2022-04-21 13:55:00 +02:00
brapru
a7bb3fe7a8 netstat: Add the wide flag option
Previously netstat would print the whole line of an ip address or
resolved hostname. If the hostname was longer than the address column
length, it would push following columns into disaligned output.

This sets the default behavior to truncate any IP address or symbolic
hostname that is larger than the maximum address column size to provide
cleaner output. In the event the user wishes to see the whole address
name, they can then pass the wide option that will output as wide as
necessary to print the whole name.
2022-04-21 13:17:29 +02:00
brapru
07c2c86314 netstat: Add hostname resolution 2022-04-21 13:17:29 +02:00
brapru
a4d84a76e1 arp: Add hostname resolution 2022-04-21 13:17:29 +02:00
Eli Youngs
3afce86e83 mkfifo: Add support for setting permissions with -m 2022-04-20 18:35:08 +02:00
Karol Kosek
35cb5ea47c Utilities/profile: Call split_view() using StringView for command parts
This fixes the always appearing 'No such file' error when using the -c
flag, as the String was deconstructed right after running this line.
2022-04-18 14:17:01 +02:00
Sam Atkins
73552c1856 Userland: Always construct Application with try_create() 2022-04-18 12:57:34 +02:00
brapru
8b370f988b host: Use AK/IPv4Address to determine if argument is host/ip
It's a bit cleaner to just rely on AK/IPv4Address' ability to determine
the validity of the given input. If a valid IP address is not returned,
then input will be processed as a hostname.
2022-04-16 22:16:29 -07:00
Tim Schumacher
d6ccee4089 AK: Differ between long and long long formats 2022-04-14 03:12:56 +04:30
Sam Atkins
f92312e778 Utilities/unzip: Use Core::Directory to create output directory 2022-04-13 16:00:17 +02:00
Sam Atkins
f64ff945b2 env: Use Core::System::exec() 2022-04-11 21:09:42 +02:00
Sam Atkins
f0aba519c3 Utilities: Read positional arguments as Strings not char*s
This is a pretty trivial change so they're all batched together.
2022-04-11 21:09:42 +02:00
Sam Atkins
1ac6c4df72 strace: Use Core::System::exec() 2022-04-11 21:09:42 +02:00
Sam Atkins
b81a3a6f0e profile: Use Core::System::exec() 2022-04-11 21:09:42 +02:00
Sam Atkins
d2b32924d6 pls: Use Core::System::exec() 2022-04-11 21:09:42 +02:00
Sam Atkins
5a47b74227 paste: Use Core::System::{exec,setenv} 2022-04-11 21:09:42 +02:00
kleines Filmröllchen
5319e3a03f LibCore+Userland: Remove File::ensure_parent_directories
We have a much safer and more powerful alternative now, so let's move
the few users over.
2022-04-11 00:08:48 +02:00
Ali Mohammad Pur
b16918ccb9 pro: Only attempt to parse a proxy url if it is provided
Otherwise we'd end up trying to parse an empty string as a proxy url
which is certainly not one.
2022-04-09 14:36:28 +02:00
Ali Mohammad Pur
f9fc28931f pro: Accept an optional proxy to tunnel the download through
For now, this only accepts the format `socks5://ip:port` (i.e. the
hostname has to be an ipv4, and the port must be present).
2022-04-09 12:21:43 +02:00
Hendiadyoin1
f602bbf135 LibX86+disasm: Use an output format closer to objdump
This mainly does two things,
1. Removes spaces after commas
2. Elides "0x" and leading zeros in most contexts

Remaining differences are:
1. objdump always has memory size annotations
   We lack these and probably have some annotations wrong
2. Boolean check names
   We use jump-zero, while objdump uses jump-equal for example
3. We sometimes add "00 00" symbols, which objdump elides
4. We always demangle (This is a good thing)
5. We always resolve relocations (This is a good thing)
6. We seem to detect some symbols differently/incorrectly
2022-04-07 16:50:34 +02:00
Hendiadyoin1
5ee85aaa5d disasm: Print instruction bytes
This prints 7 instruction bytes per line, which is enough for most
x86-64 instructions (rex+opcode+mod/rm+imm32) and is also what
objdump uses.

Co-authored-by: Simon Wanner <skyrising@pvpctutorials.de>
2022-04-07 16:50:34 +02:00
brapru
3dbb4bc3a6 Utilities: Update arp to use newer APIs
Updates the arp command to use Core::System for the socket and
ioctl calls.

Updates command line arguments to StringView.
2022-04-05 12:43:18 +02:00
brapru
26b8155530 Utilities: Pledge inet in arp command
Previously the arp command would crash when trying to set/delete from
the table.
2022-04-05 12:43:18 +02:00
Ali Mohammad Pur
431776ebb7 js: Print the accumulator instead of the returned value in BC mode
The REPL is supposed to show the last value (and not the _returned_
value), so use the accumulator register as the 'value'.
2022-04-05 11:46:48 +02:00
Timothy Flynn
b36c3a68d8 js: Convert non-UTF-8 encoded files to UTF-8 before parsing 2022-04-05 00:14:29 +01:00
Brian Gianforcaro
7eaf1cfdc2 ls: Use Core::System::pledge(..) instead of LibC API 2022-04-03 17:13:51 -07:00