/* Tim Brecht: * Added to uw-testbin : Sat 5 Jan 2013 14:36:26 EST */ #include #include #include /* * This tests concurrent access to a file. */ #define PROCS (4) #define BUF_SIZE (10) #define NUM_WRITES (500) #define TOTAL_WRITES (NUM_WRITES * PROCS) char const *to_write = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; static void do_writes(char c); int main() { char buffer[BUF_SIZE]; int status = -1; int rc[PROCS]; pid_t pid[PROCS]; int rval = -1; int id = -1; int i,k; rval = open("TESTFILE", O_RDWR | O_CREAT | O_TRUNC); if (rval < 0) { printf("### TEST FAILED: Unable to create file\n"); exit(0); } close(rval); /* do concurrent writes */ for (i=0; i