mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-11-27 07:21:09 +08:00
Remove BEOS port.
This commit is contained in:
parent
6f84b2da75
commit
44f9021223
79
configure
vendored
79
configure
vendored
@ -1496,7 +1496,6 @@ else
|
||||
|
||||
case $host_os in
|
||||
aix*) template=aix ;;
|
||||
beos*) template=beos ;;
|
||||
bsdi*) template=bsdi ;;
|
||||
cygwin*) template=cygwin ;;
|
||||
darwin*) template=darwin ;;
|
||||
@ -6166,84 +6165,6 @@ if test "$ac_cv_search_crypt" != no; then
|
||||
|
||||
fi
|
||||
|
||||
# BeOS:
|
||||
if test "$PORTNAME" = "beos"
|
||||
then
|
||||
|
||||
echo "$as_me:$LINENO: checking for __inet_ntoa in -lbind" >&5
|
||||
echo $ECHO_N "checking for __inet_ntoa in -lbind... $ECHO_C" >&6
|
||||
if test "${ac_cv_lib_bind___inet_ntoa+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
LIBS="-lbind $LIBS"
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
builtin and then its argument prototype would still apply. */
|
||||
char __inet_ntoa ();
|
||||
int
|
||||
main ()
|
||||
{
|
||||
__inet_ntoa ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
|
||||
(eval $ac_link) 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -z "$ac_c_werror_flag"
|
||||
|| test ! -s conftest.err'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; } &&
|
||||
{ ac_try='test -s conftest$ac_exeext'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
ac_cv_lib_bind___inet_ntoa=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_cv_lib_bind___inet_ntoa=no
|
||||
fi
|
||||
rm -f conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
LIBS=$ac_check_lib_save_LIBS
|
||||
fi
|
||||
echo "$as_me:$LINENO: result: $ac_cv_lib_bind___inet_ntoa" >&5
|
||||
echo "${ECHO_T}$ac_cv_lib_bind___inet_ntoa" >&6
|
||||
if test $ac_cv_lib_bind___inet_ntoa = yes; then
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_LIBBIND 1
|
||||
_ACEOF
|
||||
|
||||
LIBS="-lbind $LIBS"
|
||||
|
||||
fi
|
||||
|
||||
fi
|
||||
# Solaris:
|
||||
echo "$as_me:$LINENO: checking for library containing fdatasync" >&5
|
||||
echo $ECHO_N "checking for library containing fdatasync... $ECHO_C" >&6
|
||||
|
@ -1,5 +1,5 @@
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
dnl $PostgreSQL: pgsql/configure.in,v 1.440 2006/01/05 01:56:28 momjian Exp $
|
||||
dnl $PostgreSQL: pgsql/configure.in,v 1.441 2006/01/05 03:01:32 momjian Exp $
|
||||
dnl
|
||||
dnl Developers, please strive to achieve this order:
|
||||
dnl
|
||||
@ -49,7 +49,6 @@ PGAC_ARG_REQ(with, template, [],
|
||||
|
||||
case $host_os in
|
||||
aix*) template=aix ;;
|
||||
beos*) template=beos ;;
|
||||
bsdi*) template=bsdi ;;
|
||||
cygwin*) template=cygwin ;;
|
||||
darwin*) template=darwin ;;
|
||||
@ -614,11 +613,6 @@ AC_SEARCH_LIBS(getopt_long, [getopt gnugetopt])
|
||||
# QNX:
|
||||
AC_CHECK_LIB(unix, main)
|
||||
AC_SEARCH_LIBS(crypt, crypt)
|
||||
# BeOS:
|
||||
if test "$PORTNAME" = "beos"
|
||||
then
|
||||
AC_CHECK_LIB(bind, __inet_ntoa)
|
||||
fi
|
||||
# Solaris:
|
||||
AC_SEARCH_LIBS(fdatasync, [rt posix4])
|
||||
# Cygwin:
|
||||
|
@ -1,4 +1,4 @@
|
||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/installation.sgml,v 1.251 2006/01/05 01:56:28 momjian Exp $ -->
|
||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/installation.sgml,v 1.252 2006/01/05 03:01:32 momjian Exp $ -->
|
||||
|
||||
<chapter id="installation">
|
||||
<title><![%standalone-include[<productname>PostgreSQL</>]]>
|
||||
@ -1995,13 +1995,6 @@ kill `cat /usr/local/pgsql/data/postmaster.pid`
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<row>
|
||||
<entry><systemitem class="osname">BeOS</></entry>
|
||||
<entry><systemitem>x86</></entry>
|
||||
<entry>7.2</entry>
|
||||
<entry>Cyril Velter (<email>cyril.velter@libertysurf.fr</email>), 2001-11-29</entry>
|
||||
<entry>needs updates to semaphore code</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><systemitem class="osname">Linux</></entry>
|
||||
<entry><systemitem>PlayStation 2</></entry>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$PostgreSQL: pgsql/doc/src/sgml/runtime.sgml,v 1.360 2006/01/05 01:56:28 momjian Exp $
|
||||
$PostgreSQL: pgsql/doc/src/sgml/runtime.sgml,v 1.361 2006/01/05 03:01:33 momjian Exp $
|
||||
-->
|
||||
|
||||
<chapter Id="runtime">
|
||||
@ -480,9 +480,9 @@ psql: could not connect to server: No such file or directory
|
||||
relevant for <productname>PostgreSQL</>). Almost all modern
|
||||
operating systems provide these features, but not all of them have
|
||||
them turned on or sufficiently sized by default, especially systems
|
||||
with BSD heritage. (For the <systemitem class="osname">Windows</> and
|
||||
<systemitem class="osname">BeOS</> ports, <productname>PostgreSQL</>
|
||||
provides its own replacement implementation of these facilities.)
|
||||
with BSD heritage. (For the <systemitem class="osname">Windows</>
|
||||
port, <productname>PostgreSQL</> provides its own replacement
|
||||
implementation of these facilities.)
|
||||
</para>
|
||||
|
||||
<para>
|
||||
|
@ -6,7 +6,7 @@
|
||||
# Copyright (c) 1998, Regents of the University of California
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $PostgreSQL: pgsql/src/Makefile.shlib,v 1.101 2005/12/30 21:43:41 momjian Exp $
|
||||
# $PostgreSQL: pgsql/src/Makefile.shlib,v 1.102 2006/01/05 03:01:34 momjian Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
@ -246,12 +246,6 @@ ifeq ($(PORTNAME), win32)
|
||||
haslibarule = yes
|
||||
endif
|
||||
|
||||
ifeq ($(PORTNAME), beos)
|
||||
shlib = lib$(NAME)$(DLSUFFIX)
|
||||
LINK.shared = $(LD) -nostart
|
||||
SHLIB_LINK += -ltermcap -lstdc++.r4 -lbind -lsocket -L/boot/develop/lib/x86
|
||||
endif
|
||||
|
||||
ifeq ($(enable_rpath), yes)
|
||||
SHLIB_LINK += $(rpath)
|
||||
endif
|
||||
@ -290,7 +284,6 @@ ifeq ($(enable_shared), yes)
|
||||
|
||||
ifneq ($(PORTNAME), win32)
|
||||
ifneq ($(PORTNAME), cygwin)
|
||||
ifneq ($(PORTNAME), beos)
|
||||
ifneq ($(PORTNAME), aix)
|
||||
|
||||
# Normal case
|
||||
@ -316,15 +309,6 @@ $(shlib): lib$(NAME).a
|
||||
|
||||
endif # PORTNAME == aix
|
||||
|
||||
else # PORTNAME == beos
|
||||
|
||||
# BEOS case
|
||||
$(shlib): $(OBJS)
|
||||
ln -fs $(top_srcdir)/src/backend/postgres _APP_
|
||||
$(CC) -Xlinker -soname=$@ $(LDFLAGS_SL) -o $@ _APP_ $(OBJS) $(SHLIB_LINK)
|
||||
|
||||
endif # PORTNAME == beos
|
||||
|
||||
else # PORTNAME == cygwin
|
||||
|
||||
# Cygwin case
|
||||
|
@ -13,7 +13,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/main/main.c,v 1.98 2005/12/28 23:22:51 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/main/main.c,v 1.99 2006/01/05 03:01:34 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -118,11 +118,6 @@ main(int argc, char *argv[])
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __BEOS__
|
||||
/* BeOS-specific actions on startup */
|
||||
beos_startup(argc, argv);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Not-quite-so-platform-specific startup environment checks. Still best
|
||||
* to minimize these.
|
||||
@ -205,13 +200,8 @@ main(int argc, char *argv[])
|
||||
strcmp(argv[1], "-V") == 0)))
|
||||
{
|
||||
#ifndef WIN32
|
||||
#ifndef __BEOS__
|
||||
|
||||
/*
|
||||
* Make sure we are not running as root.
|
||||
*
|
||||
* BeOS currently runs everything as root :-(, so this check must be
|
||||
* temporarily disabled there...
|
||||
*/
|
||||
if (geteuid() == 0)
|
||||
{
|
||||
@ -221,7 +211,6 @@ main(int argc, char *argv[])
|
||||
"more information on how to properly start the server.\n");
|
||||
exit(1);
|
||||
}
|
||||
#endif /* !__BEOS__ */
|
||||
|
||||
/*
|
||||
* Also make sure that real and effective uids are the same. Executing
|
||||
|
@ -13,7 +13,7 @@
|
||||
# be converted to Method 2.
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $PostgreSQL: pgsql/src/backend/port/Makefile,v 1.21 2006/01/05 01:56:29 momjian Exp $
|
||||
# $PostgreSQL: pgsql/src/backend/port/Makefile,v 1.22 2006/01/05 03:01:35 momjian Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
@ -25,9 +25,6 @@ OBJS+=dynloader.o pg_sema.o pg_shmem.o
|
||||
|
||||
OBJS+=$(TAS)
|
||||
|
||||
ifeq ($(PORTNAME), beos)
|
||||
OBJS+=beos/SUBSYS.o
|
||||
endif
|
||||
ifeq ($(PORTNAME), darwin)
|
||||
OBJS+=darwin/SUBSYS.o
|
||||
endif
|
||||
@ -40,11 +37,6 @@ all: SUBSYS.o
|
||||
SUBSYS.o: $(OBJS)
|
||||
$(LD) $(LDREL) $(LDOUT) $@ $^
|
||||
|
||||
beos/SUBSYS.o: beos.dir
|
||||
|
||||
beos.dir:
|
||||
$(MAKE) -C beos all
|
||||
|
||||
darwin/SUBSYS.o: darwin.dir
|
||||
|
||||
darwin.dir:
|
||||
@ -64,7 +56,6 @@ ipc_test: ipc_test.o pg_sema.o pg_shmem.o
|
||||
|
||||
distclean clean:
|
||||
rm -f SUBSYS.o $(OBJS) ipc_test ipc_test.o
|
||||
$(MAKE) -C beos clean
|
||||
$(MAKE) -C darwin clean
|
||||
$(MAKE) -C win32 clean
|
||||
|
||||
|
@ -1,30 +0,0 @@
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Makefile--
|
||||
# Makefile for port/beos
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $PostgreSQL: pgsql/src/backend/port/beos/Makefile,v 1.4 2003/11/29 19:51:54 pgsql Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
subdir = src/backend/port/beos
|
||||
top_builddir = ../../../..
|
||||
include $(top_builddir)/src/Makefile.global
|
||||
|
||||
OBJS = sem.o shm.o support.o
|
||||
|
||||
all: SUBSYS.o
|
||||
|
||||
SUBSYS.o: $(OBJS)
|
||||
$(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS)
|
||||
|
||||
depend dep:
|
||||
$(CC) -MM $(CFLAGS) $(CPPFLAGS) *.c >depend
|
||||
|
||||
clean:
|
||||
rm -f SUBSYS.o $(OBJS)
|
||||
|
||||
ifeq (depend,$(wildcard depend))
|
||||
include depend
|
||||
endif
|
@ -1,312 +0,0 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* sem.c
|
||||
* BeOS System V Semaphores Emulation
|
||||
*
|
||||
* Copyright (c) 1999-2000, Cyril VELTER
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#include "postgres.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <OS.h>
|
||||
|
||||
/*#define TDBG*/
|
||||
#ifdef TDBG
|
||||
#define TRACEDBG(x) printf(x);printf("\n")
|
||||
#define TRACEDBGP(x,y) printf(x,y);printf("\n")
|
||||
#define TRACEDBGPP(x,y,z) printf(x,y,z);printf("\n")
|
||||
#else
|
||||
#define TRACEDBG(x)
|
||||
#define TRACEDBGP(x,y)
|
||||
#define TRACEDBGPP(x,y,z)
|
||||
#endif
|
||||
|
||||
/* Control of a semaphore pool. The pool is an area in which we stored all
|
||||
the semIds of the pool. The first 4 bytes are the number of semaphore allocated
|
||||
in the pool followed by SemIds */
|
||||
|
||||
int
|
||||
semctl(int semId, int semNum, int flag, union semun semun)
|
||||
{
|
||||
int32 *Address;
|
||||
area_info info;
|
||||
|
||||
TRACEDBG("->semctl");
|
||||
/* Try to find the pool */
|
||||
if (get_area_info(semId, &info) != B_OK)
|
||||
{
|
||||
/* pool is invalid (BeOS area id is invalid) */
|
||||
errno = EINVAL;
|
||||
TRACEDBG("<-semctl invalid pool");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Get the pool address */
|
||||
Address = (int32 *) info.address;
|
||||
TRACEDBGP("--semctl address %d", Address);
|
||||
|
||||
|
||||
/* semNum might be 0 */
|
||||
/* semun.array contain the sem initial values */
|
||||
|
||||
/* Fix the count of all sem of the pool to semun.array */
|
||||
if (flag == SETALL)
|
||||
{
|
||||
long i;
|
||||
|
||||
TRACEDBG("--semctl setall");
|
||||
for (i = 0; i < Address[0]; i++)
|
||||
{
|
||||
int32 cnt;
|
||||
|
||||
/* Get the current count */
|
||||
get_sem_count(Address[2 * i + 1], &cnt);
|
||||
|
||||
TRACEDBGP("--semctl setall %d", semun.array[i]);
|
||||
|
||||
/* Compute and set the new count (relative to the old one) */
|
||||
cnt -= semun.array[i];
|
||||
TRACEDBGPP("--semctl acquire id : %d cnt : %d", Address[2 * i + 1], cnt);
|
||||
if (cnt > 0)
|
||||
while (acquire_sem_etc(Address[2 * i + 1], cnt, 0, 0) == B_INTERRUPTED);
|
||||
if (cnt < 0)
|
||||
release_sem_etc(Address[2 * i + 1], -cnt, 0);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Fix the count of one semaphore to semun.val */
|
||||
if (flag == SETVAL)
|
||||
{
|
||||
int32 cnt;
|
||||
|
||||
TRACEDBGP("--semctl setval %d", semun.val);
|
||||
/* Get the current count */
|
||||
get_sem_count(Address[2 * semNum + 1], &cnt);
|
||||
|
||||
/* Compute and set the new count (relative to the old one) */
|
||||
cnt -= semun.val;
|
||||
TRACEDBGPP("--semctl acquire id : %d cnt : %d", Address[2 * semNum + 1], cnt);
|
||||
if (cnt > 0)
|
||||
while (acquire_sem_etc(Address[2 * semNum + 1], cnt, 0, 0) == B_INTERRUPTED);
|
||||
if (cnt < 0)
|
||||
release_sem_etc(Address[2 * semNum + 1], -cnt, 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Get the last pid which accessed the sem */
|
||||
if (flag == GETPID)
|
||||
{
|
||||
TRACEDBG("->semctl getpid");
|
||||
return Address[2 * semNum + 2];
|
||||
}
|
||||
|
||||
/* Delete the pool */
|
||||
if (flag == IPC_RMID)
|
||||
{
|
||||
long i;
|
||||
|
||||
thread_info ti;
|
||||
|
||||
TRACEDBG("->semctl rmid");
|
||||
get_thread_info(find_thread(NULL), &ti);
|
||||
|
||||
/* Loop over all semaphore to delete them */
|
||||
TRACEDBGP("->semctl nmbre %d", Address[0]);
|
||||
for (i = 0; i < Address[0]; i++)
|
||||
{
|
||||
/*
|
||||
* Make sure to have ownership of the semaphore (if created by
|
||||
* another team)
|
||||
*/
|
||||
TRACEDBGP("->semctl id %d", Address[2 * i + 1]);
|
||||
set_sem_owner(Address[2 * i + 1], ti.team);
|
||||
|
||||
/* Delete the semaphore */
|
||||
delete_sem(Address[2 * i + 1]);
|
||||
|
||||
/*
|
||||
* Reset to an invalid semId (in case other process try to get the
|
||||
* infos from a cloned area
|
||||
*/
|
||||
Address[2 * i + 1] = 0;
|
||||
}
|
||||
|
||||
/* Set the semaphore count to 0 */
|
||||
Address[0] = 0;
|
||||
|
||||
/*
|
||||
* Delete the area (it might be cloned by other process. Let them live
|
||||
* with it, in all cases semIds are 0 so if another process try to use
|
||||
* it, it will fail
|
||||
*/
|
||||
delete_area(semId);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Get the current semaphore count */
|
||||
if (flag == GETNCNT)
|
||||
{
|
||||
/* TO BE IMPLEMENTED */
|
||||
TRACEDBG("--semctl getncnt");
|
||||
elog(ERROR, "semctl error: GETNCNT not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Get the current semaphore count of the first semaphore in the pool */
|
||||
if (flag == GETVAL)
|
||||
{
|
||||
int32 cnt;
|
||||
|
||||
TRACEDBG("--semctl getval");
|
||||
get_sem_count(Address[2 * semNum + 1], &cnt);
|
||||
TRACEDBGP("--semctl val %d", cnt);
|
||||
return cnt;
|
||||
}
|
||||
|
||||
elog(ERROR, "semctl error: unknown flag");
|
||||
|
||||
TRACEDBG("<-semctl unknown flag");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Find a pool id based on IPC key */
|
||||
int
|
||||
semget(int semKey, int semNum, int flags)
|
||||
{
|
||||
char Nom[50];
|
||||
area_id parea;
|
||||
void *Address;
|
||||
|
||||
TRACEDBGPP("->semget key : %d num : %d", semKey, semNum);
|
||||
/* Name of the area to find */
|
||||
sprintf(Nom, "SYSV_IPC_SEM : %d", semKey);
|
||||
|
||||
/* find area */
|
||||
parea = find_area(Nom);
|
||||
|
||||
/* Test of area existence */
|
||||
if (parea != B_NAME_NOT_FOUND)
|
||||
{
|
||||
/* Area exist and creation is requested, error */
|
||||
if ((flags & IPC_CREAT) && (flags & IPC_EXCL))
|
||||
{
|
||||
errno = EEXIST;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Get an area clone (in case it's not in our address space) */
|
||||
|
||||
/*
|
||||
* TODO : a check of address space might be done to avoid duplicate
|
||||
* areas in the same address space
|
||||
*/
|
||||
parea = clone_area(Nom, &Address, B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, parea);
|
||||
return parea;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Area does not exist, but creation is requested, so create it */
|
||||
if (flags & IPC_CREAT)
|
||||
{
|
||||
int32 *Address;
|
||||
void *Ad;
|
||||
long i;
|
||||
|
||||
/*
|
||||
* Limit to 250 (8 byte per sem : 4 for the semid and 4 for the
|
||||
* last pid which accessed the semaphore in a pool
|
||||
*/
|
||||
if (semNum > 250)
|
||||
{
|
||||
errno = ENOSPC;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Create the shared memory area which will hold the pool */
|
||||
parea = create_area(Nom, &Ad, B_ANY_ADDRESS, 4096, B_NO_LOCK, B_READ_AREA | B_WRITE_AREA);
|
||||
if ((parea == B_BAD_VALUE) || (parea == B_NO_MEMORY) || (parea == B_ERROR))
|
||||
{
|
||||
errno = ENOMEM;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* fill up informations (sem number and sem ids) */
|
||||
Address = (int32 *) Ad;
|
||||
Address[0] = semNum;
|
||||
for (i = 0; i < Address[0]; i++)
|
||||
{
|
||||
/* Create the semaphores */
|
||||
Address[2 * i + 1] = create_sem(0, Nom);
|
||||
|
||||
if ((Address[2 * i + 1] == B_BAD_VALUE) || (Address[2 * i + 1] == B_NO_MEMORY) || (Address[2 * i + 1] == B_NO_MORE_SEMS))
|
||||
{
|
||||
errno = ENOMEM;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return parea;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Area does not exist and no creation is requested */
|
||||
errno = ENOENT;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Acquire or release in the semaphore pool */
|
||||
int
|
||||
semop(int semId, struct sembuf * sops, int nsops)
|
||||
{
|
||||
int32 *Address; /* Pool address */
|
||||
area_info info;
|
||||
long i;
|
||||
long ret;
|
||||
|
||||
/* Get the pool address (semId IS an area id) */
|
||||
get_area_info(semId, &info);
|
||||
Address = (int32 *) info.address;
|
||||
|
||||
/* Check the validity of semId (it should be an area id) */
|
||||
if ((semId == B_BAD_VALUE) || (semId == B_NO_MEMORY) || (semId == B_ERROR))
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Perform acquire or release */
|
||||
for (i = 0; i < nsops; i++)
|
||||
{
|
||||
/* remember the PID */
|
||||
Address[2 * (sops[i].sem_num) + 2] = getpid();
|
||||
|
||||
/* For each sem in the pool, check the operation to perform */
|
||||
if (sops[i].sem_op < 0)
|
||||
{
|
||||
/*
|
||||
* Try acquiring the semaphore till we are not interrupted by a
|
||||
* signal
|
||||
*/
|
||||
if (sops[i].sem_flg == IPC_NOWAIT)
|
||||
{
|
||||
/* Try to lock ... */
|
||||
while ((ret = acquire_sem_etc(Address[2 * (sops[i].sem_num) + 1], -sops[i].sem_op, B_RELATIVE_TIMEOUT, 0)) == B_INTERRUPTED);
|
||||
if (ret != B_OK)
|
||||
return EWOULDBLOCK;
|
||||
}
|
||||
else
|
||||
while (acquire_sem_etc(Address[2 * (sops[i].sem_num) + 1], -sops[i].sem_op, 0, 0) == B_INTERRUPTED);
|
||||
}
|
||||
if (sops[i].sem_op > 0)
|
||||
release_sem_etc(Address[2 * (sops[i].sem_num) + 1], sops[i].sem_op, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,137 +0,0 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* shm.c
|
||||
* BeOS System V Shared Memory Emulation
|
||||
*
|
||||
* Copyright (c) 1999-2001, Cyril VELTER
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "postgres.h"
|
||||
#include <OS.h>
|
||||
#include <errno.h>
|
||||
|
||||
/* Emulating SYS shared memory with beos areas. WARNING : fork clone
|
||||
areas in copy on write mode */
|
||||
|
||||
|
||||
/* Detach from a shared mem area based on its address */
|
||||
int
|
||||
shmdt(char *shmaddr)
|
||||
{
|
||||
/* Find area id for this address */
|
||||
area_id s;
|
||||
|
||||
s = area_for(shmaddr);
|
||||
|
||||
/* Delete area */
|
||||
return delete_area(s);
|
||||
}
|
||||
|
||||
/* Attach to an existing area */
|
||||
int *
|
||||
shmat(int memId, int m1, int m2)
|
||||
{
|
||||
/* Get our team id */
|
||||
thread_info thinfo;
|
||||
team_info teinfo;
|
||||
area_info ainfo;
|
||||
|
||||
get_thread_info(find_thread(NULL), &thinfo);
|
||||
get_team_info(thinfo.team, &teinfo);
|
||||
|
||||
/* Get area teamid */
|
||||
if (get_area_info(memId, &ainfo) != B_OK)
|
||||
printf("AREA %d Invalide\n", memId);
|
||||
|
||||
if (ainfo.team == teinfo.team)
|
||||
{
|
||||
/*
|
||||
* the area is already in our address space, just return the address
|
||||
*/
|
||||
return (int *) ainfo.address;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* the area is not in our address space, clone it before and return
|
||||
* the address
|
||||
*/
|
||||
area_id narea;
|
||||
|
||||
narea = clone_area(ainfo.name, &(ainfo.address), B_CLONE_ADDRESS, B_READ_AREA | B_WRITE_AREA, memId);
|
||||
get_area_info(narea, &ainfo);
|
||||
return (int *) ainfo.address;
|
||||
}
|
||||
}
|
||||
|
||||
/* Control a shared mem area */
|
||||
int
|
||||
shmctl(int shmid, int flag, struct shmid_ds * dummy)
|
||||
{
|
||||
if (flag == IPC_RMID)
|
||||
{
|
||||
/* Delete the area */
|
||||
delete_area(shmid);
|
||||
return 0;
|
||||
}
|
||||
if (flag == IPC_STAT)
|
||||
{
|
||||
/* Find any SYSV area with the shmid in its name */
|
||||
|
||||
area_info inf;
|
||||
team_info infteam;
|
||||
int32 cookteam = 0;
|
||||
char name[50];
|
||||
|
||||
sprintf(name, "SYSV_IPC %d", shmid);
|
||||
|
||||
dummy->shm_nattch = 0;
|
||||
|
||||
while (get_next_team_info(&cookteam, &infteam) == B_OK)
|
||||
{
|
||||
int32 cook = 0;
|
||||
|
||||
while (get_next_area_info(infteam.team, &cook, &inf) == B_OK)
|
||||
{
|
||||
if (strcmp(name, inf.name) == 0)
|
||||
dummy->shm_nattch++;
|
||||
}
|
||||
}
|
||||
|
||||
errno = 0;
|
||||
return 0;
|
||||
}
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Get an area based on the IPC key */
|
||||
int
|
||||
shmget(int memKey, int size, int flag)
|
||||
{
|
||||
char nom[50];
|
||||
void *Address;
|
||||
area_id parea;
|
||||
|
||||
/* Area name */
|
||||
sprintf(nom, "SYSV_IPC_SHM : %d", memKey);
|
||||
|
||||
/* Find area */
|
||||
parea = find_area(nom);
|
||||
|
||||
/* area exist, just return its id */
|
||||
if (parea != B_NAME_NOT_FOUND)
|
||||
return parea;
|
||||
|
||||
/* area does not exist and no creation is requested : error */
|
||||
if (flag == 0)
|
||||
return -1;
|
||||
|
||||
/*
|
||||
* area does not exist and its creation is requested, create it (be sure
|
||||
* to have a 4ko multiple size
|
||||
*/
|
||||
return create_area(nom, &Address, B_ANY_ADDRESS, ((size / 4096) + 1) * 4096, B_NO_LOCK, B_READ_AREA | B_WRITE_AREA);
|
||||
}
|
@ -1,344 +0,0 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* support.c
|
||||
* BeOS Support functions
|
||||
*
|
||||
* Copyright (c) 1999-2001, Cyril VELTER
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "postgres.h"
|
||||
|
||||
/* Support Globals */
|
||||
port_id beos_dl_port_in = 0;
|
||||
port_id beos_dl_port_out = 0;
|
||||
sem_id beos_shm_sem;
|
||||
|
||||
/* Global var containing the postgres path */
|
||||
extern char my_exec_path[];
|
||||
|
||||
|
||||
/* Shared library loading doesn't work after fork in beos. The solution is to use an exact
|
||||
copy of the process and use it to perform the loading, then just map the Text and Data segment
|
||||
of the add-on in our address space. Both process must have the exact same memory mapping, so
|
||||
we use the postgres executable. When it's lauched with the -beossupportserver parameter, the
|
||||
postgres executable just run a loop to wait command on a port. Its only action is to load the addon,
|
||||
the beos_dl_open will then remap the good areas in the backend address space. */
|
||||
|
||||
|
||||
image_id
|
||||
beos_dl_open(char *filename)
|
||||
{
|
||||
image_id im;
|
||||
|
||||
/* If a port doesn't exist, lauch support server */
|
||||
if ((beos_dl_port_in <= 0) || (beos_dl_port_out <= 0))
|
||||
{
|
||||
/* Create communication port */
|
||||
beos_dl_port_in = create_port(50, "beos_support_in");
|
||||
beos_dl_port_out = create_port(50, "beos_support_in");
|
||||
|
||||
|
||||
if ((beos_dl_port_in <= 0) || (beos_dl_port_out <= 0))
|
||||
{
|
||||
elog(WARNING, "error loading BeOS support server: could not create communication ports");
|
||||
return B_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
char Cmd[4000];
|
||||
|
||||
/* Build arg list */
|
||||
sprintf(Cmd, "%s -beossupportserver %d %d &", my_exec_path, (int) beos_dl_port_in, (int) beos_dl_port_out);
|
||||
|
||||
/* Lauch process */
|
||||
system(Cmd);
|
||||
}
|
||||
}
|
||||
|
||||
/* Add-on loading */
|
||||
|
||||
/* Send command '1' (load) to the support server */
|
||||
write_port(beos_dl_port_in, 1, filename, strlen(filename) + 1);
|
||||
|
||||
/* Read Object Id */
|
||||
read_port(beos_dl_port_out, &im, NULL, 0);
|
||||
|
||||
/* Checking integrity */
|
||||
if (im < 0)
|
||||
{
|
||||
elog(WARNING, "could not load this add-on");
|
||||
return B_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Map text and data segment in our address space */
|
||||
char datas[4000];
|
||||
int32 area;
|
||||
int32 resu;
|
||||
void *add;
|
||||
|
||||
/* read text segment id and address */
|
||||
read_port(beos_dl_port_out, &area, datas, 4000);
|
||||
read_port(beos_dl_port_out, (void *) &add, datas, 4000);
|
||||
/* map text segment in our address space */
|
||||
resu = clone_area(datas, &add, B_EXACT_ADDRESS, B_READ_AREA | B_WRITE_AREA, area);
|
||||
if (resu < 0)
|
||||
{
|
||||
/* If we can't map, we are in reload case */
|
||||
/* delete the mapping */
|
||||
resu = delete_area(area_for(add));
|
||||
/* Remap */
|
||||
resu = clone_area(datas, &add, B_EXACT_ADDRESS, B_READ_AREA | B_WRITE_AREA, area);
|
||||
if (resu < 0)
|
||||
elog(WARNING, "could not load this add-on: map text error");
|
||||
}
|
||||
|
||||
/* read text segment id and address */
|
||||
read_port(beos_dl_port_out, &area, datas, 4000);
|
||||
read_port(beos_dl_port_out, (void *) &add, datas, 4000);
|
||||
/* map text segment in our address space */
|
||||
resu = clone_area(datas, &add, B_EXACT_ADDRESS, B_READ_AREA | B_WRITE_AREA, area);
|
||||
if (resu < 0)
|
||||
{
|
||||
/* If we can't map, we are in reload case */
|
||||
/* delete the mapping */
|
||||
resu = delete_area(area_for(add));
|
||||
/* Remap */
|
||||
resu = clone_area(datas, &add, B_EXACT_ADDRESS, B_READ_AREA | B_WRITE_AREA, area);
|
||||
if (resu < 0)
|
||||
elog(WARNING, "could not load this add-on: map data error");
|
||||
}
|
||||
|
||||
return im;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
beos_dl_sym(image_id im, char *symname, void **fptr)
|
||||
{
|
||||
/* Send command '3' (get symbol) to the support server */
|
||||
write_port(beos_dl_port_in, 3, symname, strlen(symname) + 1);
|
||||
write_port(beos_dl_port_in, im, NULL, 0);
|
||||
|
||||
/* Read sym address */
|
||||
read_port(beos_dl_port_out, (int32 *) (fptr), NULL, 0);
|
||||
|
||||
if (fptr == NULL)
|
||||
elog(WARNING, "loading symbol \"%s\" failed", symname);
|
||||
}
|
||||
|
||||
status_t
|
||||
beos_dl_close(image_id im)
|
||||
{
|
||||
/* unload add-on */
|
||||
int32 resu;
|
||||
|
||||
write_port(beos_dl_port_in, 2, &im, 4);
|
||||
read_port(beos_dl_port_out, &resu, NULL, 0);
|
||||
return resu;
|
||||
}
|
||||
|
||||
/* Main support server loop */
|
||||
|
||||
void
|
||||
beos_startup(int argc, char **argv)
|
||||
{
|
||||
if (strlen(argv[0]) >= 10 && !strcmp(argv[0] + strlen(argv[0]) - 10, "postmaster"))
|
||||
{
|
||||
/*
|
||||
* We are in the postmaster, create the protection semaphore for
|
||||
* shared mem remapping
|
||||
*/
|
||||
beos_shm_sem = create_sem(1, "beos_shm_sem");
|
||||
}
|
||||
|
||||
if (argc > 1 && strcmp(argv[1], "-beossupportserver") == 0)
|
||||
{
|
||||
/* We are in the support server, run it ... */
|
||||
|
||||
port_id port_in;
|
||||
port_id port_out;
|
||||
|
||||
/* Get back port ids from arglist */
|
||||
sscanf(argv[2], "%d", (int *) (&port_in));
|
||||
sscanf(argv[3], "%d", (int *) (&port_out));
|
||||
|
||||
/* Main server loop */
|
||||
for (;;)
|
||||
{
|
||||
int32 opcode = 0;
|
||||
char datas[4000];
|
||||
|
||||
/*
|
||||
* Wait for a message from the backend : 1 : load a shared object
|
||||
* 2 : unload a shared object any other : exit support server
|
||||
*/
|
||||
read_port(port_in, &opcode, datas, 4000);
|
||||
|
||||
switch (opcode)
|
||||
{
|
||||
image_id addon;
|
||||
image_info info_im;
|
||||
area_info info_ar;
|
||||
void *fpt;
|
||||
|
||||
/* Load Add-On */
|
||||
case 1:
|
||||
|
||||
/* Load shared object */
|
||||
addon = load_add_on(datas);
|
||||
|
||||
/* send back the shared object Id */
|
||||
write_port(port_out, addon, NULL, 0);
|
||||
|
||||
/* Get Shared Object infos */
|
||||
get_image_info(addon, &info_im);
|
||||
|
||||
/* get text segment info */
|
||||
get_area_info(area_for(info_im.text), &info_ar);
|
||||
/* Send back area_id of text segment */
|
||||
write_port(port_out, info_ar.area, info_ar.name, strlen(info_ar.name) + 1);
|
||||
/* Send back real address of text segment */
|
||||
write_port(port_out, (int) info_ar.address, info_ar.name, strlen(info_ar.name) + 1);
|
||||
|
||||
|
||||
/* get data segment info */
|
||||
get_area_info(area_for(info_im.data), &info_ar);
|
||||
/* Send back area_id of data segment */
|
||||
write_port(port_out, info_ar.area, info_ar.name, strlen(info_ar.name) + 1);
|
||||
/* Send back real address of data segment */
|
||||
write_port(port_out, (int) info_ar.address, info_ar.name, strlen(info_ar.name) + 1);
|
||||
break;
|
||||
/* UnLoad Add-On */
|
||||
case 2:
|
||||
|
||||
/*
|
||||
* Unload shared object and send back the result of the
|
||||
* operation
|
||||
*/
|
||||
write_port(port_out, unload_add_on(*((int *) (datas))), NULL, 0);
|
||||
break;
|
||||
/* Cleanup and exit */
|
||||
case 3:
|
||||
|
||||
/* read image Id on the input port */
|
||||
read_port(port_in, &addon, NULL, 0);
|
||||
|
||||
/* Loading symbol */
|
||||
fpt = NULL;
|
||||
|
||||
|
||||
if (get_image_symbol(addon, datas, B_SYMBOL_TYPE_TEXT, &fpt) == B_OK);
|
||||
{
|
||||
/*
|
||||
* Sometime the loader return B_OK for an inexistant
|
||||
* function with an invalid address !!! Check that the
|
||||
* return address is in the image range
|
||||
*/
|
||||
|
||||
get_image_info(addon, &info_im);
|
||||
if ((fpt < info_im.text) ||(fpt >= (info_im.text +info_im.text_size)))
|
||||
fpt = NULL;
|
||||
}
|
||||
|
||||
/* Send back fptr of data segment */
|
||||
write_port(port_out, (int32) (fpt), NULL, 0);
|
||||
break;
|
||||
|
||||
default:
|
||||
/* Free system resources */
|
||||
delete_port(port_in);
|
||||
delete_port(port_out);
|
||||
/* Exit */
|
||||
exit(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* Never be there */
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* The behavior of fork is broken on beos regarding shared memory. In fact
|
||||
all shared memory areas are clones in copy on write mode in the new process.
|
||||
|
||||
We need to do a remapping of these areas. Just afer the fork we performe the
|
||||
following actions :
|
||||
|
||||
* Find all areas with a name begining by SYS_V_IPC_ in our process
|
||||
(areas created by the SYSV IPC emulation functions). The name is
|
||||
followed by the IPC KEY in decimal format
|
||||
|
||||
* For each area we do :
|
||||
|
||||
* 1 : Get its name
|
||||
* 2 : destroy it
|
||||
* 3 : find another area with the exact same name
|
||||
* 4 : clone it in our address space with a different name
|
||||
|
||||
There is a race condition in 3-4 : if there two fork in a very short
|
||||
time, in step 3 we might end up with two areas with the same name, and no
|
||||
possibility to find the postmaster one. So the whole process is protected
|
||||
by a semaphore which is acquires just before the fork and released in case
|
||||
of fork failure or just after the end of the remapping.*/
|
||||
|
||||
void
|
||||
beos_before_backend_startup(void)
|
||||
{
|
||||
/* Just before forking, acquire the semaphore */
|
||||
if (acquire_sem(beos_shm_sem) != B_OK)
|
||||
exit(1); /* Fatal error, exiting with error */
|
||||
}
|
||||
|
||||
void
|
||||
beos_backend_startup_failed(void)
|
||||
{
|
||||
/* The fork failed, just release the semaphore */
|
||||
release_sem(beos_shm_sem);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
beos_backend_startup(void)
|
||||
{
|
||||
char nom[50];
|
||||
char nvnom[50];
|
||||
area_info inf;
|
||||
int32 cook = 0;
|
||||
|
||||
/* Perform the remapping process */
|
||||
|
||||
/* Loop in all our team areas */
|
||||
while (get_next_area_info(0, &cook, &inf) == B_OK)
|
||||
{
|
||||
strcpy(nom, inf.name);
|
||||
strcpy(nvnom, inf.name);
|
||||
nom[9] = 0;
|
||||
nvnom[5] = 'i';
|
||||
/* Is it a SYS V area ? */
|
||||
if (!strcmp(nom, "SYSV_IPC_"))
|
||||
{
|
||||
void *area_address;
|
||||
area_id area_postmaster;
|
||||
|
||||
/* Get the area address */
|
||||
area_address = inf.address;
|
||||
/* Destroy the bad area */
|
||||
delete_area(inf.area);
|
||||
/* Find the postmaster area */
|
||||
area_postmaster = find_area(inf.name);
|
||||
/* Compute new area name */
|
||||
sprintf(nvnom, "SYSV_IPC %d", area_postmaster);
|
||||
/* Clone it at the exact same address */
|
||||
clone_area(nvnom, &area_address, B_CLONE_ADDRESS, B_READ_AREA | B_WRITE_AREA, area_postmaster);
|
||||
}
|
||||
}
|
||||
|
||||
/* remapping done release semaphore to allow other backend to startup */
|
||||
|
||||
release_sem(beos_shm_sem);
|
||||
}
|
@ -1,69 +0,0 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* dynloader.c
|
||||
* Dynamic Loader for Postgres for BeOS
|
||||
*
|
||||
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/port/dynloader/beos.c,v 1.15 2004/12/31 22:00:32 pgsql Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "utils/dynamic_loader.h"
|
||||
|
||||
|
||||
void *
|
||||
pg_dlopen(char *filename)
|
||||
{
|
||||
image_id *im;
|
||||
|
||||
/* Handle memory allocation to store the Id of the shared object */
|
||||
im = (image_id *) (malloc(sizeof(image_id)));
|
||||
|
||||
/* Add-on loading */
|
||||
*im = beos_dl_open(filename);
|
||||
|
||||
return im;
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
pg_dlerror()
|
||||
{
|
||||
static char errmsg[] = "Load Add-On failed";
|
||||
|
||||
return errmsg;
|
||||
}
|
||||
|
||||
PGFunction
|
||||
pg_dlsym(void *handle, char *funcname)
|
||||
{
|
||||
PGFunction fpt;
|
||||
|
||||
/* Checking that "Handle" is valid */
|
||||
if ((handle) && ((*(int *) (handle)) >= 0))
|
||||
{
|
||||
beos_dl_sym(*((int *) (handle)), funcname, (void **) &fpt);
|
||||
return fpt;
|
||||
}
|
||||
elog(WARNING, "add-on not loaded correctly");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
pg_dlclose(void *handle)
|
||||
{
|
||||
/* Checking that "Handle" is valid */
|
||||
if ((handle) && ((*(int *) (handle)) >= 0))
|
||||
{
|
||||
if (beos_dl_close(*(image_id *) handle) != B_OK)
|
||||
elog(WARNING, "error while unloading add-on");
|
||||
free(handle);
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* port_protos.h
|
||||
* port-specific prototypes for BeOS
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/backend/port/dynloader/beos.h,v 1.11 2004/12/31 22:00:32 pgsql Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef PORT_PROTOS_H
|
||||
#define PORT_PROTOS_H
|
||||
|
||||
#endif /* PORT_PROTOS_H */
|
@ -7,7 +7,7 @@
|
||||
* Copyright (c) 1996-2005, PostgreSQL Global Development Group
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/postmaster/fork_process.c,v 1.4 2005/10/15 02:49:23 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/postmaster/fork_process.c,v 1.5 2006/01/05 03:01:35 momjian Exp $
|
||||
*/
|
||||
#include "postgres.h"
|
||||
#include "postmaster/fork_process.h"
|
||||
@ -52,31 +52,14 @@ fork_process(void)
|
||||
getitimer(ITIMER_PROF, &prof_itimer);
|
||||
#endif
|
||||
|
||||
#ifdef __BEOS__
|
||||
/* Specific beos actions before backend startup */
|
||||
beos_before_backend_startup();
|
||||
#endif
|
||||
|
||||
result = fork();
|
||||
if (result == (pid_t) -1)
|
||||
{
|
||||
/* fork failed */
|
||||
#ifdef __BEOS__
|
||||
/* Specific beos backend startup actions */
|
||||
beos_backend_startup_failed();
|
||||
#endif
|
||||
}
|
||||
else if (result == 0)
|
||||
if (result == 0)
|
||||
{
|
||||
/* fork succeeded, in child */
|
||||
#ifdef LINUX_PROFILE
|
||||
setitimer(ITIMER_PROF, &prof_itimer, NULL);
|
||||
#endif
|
||||
|
||||
#ifdef __BEOS__
|
||||
/* Specific beos backend startup actions */
|
||||
beos_backend_startup();
|
||||
#endif
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/storage/lmgr/proc.c,v 1.171 2006/01/04 21:06:31 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/storage/lmgr/proc.c,v 1.172 2006/01/05 03:01:35 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -1113,12 +1113,7 @@ bool
|
||||
enable_sig_alarm(int delayms, bool is_statement_timeout)
|
||||
{
|
||||
struct timeval fin_time;
|
||||
|
||||
#ifndef __BEOS__
|
||||
struct itimerval timeval;
|
||||
#else
|
||||
bigtime_t time_interval;
|
||||
#endif
|
||||
|
||||
/* Compute target timeout time if we will need it */
|
||||
if (is_statement_timeout || statement_timeout_active)
|
||||
@ -1170,18 +1165,11 @@ enable_sig_alarm(int delayms, bool is_statement_timeout)
|
||||
}
|
||||
|
||||
/* If we reach here, okay to set the timer interrupt */
|
||||
#ifndef __BEOS__
|
||||
MemSet(&timeval, 0, sizeof(struct itimerval));
|
||||
timeval.it_value.tv_sec = delayms / 1000;
|
||||
timeval.it_value.tv_usec = (delayms % 1000) * 1000;
|
||||
if (setitimer(ITIMER_REAL, &timeval, NULL))
|
||||
return false;
|
||||
#else
|
||||
/* BeOS doesn't have setitimer, but has set_alarm */
|
||||
time_interval = delayms * 1000; /* usecs */
|
||||
if (set_alarm(time_interval, B_ONE_SHOT_RELATIVE_ALARM) < 0)
|
||||
return false;
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1204,7 +1192,6 @@ disable_sig_alarm(bool is_statement_timeout)
|
||||
*/
|
||||
if (statement_timeout_active || deadlock_timeout_active)
|
||||
{
|
||||
#ifndef __BEOS__
|
||||
struct itimerval timeval;
|
||||
|
||||
MemSet(&timeval, 0, sizeof(struct itimerval));
|
||||
@ -1215,16 +1202,6 @@ disable_sig_alarm(bool is_statement_timeout)
|
||||
deadlock_timeout_active = false;
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
/* BeOS doesn't have setitimer, but has set_alarm */
|
||||
if (set_alarm(B_INFINITE_TIMEOUT, B_PERIODIC_ALARM) < 0)
|
||||
{
|
||||
statement_timeout_active = false;
|
||||
cancel_from_timeout = false;
|
||||
deadlock_timeout_active = false;
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Always cancel deadlock timeout, in case this is error cleanup */
|
||||
@ -1274,7 +1251,6 @@ CheckStatementTimeout(void)
|
||||
else
|
||||
{
|
||||
/* Not time yet, so (re)schedule the interrupt */
|
||||
#ifndef __BEOS__
|
||||
struct itimerval timeval;
|
||||
|
||||
MemSet(&timeval, 0, sizeof(struct itimerval));
|
||||
@ -1287,16 +1263,6 @@ CheckStatementTimeout(void)
|
||||
}
|
||||
if (setitimer(ITIMER_REAL, &timeval, NULL))
|
||||
return false;
|
||||
#else
|
||||
/* BeOS doesn't have setitimer, but has set_alarm */
|
||||
bigtime_t time_interval;
|
||||
|
||||
time_interval =
|
||||
(statement_fin_time.tv_sec - now.tv_sec) * 1000000 +
|
||||
(statement_fin_time.tv_usec - now.tv_usec);
|
||||
if (set_alarm(time_interval, B_ONE_SHOT_RELATIVE_ALARM) < 0)
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.475 2006/01/04 21:06:31 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.476 2006/01/05 03:01:35 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* this is the "main" module of the postgres backend and
|
||||
@ -3520,7 +3520,6 @@ ShowUsage(const char *title)
|
||||
(long) user.tv_usec,
|
||||
(long) sys.tv_sec,
|
||||
(long) sys.tv_usec);
|
||||
/* BeOS has rusage but only has some fields, and not these... */
|
||||
#if defined(HAVE_GETRUSAGE)
|
||||
appendStringInfo(&str,
|
||||
"!\t%ld/%ld [%ld/%ld] filesystem blocks in/out\n",
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/init/miscinit.c,v 1.151 2005/11/22 18:17:25 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/init/miscinit.c,v 1.152 2006/01/05 03:01:36 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -777,7 +777,7 @@ CreateLockFile(const char *filename, bool amPostmaster,
|
||||
* using real kill() either...
|
||||
*
|
||||
* Normally kill() will fail with ESRCH if the given PID doesn't
|
||||
* exist. BeOS returns EINVAL for some silly reason, however.
|
||||
* exist.
|
||||
*/
|
||||
if (other_pid != my_pid
|
||||
#ifndef WIN32
|
||||
@ -786,11 +786,7 @@ CreateLockFile(const char *filename, bool amPostmaster,
|
||||
)
|
||||
{
|
||||
if (kill(other_pid, 0) == 0 ||
|
||||
(errno != ESRCH &&
|
||||
#ifdef __BEOS__
|
||||
errno != EINVAL &&
|
||||
#endif
|
||||
errno != EPERM))
|
||||
(errno != ESRCH && errno != EPERM))
|
||||
{
|
||||
/* lockfile belongs to a live process */
|
||||
ereport(FATAL,
|
||||
|
@ -42,7 +42,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
* Portions taken from FreeBSD.
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.104 2006/01/02 16:45:12 adunstan Exp $
|
||||
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.105 2006/01/05 03:01:36 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -633,8 +633,6 @@ get_id(void)
|
||||
|
||||
pw = getpwuid(geteuid());
|
||||
|
||||
#ifndef __BEOS__ /* no root check on BEOS */
|
||||
|
||||
if (geteuid() == 0) /* 0 is root's uid */
|
||||
{
|
||||
fprintf(stderr,
|
||||
@ -645,7 +643,6 @@ get_id(void)
|
||||
progname);
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
#else /* the windows code */
|
||||
|
||||
struct passwd_win32
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.62 2005/11/22 18:17:28 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.63 2006/01/05 03:01:37 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -1322,7 +1322,6 @@ main(int argc, char **argv)
|
||||
* Disallow running as root, to forestall any possible security holes.
|
||||
*/
|
||||
#ifndef WIN32
|
||||
#ifndef __BEOS__ /* no root check on BEOS */
|
||||
if (geteuid() == 0)
|
||||
{
|
||||
write_stderr(_("%s: cannot be run as root\n"
|
||||
@ -1332,7 +1331,6 @@ main(int argc, char **argv)
|
||||
progname);
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -23,7 +23,7 @@
|
||||
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/bin/pg_resetxlog/pg_resetxlog.c,v 1.38 2005/10/15 02:49:40 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/bin/pg_resetxlog/pg_resetxlog.c,v 1.39 2006/01/05 03:01:37 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -220,7 +220,6 @@ main(int argc, char *argv[])
|
||||
* the data directory.
|
||||
*/
|
||||
#ifndef WIN32
|
||||
#ifndef __BEOS__ /* no root check on BeOS */
|
||||
if (geteuid() == 0)
|
||||
{
|
||||
fprintf(stderr, _("%s: cannot be executed by \"root\"\n"),
|
||||
@ -229,7 +228,6 @@ main(int argc, char *argv[])
|
||||
progname);
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
DataDir = argv[optind];
|
||||
|
@ -12,7 +12,7 @@
|
||||
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/c.h,v 1.193 2005/12/25 02:14:18 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/include/c.h,v 1.194 2006/01/05 03:01:37 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -170,11 +170,6 @@
|
||||
* built-in definition of bool.
|
||||
*/
|
||||
|
||||
/* BeOS defines bool already, but the compiler chokes on the
|
||||
* #ifndef unless we wrap it in this check.
|
||||
*/
|
||||
#ifndef __BEOS__
|
||||
|
||||
#ifndef __cplusplus
|
||||
|
||||
#ifndef bool
|
||||
@ -189,7 +184,6 @@ typedef char bool;
|
||||
#define false ((bool) 0)
|
||||
#endif
|
||||
#endif /* not C++ */
|
||||
#endif /* __BEOS__ */
|
||||
|
||||
typedef bool *BoolPtr;
|
||||
|
||||
|
@ -200,9 +200,6 @@
|
||||
/* Define to 1 if you have the <langinfo.h> header file. */
|
||||
#undef HAVE_LANGINFO_H
|
||||
|
||||
/* Define to 1 if you have the `bind' library (-lbind). */
|
||||
#undef HAVE_LIBBIND
|
||||
|
||||
/* Define to 1 if you have the `BSD' library (-lBSD). */
|
||||
#undef HAVE_LIBBSD
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
* for developers. If you edit any of these, be sure to do a *full*
|
||||
* rebuild (and an initdb if noted).
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/pg_config_manual.h,v 1.19 2006/01/05 01:56:29 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/include/pg_config_manual.h,v 1.20 2006/01/05 03:01:37 momjian Exp $
|
||||
*------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
@ -155,15 +155,14 @@
|
||||
/*
|
||||
* Disable UNIX sockets for those operating system.
|
||||
*/
|
||||
#if defined(__BEOS__) || defined(WIN32)
|
||||
#if defined(WIN32)
|
||||
#undef HAVE_UNIX_SOCKETS
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Define this if your operating system supports link()
|
||||
*/
|
||||
#if !defined(__BEOS__) && \
|
||||
!defined(WIN32) && !defined(__CYGWIN__)
|
||||
#if !defined(WIN32) && !defined(__CYGWIN__)
|
||||
#define HAVE_WORKING_LINK 1
|
||||
#endif
|
||||
|
||||
|
@ -1,82 +0,0 @@
|
||||
#include <kernel/OS.h>
|
||||
#include <kernel/image.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#define AF_UNIX 10 /* no domain sockets on BeOS */
|
||||
|
||||
/* Beos doesn't have all the required getrusage fields */
|
||||
#undef HAVE_GETRUSAGE
|
||||
|
||||
/* SYS V emulation */
|
||||
|
||||
#undef HAVE_UNION_SEMUN
|
||||
#define HAVE_UNION_SEMUN 1
|
||||
|
||||
#define IPC_RMID 256
|
||||
#define IPC_CREAT 512
|
||||
#define IPC_EXCL 1024
|
||||
#define IPC_PRIVATE 234564
|
||||
#define IPC_NOWAIT 2048
|
||||
#define IPC_STAT 4096
|
||||
|
||||
#define EACCESS 2048
|
||||
#define EIDRM 4096
|
||||
|
||||
#define SETALL 8192
|
||||
#define GETNCNT 16384
|
||||
#define GETVAL 65536
|
||||
#define SETVAL 131072
|
||||
#define GETPID 262144
|
||||
|
||||
union semun
|
||||
{
|
||||
int val;
|
||||
struct semid_ds *buf;
|
||||
unsigned short *array;
|
||||
};
|
||||
|
||||
struct sembuf
|
||||
{
|
||||
int sem_flg;
|
||||
int sem_op;
|
||||
int sem_num;
|
||||
};
|
||||
|
||||
struct shmid_ds
|
||||
{
|
||||
int dummy;
|
||||
int shm_nattch;
|
||||
};
|
||||
|
||||
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);
|
||||
|
||||
int shmdt(char *shmaddr);
|
||||
int *shmat(int memId, int m1, int m2);
|
||||
int shmctl(int shmid, int flag, struct shmid_ds * dummy);
|
||||
int shmget(int memKey, int size, int flag);
|
||||
|
||||
|
||||
/* Support functions */
|
||||
|
||||
/* Specific beos action made on postgres/postmaster startup */
|
||||
void beos_startup(int argc, char **argv);
|
||||
|
||||
/* Load a shared library */
|
||||
image_id beos_dl_open(char *filename);
|
||||
|
||||
/* Find symbol */
|
||||
void beos_dl_sym(image_id im, char *symname, void **fptr);
|
||||
|
||||
/* UnLoad a shared library */
|
||||
status_t beos_dl_close(image_id im);
|
||||
|
||||
/* Specific beos action made on backend startup */
|
||||
void beos_before_backend_startup(void);
|
||||
|
||||
/* Specific beos action made on backend startup */
|
||||
void beos_backend_startup(void);
|
||||
|
||||
/* Specific beos action made on backend startup failure*/
|
||||
void beos_backend_startup_failed(void);
|
@ -10,7 +10,6 @@
|
||||
#include "ecpgtype.h"
|
||||
#include <string.h>
|
||||
|
||||
#ifndef __BEOS__
|
||||
#ifndef __cplusplus
|
||||
#ifndef bool
|
||||
#define bool char
|
||||
@ -23,9 +22,6 @@
|
||||
#define false ((bool) 0)
|
||||
#endif /* ndef false */
|
||||
#endif /* not C++ */
|
||||
#else /* __BEOS__ */
|
||||
#include <SupportDefs.h>
|
||||
#endif /* __BEOS__ */
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
|
@ -1,19 +0,0 @@
|
||||
MK_NO_LORDER=true
|
||||
AROPT = crs
|
||||
|
||||
ifdef ELF_SYSTEM
|
||||
export_dynamic = -Wl,-E
|
||||
endif
|
||||
|
||||
DLSUFFIX = .so
|
||||
CFLAGS_SL = -fpic -DPIC
|
||||
|
||||
%.so: %.o
|
||||
ifdef PGXS
|
||||
ln -fs $(DESTDIR)$(bindir)/postgres _APP_
|
||||
else
|
||||
ln -fs $(top_builddir)/src/backend/postgres _APP_
|
||||
endif
|
||||
$(CC) -nostart -Xlinker -soname=$@ -o $@ _APP_ $<
|
||||
|
||||
sqlmansect = 7
|
@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/port/noblock.c,v 1.8 2005/10/15 02:49:51 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/port/noblock.c,v 1.9 2006/01/05 03:01:38 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -20,26 +20,21 @@
|
||||
bool
|
||||
pg_set_noblock(int sock)
|
||||
{
|
||||
#if !defined(WIN32) && !defined(__BEOS__)
|
||||
#if !defined(WIN32)
|
||||
return (fcntl(sock, F_SETFL, O_NONBLOCK) != -1);
|
||||
#else
|
||||
long ioctlsocket_ret = 1;
|
||||
|
||||
/* Returns non-0 on failure, while fcntl() returns -1 on failure */
|
||||
#ifdef WIN32
|
||||
return (ioctlsocket(sock, FIONBIO, &ioctlsocket_ret) == 0);
|
||||
#endif
|
||||
#ifdef __BEOS__
|
||||
return (ioctl(sock, FIONBIO, &ioctlsocket_ret) == 0);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
pg_set_block(int sock)
|
||||
{
|
||||
#if !defined(WIN32) && !defined(__BEOS__)
|
||||
#if !defined(WIN32)
|
||||
int flags;
|
||||
|
||||
flags = fcntl(sock, F_GETFL);
|
||||
@ -50,11 +45,6 @@ pg_set_block(int sock)
|
||||
long ioctlsocket_ret = 0;
|
||||
|
||||
/* Returns non-0 on failure, while fcntl() returns -1 on failure */
|
||||
#ifdef WIN32
|
||||
return (ioctlsocket(sock, FIONBIO, &ioctlsocket_ret) == 0);
|
||||
#endif
|
||||
#ifdef __BEOS__
|
||||
return (ioctl(sock, FIONBIO, &ioctlsocket_ret) == 0);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
#! /bin/sh
|
||||
# $PostgreSQL: pgsql/src/test/regress/pg_regress.sh,v 1.63 2006/01/05 01:56:30 momjian Exp $
|
||||
# $PostgreSQL: pgsql/src/test/regress/pg_regress.sh,v 1.64 2006/01/05 03:01:38 momjian Exp $
|
||||
|
||||
me=`basename $0`
|
||||
: ${TMPDIR=/tmp}
|
||||
@ -216,7 +216,7 @@ esac
|
||||
# On some platforms we can't use Unix sockets.
|
||||
# ----------
|
||||
case $host_platform in
|
||||
*-*-cygwin* | *-*-mingw32* | *beos*)
|
||||
*-*-cygwin* | *-*-mingw32*)
|
||||
unix_sockets=no;;
|
||||
*)
|
||||
unix_sockets=yes;;
|
||||
|
Loading…
Reference in New Issue
Block a user