PKUOS - Pintos
Pintos source browser for PKU Operating System course
src
tests
userprog
close-twice.c
Go to the documentation of this file.
1
/** Opens a file and then tries to close it twice. The second
2
close must either fail silently or terminate with exit code
3
-1. */
4
5
#include <syscall.h>
6
#include "
tests/lib.h
"
7
#include "
tests/main.h
"
8
9
void
10
test_main
(
void
)
11
{
12
int
handle;
13
CHECK
((handle =
open
(
"sample.txt"
)) > 1,
"open \"sample.txt\""
);
14
msg
(
"close \"sample.txt\""
);
15
close
(handle);
16
msg
(
"close \"sample.txt\" again"
);
17
close
(handle);
18
}
test_main
void test_main(void)
Opens a file and then tries to close it twice.
Definition:
close-twice.c:10
close
void close(int fd)
Definition:
syscall.c:139
open
int open(const char *file)
Definition:
syscall.c:103
msg
void msg(const char *format,...)
Definition:
lib.c:28
lib.h
CHECK
#define CHECK(SUCCESS,...)
Takes an expression to test for SUCCESS and a message, which may include printf-style arguments.
Definition:
lib.h:29
main.h
Generated on Thu Nov 4 2021 19:31:01 for PKUOS - Pintos by
1.9.2