diff options
| author | manuel <manuel@mausz.at> | 2012-03-27 11:51:08 +0200 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2012-03-27 11:51:08 +0200 |
| commit | 4f670845ff9ab6c48bcb5f7bf4d4ef6dc3c3064b (patch) | |
| tree | 868c52e06f207b5ec8a3cc141f4b8b2bdfcc165c /tests/userprog/child-close.c | |
| parent | eae0bd57f0a26314a94785061888d193d186944a (diff) | |
| download | progos-4f670845ff9ab6c48bcb5f7bf4d4ef6dc3c3064b.tar.gz progos-4f670845ff9ab6c48bcb5f7bf4d4ef6dc3c3064b.tar.bz2 progos-4f670845ff9ab6c48bcb5f7bf4d4ef6dc3c3064b.zip | |
reorganize file structure to match the upstream requirements
Diffstat (limited to 'tests/userprog/child-close.c')
| -rw-r--r-- | tests/userprog/child-close.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/userprog/child-close.c b/tests/userprog/child-close.c new file mode 100644 index 0000000..ac948c8 --- /dev/null +++ b/tests/userprog/child-close.c | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | /* Child process run by multi-child-fd test. | ||
| 2 | |||
| 3 | Attempts to close the file descriptor passed as the first | ||
| 4 | command-line argument. This is invalid, because file | ||
| 5 | descriptors are not inherited in Pintos. Two results are | ||
| 6 | allowed: either the system call should return without taking | ||
| 7 | any action, or the kernel should terminate the process with a | ||
| 8 | -1 exit code. */ | ||
| 9 | |||
| 10 | #include <ctype.h> | ||
| 11 | #include <stdio.h> | ||
| 12 | #include <stdlib.h> | ||
| 13 | #include <syscall.h> | ||
| 14 | #include "tests/lib.h" | ||
| 15 | |||
| 16 | const char *test_name = "child-close"; | ||
| 17 | |||
| 18 | int | ||
| 19 | main (int argc UNUSED, char *argv[]) | ||
| 20 | { | ||
| 21 | msg ("begin"); | ||
| 22 | if (!isdigit (*argv[1])) | ||
| 23 | fail ("bad command-line arguments"); | ||
| 24 | close (atoi (argv[1])); | ||
| 25 | msg ("end"); | ||
| 26 | |||
| 27 | return 0; | ||
| 28 | } | ||
