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
6262static int onexit_index ;
63+ static void IpcConfigTip ();
6364
6465typedef struct _PrivateMemStruct {
6566int id ;
@@ -272,6 +273,7 @@ IpcSemaphoreCreate(IpcSemaphoreKey semKey,
272273
273274if (semId < 0 ) {
274275perror ("semget" );
276+ IpcConfigTip ();
275277exitpg (3 );
276278}
277279for (i = 0 ;i < semNum ;i ++ ) {
@@ -281,6 +283,7 @@ IpcSemaphoreCreate(IpcSemaphoreKey semKey,
281283errStatus = semctl (semId ,0 ,SETALL ,semun );
282284if (errStatus == -1 ) {
283285perror ("semctl" );
286+ IpcConfigTip ();
284287}
285288
286289if (removeOnExit )
@@ -320,7 +323,10 @@ IpcSemaphoreSet(int semId, int semno, int value)
320323IpcSemaphoreSet_return = errStatus ;
321324
322325if (errStatus == -1 )
326+ {
323327perror ("semctl" );
328+ IpcConfigTip ();
329+ }
324330}
325331
326332/****************************************************************************/
@@ -377,6 +383,7 @@ IpcSemaphoreLock(IpcSemaphoreId semId, int sem, int lock)
377383
378384if (errStatus == -1 ) {
379385perror ("semop" );
386+ IpcConfigTip ();
380387exitpg (255 );
381388 }
382389}
@@ -419,6 +426,7 @@ IpcSemaphoreUnlock(IpcSemaphoreId semId, int sem, int lock)
419426
420427if (errStatus == -1 ) {
421428perror ("semop" );
429+ IpcConfigTip ();
422430exitpg (255 );
423431 }
424432}
@@ -466,6 +474,7 @@ IpcMemoryCreate(IpcMemoryKey memKey, uint32 size, int permission)
466474fprintf (stderr ,"IpcMemoryCreate: memKey=%d , size=%d , permission=%d" ,
467475memKey ,size ,permission );
468476perror ("IpcMemoryCreate: shmget(..., create, ...) failed" );
477+ IpcConfigTip ();
469478return (IpcMemCreationFailed );
470479 }
471480
@@ -490,6 +499,7 @@ IpcMemoryIdGet(IpcMemoryKey memKey, uint32 size)
490499fprintf (stderr ,"IpcMemoryIdGet: memKey=%d , size=%d , permission=%d" ,
491500memKey ,size ,0 );
492501perror ("IpcMemoryIdGet: shmget() failed" );
502+ IpcConfigTip ();
493503return (IpcMemIdGetFailed );
494504 }
495505
@@ -530,6 +540,7 @@ IpcMemoryAttach(IpcMemoryId memId)
530540/*if ( *memAddress == -1) { XXX ??? */
531541if (memAddress == (char * )-1 ) {
532542perror ("IpcMemoryAttach: shmat() failed" );
543+ IpcConfigTip ();
533544return (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+ }