From 20ead395c74906acfd95f61aaa1583bfaff02364 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Thu, 24 Apr 2003 21:23:01 +0000 Subject: [PATCH] Add Win32 shmem/sema prototypes. --- src/backend/port/sysv_shmem.c | 6 ++- src/backend/port/win32/{sem.c => sema.c} | 3 +- src/backend/port/win32/{shm.c => shmem.c} | 3 +- src/include/port/win32.h | 52 ++++++++++++++++++++++- 4 files changed, 59 insertions(+), 5 deletions(-) rename src/backend/port/win32/{sem.c => sema.c} (99%) rename src/backend/port/win32/{shm.c => shmem.c} (98%) diff --git a/src/backend/port/sysv_shmem.c b/src/backend/port/sysv_shmem.c index fc5c6e83c1..9e5f8f9457 100644 --- a/src/backend/port/sysv_shmem.c +++ b/src/backend/port/sysv_shmem.c @@ -10,7 +10,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/port/sysv_shmem.c,v 1.5 2003/03/25 16:15:44 petere Exp $ + * $Header: /cvsroot/pgsql/src/backend/port/sysv_shmem.c,v 1.6 2003/04/24 21:23:01 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -30,6 +30,10 @@ #include #endif +#ifdef WIN32 +#include "win32/shmem.h" +#endif + #include "miscadmin.h" #include "storage/ipc.h" #include "storage/pg_shmem.h" diff --git a/src/backend/port/win32/sem.c b/src/backend/port/win32/sema.c similarity index 99% rename from src/backend/port/win32/sem.c rename to src/backend/port/win32/sema.c index 90296bd7eb..489918fa97 100644 --- a/src/backend/port/win32/sem.c +++ b/src/backend/port/win32/sema.c @@ -1,6 +1,6 @@ /*------------------------------------------------------------------------- * - * sem.c + * sema.c * Microsoft Windows Win32 Semaphores Emulation * * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group @@ -10,6 +10,7 @@ #include "postgres.h" #include "storage/shmem.h" +#include "sema.h" #include diff --git a/src/backend/port/win32/shm.c b/src/backend/port/win32/shmem.c similarity index 98% rename from src/backend/port/win32/shm.c rename to src/backend/port/win32/shmem.c index 833f13c4cf..8e56011850 100644 --- a/src/backend/port/win32/shm.c +++ b/src/backend/port/win32/shmem.c @@ -1,6 +1,6 @@ /*------------------------------------------------------------------------- * - * shm.c + * shmem.c * Microsoft Windows Win32 Shared Memory Emulation * * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group @@ -9,7 +9,6 @@ */ #include "postgres.h" -#include "windows.h" #include #include diff --git a/src/include/port/win32.h b/src/include/port/win32.h index a117be863a..ecd79368fb 100644 --- a/src/include/port/win32.h +++ b/src/include/port/win32.h @@ -1,4 +1,4 @@ -/* $Header: /cvsroot/pgsql/src/include/port/win32.h,v 1.7 2003/04/18 01:03:42 momjian Exp $ */ +/* $Header: /cvsroot/pgsql/src/include/port/win32.h,v 1.8 2003/04/24 21:23:01 momjian Exp $ */ #include @@ -32,6 +32,56 @@ #endif +/* + * IPC defines + */ +#define IPC_RMID 256 +#define IPC_CREAT 512 +#define IPC_EXCL 1024 +#define IPC_PRIVATE 234564 +#define IPC_NOWAIT 2048 +#define IPC_STAT 4096 + + +/* + * Shared memory + */ +struct shmid_ds +{ + int dummy; + int shm_nattch; +}; + +int shmdt(const void *shmaddr); +void* shmat(int memId, void* shmaddr, int flag); +int shmctl(int shmid, int flag, struct shmid_ds * dummy); +int shmget(int memKey, int size, int flag); + + +/* + * Semaphores + */ +union semun +{ + int val; + struct semid_ds *buf; + unsigned short *array; +}; + +struct sembuf +{ + int sem_flg; + int sem_op; + int sem_num; +}; + +int semctl(int semId, int semNum, int flag, union semun); +int semget(int semKey, int semNum, int flags); +int semop(int semId, struct sembuf * sops, int flag); + + +/* FROM SRA */ + /* * Supplement to . */