The output of the following code is just "hello!", which is confusing because when I do make qemu to start xv6 everything compiles well, but obviously something goes wrong with the function getiocounts.
I am new to sys calls, so there might be something obvios I'm missing. Please help! Thank you!
#include "types.h"
#include "stat.h"
#include "user.h"
#include "iostat.h"
int main(int argc, char** argv) {
struct iostat* io;
io =(struct iostat* ) malloc(sizeof(int)*2);
int r=0;
printf(1, "hello!");
printf(1, "%d", getiocounts(io));
r = io->readcount;
printf(1, "hello!");
printf(1, "%d", r);
exit();
}
int sys_getiocounts( struct iostat* io){
if(argptr(1, (void*)&io, sizeof(*io)) < 0)
return -1;
io->readcount = myproc()->r;
io->writecount = myproc()->w;
return 0;
}