Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 988a9ad

Browse files
committed
This is a fix to be included in 1.02.1. It adds a tip for people
getting semaphore or shared memory errors. Submitted by: bryanh@giraffe.netgate.net (Bryan Henderson)
1 parent 011ee13 commit 988a9ad

File tree

1 file changed

+20
-1
lines changed
  • src/backend/storage/ipc

1 file changed

+20
-1
lines changed

src/backend/storage/ipc/ipc.c

+20-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipc.c,v 1.3 1996/07/25 19:45:24 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipc.c,v 1.4 1996/08/14 05:01:53 scrappy Exp $
1111
*
1212
* NOTES
1313
*
@@ -60,6 +60,7 @@ static struct ONEXIT {
6060
} onexit_list[ MAX_ON_EXITS ];
6161

6262
static int onexit_index;
63+
static void IpcConfigTip();
6364

6465
typedef struct _PrivateMemStruct {
6566
int id;
@@ -272,6 +273,7 @@ IpcSemaphoreCreate(IpcSemaphoreKey semKey,
272273

273274
if (semId < 0) {
274275
perror("semget");
276+
IpcConfigTip();
275277
exitpg(3);
276278
}
277279
for (i = 0; i < semNum; i++) {
@@ -281,6 +283,7 @@ IpcSemaphoreCreate(IpcSemaphoreKey semKey,
281283
errStatus = semctl(semId, 0, SETALL, semun);
282284
if (errStatus == -1) {
283285
perror("semctl");
286+
IpcConfigTip();
284287
}
285288

286289
if (removeOnExit)
@@ -320,7 +323,10 @@ IpcSemaphoreSet(int semId, int semno, int value)
320323
IpcSemaphoreSet_return = errStatus;
321324

322325
if (errStatus == -1)
326+
{
323327
perror("semctl");
328+
IpcConfigTip();
329+
}
324330
}
325331

326332
/****************************************************************************/
@@ -377,6 +383,7 @@ IpcSemaphoreLock(IpcSemaphoreId semId, int sem, int lock)
377383

378384
if (errStatus == -1) {
379385
perror("semop");
386+
IpcConfigTip();
380387
exitpg(255);
381388
}
382389
}
@@ -419,6 +426,7 @@ IpcSemaphoreUnlock(IpcSemaphoreId semId, int sem, int lock)
419426

420427
if (errStatus == -1) {
421428
perror("semop");
429+
IpcConfigTip();
422430
exitpg(255);
423431
}
424432
}
@@ -466,6 +474,7 @@ IpcMemoryCreate(IpcMemoryKey memKey, uint32 size, int permission)
466474
fprintf(stderr,"IpcMemoryCreate: memKey=%d , size=%d , permission=%d",
467475
memKey, size , permission );
468476
perror("IpcMemoryCreate: shmget(..., create, ...) failed");
477+
IpcConfigTip();
469478
return(IpcMemCreationFailed);
470479
}
471480

@@ -490,6 +499,7 @@ IpcMemoryIdGet(IpcMemoryKey memKey, uint32 size)
490499
fprintf(stderr,"IpcMemoryIdGet: memKey=%d , size=%d , permission=%d",
491500
memKey, size , 0 );
492501
perror("IpcMemoryIdGet: shmget() failed");
502+
IpcConfigTip();
493503
return(IpcMemIdGetFailed);
494504
}
495505

@@ -530,6 +540,7 @@ IpcMemoryAttach(IpcMemoryId memId)
530540
/* if ( *memAddress == -1) { XXX ??? */
531541
if ( memAddress == (char *)-1) {
532542
perror("IpcMemoryAttach: shmat() failed");
543+
IpcConfigTip();
533544
return(IpcMemAttachFailed);
534545
}
535546

@@ -706,3 +717,11 @@ LockIsFree(int lockid)
706717
}
707718

708719
#endif /* HAS_TEST_AND_SET */
720+
721+
static void
722+
IpcConfigTip()
723+
{
724+
fprintf(stderr,"This type of error is usually caused by improper\n");
725+
fprintf(stderr,"shared memory or System V IPC semaphore configuration.\n");
726+
fprintf(stderr,"See the FAQ for more detailed information\n");
727+
}

0 commit comments

Comments
 (0)