summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-02-18 10:41:37 +0100
committerAndreas Kling <kling@serenityos.org>2020-02-18 11:35:47 +0100
commit16d5b1d4ca8e54c28c85ab39c08461dbda0f8848 (patch)
tree465110b51e105106fa90f05b418855f3adfc06a2 /Userland
parenta7dbb3cf96b049d66282350f4cb0ca65e4b0e9ea (diff)
downloadserenity-16d5b1d4ca8e54c28c85ab39c08461dbda0f8848.zip
top: Use pledge() and unveil()
Diffstat (limited to 'Userland')
-rw-r--r--Userland/top.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/Userland/top.cpp b/Userland/top.cpp
index 37175cf3d3..beef373a97 100644
--- a/Userland/top.cpp
+++ b/Userland/top.cpp
@@ -133,6 +133,23 @@ static Snapshot get_snapshot()
int main(int, char**)
{
+ if (pledge("stdio rpath", nullptr) < 0) {
+ perror("pledge");
+ return 1;
+ }
+
+ if (unveil("/proc/all", "r") < 0) {
+ perror("unveil");
+ return 1;
+ }
+
+ if (unveil("/etc/passwd", "r") < 0) {
+ perror("unveil");
+ return 1;
+ }
+
+ unveil(nullptr, nullptr);
+
Vector<ThreadData*> threads;
auto prev = get_snapshot();
usleep(10000);