ladybird/Userland/mm.cpp
Andreas Kling 97726862dd Add basic symlink support.
- sys$readlink + readlink()
- Add a /proc/PID/exe symlink to the process's executable.
- Print symlink contents in ls output.
- Some work on plumbing options into VFS::open().
2018-10-28 14:11:51 +01:00

26 lines
541 B
C++

#include <LibC/stdio.h>
#include <LibC/unistd.h>
int main(int c, char** v)
{
int fd = open("/proc/mm", O_RDONLY);
if (fd == -1) {
perror("failed to open /proc/mm");
return 1;
}
for (;;) {
char buf[128];
ssize_t nread = read(fd, buf, sizeof(buf));
if (nread == 0)
break;
if (nread < 0) {
perror("failed to read");
return 2;
}
for (ssize_t i = 0; i < nread; ++i) {
putchar(buf[i]);
}
}
return 0;
}