Commit graph

232 commits

Author SHA1 Message Date
Jean-Baptiste Boric
e16894af5a LibC: Do not include errno.h inside unistd.h
POSIX does not mandate this, therefore let's not do it.
2021-05-14 22:24:02 +02:00
Jean-Baptiste Boric
090936e424 Userland: Replace arc4random() with get_random<u32>() 2021-05-14 22:24:02 +02:00
Jean-Baptiste Boric
5a0468c21f Userland: Migrate from arc4random_uniform() to get_random_uniform() 2021-05-14 22:24:02 +02:00
Andreas Kling
04d78adaf7 Userland: Remove no-longer-needed unveil()'s of /tmp/rpc 2021-05-13 23:28:40 +02:00
Ali Mohammad Pur
4d9246ac9d LibWasm: Add basic support for module instantiation and execution stubs
This adds very basic support for module instantiation/allocation, as
well as a stub for an interpreter (and executions APIs).
The 'wasm' utility is further expanded to instantiate, and attempt
executing the first non-imported function in the module.
Note that as the execution is a stub, the expected result is a zero.
Regardless, this will allow future commits to implement the JS
WebAssembly API. :^)
2021-05-13 19:44:32 +01:00
Ali Mohammad Pur
bd8dac111c LibWasm: Add a module pretty printer 2021-05-13 19:44:32 +01:00
DexesTTP
ac6bd3a7a4 test-crypto: Add more tests for the modular power operator
Also addresses a fixup in the test suite by moving the NumberTheory
tests out of the RSA suite and into the BigInteger suite.
2021-05-13 19:18:07 +01:00
DexesTTP
5071989545 LibCrypto: Add a += operation to UnsignedBigIntegerAlgorithms
This new operation is immediately used in several existing algorithms.
2021-05-13 19:18:07 +01:00
Ali Mohammad Pur
1ae8775a1b LibCore+Everywhere: Move SeekMode out of IODevice 2021-05-12 11:00:45 +01:00
Ali Mohammad Pur
a91a49337c LibCore+Everywhere: Move OpenMode out of IODevice
...and make it an enum class so people don't omit "OpenMode".
2021-05-12 11:00:45 +01:00
Valtteri Koskivuori
4864ef9440 WindowServer: Add Optional<Gfx::IntRect> argument to get_screen_bitmap()
This way, we can optionally specify a region of the display to capture.
Defaults to entire screen if no rectangle is given.
2021-05-11 10:18:29 +01:00
SViN24
e60c0d675e
strace: Write output to stderr instead of stdout (#7016)
Fixes #7014.
2021-05-11 09:56:28 +02:00
Sergey Bugaev
d8faafef14 Userland: Implement paste --watch mode
You can now watch the clipboard for changes and run a command each time
the clipboard contents change like this:

$ paste --watch some command here

The command will be spawned each time the clipboard contents change. It
can read the clipboard contents from its stdin, and CLIPBOARD_STATE
environment variable will be set to "data" if there is data to be read,
or to "nil"/"clear" if the clipboard has been cleared.
2021-05-10 19:09:53 +01:00
Sergey Bugaev
93a1b88965 Userland: Implement copy --clear
You can now clear the clipboard using copy(1) like this:

$ copy --clear
2021-05-10 19:09:53 +01:00
Ömer Kurttekin
d922c2f5f3
Userland: Preserve keyboard mapping preference on reboot (#6955) 2021-05-09 15:56:03 +02:00
faxe1008
cbb06d7014
tac: Support concatenating multiple files (#6970) 2021-05-09 15:47:16 +02:00
Ali Mohammad Pur
426878c884 LibWasm: Add some more descriptive parse errors
It's much better to tell the user "hey, the magic numbers don't check
out" than "oh there was a problem with your input" :P
Also refactors some stuff to make it possible to efficiently use the
parser error enum without it getting in the way.
2021-05-08 22:14:39 +02:00
Ali Mohammad Pur
aa4d8d26b9 LibWasm: Start implementing a basic WebAssembly binary format parser
This can currently parse a really simple module.
Note that it cannot parse the DataCount section, and it's still missing
almost all of the instructions.
This commit also adds a 'wasm' test utility that tries to parse a given
webassembly binary file.
It currently does nothing but exit when the parse fails, but it's a
start :^)
2021-05-08 22:14:39 +02:00
r-paiva
90b6f999e5 Utilities: Fix mv command requesting incorrect path
When moving multiple files by using *, e.g.,: mv * /new_path/
If there was an error while trying to move a file to the new path
the next file in the file list to be moved would have its path
incorrectly set.

- Fixed mv loop to always append the correct path to the destination
path.
- Added proper error message when mv fails.
2021-05-08 15:22:47 +02:00
Linus Groh
dfa546702a Utilities/CMakeLists: Put all entries in alphabetical order 2021-05-08 10:07:11 +01:00
bleusakura
87de32df59
dd: Add ability to use k, M, & G suffixes for block sizes 2021-05-08 10:03:31 +01:00
Ali Mohammad Pur
3c01de4f0b Utilities/CMakeLists: Put 'file' entry in alphabetical order 2021-05-08 10:54:29 +02:00
Gunnar Beutner
605848787b Utilities: Specify mode argument when creating files with dd
When using open() with the O_CREAT flag we must specify the mode
argument. Otherwise we'll incorrectly set the new file's mode
to whatever is left on the stack:

courage:~ $ dd if=/dev/zero of=test count=1
1+0 blocks in
1+0 blocks out
512 bytes copied.
courage:~ $ ls -l test
--w-r-x---   1    anon   users        512   2021-05-08 01:29:52  test
courage:~ $

This also specifies the mode argument when opening files for
reading. This however is harmless because in those cases the argument
is ignored.

fixes #6923
2021-05-08 09:56:00 +02:00
Brian Gianforcaro
4c0d3f47e1 LibTest: Move Crash testing facility from crash.cpp to LibTest 2021-05-08 00:04:10 +01:00
Brian Gianforcaro
9720ad3901 Tests: Move Userland/Utilities/test-js to Tests/LibJS 2021-05-08 00:04:10 +01:00
Brian Gianforcaro
b390554ad8 Tests: Move Userland/Utilities/test-web to Tests/LibWeb 2021-05-08 00:04:10 +01:00
Idan Horowitz
284730c002 Utilities: Use GzipDecompressor::describe_header for gzip descriptions 2021-05-07 23:22:07 +02:00
Valtteri Koskivuori
9e49895bbf Userland: Fix some weird syntax in find
Spotted this while trying to fix a bug. clang-format approved.
2021-05-07 22:29:19 +02:00
Valtteri Koskivuori
33af7075e7 Userland: Remove extra slashes from find output
I noticed while testing `find` that the output of `find` contains extra
forward slashes if the root path has a trailing slash. This patch fixes
that issue by passing the root path through LexicalPath before
proceeding.
2021-05-07 22:25:39 +02:00
Andreas Kling
c7e5ef3057 strace: Stop using Core::IODevice::printf()
There are no other clients of this weird API, so let's get rid of it.
Now that we call IODevice::write() instead, we can also handle errors.
2021-05-07 22:06:58 +02:00
Andreas Kling
977fa4df81 Utilities: Convert StringBuilder::appendf() => AK::Format 2021-05-07 21:12:09 +02:00
Linus Groh
e37d9eabb1 file: Clean up mime type enumeration macro
- Improve naming
- Order alphabetically
- Remove duplicates
2021-05-07 15:43:23 +01:00
Linus Groh
2ddd2d0866 file: Remove unused static description strings 2021-05-07 15:43:23 +01:00
Linus Groh
d7446e05db file: Don't exit immediately after file open error
Instead just remember that a file failed to open, carry on and return 1
at the end.
2021-05-07 15:43:23 +01:00
Linus Groh
85a7dae391 file: Remove redundant value_or({}) 2021-05-07 15:43:23 +01:00
Linus Groh
a9fcdc767e file: Avoid some unnecessary string copies 2021-05-07 15:43:23 +01:00
Valtteri Koskivuori
8b2706e5bb Userland: Implement a file utility
This unix classic attempts to classify and identify information about
given files based on various heuristics. In this case, we're relying on
the Core::MimeData detector for file type and LibGfx::ImageDecoder for
additional metadata if the given file is an image.
It's very simple for now, but adding new detectors should be quite easy.
2021-05-07 11:46:53 +01:00
setepenre
580b335053 Userland: Add groups program 2021-05-05 15:12:30 +01:00
Sergey Bugaev
7f98aaa65a Userland: Pledge wpath & cpath in strace
...while we open the output file.
2021-05-04 22:36:58 +02:00
Sergey Bugaev
72125827da Userland: Refactor head(1) to not use stdio
This fixes extensive copying data around, and also makes head(1) in
bytes mode read exactly as much data as it needs.

Also, rename --characters to --bytes: that's exactly what it does
(actual character counting is way more complicated), and that's what
the option is called in GNU coreutils.

Fixes https://github.com/SerenityOS/serenity/issues/6852
2021-05-04 22:36:58 +02:00
Gunnar Beutner
eb21aa65d1 Userland: Make IPC results with one return value available directly
This changes client methods so that they return the IPC response's
return value directly - instead of the response struct - for IPC
methods which only have a single return value.
2021-05-03 21:14:40 +02:00
Gunnar Beutner
5bb79ea0a7 Userland: Update IPC calls to use proxies
This updates all existing code to use the auto-generated client
methods instead of post_message/send_sync.
2021-05-03 21:14:40 +02:00
Gunnar Beutner
b613817bca Userland: Fix 64-bit portability issues 2021-05-03 08:42:39 +02:00
Gunnar Beutner
63ff271125 Userland: Improve how traceroute reports timing data for packets
Previously we'd include the time required to do DNS resolution in the
time we'd report for traceroute packets. This would skew the times
reported.
2021-05-01 20:52:35 +02:00
Mango0x45
10fc9231d5 Userland: Add the rev(1) utility to reverse lines 2021-05-01 14:15:30 +02:00
Mango0x45
ec0abec9ee Userland: Remove an unused function declaration from tac.
The function declaration seems to have come from an earlier commit. The
function is no longer here so there is no reason to keep this around.
2021-05-01 14:15:23 +02:00
Gunnar Beutner
302f9798ee LibC: Implement support for getspnam() and friends 2021-05-01 12:40:12 +02:00
Brian Gianforcaro
ca213ab374 bt: Enumerate all threads when symbolizing stacks in the bt utility.
Enumerate tid's from /proc/{pid}/stacks/ and use it to print the
backtrace for all active threads in the specified process.
2021-05-01 08:44:33 +02:00
Brian Gianforcaro
f1c98dc5ea bt: Fix generation of click-able links for source files.
When the default build location was moved from /Build to the new
architecture specific directory, /Build/i686, this code broke.
All file names are now path relative one additional level up.

So continue the hack, and introduce another dummy directory to
make the relative paths resolve correctly.
2021-05-01 08:44:33 +02:00
Andreas Kling
3d4afe7614 Everywhere: "indexes" => "indices"
I've wasted a silly amount of time in the past fretting over which
of these words to use. Let's just choose one and use it everywhere. :^)
2021-04-29 22:23:52 +02:00