Commit f8058b5f authored by Claes Sjofors's avatar Claes Sjofors

pwr_db_lock-file was created by xtt if Proview wasn't started

parent ca4ab86c
......@@ -653,7 +653,8 @@ gdb_CreateDb (
/* Create lock section. */
gdbroot->lock = sect_Alloc(sts, &created, &gdbroot->h.lock, sizeof(sect_sMutex), gdb_cNameDbLock);
gdbroot->lock = sect_Alloc(sts, &created, &gdbroot->h.lock, sizeof(sect_sMutex),
gdb_cNameDbLock, sect_mFlags_Create);
if (gdbroot->lock == NULL) errh_Bugcheck(*sts, "creating database lock");
if (!created) errh_Bugcheck(GDH__WEIRD, "database lock was allready created");
......@@ -1123,7 +1124,7 @@ gdb_MapDb (
/* Map lock sections. */
gdbroot->lock = sect_Alloc(sts, &created, &gdbroot->h.lock, sizeof(sect_sMutex), gdb_cNameDbLock);
gdbroot->lock = sect_Alloc(sts, &created, &gdbroot->h.lock, sizeof(sect_sMutex), gdb_cNameDbLock, 0);
if (gdbroot->lock == NULL) errh_Bugcheck(*sts, "mapping db lock");
if (created) {
sect_Free(&lsts, gdbroot->lock);
......
......@@ -51,7 +51,7 @@ void nmps_create_lock( pwr_tStatus *sts)
if ( !nmps_locksect) {
nmps_locksect = sect_Alloc( sts, &created, 0, sizeof(sect_sMutex),
nmps_cName_Lock);
nmps_cName_Lock, sect_mFlags_Create);
if ( ODD(*sts) && created)
sect_InitLock( sts, nmps_locksect, (sect_sMutex *)nmps_locksect->base);
}
......
......@@ -345,7 +345,8 @@ mapSegment (
segName(name, gphp->name, psp->gpsp->generation);
shp = sect_Alloc(&lsts, &created, &psp->sect, psp->gpsp->size << pool_cOffsGranul, name);
shp = sect_Alloc(&lsts, &created, &psp->sect, psp->gpsp->size << pool_cOffsGranul, name,
sect_mFlags_Create);
if (shp == NULL) errh_ReturnOrBugcheck(NULL, sts, lsts, "");
if (created) errh_Bugcheck(POOL__NOTCREATED, "pool was not created");
......@@ -397,7 +398,7 @@ newSegment (
segName(name, gphp->name, gphp->generation);
shp = sect_Alloc(sts, &created, &psp->sect, size << pool_cOffsAlign, name);
shp = sect_Alloc(sts, &created, &psp->sect, size << pool_cOffsAlign, name, sect_mFlags_Create);
if (shp == NULL) return NULL;
if (!created) errh_Bugcheck(POOL__ALLREXIST, "");
......@@ -769,7 +770,7 @@ pool_Create (
pwr_Return(NULL, sts, POOL__ALLRMAPPED);
do {
shp = sect_Alloc(&lsts, &created, &php->sect, sizeof(*gphp), name);
shp = sect_Alloc(&lsts, &created, &php->sect, sizeof(*gphp), name, sect_mFlags_Create);
if (shp == NULL) break;
gphp = (pool_sGhead *) shp->base;
......
......@@ -678,7 +678,8 @@ qdb_CreateDb (
/* Create lock section. */
sp = sect_Alloc(sts, &created, &qdb->lock, sizeof(sect_sMutex), qdb_cNameDbLock);
sp = sect_Alloc(sts, &created, &qdb->lock, sizeof(sect_sMutex), qdb_cNameDbLock,
sect_mFlags_Create);
if (sp == NULL) errh_Bugcheck(*sts, "creating db lock");
if (!created) errh_Bugcheck(QCOM__WEIRD, "db lock was allready created");
......@@ -916,7 +917,7 @@ qdb_MapDb (
/* Map lock sections. */
sp = sect_Alloc(sts, &created, &qdb->lock, sizeof(sect_sMutex), qdb_cNameDbLock);
sp = sect_Alloc(sts, &created, &qdb->lock, sizeof(sect_sMutex), qdb_cNameDbLock, 0);
if (sp == NULL) errh_Bugcheck(*sts, "mapping db lock");
if (created) errh_Bugcheck(QCOM__WEIRD, "db lock was not created");
*sts = sync_MutexInit(&qdb->thread_lock.mutex);
......
......@@ -127,7 +127,8 @@ sect_Alloc (
pwr_tBoolean *created,
sect_sHead *shp,
size_t size,
char *name
char *name,
unsigned int flags
)
{
pwr_tStatus lsts = 1;
......@@ -290,6 +291,11 @@ sect_Alloc (
*created = 1;
} else if(shm_fd == -1) {
if (errno == ENOENT) { /* It didn't exist */
if ( !(flags & sect_mFlags_Create)) {
lsts = 2;
errh_Error("sect_Alloc: Couldn't attach shm section size");
break;
}
shMemFlags |= O_CREAT | O_EXCL;
shm_fd = open(shp->name, shMemFlags, shMemMode);
if(shm_fd == -1) {
......
......@@ -45,6 +45,10 @@
#include "pwr.h"
typedef enum {
sect_mFlags_Create = 1 << 0
} sect_mFlags;
#if defined OS_LYNX
# include <semaphore.h>
......@@ -123,7 +127,8 @@ sect_Alloc (
pwr_tBoolean *created,
sect_sHead *shp,
size_t size,
char *name
char *name,
unsigned int flags
);
pwr_tBoolean
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment