#include "err.h"
#include "ipc.h"
-static int get_key(const char *config_file)
+static key_t get_key(const char *config_file)
{
- int ret;
+ key_t ret;
assert(config_file);
ret = ftok(config_file, 'D');
return 0x0D55; /* no magic, this number just looks a bit like DSS */
}
-static int mutex_get(int key, int flags)
+static int mutex_get(key_t key, int flags)
{
int ret;
- DSS_DEBUG_LOG(("getting semaphore 0x%x\n", key));
+ DSS_DEBUG_LOG(("getting semaphore 0x%lx\n", (long)key));
ret = semget(key, 2, flags);
if (ret < 0)
return -ERRNO_TO_DSS_ERROR(errno);
int lock_dss(char *config_file)
{
- int ret, key = get_key(config_file);
+ int ret;
+ key_t key = get_key(config_file);
ret = mutex_get(key, IPC_CREAT | 0600);
if (ret < 0)
int get_dss_pid(char *config_file, pid_t *pid)
{
- int ret, semid, key = get_key(config_file);
+ int ret, semid;
+ key_t key = get_key(config_file);
if (pid)
*pid = 0;