projects
/
pintos-anon
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Improve error message for grading when the make failed.
[pintos-anon]
/
grading
/
vm
/
child-sort.c
diff --git
a/grading/vm/child-sort.c
b/grading/vm/child-sort.c
index 5ce8da45ab45b04c778743c148a435d03d9adb62..56161b9b77ca32b57036707a71a7e5fd8666c75d 100644
(file)
--- a/
grading/vm/child-sort.c
+++ b/
grading/vm/child-sort.c
@@
-2,26
+2,21
@@
#ifdef PINTOS
#include <syscall.h>
#else
#ifdef PINTOS
#include <syscall.h>
#else
-#include <unistd.h>
-#include <fcntl.h>
+#include "posix-compat.h"
#endif
unsigned char buf[65536];
size_t histogram[256];
int
#endif
unsigned char buf[65536];
size_t histogram[256];
int
-main (
void
)
+main (
int argc __attribute__ ((unused)), char *argv[]
)
{
int fd;
unsigned char *p;
size_t size;
size_t i;
{
int fd;
unsigned char *p;
size_t size;
size_t i;
-
-#ifdef PINTOS
- fd = open ("buffer");
-#else
- fd = open ("buffer", O_RDWR);
-#endif
+
+ fd = open (argv[1]);
if (fd < 0)
{
printf ("(child-sort) open() failed\n");
if (fd < 0)
{
printf ("(child-sort) open() failed\n");
@@
-38,13
+33,9
@@
main (void)
while (j-- > 0)
*p++ = i;
}
while (j-- > 0)
*p++ = i;
}
-#ifdef PINTOS
seek (fd, 0);
seek (fd, 0);
-#else
- lseek (fd, 0, SEEK_SET);
-#endif
write (fd, buf, size);
close (fd);
write (fd, buf, size);
close (fd);
- return
0x
123;
+ return 123;
}
}