xv6-lab/user/stats.c
Frans Kaashoek ad57ec8cb9 Lock lab
2022-11-09 20:27:22 -05:00

25 lines
317 B
C

#include "kernel/types.h"
#include "kernel/stat.h"
#include "kernel/fcntl.h"
#include "user/user.h"
#define SZ 4096
char buf[SZ];
int
main(void)
{
int i, n;
while (1) {
n = statistics(buf, SZ);
for (i = 0; i < n; i++) {
write(1, buf+i, 1);
}
if (n != SZ)
break;
}
exit(0);
}