~ubuntu-branches/ubuntu/precise/postgresql-9.1/precise-security

« back to all changes in this revision

Viewing changes to src/include/storage/pg_shmem.h

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2011-05-11 10:41:53 UTC
  • Revision ID: james.westby@ubuntu.com-20110511104153-psbh2o58553fv1m0
Tags: upstream-9.1~beta1
ImportĀ upstreamĀ versionĀ 9.1~beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*-------------------------------------------------------------------------
 
2
 *
 
3
 * pg_shmem.h
 
4
 *        Platform-independent API for shared memory support.
 
5
 *
 
6
 * Every port is expected to support shared memory with approximately
 
7
 * SysV-ish semantics; in particular, a memory block is not anonymous
 
8
 * but has an ID, and we must be able to tell whether there are any
 
9
 * remaining processes attached to a block of a specified ID.
 
10
 *
 
11
 * To simplify life for the SysV implementation, the ID is assumed to
 
12
 * consist of two unsigned long values (these are key and ID in SysV
 
13
 * terms).      Other platforms may ignore the second value if they need
 
14
 * only one ID number.
 
15
 *
 
16
 *
 
17
 * Portions Copyright (c) 1996-2011, PostgreSQL Global Development Group
 
18
 * Portions Copyright (c) 1994, Regents of the University of California
 
19
 *
 
20
 * src/include/storage/pg_shmem.h
 
21
 *
 
22
 *-------------------------------------------------------------------------
 
23
 */
 
24
#ifndef PG_SHMEM_H
 
25
#define PG_SHMEM_H
 
26
 
 
27
typedef struct PGShmemHeader    /* standard header for all Postgres shmem */
 
28
{
 
29
        int32           magic;                  /* magic # to identify Postgres segments */
 
30
#define PGShmemMagic  679834894
 
31
        pid_t           creatorPID;             /* PID of creating process */
 
32
        Size            totalsize;              /* total size of segment */
 
33
        Size            freeoffset;             /* offset to first free space */
 
34
        void       *index;                      /* pointer to ShmemIndex table */
 
35
#ifndef WIN32                                   /* Windows doesn't have useful inode#s */
 
36
        dev_t           device;                 /* device data directory is on */
 
37
        ino_t           inode;                  /* inode number of data directory */
 
38
#endif
 
39
} PGShmemHeader;
 
40
 
 
41
 
 
42
#ifdef EXEC_BACKEND
 
43
#ifndef WIN32
 
44
extern unsigned long UsedShmemSegID;
 
45
#else
 
46
extern HANDLE UsedShmemSegID;
 
47
#endif
 
48
extern void *UsedShmemSegAddr;
 
49
 
 
50
extern void PGSharedMemoryReAttach(void);
 
51
#endif
 
52
 
 
53
extern PGShmemHeader *PGSharedMemoryCreate(Size size, bool makePrivate,
 
54
                                         int port);
 
55
extern bool PGSharedMemoryIsInUse(unsigned long id1, unsigned long id2);
 
56
extern void PGSharedMemoryDetach(void);
 
57
 
 
58
#endif   /* PG_SHMEM_H */