blob: ac948c8efe6978e98960fceda85218b84a3c3415 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
/* Child process run by multi-child-fd test.
Attempts to close the file descriptor passed as the first
command-line argument. This is invalid, because file
descriptors are not inherited in Pintos. Two results are
allowed: either the system call should return without taking
any action, or the kernel should terminate the process with a
-1 exit code. */
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <syscall.h>
#include "tests/lib.h"
const char *test_name = "child-close";
int
main (int argc UNUSED, char *argv[])
{
msg ("begin");
if (!isdigit (*argv[1]))
fail ("bad command-line arguments");
close (atoi (argv[1]));
msg ("end");
return 0;
}
|