00001 /* Writes data spanning two pages in virtual address space, 00002 which must succeed. */ 00003 00004 #include <string.h> 00005 #include <syscall.h> 00006 #include "tests/userprog/boundary.h" 00007 #include "tests/userprog/sample.inc" 00008 #include "tests/lib.h" 00009 #include "tests/main.h" 00010 00011 void 00012 test_main (void) 00013 { 00014 int handle; 00015 int byte_cnt; 00016 char *sample_p; 00017 00018 sample_p = copy_string_across_boundary (sample); 00019 00020 CHECK ((handle = open ("sample.txt")) > 1, "open \"sample.txt\""); 00021 00022 byte_cnt = write (handle, sample_p, sizeof sample - 1); 00023 if (byte_cnt != sizeof sample - 1) 00024 fail ("write() returned %d instead of %zu", byte_cnt, sizeof sample - 1); 00025 }