PKUOS - Pintos
Pintos source browser for PKU Operating System course
Macros | Typedefs | Functions
syscall.h File Reference
#include <stdbool.h>
#include <debug.h>
Include dependency graph for syscall.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define PID_ERROR   ((pid_t) -1)
 
#define MAP_FAILED   ((mapid_t) -1)
 
#define READDIR_MAX_LEN   14
 Maximum characters in a filename written by readdir(). More...
 
#define EXIT_SUCCESS   0
 Typical return values from main() and arguments to exit(). More...
 
#define EXIT_FAILURE   1
 Unsuccessful execution. More...
 

Typedefs

typedef int pid_t
 Process identifier. More...
 
typedef int mapid_t
 Map region identifier. More...
 

Functions

void halt (void) NO_RETURN
 Projects 2 and later. More...
 
void exit (int status) NO_RETURN
 
pid_t exec (const char *file)
 
int wait (pid_t)
 
bool create (const char *file, unsigned initial_size)
 
bool remove (const char *file)
 
int open (const char *file)
 
int filesize (int fd)
 
int read (int fd, void *buffer, unsigned length)
 
int write (int fd, const void *buffer, unsigned length)
 
void seek (int fd, unsigned position)
 
unsigned tell (int fd)
 
void close (int fd)
 
mapid_t mmap (int fd, void *addr)
 Project 3 and optionally project 4. More...
 
void munmap (mapid_t)
 
bool chdir (const char *dir)
 Project 4 only. More...
 
bool mkdir (const char *dir)
 
bool readdir (int fd, char name[READDIR_MAX_LEN+1])
 
bool isdir (int fd)
 
int inumber (int fd)
 lib/user/syscall.h More...
 

Macro Definition Documentation

◆ EXIT_FAILURE

#define EXIT_FAILURE   1

Unsuccessful execution.

Definition at line 20 of file syscall.h.

◆ EXIT_SUCCESS

#define EXIT_SUCCESS   0

Typical return values from main() and arguments to exit().

Successful execution.

Definition at line 19 of file syscall.h.

◆ MAP_FAILED

#define MAP_FAILED   ((mapid_t) -1)

Definition at line 13 of file syscall.h.

◆ PID_ERROR

#define PID_ERROR   ((pid_t) -1)

Definition at line 9 of file syscall.h.

◆ READDIR_MAX_LEN

#define READDIR_MAX_LEN   14

Maximum characters in a filename written by readdir().

Definition at line 16 of file syscall.h.

Typedef Documentation

◆ mapid_t

typedef int mapid_t

Map region identifier.

Definition at line 12 of file syscall.h.

◆ pid_t

typedef int pid_t

Process identifier.

Definition at line 8 of file syscall.h.

Function Documentation

◆ chdir()

bool chdir ( const char *  dir)

Project 4 only.

Definition at line 157 of file syscall.c.

References SYS_CHDIR, and syscall1.

Referenced by main(), and test_main().

Here is the caller graph for this function:

◆ close()

void close ( int  fd)

Definition at line 139 of file syscall.c.

References SYS_CLOSE, and syscall1.

Referenced by archive_file(), check_file(), get_inumber(), getcwd(), handle_error(), list_dir(), main(), make_tar_archive(), make_tree(), seq_test(), sort_chunks(), test_main(), and try_write().

Here is the caller graph for this function:

◆ create()

bool create ( const char *  file,
unsigned  initial_size 
)

Definition at line 91 of file syscall.c.

References SYS_CREATE, and syscall2.

Referenced by do_touch(), lookup_page(), main(), make_tar_archive(), seq_test(), sort_chunks(), and test_main().

Here is the caller graph for this function:

◆ exec()

pid_t exec ( const char *  file)

Definition at line 79 of file syscall.c.

References SYS_EXEC, and syscall1.

Referenced by exec_children(), main(), sort_chunks(), spawn_child(), and test_main().

Here is the caller graph for this function:

◆ exit()

void exit ( int  status)

Definition at line 72 of file syscall.c.

References NOT_REACHED, SYS_EXIT, and syscall1.

Referenced by _start(), consume_some_resources_and_die(), debug_panic(), fail(), fail_io(), main(), relay(), test_main(), and usage().

Here is the caller graph for this function:

◆ filesize()

int filesize ( int  fd)

Definition at line 109 of file syscall.c.

References SYS_FILESIZE, and syscall1.

Referenced by archive_ordinary_file(), check_file_handle(), check_file_size(), list_dir(), and main().

Here is the caller graph for this function:

◆ halt()

void halt ( void  )

Projects 2 and later.

Definition at line 65 of file syscall.c.

References NOT_REACHED, SYS_HALT, and syscall0.

Referenced by main(), and test_main().

Here is the caller graph for this function:

◆ inumber()

int inumber ( int  fd)

lib/user/syscall.h

Definition at line 181 of file syscall.c.

References SYS_INUMBER, and syscall1.

Referenced by archive_file(), get_inumber(), getcwd(), list_dir(), and test_main().

Here is the caller graph for this function:

◆ isdir()

bool isdir ( int  fd)

Definition at line 175 of file syscall.c.

References SYS_ISDIR, and syscall1.

Referenced by archive_file(), and list_dir().

Here is the caller graph for this function:

◆ mkdir()

bool mkdir ( const char *  dir)

Definition at line 163 of file syscall.c.

References SYS_MKDIR, and syscall1.

Referenced by do_mkdir(), main(), and test_main().

Here is the caller graph for this function:

◆ mmap()

mapid_t mmap ( int  fd,
void *  addr 
)

Project 3 and optionally project 4.

Definition at line 145 of file syscall.c.

References SYS_MMAP, and syscall2.

Referenced by main(), and test_main().

Here is the caller graph for this function:

◆ munmap()

void munmap ( mapid_t  mapid)

Definition at line 151 of file syscall.c.

References SYS_MUNMAP, and syscall1.

Referenced by main(), and test_main().

Here is the caller graph for this function:

◆ open()

int open ( const char *  file)

◆ read()

int read ( int  fd,
void *  buffer,
unsigned  length 
)

Definition at line 115 of file syscall.c.

References buffer, SYS_READ, and syscall3.

Referenced by archive_ordinary_file(), check_file_handle(), main(), read_line(), relay(), sort_chunks(), and test_main().

Here is the caller graph for this function:

◆ readdir()

bool readdir ( int  fd,
char  name[READDIR_MAX_LEN+1] 
)

Definition at line 169 of file syscall.c.

References name, SYS_READDIR, and syscall2.

Referenced by archive_directory(), getcwd(), list_dir(), and test_main().

Here is the caller graph for this function:

◆ remove()

bool remove ( const char *  file)

Definition at line 97 of file syscall.c.

References SYS_REMOVE, and syscall1.

Referenced by do_remove(), main(), and test_main().

Here is the caller graph for this function:

◆ seek()

void seek ( int  fd,
unsigned  position 
)

Definition at line 127 of file syscall.c.

References SYS_SEEK, and syscall2.

Referenced by main(), and test_main().

Here is the caller graph for this function:

◆ tell()

unsigned tell ( int  fd)

Definition at line 133 of file syscall.c.

References SYS_TELL, and syscall1.

Referenced by check_tell(), and main().

Here is the caller graph for this function:

◆ wait()

int wait ( pid_t  pid)

Definition at line 85 of file syscall.c.

References SYS_WAIT, and syscall1.

◆ write()

int write ( int  fd,
const void *  buffer,
unsigned  length 
)

Definition at line 121 of file syscall.c.

References buffer, SYS_WRITE, and syscall3.

Referenced by do_write(), flush(), main(), page_fault(), putchar(), puts(), relay(), seq_test(), sigchld_handler(), sort_chunks(), test_main(), try_write(), vmsg(), and write_some_bytes().

Here is the caller graph for this function: