Page principale | Liste des namespaces | Hiérarchie des classes | Liste des classes | Répertoires | Liste des fichiers | Membres de namespace | Membres de classe | Membres de fichier

sysdep.h

Aller à la documentation de ce fichier.
00001 // sysdep.h 
00002 //      System-dependent interface.  Nachos uses the routines defined
00003 //      here, rather than directly calling the UNIX library functions, to
00004 //      simplify porting between versions of UNIX, and even to
00005 //      other systems, such as MSDOS and the Macintosh.
00006 //
00007 // Copyright (c) 1992-1996 The Regents of the University of California.
00008 // All rights reserved.  See copyright.h for copyright notice and limitation 
00009 // of liability and disclaimer of warranty provisions.
00010 
00011 #ifndef SYSDEP_H
00012 #define SYSDEP_H
00013 
00014 #include "copyright.h"
00015 #include "iostream.h"
00016 #include "stdlib.h"
00017 #include "stdio.h"
00018 #include "string.h"
00019 
00020 // Process control: abort, exit, and sleep
00021 extern void Abort();
00022 extern void Exit(int exitCode);
00023 extern void Delay(int seconds);
00024 extern void UDelay(unsigned int usec);// rcgood - to avoid spinners.
00025 
00026 // Initialize system so that cleanUp routine is called when user hits ctl-C
00027 extern void CallOnUserAbort(void (*cleanup)(int));
00028 
00029 // Initialize the pseudo random number generator
00030 extern void RandomInit(unsigned seed);
00031 extern unsigned int RandomNumber();
00032 
00033 // Allocate, de-allocate an array, such that de-referencing
00034 // just beyond either end of the array will cause an error
00035 extern char *AllocBoundedArray(int size);
00036 extern void DeallocBoundedArray(char *p, int size);
00037 
00038 // Check file to see if there are any characters to be read.
00039 // If no characters in the file, return without waiting.
00040 extern bool PollFile(int fd);
00041 
00042 // File operations: open/read/write/lseek/close, and check for error
00043 // For simulating the disk and the console devices.
00044 extern int OpenForWrite(char *name);
00045 extern int OpenForReadWrite(char *name, bool crashOnError);
00046 extern void Read(int fd, char *buffer, int nBytes);
00047 extern int ReadPartial(int fd, char *buffer, int nBytes);
00048 extern void WriteFile(int fd, char *buffer, int nBytes);
00049 extern void Lseek(int fd, int offset, int whence);
00050 extern int Tell(int fd);
00051 extern int Close(int fd);
00052 extern bool Unlink(char *name);
00053 
00054 // Other C library routines that are used by Nachos.
00055 // These are assumed to be portable, so we don't include a wrapper.
00056 extern "C" {
00057 int atoi(const char *str);
00058 double atof(const char *str);
00059 int abs(int i);
00060 void bcopy(const void *s1, void *s2, size_t n);
00061 void bzero(void *s, size_t n);
00062 }
00063 
00064 // Interprocess communication operations, for simulating the network
00065 extern int OpenSocket();
00066 extern void CloseSocket(int sockID);
00067 extern void AssignNameToSocket(char *socketName, int sockID);
00068 extern void DeAssignNameToSocket(char *socketName);
00069 extern bool PollSocket(int sockID);
00070 extern void ReadFromSocket(int sockID, char *buffer, int packetSize);
00071 extern void SendToSocket(int sockID, char *buffer, int packetSize,char *toName);
00072 
00073 #endif // SYSDEP_H

Généré le Sun Jan 15 00:45:46 2006 pour Système NachOS : par  doxygen 1.4.4