projects
/
pintos-anon
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Update tests.
[pintos-anon]
/
grading
/
vm
/
page-merge-seq.c
diff --git
a/grading/vm/page-merge-seq.c
b/grading/vm/page-merge-seq.c
index 3abe9e26726a0f189bd8022f19a85cea541abff5..306910d964875cea97cb882401bd8c3f9a1516d7 100644
(file)
--- a/
grading/vm/page-merge-seq.c
+++ b/
grading/vm/page-merge-seq.c
@@
-3,8
+3,7
@@
#ifdef PINTOS
#include <syscall.h>
#else
#ifdef PINTOS
#include <syscall.h>
#else
-#include <unistd.h>
-#include <fcntl.h>
+#include "posix-compat.h"
#endif
#include "arc4.h"
#endif
#include "arc4.h"
@@
-37,9
+36,7
@@
sort (void)
{
size_t i;
{
size_t i;
-#ifdef PINTOS
create ("buffer", CHUNK_SIZE);
create ("buffer", CHUNK_SIZE);
-#endif
for (i = 0; i < CHUNK_CNT; i++)
{
int fd;
for (i = 0; i < CHUNK_CNT; i++)
{
int fd;
@@
-47,11
+44,8
@@
sort (void)
printf ("(page-merge-seq) sort chunk %zu\n", i);
/* Write this chunk to a file. */
printf ("(page-merge-seq) sort chunk %zu\n", i);
/* Write this chunk to a file. */
-#ifdef PINTOS
fd = open ("buffer");
fd = open ("buffer");
-#else
- fd = open ("buffer", O_WRONLY | O_CREAT, 0660);
-#endif
+
if (fd < 0)
{
printf ("(page-merge-seq) open() failed\n");
if (fd < 0)
{
printf ("(page-merge-seq) open() failed\n");
@@
-61,28
+55,20
@@
sort (void)
close (fd);
/* Sort with subprocess. */
close (fd);
/* Sort with subprocess. */
-#ifdef PINTOS
- pid_t child = exec ("child-sort");
+ pid_t child = exec ("child-sort buffer");
if (child == -1)
{
printf ("(page-merge-seq) exec() failed\n");
exit (1);
}
if (child == -1)
{
printf ("(page-merge-seq) exec() failed\n");
exit (1);
}
- if (join (child) !=
0x
123)
+ if (join (child) != 123)
{
printf ("(page-merge-seq) join(exec()) returned bad value\n");
exit (1);
}
{
printf ("(page-merge-seq) join(exec()) returned bad value\n");
exit (1);
}
-#else
- system ("./child-sort");
-#endif
/* Read chunk back from file. */
/* Read chunk back from file. */
-#ifdef PINTOS
fd = open ("buffer");
fd = open ("buffer");
-#else
- fd = open ("buffer", O_RDONLY);
-#endif
if (fd < 0)
{
printf ("(page-merge-seq) open() failed\n");
if (fd < 0)
{
printf ("(page-merge-seq) open() failed\n");