PKUOS - Pintos
Pintos source browser for PKU Operating System course
Functions | Variables
child-syn-rw.c File Reference
#include <random.h>
#include <stdlib.h>
#include <syscall.h>
#include "tests/filesys/extended/syn-rw.h"
#include "tests/lib.h"
Include dependency graph for child-syn-rw.c:

Go to the source code of this file.

Functions

int main (int argc, const char *argv[])
 

Variables

const char * test_name = "child-syn-rw"
 Child process for syn-rw. More...
 
static char buf1 [BUF_SIZE]
 
static char buf2 [BUF_SIZE]
 

Function Documentation

◆ main()

int main ( int argc   ,
const char *  argv[] 
)

Definition at line 22 of file child-syn-rw.c.

References atoi(), buf1, buf2, CHECK, close(), compare_bytes(), file_name, open(), quiet, random_bytes(), random_init(), and read().

Here is the call graph for this function:

Variable Documentation

◆ buf1

char buf1[BUF_SIZE]
static

Definition at line 18 of file child-syn-rw.c.

Referenced by main().

◆ buf2

char buf2[BUF_SIZE]
static

Definition at line 19 of file child-syn-rw.c.

Referenced by main().

◆ test_name

const char* test_name = "child-syn-rw"

Child process for syn-rw.

Child process for syn-read test.

Reads from a file created by our parent process, which is growing it. We loop until we've read the whole file successfully. Many iterations through the loop will return 0 bytes, because the file has not grown in the meantime. That is, we are "busy waiting" for the file to grow. (This test could be improved by adding a "yield" system call and calling yield whenever we receive a 0-byte read.)

Definition at line 16 of file child-syn-rw.c.