pcsc-lite 1.5.5
Functions

sys_generic.h File Reference

This handles abstract system level calls. More...

#include <sys/stat.h>
#include <sys/mman.h>
Include dependency graph for sys_generic.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int SYS_Initialize (void)
 Make system wide initialization.
int SYS_Mkdir (const 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 (const char *, int, int)
 Opens/creates a file.
int SYS_CloseFile (int)
 Opens/creates a file.
int SYS_RemoveFile (const char *)
 Removes a file.
int SYS_Chmod (const char *, int)
int SYS_Chdir (const char *)
int SYS_GetUID (void)
int SYS_GetGID (void)
int SYS_ChangePermissions (const char *, int)
int SYS_SeekFile (int, int)
int SYS_ReadFile (int, char *, int)
int SYS_WriteFile (int, const 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.
void SYS_PublicMemoryUnmap (void *, int)
 Unmap a memory segment.
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_Stat (const char *pcFile, struct stat *psStatus)
int SYS_RandomInt (int, int)
int SYS_GetSeed (void)
void SYS_Exit (int)

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]iHandleFile descriptor.
Returns:
Error code.
Return values:
0Success.
-1An error ocurred.

Definition at line 143 of file sys_unix.c.

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

int SYS_Daemon ( int  nochdir,
int  noclose 
)

put the process to run in the background.

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

Definition at line 318 of file sys_unix.c.

References SYS_CloseFile().

Here is the call graph for this function:

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 207 of file sys_unix.c.

Referenced by SCardEstablishContextTH(), and StatSynchronize().

int SYS_GetPID ( void  )

Gets the running process's ID.

Returns:
PID.

Definition at line 71 of file sys_unix.c.

Referenced by StatSynchronizeContext().

int SYS_Initialize ( void  )

Make system wide initialization.

Returns:
Eror code.
Return values:
0Success.

Definition at line 43 of file sys_unix.c.

Referenced by SCardEstablishContextTH().

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

Map the file iFid in memory for reading and writing.

Parameters:
[in]iSizeSize of the memmory mapped.
[in]iFidFile which will be mapped in memory.
[in]iOffsetStart point of the file to be mapped in memory.
Returns:
Address of the memory map.
Return values:
MAP_FAILEDin case of error

Definition at line 227 of file sys_unix.c.

int SYS_Mkdir ( const char *  path,
int  perms 
)

Attempts to create a directory with some permissions.

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

Definition at line 61 of file sys_unix.c.

int SYS_MMapSynchronize ( void *  begin,
int  length 
)

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

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

Definition at line 293 of file sys_unix.c.

Referenced by StatSynchronize().

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

Opens/creates a file.

Parameters:
[in]pcFilepath to the file.
[in]flagsOpen and read/write choices.
[in]modePermissions to the file.
Returns:
File descriptor.
Return values:
>0The file descriptor.
-1An error ocurred.

Definition at line 127 of file sys_unix.c.

Referenced by SCardEstablishContextTH(), StatSynchronize(), and StatSynchronizeContext().

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

Map the file iFid in memory only for reading.

Parameters:
[in]iSizeSize of the memmory mapped.
[in]iFidFile which will be mapped in memory.
[in]iOffsetStart point of the file to be mapped in memory.
Returns:
Address of the memory map.

Definition at line 255 of file sys_unix.c.

Referenced by SCardEstablishContextTH().

void SYS_PublicMemoryUnmap ( void *  ptr,
int  iSize 
)

Unmap a memory segment.

Parameters:
ptrpointer returned by SYS_PublicMemoryMap()
iSizesize of the memory segment

Definition at line 278 of file sys_unix.c.

Referenced by SCardUnload().

int SYS_RemoveFile ( const char *  pcFile)

Removes a file.

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

Definition at line 157 of file sys_unix.c.

Referenced by SHMCleanupSharedSegment(), and SHMInitializeCommonSegment().

int SYS_Sleep ( int  iTimeVal)

Makes the current process sleep for some seconds.

Parameters:
[in]iTimeValNumber of seconds to sleep.

Definition at line 81 of file sys_unix.c.

Referenced by SVCServiceRunLoop().

int SYS_USleep ( int  iTimeVal)

Makes the current process sleep for some microseconds.

Parameters:
[in]iTimeValNumber of microseconds to sleep.

Definition at line 99 of file sys_unix.c.

Referenced by IFDCloseIFD(), SCardBeginTransaction(), SCardConnect(), SCardDisconnect(), SCardEndTransaction(), and SCardGetStatusChange().