summaryrefslogtreecommitdiffstats
path: root/src/examples
diff options
context:
space:
mode:
authorGustav Sörnäs <gustav@sornas.net>2021-02-05 16:14:52 +0100
committerGustav Sörnäs <gustav@sornas.net>2021-02-05 16:14:52 +0100
commitd8b452e7b5177c37746e2ec923d081d3ac153e4f (patch)
treef8cf1cfdd70b95d5c99aafa6f29c39a5ff5a530f /src/examples
parent466145ce0bf0423fdd0c70f7232978cdb2c8aef7 (diff)
downloadpintos-d8b452e7b5177c37746e2ec923d081d3ac153e4f.tar.gz
update test
Diffstat (limited to 'src/examples')
-rw-r--r--src/examples/create.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/examples/create.c b/src/examples/create.c
index 2702552..65be47d 100644
--- a/src/examples/create.c
+++ b/src/examples/create.c
@@ -9,12 +9,21 @@ main (int argc, char *argv[])
} else {
printf ("couldn't create file\n");
}
- int fd = open ("test");
+ int fd = open ("test"); // open 2
printf ("opened file with fd %d\n", fd);
- int fd2 = open ("test");
+ int fd2 = open ("test"); // open 3
printf ("opened file with fd %d\n", fd2);
- int fd3 = open ("test");
+ close(fd); // close 2
+ int fd3 = open ("test"); // open 2
printf ("opened file with fd %d\n", fd3);
+ close(fd2); // close 3
+ int fd4 = open ("test"); // open 3
+ printf ("opened file with fd %d\n", fd4);
+ close(fd4); // close 3, valid
+ close(fd3); // close 2, valid
+ close(fd); // close closed 2, invalid
+ int fd5 = open ("test"); // open 2
+ printf ("opened file with fd %d\n", fd5);
halt ();
}