f_test - /* * Razvan Surdulescu * abhi shelat * April 28...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
/* * Razvan Surdulescu * abhi shelat * April 28 1997 * * Test suite for Nachos HW4--The Filesystem * * Modified by dholland 1/31/2001 for OS/161 * * This should run successfully (on SFS) when the file system * assignment is complete. */ #include <sys/types.h> #include <sys/stat.h> #include <stdio.h> #include <string.h> #include <unistd.h> #include <err.h> #include "f_hdr.h" #define SECTOR_SIZE 512 #define BUFFER_SIZE (2 * SECTOR_SIZE + 1) #define BIGFILE_SIZE (270 * BUFFER_SIZE) #define BIGFILE_NAME "large-f" #define LETTER(x) ('a' + (x % 31)) char fbuffer[BUFFER_SIZE]; char ibuffer[32]; #define DIR_DEPTH 8 #define DIR_NAME "/t" #define DIRFILE_NAME "a" #define FNAME "f-testfile" #define TMULT 50 #define FSIZE ((SECTOR_SIZE + 1) * TMULT) #define READCHAR 'r' #define WRITECHAR 'w' char cbuffer[SECTOR_SIZE + 1]; /* =================================================== */ static pid_t forkoff(void (*func)(void)) { pid_t pid = fork(); switch (pid) {
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
case -1: warn("fork"); return -1; case 0: func(); _exit(0); default: break; } return pid; } static void dowait(int pid) { int status; warn("waitpid for %d", pid); } else if (status != 0) { warn("pid %d: exit %d", pid, status); } } /* =================================================== */ void
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 6

f_test - /* * Razvan Surdulescu * abhi shelat * April 28...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online