OSDN Git Service

Remove sys/types.h in files that include postgres.h, and hence c.h,
[pg-rex/syncrep.git] / src / include / storage / pg_shmem.h
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-2002, PostgreSQL Global Development Group
18  * Portions Copyright (c) 1994, Regents of the University of California
19  *
20  * $Id: pg_shmem.h,v 1.3 2002/09/02 02:47:07 momjian Exp $
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  679834892
31         pid_t           creatorPID;             /* PID of creating process */
32         uint32          totalsize;              /* total size of segment */
33         uint32          freeoffset;             /* offset to first free space */
34 } PGShmemHeader;
35
36
37 extern PGShmemHeader *PGSharedMemoryCreate(uint32 size, bool makePrivate,
38                                                                                    int port);
39 extern bool PGSharedMemoryIsInUse(unsigned long id1, unsigned long id2);
40
41 #endif   /* PG_SHMEM_H */