This repository has been archived on 2021-05-26. You can view files and clone it, but cannot push or open issues or pull requests.
OS/pintos-env/pintos/tests/userprog/rox-simple.c

20 lines
476 B
C
Raw Normal View History

/* Ensure that the executable of a running process cannot be
modified. */
#include <syscall.h>
#include "tests/lib.h"
#include "tests/main.h"
void
test_main (void)
{
int handle;
char buffer[16];
CHECK ((handle = open ("rox-simple")) > 1, "open \"rox-simple\"");
CHECK (read (handle, buffer, sizeof buffer) == (int) sizeof buffer,
"read \"rox-simple\"");
CHECK (write (handle, buffer, sizeof buffer) == 0,
"try to write \"rox-simple\"");
}