Commit Graph

12 Commits

Author SHA1 Message Date
sin-ack
3f3f45580a Everywhere: Add sv suffix to strings relying on StringView(char const*)
Each of these strings would previously rely on StringView's char const*
constructor overload, which would call __builtin_strlen on the string.
Since we now have operator ""sv, we can replace these with much simpler
versions. This opens the door to being able to remove
StringView(char const*).

No functional changes.
2022-07-12 23:11:35 +02:00
sin-ack
c70f45ff44 Everywhere: Explicitly specify the size in StringView constructors
This commit moves the length calculations out to be directly on the
StringView users. This is an important step towards the goal of removing
StringView(char const*), as it moves the responsibility of calculating
the size of the string to the user of the StringView (which will prevent
naive uses causing OOB access).
2022-07-12 23:11:35 +02:00
Maciej
7fba41321e netstat: Stop needing LookupServer for parsing arguments
Previously the netstat utility crashed when LookupServer wasn't running
because it tried to unveil nonexistent /tmp/portal/lookup socket. This
commit fixes that.
2022-05-26 21:49:52 +01: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
Brendan Coles
fd6d87df82 netstat: Resolve ports to service names 2022-04-03 12:08:41 +02:00
creator1creeper1
067e32c023 Utilities/netstat: Propagate errors in JSON decoding 2021-12-30 14:37:02 +01:00
Andreas Kling
6e7ff8cf1c netstat: Port to LibMain :^) 2021-11-30 23:34:40 +01:00
Andreas Kling
587f9af960 AK: Make JSON parser return ErrorOr<JsonValue> (instead of Optional)
Also add slightly richer parse errors now that we can include a string
literal with returned errors.

This will allow us to use TRY() when working with JSON data.
2021-11-17 00:21:10 +01: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
Linus Groh
16d51d78c0 Userland: Avoid a bunch of JsonObject copies
JsonValue::as_object() returns a reference.
2021-05-31 17:59:02 +01:00
brapru
5a03531417 Utilities: Implement a netstat command
This implementation of netstat presents an overview of existing network
sockets. It directly reads the exposed sockets from /proc/net/. Current
support is limited to information regarding TCP and UDP connections.
Future improvements could include presenting information regarding
local sockets.
2021-05-15 11:27:20 +01:00