Skip to content
Snippets Groups Projects
  • Peter Eisentraut's avatar
    6a68f426
    The heralded `Grand Unified Configuration scheme' (GUC) · 6a68f426
    Peter Eisentraut authored
    That means you can now set your options in either or all of $PGDATA/configuration,
    some postmaster option (--enable-fsync=off), or set a SET command. The list of
    options is in backend/utils/misc/guc.c, documentation will be written post haste.
    
    pg_options is gone, so is that pq_geqo config file. Also removed were backend -K,
    -Q, and -T options (no longer applicable, although -d0 does the same as -Q).
    
    Added to configure an --enable-syslog option.
    
    changed all callers from TPRINTF to elog(DEBUG)
    6a68f426
    History
    The heralded `Grand Unified Configuration scheme' (GUC)
    Peter Eisentraut authored
    That means you can now set your options in either or all of $PGDATA/configuration,
    some postmaster option (--enable-fsync=off), or set a SET command. The list of
    options is in backend/utils/misc/guc.c, documentation will be written post haste.
    
    pg_options is gone, so is that pq_geqo config file. Also removed were backend -K,
    -Q, and -T options (no longer applicable, although -d0 does the same as -Q).
    
    Added to configure an --enable-syslog option.
    
    changed all callers from TPRINTF to elog(DEBUG)
sinvaladt.c 9.80 KiB
/*-------------------------------------------------------------------------
 *
 * sinvaladt.c
 *	  POSTGRES shared cache invalidation segment definitions.
 *
 * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
 * Portions Copyright (c) 1994, Regents of the University of California
 *
 *
 * IDENTIFICATION
 *	  $Header: /cvsroot/pgsql/src/backend/storage/ipc/sinvaladt.c,v 1.32 2000/05/31 00:28:29 petere Exp $
 *
 *-------------------------------------------------------------------------
 */
#include <signal.h>
#include <unistd.h>

#include "postgres.h"

#include "miscadmin.h"
#include "storage/backendid.h"
#include "storage/proc.h"
#include "storage/sinval.h"
#include "storage/sinvaladt.h"

SISeg	   *shmInvalBuffer;

static void SISegmentAttach(IpcMemoryId shmid);
static void SISegInit(SISeg *segP, int maxBackends);
static void CleanupInvalidationState(int status, SISeg *segP);
static void SISetProcStateInvalid(SISeg *segP);

/*
 * SISegmentInit
 *		Create a new SI memory segment, or attach to an existing one
 *
 * This is called with createNewSegment = true by the postmaster (or by
 * a standalone backend), and subsequently with createNewSegment = false
 * by backends started by the postmaster.
 *
 * Note: maxBackends param is only valid when createNewSegment is true
 */
int
SISegmentInit(bool createNewSegment, IPCKey key, int maxBackends)
{
	int			segSize;
	IpcMemoryId shmId;

	if (createNewSegment)
	{
		/* Kill existing segment, if any */
		IpcMemoryKill(key);

		/*
		 * Figure space needed. Note sizeof(SISeg) includes the first
		 * ProcState entry.
		 */
		segSize = sizeof(SISeg) + sizeof(ProcState) * (maxBackends - 1);

		/* Get a shared segment */
		shmId = IpcMemoryCreate(key, segSize, IPCProtection);
		if (shmId < 0)
		{
			perror("SISegmentInit: segment create failed");
			return -1;			/* an error */
		}

		/* Attach to the shared cache invalidation segment */
		/* sets the global variable shmInvalBuffer */
		SISegmentAttach(shmId);