Trace syscall complete, kernel interface and userspace demo program
This commit is contained in:
parent
641ebb302a
commit
ca76d0772b
7 changed files with 33 additions and 1 deletions
18
user/traced.c
Normal file
18
user/traced.c
Normal file
|
@ -0,0 +1,18 @@
|
|||
#include "kernel/types.h"
|
||||
#include "kernel/stat.h"
|
||||
#include "user/user.h"
|
||||
#include "kernel/syscall.h"
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
trace(1 << SYS_open);
|
||||
int fd;
|
||||
|
||||
if((fd = open(argv[1], 0)) < 0) {
|
||||
fprintf(stderr, "Traced: cannot open %s\n", argv[1]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
exit(0);
|
||||
}
|
|
@ -2,6 +2,9 @@
|
|||
|
||||
#include "../kernel/types.h"
|
||||
|
||||
#define stderr 2
|
||||
#define stdout 1
|
||||
|
||||
struct stat;
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue