Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

sysdep.h File Reference

#include "copyright.h"
#include "iostream.h"
#include "stdlib.h"
#include "stdio.h"
#include "string.h"

Go to the source code of this file.

Functions

void Abort ()
void Exit (int exitCode)
void Delay (int seconds)
void CallOnUserAbort (void(*cleanup)(int))
void RandomInit (unsigned seed)
unsigned int RandomNumber ()
char* AllocBoundedArray (int size)
void DeallocBoundedArray (char *p, int size)
bool PollFile (int fd)
int OpenForWrite (char *name)
int OpenForReadWrite (char *name, bool crashOnError)
void Read (int fd, char *buffer, int nBytes)
int ReadPartial (int fd, char *buffer, int nBytes)
void WriteFile (int fd, char *buffer, int nBytes)
void Lseek (int fd, int offset, int whence)
int Tell (int fd)
void Close (int fd)
bool Unlink (char *name)
int atoi (const char *str)
double atof (const char *str)
int abs (int i)


Function Documentation

void Abort ( )
 

Abort Quit and drop core.

Definition at line 120 of file sysdep.cc.

char* AllocBoundedArray ( int size )
 

AllocBoundedArray Return an array, with the two pages just before and after the array unmapped, to catch illegal references off the end of the array. Particularly useful for catching overflow beyond fixed-size thread execution stacks.

Note: Just return the useful part!

"size" -- amount of useful space needed (in bytes)

Definition at line 172 of file sysdep.cc.

Referenced by Thread::StackAllocate().

void CallOnUserAbort ( void(* cleanup)(int) )
 

CallOnUserAbort Arrange that "func" will be called when the user aborts (e.g., by hitting ctl-C.

Definition at line 96 of file sysdep.cc.

Referenced by main().

void Close ( int fd )
 

void DeallocBoundedArray ( char * p,
int size )
 

DeallocBoundedArray Deallocate an array of integers, unprotecting its two boundary pages.

"ptr" -- the array to be deallocated

"size" -- amount of useful space in the array (in bytes)

Definition at line 196 of file sysdep.cc.

Referenced by Thread::~Thread().

void Delay ( int seconds )
 

Sleep Put the UNIX process running Nachos to sleep for x seconds, to give the user time to start up another invocation of Nachos in a different UNIX shell.

Definition at line 109 of file sysdep.cc.

void Exit ( int status )
 

This user program is done (status = 0 means exited normally).

void Lseek ( int fd,
int offset,
int whence )
 

Lseek Change the location within an open file. Abort on error.

Definition at line 318 of file sysdep.cc.

Referenced by Disk::Disk(), Disk::ReadRequest(), and Disk::WriteRequest().

int OpenForReadWrite ( char * name,
bool crashOnError )
 

OpenForReadWrite Open a file for reading or writing. Return the file descriptor, or error if it doesn't exist.

"name" -- file name

Definition at line 267 of file sysdep.cc.

Referenced by ConsoleInput::ConsoleInput(), and Disk::Disk().

int OpenForWrite ( char * name )
 

OpenForWrite Open a file for writing. Create it if it doesn't exist; truncate it if it does already exist. Return the file descriptor.

"name" -- file name

Definition at line 250 of file sysdep.cc.

Referenced by ConsoleOutput::ConsoleOutput(), and Disk::Disk().

bool PollFile ( int fd )
 

PollFile Check open file or open socket to see if there are any characters that can be read immediately. If so, read them in, and return TRUE.

"fd" -- the file descriptor of the file to be polled

Definition at line 219 of file sysdep.cc.

Referenced by ConsoleInput::CallBack().

void RandomInit ( unsigned seed )
 

RandomInit Initialize the pseudo-random number generator. We use the now obsolete "srand" and "rand" because they are more portable!

Definition at line 143 of file sysdep.cc.

Referenced by ThreadedKernel::ThreadedKernel().

unsigned int RandomNumber ( )
 

RandomNumber Return a pseudo-random number.

Definition at line 154 of file sysdep.cc.

void Read ( int fd,
char * buffer,
int nBytes )
 

int ReadPartial ( int fd,
char * buffer,
int nBytes )
 

ReadPartial Read characters from an open file, returning as many as are available.

Definition at line 294 of file sysdep.cc.

int Tell ( int fd )
 

Tell Report the current location within an open file.

Definition at line 330 of file sysdep.cc.

bool Unlink ( char * name )
 

Unlink Delete a file.

Definition at line 358 of file sysdep.cc.

void WriteFile ( int fd,
char * buffer,
int nBytes )
 

WriteFile Write characters to an open file. Abort if write fails.

Definition at line 306 of file sysdep.cc.

Referenced by Disk::Disk(), ConsoleOutput::PutChar(), and Disk::WriteRequest().

int abs ( int i )
 

Referenced by Disk::TimeToSeek().

double atof ( const char * str )
 

Referenced by NetKernel::NetKernel().

int atoi ( const char * str )
 

Referenced by HashKey(), NetKernel::NetKernel(), and ThreadedKernel::ThreadedKernel().


Generated at Wed Jul 4 11:32:22 2001 for Nachos by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001