Switched to using the /tmp folder rather than the /var folder for

creating user semaphores under Linux.
This commit is contained in:
Juan Carlos Luciani 2006-12-01 04:48:11 +00:00
parent df3c67e201
commit 5d70356a09
3 changed files with 22 additions and 15 deletions

View File

@ -61,7 +61,7 @@ StaticLockFunction(
// L2
//=======================================================================--
{
DbgTrace(2, "-StaticLockFunction- Start\n", 0);
DbgTrace(3, "-StaticLockFunction- Start\n", 0);
// Verify that the lock number is within range
if (n < g_numStaticLocks
@ -81,10 +81,10 @@ StaticLockFunction(
}
else
{
DbgTrace(2, "-StaticLockFunction- n out of range\n", 0);
DbgTrace(0, "-StaticLockFunction- n out of range\n", 0);
}
DbgTrace(2, "-StaticLockFunction- End\n", 0);
DbgTrace(3, "-StaticLockFunction- End\n", 0);
}
@ -107,7 +107,7 @@ DynLockFunction(
// L2
//=======================================================================--
{
DbgTrace(2, "-DynLockFunction- Start\n", 0);
DbgTrace(3, "-DynLockFunction- Start\n", 0);
if (l)
{
@ -125,10 +125,10 @@ DynLockFunction(
}
else
{
DbgTrace(2, "-DynLockFunction- Invalid parameter\n", 0);
DbgTrace(0, "-DynLockFunction- Invalid parameter\n", 0);
}
DbgTrace(2, "-DynLockFunction- End\n", 0);
DbgTrace(3, "-DynLockFunction- End\n", 0);
}
@ -217,11 +217,11 @@ ThreadIdFunction(void)
{
unsigned long threadId;
DbgTrace(2, "-ThreadIdFunction- Start\n", 0);
DbgTrace(3, "-ThreadIdFunction- Start\n", 0);
threadId = (unsigned long) pthread_self();
DbgTrace(2, "-ThreadIdFunction- End, id = %0lX\n", threadId);
DbgTrace(3, "-ThreadIdFunction- End, id = %0lX\n", threadId);
return threadId;
}

View File

@ -76,17 +76,17 @@ typedef struct
#define SEM_A 0200
#endif
#define SVSEM_MODE (SEM_R | SEM_A | SEM_R>>3 | SEM_R>>6)
#define SVSEM_MODE (SEM_R | SEM_A | SEM_R>>3 | SEM_R>>6)
#define SEM_MAGIC 0x45678923
#define SEM_MAGIC 0x45678923
#define SEM_FAILED ((Local_sem_t *)(-1)) /* avoid compiler warnings */
#define SEM_FAILED ((Local_sem_t *)(-1)) /* avoid compiler warnings */
#ifndef SEMVMX
#define SEMVMX 32767 /* historical System V max value for sem */
#ifndef SEMVMX
#define SEMVMX 32767 /* historical System V max value for sem */
#endif
#define MAX_OPEN_SEM_TRIES 10 /* for waiting for initialization */
#define MAX_OPEN_SEM_TRIES 10 /* for waiting for initialization */
//===[ Function prototypes ]===============================================
@ -392,7 +392,7 @@ CreateUserMutex(
// We use Named Semaphores to provide this functionality. The semaphore names are
// linked to the user via its uid.
if (sprintf(g_userNamedSemName, "/var/lib/CASA/authtoken/semuser_%d", geteuid()) != -1)
if (sprintf(g_userNamedSemName, "/tmp/CASA/authtoken/client/semuser_%d", geteuid()) != -1)
{
// Create or open semaphore to be only used by the effective user
g_userNamedSem = Local_sem_open((const char*) g_userNamedSemName, O_RDWR | O_CREAT, 0600, 1);

View File

@ -112,6 +112,10 @@ install -d -m 755 %{buildroot}/etc/CASA
install -d -m 755 %{buildroot}/etc/CASA/authtoken
install -d -m 755 %{buildroot}/etc/CASA/authtoken/client
install -d -m 755 %{buildroot}/etc/CASA/authtoken/client/mechanisms
install -d %{buildroot}/tmp
install -d -m 777 %{buildroot}/tmp/CASA
install -d -m 777 %{buildroot}/tmp/CASA/authtoken
install -d -m 777 %{buildroot}/tmp/CASA/authtoken/client
## CASA_auth_token_client ##
@ -166,6 +170,9 @@ rm -rf $RPM_BUILD_ROOT
%dir /etc/CASA/authtoken
%dir /etc/CASA/authtoken/client
%dir /etc/CASA/authtoken/client/mechanisms
%dir /tmp/CASA
%dir /tmp/CASA/authtoken
%dir /tmp/CASA/authtoken/client
%{prefix}/%{_lib}/libcasa_c_authtoken.so.%{bldno}
%{prefix}/%{_lib}/CASA/authtoken/krb5mech.so.%{bldno}
%{prefix}/%{_lib}/CASA/authtoken/krb5mech.so