Commit Graph

546 Commits

Author SHA1 Message Date
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
Brian Gianforcaro
188e5f018f ddate: Use DateTime::now() for time 2021-08-15 12:20:38 +02:00
Brian Gianforcaro
3870f4160d date: Use DateTime::now() for time, cleanup duplicate returns 2021-08-15 12:20:38 +02:00
Andreas Kling
661bd992b0 Kernel+LibC: Share definitions for net/{if,if_arp,route}.h 2021-08-14 19:58:11 +02:00
Itamar
fd864fbb74 Utilities: Add 'file' and 'definitions' arguments to cpp-preprocessor
The 'file' argument allows specifying a file path.
The 'definitions' flag controls whether preprocessor definitions are
printed.
2021-08-14 12:40:55 +02:00
Itamar
8505fcb8ae LibCpp: Understand preprocessor macro definition and invocation
The preprocessor now understands when a function-like macro is defined,
and can also parse calls to such macros.

The actual evaluation of function-like macros will be done in a
separate commit.
2021-08-14 12:40:55 +02:00
Itamar
06e47ce7aa Utilities: Rename PreprocessorTest=>cpp-preprocessor 2021-08-14 12:40:55 +02:00
brapru
8059f28977 Utilities: Add program argument for netstat to display connection pid
Adds netstat command line argument to display slash-separated pair of
the id and name of the process that owns the socket. User must have
superuser privileges to see information on non-owned sockets.
2021-08-13 20:03:57 +04:30
Liav A
bf1adc2d5d Kernel+LibC: Use 64 bit values for ino_t
Since the InodeIndex encapsulates a 64 bit value, it is correct to
ensure that the Kernel is exposing the entire value and the LibC is
aware of it.

This commit requires an entire re-compile because it's essentially a
change in the Kernel ABI, together with a corresponding change in LibC.
2021-08-12 20:57:32 +02:00
TheFightingCatfish
fdde19d616 Utilities: Add option to control when to use colored output for grep
Fixes #9351.
2021-08-12 18:57:21 +02:00
Jean-Baptiste Boric
9b2cc9580b Userland: Add partial support for complex specifications to tr 2021-08-12 00:41:13 +02:00
Jean-Baptiste Boric
310eb72f72 Userland: Add support for --delete flag as alias of -d to tr 2021-08-12 00:41:13 +02:00
Jean-Baptiste Boric
89ba022ede Userland: Add support for -c/--complement flag to tr 2021-08-12 00:41:13 +02:00
Jean-Baptiste Boric
7f2d3df906 Userland: Add support for multiple character translations to tr 2021-08-12 00:41:13 +02:00
Andreas Kling
9ae8cd823c profile: Always enable PERF_EVENT_SIGNPOST 2021-08-12 00:03:38 +02:00
Jean-Baptiste Boric
0286160b62 Kernel: Add syscall performance event type
This allows tracing the syscalls made by a thread through the kernel's
performance event framework, which is similar in principle to strace.

Currently, this merely logs a stack backtrace to the current thread's
performance event buffer whenever a syscall is made, if profiling is
enabled. Future improvements could include tracing the arguments and
the return value, for example.
2021-08-10 21:55:48 +02:00
Itamar
4673a517f6 LibCpp: Do lexing in the Preprocessor
We now call Preprocessor::process_and_lex() and pass the result to the
parser.

Doing the lexing in the preprocessor will allow us to maintain the
original position information of tokens after substituting definitions.
2021-08-07 21:24:11 +02:00
Andreas Kling
af46f2214c Kernel: Make a bunch of "char const* to_string()" return StringView 2021-08-06 00:37:47 +02:00
brapru
a037e0ffec Utilities: Improve the arp information output
This updates the arp command to use output styles similar to other
utilities.
2021-08-05 09:30:35 +02:00
brapru
3bd6905ea8 Utilities: Add pledge and unveil protections in arp 2021-08-05 09:30:35 +02:00
Thomas Wagenveld
4181c0330c Ping: Add -s argument to specify the payload size of the ping
Change the static buffers to ByteBuffers to deal with the dynamic
size of the incoming and outgoing packets. Use sizeof(struct ip) rather
than the magic number '20' for the IPv4 header size.
Report the size of the reply packet to the console.
2021-08-03 09:06:11 +02:00
Ali Mohammad Pur
dc68c765b7 LibCpp: Correctly parse lines that end in '\'
Such lines should be considered to be joined into the next line.
This makes multiline preprocessor stuff "work".
2021-08-02 01:03:59 +02:00
Linus Groh
0990c23fc3 js: Implement pretty-printing of Temporal.ZonedDateTime objects 2021-08-01 20:31:31 +01:00
LuK1337
feacf774fb cksum: Print argv[0] on failed read
Forgot to do it in c5df5e5.
2021-08-01 19:26:57 +04:30
LuK1337
cf4bd4e4c9 cksum: Display adler32/crc32 sums as hex numbers
This basically follows what `crc32` and `xrdadler32` does on Linux
distros.
2021-08-01 13:02:16 +02:00
LuK1337
c5df5e504c cksum: Don't read the entire input file in memory
Same as `checksum`, in some cases we just can't load whole file into
memory.
2021-08-01 13:02:16 +02:00
Brian Gianforcaro
219d4ba376 Utilities: Remove unused header includes 2021-08-01 08:10:16 +02:00
Ryan Liptak
b0a4bcb688 shot: Make output filename a hyperlink when applicable
The hyperlink only gets printed when stdout is a TTY, so e.g. something
like `shot | cat` will not get the hyperlink escapes.
2021-08-01 08:04:53 +02:00