summaryrefslogtreecommitdiff
path: root/Userland/ps.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/ps.cpp')
-rw-r--r--Userland/ps.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/Userland/ps.cpp b/Userland/ps.cpp
new file mode 100644
index 0000000000..5b620d96e4
--- /dev/null
+++ b/Userland/ps.cpp
@@ -0,0 +1,25 @@
+#include <LibC/stdio.h>
+#include <LibC/unistd.h>
+
+int main(int c, char** v)
+{
+ int fd = open("/proc/summary");
+ if (fd == -1) {
+ printf("failed to open /proc/summary :(\n");
+ return 1;
+ }
+ for (;;) {
+ char buf[16];
+ ssize_t nread = read(fd, buf, sizeof(buf));
+ if (nread == 0)
+ break;
+ if (nread < 0) {
+ printf("failed to read :(\n");
+ return 2;
+ }
+ for (ssize_t i = 0; i < nread; ++i) {
+ putchar(buf[i]);
+ }
+ }
+ return 0;
+}