[Pcsclite-cvs-commit] r4836 - in /trunk/PCSC/src: configfile.l pcscdaemon.c sys_generic.h sys_unix.c winscard_msg.c winscard_msg_srv.c winscard_svc.c
rousseau at users.alioth.debian.org
rousseau at users.alioth.debian.org
Fri Mar 19 12:34:38 UTC 2010
Author: rousseau
Date: Fri Mar 19 12:34:32 2010
New Revision: 4836
URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=4836
Log:
Remove the one line wrappers from sys_unix.c and use directly the POSIX
functions instead.
Modified:
trunk/PCSC/src/configfile.l
trunk/PCSC/src/pcscdaemon.c
trunk/PCSC/src/sys_generic.h
trunk/PCSC/src/sys_unix.c
trunk/PCSC/src/winscard_msg.c
trunk/PCSC/src/winscard_msg_srv.c
trunk/PCSC/src/winscard_svc.c
Modified: trunk/PCSC/src/configfile.l
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/configfile.l?rev=4836&op=diff
==============================================================================
--- trunk/PCSC/src/configfile.l (original)
+++ trunk/PCSC/src/configfile.l Fri Mar 19 12:34:32 2010
@@ -118,7 +118,7 @@
pcDevicename = strdup(pcCurrent);
if ((NULL == strchr(pcDevicename, ':'))
- && (SYS_Stat(pcDevicename, &fStatBuf) != 0))
+ && (stat(pcDevicename, &fStatBuf) != 0))
{
Log3(PCSC_LOG_CRITICAL, "Error with device %s: %s",
pcDevicename, strerror(errno));
@@ -139,7 +139,7 @@
struct stat fStatBuf;
pcLibpath = strdup(pcCurrent);
- if (SYS_Stat(pcLibpath, &fStatBuf) != 0)
+ if (stat(pcLibpath, &fStatBuf) != 0)
{
Log3(PCSC_LOG_CRITICAL, "Error with library %s: %s",
pcLibpath, strerror(errno));
Modified: trunk/PCSC/src/pcscdaemon.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/pcscdaemon.c?rev=4836&op=diff
==============================================================================
--- trunk/PCSC/src/pcscdaemon.c (original)
+++ trunk/PCSC/src/pcscdaemon.c Fri Mar 19 12:34:32 2010
@@ -340,7 +340,7 @@
* test the presence of /var/run/pcscd/pcscd.comm
*/
- rv = SYS_Stat(PCSCLITE_CSOCK_NAME, &fStatBuf);
+ rv = stat(PCSCLITE_CSOCK_NAME, &fStatBuf);
if (rv == 0)
{
@@ -430,12 +430,12 @@
/*
* If PCSCLITE_IPC_DIR does not exist then create it
*/
- rv = SYS_Stat(PCSCLITE_IPC_DIR, &fStatBuf);
+ rv = stat(PCSCLITE_IPC_DIR, &fStatBuf);
if (rv < 0)
{
int mode = S_IROTH | S_IXOTH | S_IRGRP | S_IXGRP | S_IRWXU;
- rv = SYS_Mkdir(PCSCLITE_IPC_DIR, mode);
+ rv = mkdir(PCSCLITE_IPC_DIR, mode);
if (rv != 0)
{
Log2(PCSC_LOG_CRITICAL,
@@ -446,7 +446,7 @@
/* set mode so that the directory is world readable and
* executable even is umask is restrictive
* The directory containes files used by libpcsclite */
- (void)SYS_Chmod(PCSCLITE_IPC_DIR, mode);
+ (void)chmod(PCSCLITE_IPC_DIR, mode);
}
/*
@@ -457,18 +457,18 @@
int f;
int mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
- if ((f = SYS_OpenFile(PCSCLITE_RUN_PID, O_RDWR | O_CREAT, mode)) != -1)
+ if ((f = open(PCSCLITE_RUN_PID, O_RDWR | O_CREAT, mode)) != -1)
{
char pid[PID_ASCII_SIZE];
(void)snprintf(pid, sizeof(pid), "%u\n", (unsigned) getpid());
- (void)SYS_WriteFile(f, pid, strlen(pid));
- (void)SYS_CloseFile(f);
+ (void)write(f, pid, strlen(pid));
+ (void)close(f);
/* set mode so that the file is world readable even is umask is
* restrictive
* The file is used by libpcsclite */
- (void)SYS_Chmod(PCSCLITE_RUN_PID, mode);
+ (void)chmod(PCSCLITE_RUN_PID, mode);
}
else
Log2(PCSC_LOG_CRITICAL, "cannot create " PCSCLITE_RUN_PID ": %s",
@@ -546,19 +546,19 @@
clean_temp_files();
- SYS_Exit(ExitValue);
+ _exit(ExitValue);
}
static void clean_temp_files(void)
{
int rv;
- rv = SYS_RemoveFile(PCSCLITE_CSOCK_NAME);
+ rv = remove(PCSCLITE_CSOCK_NAME);
if (rv != 0)
Log2(PCSC_LOG_ERROR, "Cannot remove " PCSCLITE_CSOCK_NAME ": %s",
strerror(errno));
- rv = SYS_RemoveFile(PCSCLITE_RUN_PID);
+ rv = remove(PCSCLITE_RUN_PID);
if (rv != 0)
Log2(PCSC_LOG_ERROR, "Cannot remove " PCSCLITE_RUN_PID ": %s",
strerror(errno));
Modified: trunk/PCSC/src/sys_generic.h
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/sys_generic.h?rev=4836&op=diff
==============================================================================
--- trunk/PCSC/src/sys_generic.h (original)
+++ trunk/PCSC/src/sys_generic.h Fri Mar 19 12:34:32 2010
@@ -25,33 +25,15 @@
#include <sys/stat.h>
#include <sys/mman.h>
- int SYS_Mkdir(const char *, int);
-
int SYS_Sleep(int);
int SYS_USleep(int);
- int SYS_OpenFile(const char *, int, int);
-
- int SYS_CloseFile(int);
-
- int SYS_RemoveFile(const char *);
-
- int SYS_Chmod(const char *, int);
-
- int SYS_Chdir(const char *);
-
- int SYS_WriteFile(int, const char *, int);
-
int SYS_Daemon(int, int);
-
- int SYS_Stat(const char *pcFile, /*@out@*/ struct stat *psStatus);
int SYS_RandomInt(int, int);
int SYS_GetSeed(void);
-
- void SYS_Exit(int);
#ifdef __cplusplus
}
Modified: trunk/PCSC/src/sys_unix.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/sys_unix.c?rev=4836&op=diff
==============================================================================
--- trunk/PCSC/src/sys_unix.c (original)
+++ trunk/PCSC/src/sys_unix.c Fri Mar 19 12:34:32 2010
@@ -37,21 +37,6 @@
#include "debuglog.h"
/**
- * @brief Attempts to create a directory with some permissions.
- *
- * @param[in] path Path of the directory to be created.
- * @param[in] perms Permissions to the new directory.
- *
- * @return Eror code.
- * @retval 0 Success.
- * @retval -1 An error occurred.
- */
-INTERNAL int SYS_Mkdir(const char *path, int perms)
-{
- return mkdir(path, perms);
-}
-
-/**
* @brief Makes the current process sleep for some seconds.
*
* @param[in] iTimeVal Number of seconds to sleep.
@@ -88,65 +73,6 @@
tv.tv_usec = iTimeVal - (tv.tv_sec * 1000000);
return select(0, NULL, NULL, NULL, &tv);
#endif
-}
-
-/**
- * @brief Opens/creates a file.
- *
- * @param[in] pcFile path to the file.
- * @param[in] flags Open and read/write choices.
- * @param[in] mode Permissions to the file.
- *
- * @return File descriptor.
- * @retval >0 The file descriptor.
- * @retval -1 An error ocurred.
- */
-INTERNAL int SYS_OpenFile(const char *pcFile, int flags, int mode)
-{
- return open(pcFile, flags, mode);
-}
-
-/**
- * @brief Opens/creates a file.
- *
- * @param[in] iHandle File descriptor.
- *
- * @return Error code.
- * @retval 0 Success.
- * @retval -1 An error ocurred.
- */
-INTERNAL int SYS_CloseFile(int iHandle)
-{
- return close(iHandle);
-}
-
-/**
- * @brief Removes a file.
- *
- * @param[in] pcFile path to the file.
- *
- * @return Error code.
- * @retval 0 Success.
- * @retval -1 An error ocurred.
- */
-INTERNAL int SYS_RemoveFile(const char *pcFile)
-{
- return remove(pcFile);
-}
-
-INTERNAL int SYS_Chmod(const char *path, int mode)
-{
- return chmod(path, mode);
-}
-
-INTERNAL int SYS_Chdir(const char *path)
-{
- return chdir(path);
-}
-
-INTERNAL int SYS_WriteFile(int iHandle, const char *pcBuffer, int iLength)
-{
- return write(iHandle, pcBuffer, iLength);
}
#ifndef HAVE_DAEMON
@@ -235,11 +161,6 @@
#endif
}
-INTERNAL int SYS_Stat(const char *pcFile, struct stat *psStatus)
-{
- return stat(pcFile, psStatus);
-}
-
INTERNAL int SYS_RandomInt(int fStart, int fEnd)
{
static int iInitialized = 0;
@@ -274,8 +195,3 @@
return myseed;
}
-INTERNAL void SYS_Exit(int iRetVal)
-{
- _exit(iRetVal);
-}
-
Modified: trunk/PCSC/src/winscard_msg.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/winscard_msg.c?rev=4836&op=diff
==============================================================================
--- trunk/PCSC/src/winscard_msg.c (original)
+++ trunk/PCSC/src/winscard_msg.c Fri Mar 19 12:34:32 2010
@@ -82,7 +82,7 @@
{
Log3(PCSC_LOG_CRITICAL, "Error: connect to client socket %s: %s",
PCSCLITE_CSOCK_NAME, strerror(errno));
- (void)SYS_CloseFile(*pdwClientID);
+ (void)close(*pdwClientID);
return -1;
}
@@ -91,7 +91,7 @@
{
Log3(PCSC_LOG_CRITICAL, "Error: cannot set socket %s nonblocking: %s",
PCSCLITE_CSOCK_NAME, strerror(errno));
- (void)SYS_CloseFile(*pdwClientID);
+ (void)close(*pdwClientID);
return -1;
}
@@ -107,8 +107,7 @@
*/
INTERNAL int SHMClientCloseSession(uint32_t dwClientID)
{
- (void)SYS_CloseFile(dwClientID);
- return 0;
+ return close(dwClientID);
}
/**
@@ -408,7 +407,7 @@
*/
INTERNAL void SHMCleanupSharedSegment(int sockValue, const char *pcFilePath)
{
- (void)SYS_CloseFile(sockValue);
- (void)SYS_RemoveFile(pcFilePath);
-}
-
+ (void)close(sockValue);
+ (void)remove(pcFilePath);
+}
+
Modified: trunk/PCSC/src/winscard_msg_srv.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/winscard_msg_srv.c?rev=4836&op=diff
==============================================================================
--- trunk/PCSC/src/winscard_msg_srv.c (original)
+++ trunk/PCSC/src/winscard_msg_srv.c Fri Mar 19 12:34:32 2010
@@ -42,7 +42,6 @@
#include "winscard.h"
#include "debuglog.h"
#include "winscard_msg.h"
-#include "sys_generic.h"
/**
* Socket to a file, used for clients-server comminication.
@@ -113,7 +112,7 @@
serv_adr.sun_family = AF_UNIX;
strncpy(serv_adr.sun_path, PCSCLITE_CSOCK_NAME,
sizeof(serv_adr.sun_path));
- (void)SYS_RemoveFile(PCSCLITE_CSOCK_NAME);
+ (void)remove(PCSCLITE_CSOCK_NAME);
if (bind(commonSocket, (struct sockaddr *) &serv_adr,
sizeof(serv_adr.sun_family) + strlen(serv_adr.sun_path) + 1) < 0)
@@ -135,7 +134,7 @@
/*
* Chmod the public entry channel
*/
- (void)SYS_Chmod(PCSCLITE_CSOCK_NAME, S_IRWXO | S_IRWXG | S_IRWXU);
+ (void)chmod(PCSCLITE_CSOCK_NAME, S_IRWXO | S_IRWXG | S_IRWXU);
return 0;
}
Modified: trunk/PCSC/src/winscard_svc.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/winscard_svc.c?rev=4836&op=diff
==============================================================================
--- trunk/PCSC/src/winscard_svc.c (original)
+++ trunk/PCSC/src/winscard_svc.c Fri Mar 19 12:34:32 2010
@@ -226,7 +226,7 @@
error:
if (newContext)
free(newContext);
- (void)SYS_CloseFile(*pdwClientID);
+ (void)close(*pdwClientID);
return SCARD_E_NO_MEMORY;
}
@@ -759,7 +759,7 @@
wrong_length:
Log2(PCSC_LOG_DEBUG, "Wrong length: %d", filedes);
exit:
- (void)SYS_CloseFile(filedes);
+ (void)close(filedes);
(void)MSGCleanupClient(threadContext);
(void)SYS_ThreadExit((LPVOID) NULL);
}
More information about the Pcsclite-cvs-commit
mailing list