mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-23 08:00:20 +00:00
97726862dd
- 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().
25 lines
551 B
C++
25 lines
551 B
C++
#include <LibC/stdio.h>
|
|
#include <LibC/unistd.h>
|
|
|
|
int main(int c, char** v)
|
|
{
|
|
int fd = open("/proc/summary", O_RDONLY);
|
|
if (fd == -1) {
|
|
perror("failed to open /proc/summary");
|
|
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;
|
|
}
|