sys_generic.h File Reference

This handles abstract system level calls. More...

#include <sys/stat.h>

Go to the source code of this file.

Functions

int SYS_Initialize (void)
 Make system wide initialization.
int SYS_Mkdir (char *, int)
 Attempts to create a directory with some permissions.
int SYS_GetPID (void)
 Gets the running process's ID.
int SYS_Sleep (int)
 Makes the current process sleep for some seconds.
int SYS_USleep (int)
 Makes the current process sleep for some microseconds.
int SYS_OpenFile (char *, int, int)
 Opens/creates a file.
int SYS_CloseFile (int)
 Opens/creates a file.
int SYS_RemoveFile (char *)
 Removes a file.
int SYS_Chmod (const char *, int)
int SYS_Chdir (const char *)
int SYS_Mkfifo (const char *, int)
int SYS_Mknod (const char *, int, int)
int SYS_GetUID (void)
int SYS_GetGID (void)
int SYS_Chown (const char *, int, int)
int SYS_ChangePermissions (char *, int)
int SYS_LockFile (int)
 Makes a non-blocking request to lock a file exclusively.
int SYS_LockAndBlock (int)
 Makes a blocking request to lock a file exclusively.
int SYS_UnlockFile (int)
 Unlocks the file.
int SYS_SeekFile (int, int)
int SYS_ReadFile (int, char *, int)
int SYS_WriteFile (int, char *, int)
int SYS_GetPageSize (void)
 Gets the memory page size.
void * SYS_MemoryMap (int, int, int)
 Map the file iFid in memory for reading and writing.
void * SYS_PublicMemoryMap (int, int, int)
 Map the file iFid in memory only for reading.
int SYS_MMapSynchronize (void *, int)
 Writes the changes made in a memory map to the disk mapped file.
int SYS_Fork (void)
int SYS_Daemon (int, int)
 put the process to run in the background.
int SYS_Wait (int, int)
int SYS_Stat (char *pcFile, struct stat *psStatus)
int SYS_Fstat (int)
int SYS_RandomInt (int, int)
int SYS_GetSeed (void)
void SYS_Exit (int)
int SYS_Rmdir (char *pcFile)
int SYS_Unlink (char *pcFile)


Detailed Description

This handles abstract system level calls.

Definition in file sys_generic.h.


Function Documentation

int SYS_CloseFile ( int  iHandle  ) 

Opens/creates a file.

Parameters:
[in] iHandle File descriptor.
Returns:
Error code.
Return values:
0 Success.
-1 An error ocurred.

Definition at line 138 of file sys_unix.c.

Referenced by CreateContextThread(), SCardEstablishContextTH(), SCardUnload(), SHMCleanupSharedSegment(), SHMClientCloseSession(), SHMClientSetupSession(), SHMProcessCommonChannelRequest(), SHMProcessEventsContext(), and SYS_Daemon().

int SYS_Daemon ( int  nochdir,
int  noclose 
)

put the process to run in the background.

Parameters:
[in] nochdir if zero, change the current directory to "/".
[in] noclose if zero, redirect standard imput/output/error to /dev/nulll.
Returns:
error code.
Return values:
0 success.
-1 an error ocurred.

Definition at line 384 of file sys_unix.c.

References Log2, SYS_Chdir(), SYS_CloseFile(), and SYS_Fork().

Referenced by main().

int SYS_GetPageSize ( void   ) 

Gets the memory page size.

The page size is used when calling the SYS_MemoryMap() and SYS_PublicMemoryMap() functions.

Returns:
Number of bytes per page.

Definition at line 297 of file sys_unix.c.

Referenced by EHInitializeEventStructures(), EHStatusHandlerThread(), and SCardEstablishContextTH().

int SYS_GetPID ( void   ) 

Gets the running process's ID.

Returns:
PID.

Definition at line 71 of file sys_unix.c.

int SYS_Initialize ( void   ) 

Make system wide initialization.

Returns:
Eror code.
Return values:
0 Success.

Definition at line 43 of file sys_unix.c.

Referenced by SCardEstablishContextTH().

int SYS_LockAndBlock ( int  iHandle  ) 

Makes a blocking request to lock a file exclusively.

Parameters:
[in] iHandle File descriptor.
Returns:
Error code.
Return values:
0 Success.
-1 An error ocurred.

Definition at line 231 of file sys_unix.c.

int SYS_LockFile ( int  iHandle  ) 

Makes a non-blocking request to lock a file exclusively.

Parameters:
[in] iHandle File descriptor.
Returns:
Error code.
Return values:
0 Success.
-1 An error ocurred.

Definition at line 206 of file sys_unix.c.

void* SYS_MemoryMap ( int  iSize,
int  iFid,
int  iOffset 
)

Map the file iFid in memory for reading and writing.

Parameters:
[in] iSize Size of the memmory mapped.
[in] iFid File which will be mapped in memory.
[in] iOffset Start point of the file to be mapped in memory.
Returns:
Address of the memory map.

Definition at line 311 of file sys_unix.c.

Referenced by EHInitializeEventStructures().

int SYS_Mkdir ( char *  path,
int  perms 
)

Attempts to create a directory with some permissions.

Parameters:
[in] path Path of the directory to be created.
[in] perms Permissions to the new directory.
Returns:
Eror code.
Return values:
0 Success.
-1 An error occurred.

Definition at line 61 of file sys_unix.c.

Referenced by main().

int SYS_MMapSynchronize ( void *  begin,
int  length 
)

Writes the changes made in a memory map to the disk mapped file.

Parameters:
[in] begin Start of the block to be written
[in] length Lenght of the block to be written
Returns:
Error code.
Return values:
0 Success.
-1 An error ocurred.

Definition at line 359 of file sys_unix.c.

Referenced by EHStatusHandlerThread().

int SYS_OpenFile ( char *  pcFile,
int  flags,
int  mode 
)

Opens/creates a file.

Parameters:
[in] pcFile path to the file.
[in] flags Open and read/write choices.
[in] mode Permissions to the file.
Returns:
File descriptor.
Return values:
>0 The file descriptor.
-1 An error ocurred.

Definition at line 124 of file sys_unix.c.

Referenced by EHInitializeEventStructures(), and SCardEstablishContextTH().

void* SYS_PublicMemoryMap ( int  iSize,
int  iFid,
int  iOffset 
)

Map the file iFid in memory only for reading.

Parameters:
[in] iSize Size of the memmory mapped.
[in] iFid File which will be mapped in memory.
[in] iOffset Start point of the file to be mapped in memory.
Returns:
Address of the memory map.

Definition at line 339 of file sys_unix.c.

Referenced by SCardEstablishContextTH().

int SYS_RemoveFile ( char *  pcFile  ) 

Removes a file.

Parameters:
[in] pcFile path to the file.
Returns:
Error code.
Return values:
0 Success.
-1 An error ocurred.

Definition at line 152 of file sys_unix.c.

Referenced by EHInitializeEventStructures().

int SYS_Sleep ( int  iTimeVal  ) 

Makes the current process sleep for some seconds.

Parameters:
[in] iTimeVal Number of seconds to sleep.

Definition at line 81 of file sys_unix.c.

Referenced by MSGCheckHandleAssociation(), and SVCServiceRunLoop().

int SYS_UnlockFile ( int  iHandle  ) 

Unlocks the file.

Parameters:
[in] iHandle File descriptor.
Returns:
Error code.
Return values:
0 Success.
-1 An error ocurred.

Definition at line 256 of file sys_unix.c.

int SYS_USleep ( int  iTimeVal  ) 

Makes the current process sleep for some microseconds.

Parameters:
[in] iTimeVal Number of microseconds to sleep.

Definition at line 99 of file sys_unix.c.

Referenced by EHDestroyEventHandler(), EHStatusHandlerThread(), SCardBeginTransaction(), SCardConnect(), SCardDisconnect(), SCardDisconnectTH(), SCardEndTransaction(), SCardEndTransactionTH(), SCardGetStatusChange(), and SCardReconnect().


Generated on Wed Jun 6 11:38:31 2007 for pcsc-lite by  doxygen 1.4.7