X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=grading%2Fvm%2Fchild-sort.c;fp=grading%2Fvm%2Fchild-sort.c;h=0000000000000000000000000000000000000000;hb=615bf3b3d2a8573ed6fb9ddc0055745e163ac999;hp=56161b9b77ca32b57036707a71a7e5fd8666c75d;hpb=5780c9f434cca090f88463b7f0199d49b4ded288;p=pintos-anon diff --git a/grading/vm/child-sort.c b/grading/vm/child-sort.c deleted file mode 100644 index 56161b9..0000000 --- a/grading/vm/child-sort.c +++ /dev/null @@ -1,41 +0,0 @@ -#include -#ifdef PINTOS -#include -#else -#include "posix-compat.h" -#endif - -unsigned char buf[65536]; -size_t histogram[256]; - -int -main (int argc __attribute__ ((unused)), char *argv[]) -{ - int fd; - unsigned char *p; - size_t size; - size_t i; - - fd = open (argv[1]); - if (fd < 0) - { - printf ("(child-sort) open() failed\n"); - return 1; - } - - size = read (fd, buf, sizeof buf); - for (i = 0; i < size; i++) - histogram[buf[i]]++; - p = buf; - for (i = 0; i < sizeof histogram / sizeof *histogram; i++) - { - size_t j = histogram[i]; - while (j-- > 0) - *p++ = i; - } - seek (fd, 0); - write (fd, buf, size); - close (fd); - - return 123; -}