Fix link errors with GCC 10 and binutils 2.34 on Fedora
[pintos-anon] / src / tests / vm / child-qsort.c
1 /* Reads a 128 kB file onto the stack and "sorts" the bytes in
2    it, using quick sort, a multi-pass divide and conquer
3    algorithm.  The sorted data is written back to the same file
4    in-place. */
5
6 #include <debug.h>
7 #include <syscall.h>
8 #include "tests/lib.h"
9 #include "tests/main.h"
10 #include "tests/vm/qsort.h"
11
12 int
13 main (int argc UNUSED, char *argv[]) 
14 {
15   int handle;
16   unsigned char buf[128 * 1024];
17   size_t size;
18
19   test_name = "child-qsort";
20   quiet = true;
21
22   CHECK ((handle = open (argv[1])) > 1, "open \"%s\"", argv[1]);
23
24   size = read (handle, buf, sizeof buf);
25   qsort_bytes (buf, sizeof buf);
26   seek (handle, 0);
27   write (handle, buf, size);
28   close (handle);
29   
30   return 72;
31 }