Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
41fe2a2a
Commit
41fe2a2a
authored
Dec 11, 2000
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Darwin porting patches from Peter Bierman <bierman@apple.com>
parent
839de3c5
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
568 additions
and
25 deletions
+568
-25
src/backend/port/Makefile.in
src/backend/port/Makefile.in
+13
-1
src/backend/port/darwin/Makefile
src/backend/port/darwin/Makefile
+30
-0
src/backend/port/darwin/sem.c
src/backend/port/darwin/sem.c
+374
-0
src/backend/port/dynloader/darwin.c
src/backend/port/dynloader/darwin.c
+15
-7
src/backend/port/dynloader/darwin.h
src/backend/port/dynloader/darwin.h
+4
-4
src/backend/storage/buffer/s_lock.c
src/backend/storage/buffer/s_lock.c
+30
-1
src/backend/storage/ipc/ipc.c
src/backend/storage/ipc/ipc.c
+9
-4
src/backend/storage/ipc/spin.c
src/backend/storage/ipc/spin.c
+2
-2
src/backend/storage/lmgr/proc.c
src/backend/storage/lmgr/proc.c
+7
-2
src/include/port/darwin.h
src/include/port/darwin.h
+6
-1
src/include/port/darwin/sem.h
src/include/port/darwin/sem.h
+75
-0
src/makefiles/Makefile.darwin
src/makefiles/Makefile.darwin
+1
-0
src/template/darwin
src/template/darwin
+2
-3
No files found.
src/backend/port/Makefile.in
View file @
41fe2a2a
...
...
@@ -13,7 +13,7 @@
# be converted to Method 2.
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/backend/port/Attic/Makefile.in,v 1.2
7 2000/10/20 21:03:45 petere
Exp $
# $Header: /cvsroot/pgsql/src/backend/port/Attic/Makefile.in,v 1.2
8 2000/12/11 00:49:54 tgl
Exp $
#
#-------------------------------------------------------------------------
...
...
@@ -30,6 +30,10 @@ endif
ifeq
($(PORTNAME), beos)
OBJS
+=
beos/SUBSYS.o
endif
ifeq
($(PORTNAME), darwin)
OBJS
+=
darwin/SUBSYS.o
endif
all
:
SUBSYS.o
SUBSYS.o
:
$(OBJS)
...
...
@@ -45,11 +49,19 @@ beos/SUBSYS.o: beos.dir
beos.dir
:
$(MAKE)
-C
beos all
darwin/SUBSYS.o
:
darwin.dir
darwin.dir
:
$(MAKE)
-C
darwin all
tas.o
:
tas.s
$(CC)
$(CFLAGS)
-c
$<
distclean clean
:
rm
-f
SUBSYS.o
$(OBJS)
$(MAKE)
-C
beos clean
$(MAKE)
-C
darwin clean
$(MAKE)
-C
qnx4 clean
depend dep
:
$(CC)
-MM
$(CFLAGS)
*
.c
>
depend
...
...
src/backend/port/darwin/Makefile
0 → 100644
View file @
41fe2a2a
#-------------------------------------------------------------------------
#
# Makefile--
# Makefile for port/darwin
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/backend/port/darwin/Makefile,v 1.1 2000/12/11 00:49:54 tgl Exp $
#
#-------------------------------------------------------------------------
subdir
=
src/backend/port/darwin
top_builddir
=
../../../..
include
$(top_builddir)/src/Makefile.global
OBJS
=
sem.o
all
:
SUBSYS.o
SUBSYS.o
:
$(OBJS)
$(LD)
$(LDREL)
$(LDOUT)
SUBSYS.o
$(OBJS)
depend dep
:
$(CC)
-MM
$(CFLAGS)
*
.c
>
depend
clean
:
rm
-f
SUBSYS.o
$(OBJS)
ifeq
(depend,$(wildcard depend))
include
depend
endif
src/backend/port/darwin/sem.c
0 → 100644
View file @
41fe2a2a
/*-------------------------------------------------------------------------
*
* sem.c
* System V Semaphore Emulation
*
* Copyright (c) 1999, repas AEG Automation GmbH
*
* 2000-12-1 pmb@mac.com
* - changed from anonymous to named semaphores for darwin
* - this required changing sem_info from containig an array of sem_t to an array of sem_t*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/port/darwin/Attic/sem.c,v 1.1 2000/12/11 00:49:54 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#include <errno.h>
#include <semaphore.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/mman.h>
#include "postgres.h"
#include "storage/ipc.h"
#include "storage/proc.h"
#include "port/darwin/sem.h"
#define SEMMAX IPC_NMAXSEM
#define SETMAX ((MAXBACKENDS + SEMMAX - 1) / SEMMAX)
#define OPMAX 8
#define MODE 0700
#define SHM_INFO_NAME "SysV_Sem_Info"
#define SEM_NAME "/pgsql-darwin"
struct
pending_ops
{
int
op
[
OPMAX
];
/* array of pending operations */
int
idx
;
/* index of first free array member */
};
struct
sem_info
{
sem_t
*
sem
;
struct
{
key_t
key
;
int
nsems
;
sem_t
*
sem
[
SEMMAX
];
/* array of POSIX semaphores */
struct
sem
semV
[
SEMMAX
];
/* array of System V semaphore
* structures */
struct
pending_ops
pendingOps
[
SEMMAX
];
/* array of pending
* operations */
}
set
[
SETMAX
];
};
static
struct
sem_info
*
SemInfo
=
(
struct
sem_info
*
)
-
1
;
int
semctl
(
int
semid
,
int
semnum
,
int
cmd
,
/* ... */
union
semun
arg
)
{
int
r
=
0
;
sem_wait
(
SemInfo
->
sem
);
if
(
semid
<
0
||
semid
>=
SETMAX
||
semnum
<
0
||
semnum
>=
SemInfo
->
set
[
semid
].
nsems
)
{
sem_post
(
SemInfo
->
sem
);
errno
=
EINVAL
;
return
-
1
;
}
switch
(
cmd
)
{
case
GETNCNT
:
r
=
SemInfo
->
set
[
semid
].
semV
[
semnum
].
semncnt
;
break
;
case
GETPID
:
r
=
SemInfo
->
set
[
semid
].
semV
[
semnum
].
sempid
;
break
;
case
GETVAL
:
r
=
SemInfo
->
set
[
semid
].
semV
[
semnum
].
semval
;
break
;
case
GETALL
:
for
(
semnum
=
0
;
semnum
<
SemInfo
->
set
[
semid
].
nsems
;
semnum
++
)
arg
.
array
[
semnum
]
=
SemInfo
->
set
[
semid
].
semV
[
semnum
].
semval
;
break
;
case
SETVAL
:
SemInfo
->
set
[
semid
].
semV
[
semnum
].
semval
=
arg
.
val
;
break
;
case
SETALL
:
for
(
semnum
=
0
;
semnum
<
SemInfo
->
set
[
semid
].
nsems
;
semnum
++
)
SemInfo
->
set
[
semid
].
semV
[
semnum
].
semval
=
arg
.
array
[
semnum
];
break
;
case
GETZCNT
:
r
=
SemInfo
->
set
[
semid
].
semV
[
semnum
].
semzcnt
;
break
;
case
IPC_RMID
:
for
(
semnum
=
0
;
semnum
<
SemInfo
->
set
[
semid
].
nsems
;
semnum
++
)
{
if
(
sem_close
(
SemInfo
->
set
[
semid
].
sem
[
semnum
])
==
-
1
)
r
=
-
1
;
}
SemInfo
->
set
[
semid
].
key
=
-
1
;
SemInfo
->
set
[
semid
].
nsems
=
0
;
break
;
default:
sem_post
(
SemInfo
->
sem
);
errno
=
EINVAL
;
return
-
1
;
}
sem_post
(
SemInfo
->
sem
);
return
r
;
}
int
semget
(
key_t
key
,
int
nsems
,
int
semflg
)
{
int
fd
,
semid
,
semnum
/* , semnum1 */
;
int
exist
=
0
;
char
semname
[
64
];
if
(
nsems
<
0
||
nsems
>
SEMMAX
)
{
#ifdef DEBUG_IPC
fprintf
(
stderr
,
"darwin semget aborting because nsems out of range. (%d)
\n
"
,
nsems
);
#endif
errno
=
EINVAL
;
return
-
1
;
}
/* open and map shared memory */
if
(
SemInfo
==
(
struct
sem_info
*
)
-
1
)
{
#ifdef DEBUG_IPC
fprintf
(
stderr
,
"darwin initializing shared mem for semaphore shim.
\n
"
);
#endif
/* test if the shared memory already exists */
fd
=
shm_open
(
SHM_INFO_NAME
,
O_RDWR
|
O_CREAT
|
O_EXCL
,
MODE
);
if
(
fd
==
-
1
&&
errno
==
EEXIST
)
{
exist
=
1
;
fd
=
shm_open
(
SHM_INFO_NAME
,
O_RDWR
|
O_CREAT
,
MODE
);
}
if
(
fd
==
-
1
)
return
fd
;
/* The size may only be set once. Ignore errors. */
ftruncate
(
fd
,
sizeof
(
struct
sem_info
));
SemInfo
=
mmap
(
NULL
,
sizeof
(
struct
sem_info
),
PROT_READ
|
PROT_WRITE
,
MAP_SHARED
,
fd
,
0
);
if
(
SemInfo
==
MAP_FAILED
)
return
-
1
;
if
(
!
exist
)
{
/* create semaphore for locking */
sprintf
(
semname
,
"%s-map"
,
SEM_NAME
);
#ifdef DEBUG_IPC
fprintf
(
stderr
,
"darwin creating sem %s to cover shared mem.
\n
"
,
semname
);
#endif
SemInfo
->
sem
=
sem_open
(
semname
,
O_CREAT
,
semflg
&
0777
,
1
);
sem_wait
(
SemInfo
->
sem
);
/* initilize shared memory */
memset
(
SemInfo
->
set
,
0
,
sizeof
(
SemInfo
->
set
));
for
(
semid
=
0
;
semid
<
SETMAX
;
semid
++
)
SemInfo
->
set
[
semid
].
key
=
-
1
;
sem_post
(
SemInfo
->
sem
);
}
}
sem_wait
(
SemInfo
->
sem
);
if
(
key
!=
IPC_PRIVATE
)
{
/* search existing element */
semid
=
0
;
while
(
semid
<
SETMAX
&&
SemInfo
->
set
[
semid
].
key
!=
key
)
semid
++
;
if
(
!
(
semflg
&
IPC_CREAT
)
&&
semid
>=
SETMAX
)
{
sem_post
(
SemInfo
->
sem
);
errno
=
ENOENT
;
return
-
1
;
}
else
if
(
semid
<
SETMAX
)
{
if
(
semflg
&
IPC_CREAT
&&
semflg
&
IPC_EXCL
)
{
sem_post
(
SemInfo
->
sem
);
errno
=
EEXIST
;
return
-
1
;
}
else
{
if
(
nsems
!=
0
&&
SemInfo
->
set
[
semid
].
nsems
<
nsems
)
{
#ifdef DEBUG_IPC
fprintf
(
stderr
,
"darwin semget failed because if (nsems != 0 && SemInfo->set[semid].nsems < nsems) %d %d
\n
"
,
nsems
,
SemInfo
->
set
[
semid
].
nsems
);
#endif
sem_post
(
SemInfo
->
sem
);
errno
=
EINVAL
;
return
-
1
;
}
sem_post
(
SemInfo
->
sem
);
return
semid
;
}
}
}
/* search first free element */
semid
=
0
;
while
(
semid
<
SETMAX
&&
SemInfo
->
set
[
semid
].
key
!=
-
1
)
semid
++
;
if
(
semid
>=
SETMAX
)
{
#ifdef DEBUG_IPC
fprintf
(
stderr
,
"darwin semget failed because all keys were -1 up to SETMAX
\n
"
);
#endif
sem_post
(
SemInfo
->
sem
);
errno
=
ENOSPC
;
return
-
1
;
}
for
(
semnum
=
0
;
semnum
<
nsems
;
semnum
++
)
{
sprintf
(
semname
,
"%s-%d-%d"
,
SEM_NAME
,
semid
,
semnum
);
#ifdef DEBUG_IPC
fprintf
(
stderr
,
"darwin creating sem %s to cover set %d num %dm.
\n
"
,
semname
,
semid
,
semnum
);
#endif
SemInfo
->
set
[
semid
].
sem
[
semnum
]
=
sem_open
(
semname
,
O_CREAT
,
semflg
&
0777
,
0
);
/* Currently sem_init always returns -1.
if( sem_init( &SemInfo->set[semid].sem[semnum], 1, 0 ) == -1 ) {
for( semnum1 = 0; semnum1 < semnum; semnum1++ ) {
sem_close( SemInfo->set[semid].sem[semnum1] );
}
sem_post( SemInfo->sem );
return -1;
}
*/
}
SemInfo
->
set
[
semid
].
key
=
key
;
SemInfo
->
set
[
semid
].
nsems
=
nsems
;
sem_post
(
SemInfo
->
sem
);
return
semid
;
}
int
semop
(
int
semid
,
struct
sembuf
*
sops
,
size_t
nsops
)
{
int
i
,
r
=
0
,
r1
,
errno1
=
0
,
op
;
sem_wait
(
SemInfo
->
sem
);
if
(
semid
<
0
||
semid
>=
SETMAX
)
{
sem_post
(
SemInfo
->
sem
);
errno
=
EINVAL
;
return
-
1
;
}
for
(
i
=
0
;
i
<
nsops
;
i
++
)
{
if
(
/* sops[i].sem_num < 0 || */
sops
[
i
].
sem_num
>=
SemInfo
->
set
[
semid
].
nsems
)
{
sem_post
(
SemInfo
->
sem
);
errno
=
EFBIG
;
return
-
1
;
}
}
for
(
i
=
0
;
i
<
nsops
;
i
++
)
{
if
(
sops
[
i
].
sem_op
<
0
)
{
if
(
SemInfo
->
set
[
semid
].
semV
[
sops
[
i
].
sem_num
].
semval
<
-
sops
[
i
].
sem_op
)
{
if
(
sops
[
i
].
sem_flg
&
IPC_NOWAIT
)
{
sem_post
(
SemInfo
->
sem
);
errno
=
EAGAIN
;
return
-
1
;
}
SemInfo
->
set
[
semid
].
semV
[
sops
[
i
].
sem_num
].
semncnt
++
;
if
(
SemInfo
->
set
[
semid
].
pendingOps
[
sops
[
i
].
sem_num
].
idx
>=
OPMAX
)
{
/* pending operations array overflow */
sem_post
(
SemInfo
->
sem
);
errno
=
ERANGE
;
return
-
1
;
}
SemInfo
->
set
[
semid
].
pendingOps
[
sops
[
i
].
sem_num
].
op
[
SemInfo
->
set
[
semid
].
pendingOps
[
sops
[
i
].
sem_num
].
idx
++
]
=
sops
[
i
].
sem_op
;
/* suspend */
sem_post
(
SemInfo
->
sem
);
/* avoid deadlock */
r1
=
sem_wait
(
SemInfo
->
set
[
semid
].
sem
[
sops
[
i
].
sem_num
]);
sem_wait
(
SemInfo
->
sem
);
if
(
r1
)
{
errno1
=
errno
;
r
=
r1
;
/* remove pending operation */
SemInfo
->
set
[
semid
].
pendingOps
[
sops
[
i
].
sem_num
].
op
[
--
SemInfo
->
set
[
semid
].
pendingOps
[
sops
[
i
].
sem_num
].
idx
]
=
0
;
}
else
SemInfo
->
set
[
semid
].
semV
[
sops
[
i
].
sem_num
].
semval
-=
-
sops
[
i
].
sem_op
;
SemInfo
->
set
[
semid
].
semV
[
sops
[
i
].
sem_num
].
semncnt
--
;
}
else
SemInfo
->
set
[
semid
].
semV
[
sops
[
i
].
sem_num
].
semval
-=
-
sops
[
i
].
sem_op
;
}
else
if
(
sops
[
i
].
sem_op
>
0
)
{
SemInfo
->
set
[
semid
].
semV
[
sops
[
i
].
sem_num
].
semval
+=
sops
[
i
].
sem_op
;
op
=
sops
[
i
].
sem_op
;
while
(
op
>
0
&&
SemInfo
->
set
[
semid
].
pendingOps
[
sops
[
i
].
sem_num
].
idx
>
0
)
{
/* operations pending */
if
(
SemInfo
->
set
[
semid
].
pendingOps
[
sops
[
i
].
sem_num
].
op
[
SemInfo
->
set
[
semid
].
pendingOps
[
sops
[
i
].
sem_num
].
idx
-
1
]
+
op
>=
0
)
{
/* unsuspend processes */
if
(
sem_post
(
SemInfo
->
set
[
semid
].
sem
[
sops
[
i
].
sem_num
]))
{
errno1
=
errno
;
r
=
-
1
;
}
/* adjust pending operations */
op
+=
SemInfo
->
set
[
semid
].
pendingOps
[
sops
[
i
].
sem_num
].
op
[
--
SemInfo
->
set
[
semid
].
pendingOps
[
sops
[
i
].
sem_num
].
idx
];
SemInfo
->
set
[
semid
].
pendingOps
[
sops
[
i
].
sem_num
].
op
[
SemInfo
->
set
[
semid
].
pendingOps
[
sops
[
i
].
sem_num
].
idx
]
=
0
;
}
else
{
/* adjust pending operations */
SemInfo
->
set
[
semid
].
pendingOps
[
sops
[
i
].
sem_num
].
op
[
SemInfo
->
set
[
semid
].
pendingOps
[
sops
[
i
].
sem_num
].
idx
-
1
]
+=
op
;
op
=
0
;
}
}
}
else
/* sops[i].sem_op == 0 */
{
/* not supported */
sem_post
(
SemInfo
->
sem
);
errno
=
ENOSYS
;
return
-
1
;
}
SemInfo
->
set
[
semid
].
semV
[
sops
[
i
].
sem_num
].
sempid
=
getpid
();
}
sem_post
(
SemInfo
->
sem
);
errno
=
errno1
;
return
r
;
}
src/backend/port/dynloader/darwin.c
View file @
41fe2a2a
...
...
@@ -3,14 +3,14 @@
* available with a PostgreSQL-compatible license. Kudos Wilfredo
* Snchez <wsanchez@apple.com>.
*
* $Header: /cvsroot/pgsql/src/backend/port/dynloader/darwin.c,v 1.
3 2000/11/14 21:26:21 petere
Exp $
* $Header: /cvsroot/pgsql/src/backend/port/dynloader/darwin.c,v 1.
4 2000/12/11 00:49:54 tgl
Exp $
*/
#include "postgres.h"
#include <mach-o/dyld.h>
#include "dynloader.h"
void
*
pg_dlopen
(
c
onst
c
har
*
filename
)
void
*
pg_dlopen
(
char
*
filename
)
{
NSObjectFileImage
image
;
...
...
@@ -26,18 +26,26 @@ void pg_dlclose(void *handle)
return
;
}
PGFunction
pg_dlsym
(
void
*
handle
,
c
onst
c
har
*
funcname
)
PGFunction
pg_dlsym
(
void
*
handle
,
char
*
funcname
)
{
NSSymbol
symbol
;
char
*
symname
=
(
char
*
)
malloc
(
strlen
(
funcname
)
+
2
);
sprintf
(
symname
,
"_%s"
,
funcname
);
symbol
=
NSLookupAndBindSymbol
(
symname
);
free
(
symname
);
return
(
PGFunction
)
NSAddressOfSymbol
(
symbol
);
if
(
NSIsSymbolNameDefined
(
symname
))
{
symbol
=
NSLookupAndBindSymbol
(
symname
);
free
(
symname
);
return
(
PGFunction
)
NSAddressOfSymbol
(
symbol
);
}
else
{
free
(
symname
);
return
(
PGFunction
)
NULL
;
}
}
c
onst
c
har
*
pg_dlerror
(
void
)
char
*
pg_dlerror
(
void
)
{
return
"no error message available"
;
}
src/backend/port/dynloader/darwin.h
View file @
41fe2a2a
/* $Header: /cvsroot/pgsql/src/backend/port/dynloader/darwin.h,v 1.
2 2000/11/09 19:00:50 petere
Exp $ */
/* $Header: /cvsroot/pgsql/src/backend/port/dynloader/darwin.h,v 1.
3 2000/12/11 00:49:54 tgl
Exp $ */
#include "fmgr.h"
void
*
pg_dlopen
(
const
char
*
filename
);
PGFunction
pg_dlsym
(
void
*
handle
,
c
onst
c
har
*
funcname
);
void
*
pg_dlopen
(
char
*
filename
);
PGFunction
pg_dlsym
(
void
*
handle
,
char
*
funcname
);
void
pg_dlclose
(
void
*
handle
);
c
onst
char
*
pg_dlerror
(
void
);
c
har
*
pg_dlerror
(
void
);
src/backend/storage/buffer/s_lock.c
View file @
41fe2a2a
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/Attic/s_lock.c,v 1.2
6 2000/11/28 23:27:55
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/Attic/s_lock.c,v 1.2
7 2000/12/11 00:49:51
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -119,6 +119,35 @@ _success: \n\
#endif
/* __m68k__ */
#if defined(__APPLE__) && defined(__ppc__)
/* used in darwin. */
/* We key off __APPLE__ here because this function differs from
* the LinuxPPC implementation only in compiler syntax.
*/
static
void
tas_dummy
()
{
__asm__
(
"
\n
\
.globl tas
\n
\
.globl _tas
\n
\
_tas:
\n
\
tas:
\n
\
lwarx r5,0,r3
\n
\
cmpwi r5,0
\n
\
bne fail
\n
\
addi r5,r5,1
\n
\
stwcx. r5,0,r3
\n
\
beq success
\n
\
fail: li r3,1
\n
\
blr
\n
\
success:
\n
\
li r3,0
\n
\
blr
\n
\
"
);
}
#endif
/* __APPLE__ && __ppc__ */
#if defined(__powerpc__)
/* Note: need a nice gcc constrained asm version so it can be inlined */
static
void
...
...
src/backend/storage/ipc/ipc.c
View file @
41fe2a2a
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipc.c,v 1.5
6 2000/12/03 17:18:10
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipc.c,v 1.5
7 2000/12/11 00:49:52
tgl Exp $
*
* NOTES
*
...
...
@@ -45,14 +45,19 @@
#ifdef HAVE_KERNEL_OS_H
#include <kernel/OS.h>
#endif
#include "miscadmin.h"
#include "utils/memutils.h"
#include "libpq/libpq.h"
#if defined(solaris_sparc)
#include <sys/ipc.h>
#endif
#if defined(__darwin__)
#include "port/darwin/sem.h"
#endif
#include "miscadmin.h"
#include "utils/memutils.h"
#include "libpq/libpq.h"
/*
* This flag is set during proc_exit() to change elog()'s behavior,
...
...
src/backend/storage/ipc/spin.c
View file @
41fe2a2a
...
...
@@ -14,14 +14,14 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/Attic/spin.c,v 1.2
6 2000/11/28 23:27:56
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/Attic/spin.c,v 1.2
7 2000/12/11 00:49:52
tgl Exp $
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
#include <errno.h>
#if
ndef HAS_TEST_AND_SET
#if
!defined(HAS_TEST_AND_SET) && defined(HAVE_SYS_SEM_H)
#include <sys/sem.h>
#endif
...
...
src/backend/storage/lmgr/proc.c
View file @
41fe2a2a
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.8
4 2000/11/28 23:27:56
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.8
5 2000/12/11 00:49:52
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -47,7 +47,7 @@
* This is so that we can support more backends. (system-wide semaphore
* sets run out pretty fast.) -ay 4/95
*
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.8
4 2000/11/28 23:27:56
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.8
5 2000/12/11 00:49:52
tgl Exp $
*/
#include "postgres.h"
...
...
@@ -61,6 +61,10 @@
#include <sys/sem.h>
#endif
#if defined(__darwin__)
#include "port/darwin/sem.h"
#endif
#include "miscadmin.h"
...
...
@@ -71,6 +75,7 @@
#include "storage/proc.h"
void
HandleDeadLock
(
SIGNAL_ARGS
);
static
void
ProcFreeAllSemaphores
(
void
);
static
bool
GetOffWaitqueue
(
PROC
*
);
...
...
src/include/port/darwin.h
View file @
41fe2a2a
#define __darwin__ 1
#if defined(__ppc__)
#define HAS_TEST_AND_SET
#if defined(__powerpc__)
#endif
#if defined(__ppc__)
typedef
unsigned
int
slock_t
;
#else
typedef
unsigned
char
slock_t
;
...
...
src/include/port/darwin/sem.h
0 → 100644
View file @
41fe2a2a
/*-------------------------------------------------------------------------
*
* sem.h
* System V Semaphore Emulation
*
* Copyright (c) 1999, repas AEG Automation GmbH
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/include/port/darwin/Attic/sem.h,v 1.1 2000/12/11 00:49:53 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef _SYS_SEM_H
#define _SYS_SEM_H
/* #define DEBUG_IPC here if you want to see the shim in action */
#include <sys/ipc.h>
#ifdef __cplusplus
extern
"C"
{
#endif
/*
* Semctl Command Definitions.
*/
#define GETNCNT 3
/* get semncnt */
#define GETPID 4
/* get sempid */
#define GETVAL 5
/* get semval */
#define GETALL 6
/* get all semval's */
#define GETZCNT 7
/* get semzcnt */
#define SETVAL 8
/* set semval */
#define SETALL 9
/* set all semval's */
#ifndef ushort_t
#define ushort_t unsigned int
#endif
/*
* There is one semaphore structure for each semaphore in the system.
*/
struct
sem
{
ushort_t
semval
;
/* semaphore text map address */
pid_t
sempid
;
/* pid of last operation */
ushort_t
semncnt
;
/* # awaiting semval > cval */
ushort_t
semzcnt
;
/* # awaiting semval = 0 */
};
/*
* User semaphore template for semop system calls.
*/
struct
sembuf
{
ushort_t
sem_num
;
/* semaphore # */
short
sem_op
;
/* semaphore operation */
short
sem_flg
;
/* operation flags */
};
extern
int
semctl
(
int
semid
,
int
semnum
,
int
cmd
,
/* ... */
union
semun
arg
);
extern
int
semget
(
key_t
key
,
int
nsems
,
int
semflg
);
extern
int
semop
(
int
semid
,
struct
sembuf
*
sops
,
size_t
nsops
);
#ifdef __cplusplus
}
#endif
#endif
/* _SYS_SEM_H */
src/makefiles/Makefile.darwin
View file @
41fe2a2a
AROPT
=
cr
AWK
=
awk
DLSUFFIX
=
.so
CFLAGS_SL
=
-bundle
-undefined
suppress
...
...
src/template/darwin
View file @
41fe2a2a
# regular cpp is broken in current development releases
# -traditional-cpp means "don't use apple's cpp-precomp" on darwin
# this should change to -no-cpp-precomp when that flag is implemented
CC="$CC -traditional-cpp"
# be on safe side while they sort out their compiler
CFLAGS=-O0
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment