[Pcsclite-cvs-commit] r4464 - in /trunk/PCSC/src: sys_generic.h sys_unix.c
rousseau at users.alioth.debian.org
rousseau at users.alioth.debian.org
Thu Oct 8 12:38:20 UTC 2009
Author: rousseau
Date: Thu Oct 8 12:38:20 2009
New Revision: 4464
URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=4464
Log:
Remove useless SYS_GetPageSize(), SYS_MemoryMap(),
SYS_PublicMemoryMap(), SYS_PublicMemoryUnmap() and SYS_MMapSynchronize()
Modified:
trunk/PCSC/src/sys_generic.h
trunk/PCSC/src/sys_unix.c
Modified: trunk/PCSC/src/sys_generic.h
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/sys_generic.h?rev=4464&op=diff
==============================================================================
--- trunk/PCSC/src/sys_generic.h (original)
+++ trunk/PCSC/src/sys_generic.h Thu Oct 8 12:38:20 2009
@@ -41,16 +41,6 @@
int SYS_WriteFile(int, const char *, int);
- int SYS_GetPageSize(void);
-
- void *SYS_MemoryMap(int, int, int);
-
- void *SYS_PublicMemoryMap(int, int, int);
-
- void SYS_PublicMemoryUnmap(void *, int);
-
- int SYS_MMapSynchronize(void *, int);
-
int SYS_Fork(void);
int SYS_Daemon(int, int);
Modified: trunk/PCSC/src/sys_unix.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/sys_unix.c?rev=4464&op=diff
==============================================================================
--- trunk/PCSC/src/sys_unix.c (original)
+++ trunk/PCSC/src/sys_unix.c Thu Oct 8 12:38:20 2009
@@ -147,110 +147,6 @@
return write(iHandle, pcBuffer, iLength);
}
-/**
- * @brief Gets the memory page size.
- *
- * The page size is used when calling the \c SYS_MemoryMap() and
- * \c SYS_PublicMemoryMap() functions.
- *
- * @return Number of bytes per page.
- */
-INTERNAL int SYS_GetPageSize(void)
-{
- static int size = -1;
-
- /* we use a cache to avoid a system call and improve perfs */
- if (-1 == size)
- size = getpagesize();
- return size;
-}
-
-/**
- * @brief Map the file \p iFid in memory for reading and writing.
- *
- * @param[in] iSize Size of the memmory mapped.
- * @param[in] iFid File which will be mapped in memory.
- * @param[in] iOffset Start point of the file to be mapped in memory.
- *
- * @return Address of the memory map.
- * @retval MAP_FAILED in case of error
- */
-INTERNAL void *SYS_MemoryMap(int iSize, int iFid, int iOffset)
-{
-
- void *vAddress;
-
- vAddress = 0;
- vAddress = mmap(0, iSize, PROT_READ | PROT_WRITE,
- MAP_SHARED, iFid, iOffset);
-
- /*
- * Here are some common error types: switch( errno ) { case EINVAL:
- * printf("EINVAL"); case EBADF: printf("EBADF"); break; case EACCES:
- * printf("EACCES"); break; case EAGAIN: printf("EAGAIN"); break; case
- * ENOMEM: printf("ENOMEM"); break; }
- */
-
- return vAddress;
-}
-
-/**
- * @brief Map the file \p iFid in memory only for reading.
- *
- * @param[in] iSize Size of the memmory mapped.
- * @param[in] iFid File which will be mapped in memory.
- * @param[in] iOffset Start point of the file to be mapped in memory.
- *
- * @return Address of the memory map.
- */
-/*@null@*/ INTERNAL void *SYS_PublicMemoryMap(int iSize, int iFid, int iOffset)
-{
-
- void *vAddress;
-
- vAddress = 0;
- vAddress = mmap(0, iSize, PROT_READ, MAP_SHARED, iFid, iOffset);
- if (vAddress == (void*)-1) /* mmap returns -1 on error */
- {
- Log2(PCSC_LOG_CRITICAL, "SYS_PublicMemoryMap() failed: %s",
- strerror(errno));
- vAddress = NULL;
- }
-
- return vAddress;
-}
-
-/**
- * @brief Unmap a memory segment
- *
- * @param ptr pointer returned by SYS_PublicMemoryMap()
- * @param iSize size of the memory segment
- */
-INTERNAL void SYS_PublicMemoryUnmap(void * ptr, int iSize)
-{
- (void)munmap(ptr, iSize);
-}
-
-/**
- * @brief Writes the changes made in a memory map to the disk mapped file.
- *
- * @param[in] begin Start of the block to be written
- * @param[in] length Lenght of the block to be written
- *
- * @return Error code.
- * @retval 0 Success.
- * @retval -1 An error ocurred.
- */
-INTERNAL int SYS_MMapSynchronize(void *begin, int length)
-{
- int flags = 0;
-
-#ifdef MS_INVALIDATE
- flags |= MS_INVALIDATE;
-#endif
- return msync(begin, length, MS_SYNC | flags);
-}
-
INTERNAL int SYS_Fork(void)
{
return fork();
More information about the Pcsclite-cvs-commit
mailing list