mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-30 19:00:29 +08:00
New diff that now covers the entire tree. Applying this gets postgresql
working on the VERY latest version of BeOS. I'm sure there will be alot of comments, but then if there weren't I'd be disappointed! Thanks for your continuing efforts to get this into your tree. Haven't bothered with the new files as they haven't changed. BTW Peter, the compiler is "broken" about the bool define and so on. I'm filing a bug report to try and get it addressed. Hopefully then we can tidy up the code a bit. I await the replies with interest :) David Reid
This commit is contained in:
parent
de1af06287
commit
87c0e623ba
@ -660,7 +660,7 @@ fi
|
|||||||
## Header files
|
## Header files
|
||||||
##
|
##
|
||||||
dnl sys/socket.h and sys/types.h are required by AC_FUNC_ACCEPT_ARGTYPES
|
dnl sys/socket.h and sys/types.h are required by AC_FUNC_ACCEPT_ARGTYPES
|
||||||
AC_CHECK_HEADERS([crypt.h dld.h endian.h fp_class.h getopt.h ieeefp.h netinet/tcp.h pwd.h sys/ipc.h sys/pstat.h sys/select.h sys/socket.h sys/types.h sys/un.h termios.h])
|
AC_CHECK_HEADERS([crypt.h dld.h endian.h fp_class.h getopt.h ieeefp.h netinet/tcp.h pwd.h sys/pstat.h sys/select.h sys/socket.h sys/types.h sys/un.h termios.h])
|
||||||
|
|
||||||
AC_CHECK_HEADERS([readline/readline.h readline.h], [break])
|
AC_CHECK_HEADERS([readline/readline.h readline.h], [break])
|
||||||
AC_CHECK_HEADERS([readline/history.h history.h], [break])
|
AC_CHECK_HEADERS([readline/history.h history.h], [break])
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.69 2000/10/02 19:42:45 petere Exp $
|
* $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.70 2000/10/03 03:11:13 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -496,7 +496,6 @@ AtCommit_Notify()
|
|||||||
*/
|
*/
|
||||||
if (kill(listenerPID, SIGUSR2) < 0)
|
if (kill(listenerPID, SIGUSR2) < 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get rid of pg_listener entry if it refers to a PID
|
* Get rid of pg_listener entry if it refers to a PID
|
||||||
* that no longer exists. Presumably, that backend
|
* that no longer exists. Presumably, that backend
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $Id: pqcomm.c,v 1.103 2000/10/02 21:45:31 petere Exp $
|
* $Id: pqcomm.c,v 1.104 2000/10/03 03:11:14 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -208,11 +208,16 @@ StreamServerPort(int family, unsigned short portName, int *fdP)
|
|||||||
|
|
||||||
MemSet((char *) &saddr, 0, sizeof(saddr));
|
MemSet((char *) &saddr, 0, sizeof(saddr));
|
||||||
saddr.sa.sa_family = family;
|
saddr.sa.sa_family = family;
|
||||||
|
|
||||||
|
/* I know this isn't a good way of testing, but until we have a
|
||||||
|
* define for this it'll do!
|
||||||
|
* we have Unix sockets...
|
||||||
|
*/
|
||||||
|
#ifdef HAVE_SYS_UN_H
|
||||||
if (family == AF_UNIX)
|
if (family == AF_UNIX)
|
||||||
{
|
{
|
||||||
len = UNIXSOCK_PATH(saddr.un, portName);
|
len = UNIXSOCK_PATH(saddr.un, portName);
|
||||||
strcpy(sock_path, saddr.un.sun_path);
|
strcpy(sock_path, saddr.un.sun_path);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the socket exists but nobody has an advisory lock on it we
|
* If the socket exists but nobody has an advisory lock on it we
|
||||||
* can safely delete the file.
|
* can safely delete the file.
|
||||||
@ -231,13 +236,16 @@ StreamServerPort(int family, unsigned short portName, int *fdP)
|
|||||||
}
|
}
|
||||||
#endif /* HAVE_FCNTL_SETLK */
|
#endif /* HAVE_FCNTL_SETLK */
|
||||||
}
|
}
|
||||||
else
|
#endif /* HAVE_SYS_UN_H */
|
||||||
{
|
|
||||||
|
if (family == AF_INET)
|
||||||
|
{
|
||||||
saddr.in.sin_addr.s_addr = htonl(INADDR_ANY);
|
saddr.in.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||||
saddr.in.sin_port = htons(portName);
|
saddr.in.sin_port = htons(portName);
|
||||||
len = sizeof(struct sockaddr_in);
|
len = sizeof(struct sockaddr_in);
|
||||||
}
|
}
|
||||||
err = bind(fd, &saddr.sa, len);
|
|
||||||
|
err = bind(fd, (struct sockaddr *)&saddr.sa, len);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
{
|
{
|
||||||
snprintf(PQerrormsg, PQERRORMSG_LENGTH,
|
snprintf(PQerrormsg, PQERRORMSG_LENGTH,
|
||||||
@ -258,6 +266,7 @@ StreamServerPort(int family, unsigned short portName, int *fdP)
|
|||||||
return STATUS_ERROR;
|
return STATUS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_SYS_UN_H /* yeah I know... */
|
||||||
if (family == AF_UNIX)
|
if (family == AF_UNIX)
|
||||||
{
|
{
|
||||||
on_proc_exit(StreamDoUnlink, 0);
|
on_proc_exit(StreamDoUnlink, 0);
|
||||||
@ -279,6 +288,7 @@ StreamServerPort(int family, unsigned short portName, int *fdP)
|
|||||||
}
|
}
|
||||||
#endif /* HAVE_FCNTL_SETLK */
|
#endif /* HAVE_FCNTL_SETLK */
|
||||||
}
|
}
|
||||||
|
#endif /* HAVE_SYS_UN_H */
|
||||||
|
|
||||||
listen(fd, SOMAXCONN);
|
listen(fd, SOMAXCONN);
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/pqpacket.c,v 1.26 2000/04/12 17:15:14 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/pqpacket.c,v 1.27 2000/10/03 03:11:14 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -61,7 +61,11 @@ PacketReceiveFragment(Port *port)
|
|||||||
got = SSL_read(port->ssl, pkt->ptr, pkt->nrtodo);
|
got = SSL_read(port->ssl, pkt->ptr, pkt->nrtodo);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef __BEOS__
|
||||||
got = read(port->sock, pkt->ptr, pkt->nrtodo);
|
got = read(port->sock, pkt->ptr, pkt->nrtodo);
|
||||||
|
#else
|
||||||
|
got = recv(port->sock, pkt->ptr, pkt->nrtodo, 0);
|
||||||
|
#endif /* __BEOS__ */
|
||||||
if (got > 0)
|
if (got > 0)
|
||||||
{
|
{
|
||||||
pkt->nrtodo -= got;
|
pkt->nrtodo -= got;
|
||||||
@ -150,8 +154,11 @@ PacketSendFragment(Port *port)
|
|||||||
done = SSL_write(port->ssl, pkt->ptr, pkt->nrtodo);
|
done = SSL_write(port->ssl, pkt->ptr, pkt->nrtodo);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef __BEOS__
|
||||||
done = write(port->sock, pkt->ptr, pkt->nrtodo);
|
done = write(port->sock, pkt->ptr, pkt->nrtodo);
|
||||||
|
#else
|
||||||
|
done = send(port->sock, pkt->ptr, pkt->nrtodo, 0);
|
||||||
|
#endif
|
||||||
if (done > 0)
|
if (done > 0)
|
||||||
{
|
{
|
||||||
pkt->nrtodo -= done;
|
pkt->nrtodo -= done;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/main/main.c,v 1.30 2000/09/06 14:15:19 petere Exp $
|
* $Header: /cvsroot/pgsql/src/backend/main/main.c,v 1.31 2000/10/03 03:11:15 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -85,11 +85,18 @@ main(int argc, char *argv[])
|
|||||||
*/
|
*/
|
||||||
len = strlen(argv[0]);
|
len = strlen(argv[0]);
|
||||||
|
|
||||||
if (!geteuid())
|
/* OK this is going to seem weird, but BeOS is presently basically
|
||||||
|
* a single user system. There is work going on, but at present it'll
|
||||||
|
* say that every user is uid 0, i.e. root. We'll inhibit this check
|
||||||
|
* until Be get the system working with multiple users!!
|
||||||
|
*/
|
||||||
|
#ifndef __BEOS__
|
||||||
|
if (!geteuid())
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s", NOROOTEXEC);
|
fprintf(stderr, "%s", NOROOTEXEC);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
#endif /* __BEOS__ */
|
||||||
|
|
||||||
if (len >= 10 && !strcmp(argv[0] + len - 10, "postmaster"))
|
if (len >= 10 && !strcmp(argv[0] + len - 10, "postmaster"))
|
||||||
exit(PostmasterMain(argc, argv));
|
exit(PostmasterMain(argc, argv));
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/port/dynloader/Attic/beos.c,v 1.1 2000/10/02 17:15:53 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/port/dynloader/Attic/beos.c,v 1.2 2000/10/03 03:11:15 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $Id: beos.h,v 1.1 2000/10/02 17:15:53 momjian Exp $
|
* $Id: beos.h,v 1.2 2000/10/03 03:11:15 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.167 2000/10/02 19:42:46 petere Exp $
|
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.168 2000/10/03 03:11:16 momjian Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
*
|
*
|
||||||
@ -818,13 +818,12 @@ ServerLoop(void)
|
|||||||
if (select(nSockets, &rmask, &wmask, (fd_set *) NULL,
|
if (select(nSockets, &rmask, &wmask, (fd_set *) NULL,
|
||||||
(struct timeval *) NULL) < 0)
|
(struct timeval *) NULL) < 0)
|
||||||
{
|
{
|
||||||
if (errno == EINTR)
|
if (errno == EINTR || errno == EWOULDBLOCK)
|
||||||
continue;
|
continue;
|
||||||
fprintf(stderr, "%s: ServerLoop: select failed: %s\n",
|
fprintf(stderr, "%s: ServerLoop: select failed: %s\n",
|
||||||
progname, strerror(errno));
|
progname, strerror(errno));
|
||||||
return STATUS_ERROR;
|
return STATUS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Select a random seed at the time of first receiving a request.
|
* Select a random seed at the time of first receiving a request.
|
||||||
*/
|
*/
|
||||||
@ -1021,7 +1020,6 @@ initMasks(fd_set *rmask, fd_set *wmask)
|
|||||||
if (ServerSock_INET != INVALID_SOCK)
|
if (ServerSock_INET != INVALID_SOCK)
|
||||||
{
|
{
|
||||||
FD_SET(ServerSock_INET, rmask);
|
FD_SET(ServerSock_INET, rmask);
|
||||||
|
|
||||||
if (ServerSock_INET > nsocks)
|
if (ServerSock_INET > nsocks)
|
||||||
nsocks = ServerSock_INET;
|
nsocks = ServerSock_INET;
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipc.c,v 1.50 2000/10/02 19:42:48 petere Exp $
|
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipc.c,v 1.51 2000/10/03 03:11:17 momjian Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
*
|
*
|
||||||
@ -34,8 +34,15 @@
|
|||||||
#include "storage/ipc.h"
|
#include "storage/ipc.h"
|
||||||
#include "storage/s_lock.h"
|
#include "storage/s_lock.h"
|
||||||
/* In Ultrix, sem.h and shm.h must be included AFTER ipc.h */
|
/* In Ultrix, sem.h and shm.h must be included AFTER ipc.h */
|
||||||
|
#ifdef HAVE_SYS_SEM_H
|
||||||
#include <sys/sem.h>
|
#include <sys/sem.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_SYS_SHM_H
|
||||||
#include <sys/shm.h>
|
#include <sys/shm.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_KERNEL_OS_H
|
||||||
|
#include <kernel/OS.h>
|
||||||
|
#endif
|
||||||
#include "miscadmin.h"
|
#include "miscadmin.h"
|
||||||
#include "utils/memutils.h"
|
#include "utils/memutils.h"
|
||||||
#include "libpq/libpq.h"
|
#include "libpq/libpq.h"
|
||||||
@ -236,12 +243,17 @@ on_exit_reset(void)
|
|||||||
static void
|
static void
|
||||||
IPCPrivateSemaphoreKill(int status, int semId)
|
IPCPrivateSemaphoreKill(int status, int semId)
|
||||||
{
|
{
|
||||||
|
/* BeOS has a native sempahore type... */
|
||||||
|
#ifndef __BEOS__
|
||||||
union semun semun;
|
union semun semun;
|
||||||
semun.val = 0; /* unused */
|
semun.val = 0; /* unused */
|
||||||
|
|
||||||
if (semctl(semId, 0, IPC_RMID, semun) == -1)
|
if (semctl(semId, 0, IPC_RMID, semun) == -1)
|
||||||
elog(NOTICE, "IPCPrivateSemaphoreKill: semctl(%d, 0, IPC_RMID, ...) failed: %s",
|
elog(NOTICE, "IPCPrivateSemaphoreKill: semctl(%d, 0, IPC_RMID, ...) failed: %s",
|
||||||
semId, strerror(errno));
|
semId, strerror(errno));
|
||||||
|
#else /* __BEOS__ */
|
||||||
|
delete_sem(semId);
|
||||||
|
#endif /* __BEOS__ */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -258,12 +270,19 @@ IPCPrivateMemoryKill(int status, int shmId)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#ifndef __BEOS__
|
||||||
if (shmctl(shmId, IPC_RMID, (struct shmid_ds *) NULL) < 0)
|
if (shmctl(shmId, IPC_RMID, (struct shmid_ds *) NULL) < 0)
|
||||||
{
|
{
|
||||||
elog(NOTICE, "IPCPrivateMemoryKill: shmctl(id=%d, IPC_RMID, NULL) failed: %m",
|
elog(NOTICE, "IPCPrivateMemoryKill: shmctl(%d, %d, 0) failed: %m",
|
||||||
shmId);
|
shmId, IPC_RMID);
|
||||||
}
|
}
|
||||||
}
|
#else
|
||||||
|
if (delete_area(shmId) != B_OK)
|
||||||
|
{
|
||||||
|
elog(NOTICE, "IPCPrivateMemoryKill: delete_area(%d) failed", shmId);
|
||||||
|
}
|
||||||
|
#endif /* __BEOS__ */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -284,9 +303,10 @@ IpcSemaphoreCreate(IpcSemaphoreKey semKey,
|
|||||||
int semStartValue,
|
int semStartValue,
|
||||||
int removeOnExit)
|
int removeOnExit)
|
||||||
{
|
{
|
||||||
|
int semId;
|
||||||
|
#ifndef __BEOS__
|
||||||
int i;
|
int i;
|
||||||
int errStatus;
|
int errStatus;
|
||||||
int semId;
|
|
||||||
u_short array[IPC_NMAXSEM];
|
u_short array[IPC_NMAXSEM];
|
||||||
union semun semun;
|
union semun semun;
|
||||||
|
|
||||||
@ -302,6 +322,7 @@ IpcSemaphoreCreate(IpcSemaphoreKey semKey,
|
|||||||
fprintf(stderr, "calling semget(%d, %d, 0%o)\n",
|
fprintf(stderr, "calling semget(%d, %d, 0%o)\n",
|
||||||
semKey, semNum, (unsigned)(IPC_CREAT|permission));
|
semKey, semNum, (unsigned)(IPC_CREAT|permission));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
semId = semget(semKey, semNum, IPC_CREAT | permission);
|
semId = semget(semKey, semNum, IPC_CREAT | permission);
|
||||||
|
|
||||||
if (semId < 0)
|
if (semId < 0)
|
||||||
@ -341,9 +362,25 @@ IpcSemaphoreCreate(IpcSemaphoreKey semKey,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (removeOnExit)
|
if (removeOnExit)
|
||||||
on_shmem_exit(IPCPrivateSemaphoreKill, (Datum)semId);
|
on_shmem_exit(IPCPrivateSemaphoreKill, (Datum) semId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#else /* BeOS implementation */
|
||||||
|
char semname[32];
|
||||||
|
sprintf (semname, "pgsql_ipc:%ld", semKey);
|
||||||
|
semId = create_sem(1, semname);
|
||||||
|
if (semId < 0) {
|
||||||
|
fprintf(stderr, "IpcSemaphoreCreate: create_sem(1, %s) failed: %s\n",
|
||||||
|
semname, strerror(errno));
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (removeOnExit)
|
||||||
|
on_shmem_exit(IPCPrivateSemaphoreKill, (caddr_t) semId);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG_IPC
|
#ifdef DEBUG_IPC
|
||||||
fprintf(stderr, "IpcSemaphoreCreate returns %d\n", semId);
|
fprintf(stderr, "IpcSemaphoreCreate returns %d\n", semId);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
@ -387,6 +424,7 @@ void
|
|||||||
IpcSemaphoreKill(IpcSemaphoreKey key)
|
IpcSemaphoreKill(IpcSemaphoreKey key)
|
||||||
{
|
{
|
||||||
int semId;
|
int semId;
|
||||||
|
#ifndef __BEOS__
|
||||||
union semun semun;
|
union semun semun;
|
||||||
semun.val = 0; /* unused */
|
semun.val = 0; /* unused */
|
||||||
|
|
||||||
@ -395,6 +433,23 @@ IpcSemaphoreKill(IpcSemaphoreKey key)
|
|||||||
semId = semget(key, 0, 0);
|
semId = semget(key, 0, 0);
|
||||||
if (semId != -1)
|
if (semId != -1)
|
||||||
semctl(semId, 0, IPC_RMID, semun);
|
semctl(semId, 0, IPC_RMID, semun);
|
||||||
|
#else
|
||||||
|
/* first find the semId by looking at sempahore names... */
|
||||||
|
sem_info si;
|
||||||
|
int32 cookie = 0;
|
||||||
|
char semname[32];
|
||||||
|
sprintf(semname, "pgsql_ipc:%ld", key);
|
||||||
|
|
||||||
|
semId = -1;
|
||||||
|
while (get_next_sem_info(0, &cookie, &si) == B_OK) {
|
||||||
|
if (strcmp(si.name, semname) == 0){
|
||||||
|
semId = si.sem;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (semId != -1)
|
||||||
|
delete_sem(semId);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
@ -407,6 +462,7 @@ static int IpcSemaphoreLock_return;
|
|||||||
void
|
void
|
||||||
IpcSemaphoreLock(IpcSemaphoreId semId, int sem, int lock)
|
IpcSemaphoreLock(IpcSemaphoreId semId, int sem, int lock)
|
||||||
{
|
{
|
||||||
|
#ifndef __BEOS__
|
||||||
extern int errno;
|
extern int errno;
|
||||||
int errStatus;
|
int errStatus;
|
||||||
struct sembuf sops;
|
struct sembuf sops;
|
||||||
@ -439,6 +495,13 @@ IpcSemaphoreLock(IpcSemaphoreId semId, int sem, int lock)
|
|||||||
semId, strerror(errno));
|
semId, strerror(errno));
|
||||||
proc_exit(255);
|
proc_exit(255);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
if ((IpcSemaphoreLock_return = acquire_sem(semId)) != B_NO_ERROR) {
|
||||||
|
fprintf(stderr, "IpcSempahoreLock: acquire_sem failed on sem_id %d: %s\n",
|
||||||
|
semId, strerror(errno));
|
||||||
|
proc_exit(255);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
@ -451,6 +514,7 @@ static int IpcSemaphoreUnlock_return;
|
|||||||
void
|
void
|
||||||
IpcSemaphoreUnlock(IpcSemaphoreId semId, int sem, int lock)
|
IpcSemaphoreUnlock(IpcSemaphoreId semId, int sem, int lock)
|
||||||
{
|
{
|
||||||
|
#ifndef __BEOS__
|
||||||
extern int errno;
|
extern int errno;
|
||||||
int errStatus;
|
int errStatus;
|
||||||
struct sembuf sops;
|
struct sembuf sops;
|
||||||
@ -484,28 +548,49 @@ IpcSemaphoreUnlock(IpcSemaphoreId semId, int sem, int lock)
|
|||||||
semId, strerror(errno));
|
semId, strerror(errno));
|
||||||
proc_exit(255);
|
proc_exit(255);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
if ((IpcSemaphoreUnlock_return = release_sem(semId)) != B_NO_ERROR) {
|
||||||
|
fprintf(stderr, "IpcSempahoreUnlock: release_sem failed on sem_id %d: %s\n",
|
||||||
|
semId, strerror(errno));
|
||||||
|
proc_exit(255);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
IpcSemaphoreGetCount(IpcSemaphoreId semId, int sem)
|
IpcSemaphoreGetCount(IpcSemaphoreId semId, int sem)
|
||||||
{
|
{
|
||||||
|
#ifndef __BEOS__
|
||||||
int semncnt;
|
int semncnt;
|
||||||
union semun dummy; /* for Solaris */
|
union semun dummy; /* for Solaris */
|
||||||
dummy.val = 0; /* unused */
|
dummy.val = 0; /* unused */
|
||||||
|
|
||||||
semncnt = semctl(semId, sem, GETNCNT, dummy);
|
semncnt = semctl(semId, sem, GETNCNT, dummy);
|
||||||
return semncnt;
|
return semncnt;
|
||||||
|
#else
|
||||||
|
sem_info si;
|
||||||
|
|
||||||
|
get_sem_info(semId, &si);
|
||||||
|
return si.count;
|
||||||
|
#endif /* __BEOS__ */
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
IpcSemaphoreGetValue(IpcSemaphoreId semId, int sem)
|
IpcSemaphoreGetValue(IpcSemaphoreId semId, int sem)
|
||||||
{
|
{
|
||||||
|
#ifndef __BEOS__
|
||||||
int semval;
|
int semval;
|
||||||
union semun dummy; /* for Solaris */
|
union semun dummy; /* for Solaris */
|
||||||
dummy.val = 0; /* unused */
|
dummy.val = 0; /* unused */
|
||||||
|
|
||||||
semval = semctl(semId, sem, GETVAL, dummy);
|
semval = semctl(semId, sem, GETVAL, dummy);
|
||||||
return semval;
|
return semval;
|
||||||
|
#else
|
||||||
|
sem_info si;
|
||||||
|
|
||||||
|
get_sem_info(semId, &si);
|
||||||
|
return si.count;
|
||||||
|
#endif /* __BEOS__ */
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
@ -526,6 +611,8 @@ IpcMemoryCreate(IpcMemoryKey memKey, uint32 size, int permission)
|
|||||||
shmid = PrivateMemoryCreate(memKey, size);
|
shmid = PrivateMemoryCreate(memKey, size);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#ifndef __BEOS__
|
||||||
|
|
||||||
shmid = shmget(memKey, size, IPC_CREAT | permission);
|
shmid = shmget(memKey, size, IPC_CREAT | permission);
|
||||||
|
|
||||||
if (shmid < 0)
|
if (shmid < 0)
|
||||||
@ -562,6 +649,25 @@ IpcMemoryCreate(IpcMemoryKey memKey, uint32 size, int permission)
|
|||||||
return IpcMemCreationFailed;
|
return IpcMemCreationFailed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
{
|
||||||
|
char *addr;
|
||||||
|
uint32 pages = ((size - 1) / B_PAGE_SIZE) +1;
|
||||||
|
char areaname[32];
|
||||||
|
sprintf (areaname, "pgsql_ipc%ld", memKey);
|
||||||
|
|
||||||
|
shmid = create_area(areaname, (void*)&addr, B_ANY_ADDRESS, pages * B_PAGE_SIZE,
|
||||||
|
B_NO_LOCK, B_READ_AREA|B_WRITE_AREA);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shmid < 0) {
|
||||||
|
fprintf(stderr, "IpcMemoryCreate: failed: %s\n",
|
||||||
|
strerror(errno));
|
||||||
|
return IpcMemCreationFailed;
|
||||||
|
}
|
||||||
|
#endif /* __BEOS__ */
|
||||||
|
|
||||||
/* if (memKey == PrivateIPCKey) */
|
/* if (memKey == PrivateIPCKey) */
|
||||||
on_shmem_exit(IPCPrivateMemoryKill, (Datum) shmid);
|
on_shmem_exit(IPCPrivateMemoryKill, (Datum) shmid);
|
||||||
|
|
||||||
@ -577,6 +683,7 @@ IpcMemoryIdGet(IpcMemoryKey memKey, uint32 size)
|
|||||||
{
|
{
|
||||||
IpcMemoryId shmid;
|
IpcMemoryId shmid;
|
||||||
|
|
||||||
|
#ifndef __BEOS__
|
||||||
shmid = shmget(memKey, size, 0);
|
shmid = shmget(memKey, size, 0);
|
||||||
|
|
||||||
if (shmid < 0)
|
if (shmid < 0)
|
||||||
@ -585,6 +692,17 @@ IpcMemoryIdGet(IpcMemoryKey memKey, uint32 size)
|
|||||||
memKey, size, strerror(errno));
|
memKey, size, strerror(errno));
|
||||||
return IpcMemIdGetFailed;
|
return IpcMemIdGetFailed;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
char areaname[32];
|
||||||
|
sprintf(areaname, "pgsql_ipc%ld", memKey);
|
||||||
|
shmid = find_area(areaname);
|
||||||
|
|
||||||
|
if (shmid == B_NAME_NOT_FOUND){
|
||||||
|
fprintf(stderr, "IpcMemoryIdGet: find_area(%s) failed: %s\n",
|
||||||
|
areaname, strerror(errno));
|
||||||
|
return IpcMemIdGetFailed;
|
||||||
|
}
|
||||||
|
#endif /* __BEOS__ */
|
||||||
|
|
||||||
return shmid;
|
return shmid;
|
||||||
}
|
}
|
||||||
@ -597,8 +715,10 @@ IpcMemoryIdGet(IpcMemoryKey memKey, uint32 size)
|
|||||||
static void
|
static void
|
||||||
IpcMemoryDetach(int status, char *shmaddr)
|
IpcMemoryDetach(int status, char *shmaddr)
|
||||||
{
|
{
|
||||||
|
#ifndef __BEOS__
|
||||||
if (shmdt(shmaddr) < 0)
|
if (shmdt(shmaddr) < 0)
|
||||||
elog(NOTICE, "IpcMemoryDetach: shmdt(0x%p) failed: %m", shmaddr);
|
elog(NOTICE, "IpcMemoryDetach: shmdt(0x%p) failed: %m", shmaddr);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
@ -613,6 +733,7 @@ IpcMemoryAttach(IpcMemoryId memId)
|
|||||||
{
|
{
|
||||||
char *memAddress;
|
char *memAddress;
|
||||||
|
|
||||||
|
#ifndef __BEOS__
|
||||||
if (UsePrivateMemory)
|
if (UsePrivateMemory)
|
||||||
memAddress = (char *) PrivateMemoryAttach(memId);
|
memAddress = (char *) PrivateMemoryAttach(memId);
|
||||||
else
|
else
|
||||||
@ -625,6 +746,23 @@ IpcMemoryAttach(IpcMemoryId memId)
|
|||||||
memId, strerror(errno));
|
memId, strerror(errno));
|
||||||
return IpcMemAttachFailed;
|
return IpcMemAttachFailed;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
|
||||||
|
if (UsePrivateMemory)
|
||||||
|
memAddress = (char *) PrivateMemoryAttach(memId);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
area_info ai;
|
||||||
|
get_area_info(memId, &ai);
|
||||||
|
memAddress = (char *)ai.address;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (memAddress == (char *)-1) {
|
||||||
|
fprintf(stderr,"IpcMemoryAttach: failed to get area address (%d): %s\n",
|
||||||
|
memId, strerror(errno));
|
||||||
|
return IpcMemAttachFailed;
|
||||||
|
}
|
||||||
|
#endif /* __BEOS__ */
|
||||||
|
|
||||||
if (!UsePrivateMemory)
|
if (!UsePrivateMemory)
|
||||||
on_shmem_exit(IpcMemoryDetach, PointerGetDatum(memAddress));
|
on_shmem_exit(IpcMemoryDetach, PointerGetDatum(memAddress));
|
||||||
@ -642,6 +780,7 @@ IpcMemoryKill(IpcMemoryKey memKey)
|
|||||||
{
|
{
|
||||||
IpcMemoryId shmid;
|
IpcMemoryId shmid;
|
||||||
|
|
||||||
|
#ifndef __BEOS__
|
||||||
if (!UsePrivateMemory && (shmid = shmget(memKey, 0, 0)) >= 0)
|
if (!UsePrivateMemory && (shmid = shmget(memKey, 0, 0)) >= 0)
|
||||||
{
|
{
|
||||||
if (shmctl(shmid, IPC_RMID, (struct shmid_ds *) NULL) < 0)
|
if (shmctl(shmid, IPC_RMID, (struct shmid_ds *) NULL) < 0)
|
||||||
@ -650,6 +789,15 @@ IpcMemoryKill(IpcMemoryKey memKey)
|
|||||||
shmid, IPC_RMID);
|
shmid, IPC_RMID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
char areaname[32];
|
||||||
|
sprintf(areaname, "pgsql_ipc%ld", memKey);
|
||||||
|
shmid = find_area(areaname);
|
||||||
|
if (!UsePrivateMemory && shmid > 0) {
|
||||||
|
if (delete_area(shmid) != B_OK)
|
||||||
|
elog(NOTICE, "IpcMemoryKill: deleta_area(%d) failed!", shmid);
|
||||||
|
}
|
||||||
|
#endif /* __BEOS__ */
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAS_TEST_AND_SET
|
#ifdef HAS_TEST_AND_SET
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.81 2000/10/02 21:45:32 petere Exp $
|
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.82 2000/10/03 03:11:18 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -47,7 +47,7 @@
|
|||||||
* This is so that we can support more backends. (system-wide semaphore
|
* This is so that we can support more backends. (system-wide semaphore
|
||||||
* sets run out pretty fast.) -ay 4/95
|
* sets run out pretty fast.) -ay 4/95
|
||||||
*
|
*
|
||||||
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.81 2000/10/02 21:45:32 petere Exp $
|
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.82 2000/10/03 03:11:18 momjian Exp $
|
||||||
*/
|
*/
|
||||||
#include "postgres.h"
|
#include "postgres.h"
|
||||||
|
|
||||||
@ -65,7 +65,9 @@
|
|||||||
|
|
||||||
|
|
||||||
/* In Ultrix and QNX, sem.h must be included after ipc.h */
|
/* In Ultrix and QNX, sem.h must be included after ipc.h */
|
||||||
|
#ifdef HAVE_SYS_SEM_H
|
||||||
#include <sys/sem.h>
|
#include <sys/sem.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "storage/proc.h"
|
#include "storage/proc.h"
|
||||||
|
|
||||||
@ -264,8 +266,10 @@ InitProcess(IPCKey key)
|
|||||||
* we might be reusing a semaphore that belongs to a dead backend.
|
* we might be reusing a semaphore that belongs to a dead backend.
|
||||||
* So be careful and reinitialize its value here.
|
* So be careful and reinitialize its value here.
|
||||||
*/
|
*/
|
||||||
|
#ifndef __BEOS__
|
||||||
semun.val = IpcSemaphoreDefaultStartValue;
|
semun.val = IpcSemaphoreDefaultStartValue;
|
||||||
semctl(semId, semNum, SETVAL, semun);
|
semctl(semId, semNum, SETVAL, semun);
|
||||||
|
#endif
|
||||||
|
|
||||||
IpcSemaphoreLock(semId, semNum, IpcExclusiveLock);
|
IpcSemaphoreLock(semId, semNum, IpcExclusiveLock);
|
||||||
MyProc->sem.semId = semId;
|
MyProc->sem.semId = semId;
|
||||||
@ -515,7 +519,9 @@ SetWaitingForLock(bool waiting)
|
|||||||
void
|
void
|
||||||
LockWaitCancel(void)
|
LockWaitCancel(void)
|
||||||
{
|
{
|
||||||
struct itimerval timeval,
|
/* BeOS doesn't have setitimer, but has set_alarm */
|
||||||
|
#ifndef __BEOS__
|
||||||
|
struct itimerval timeval,
|
||||||
dummy;
|
dummy;
|
||||||
|
|
||||||
if (!lockWaiting)
|
if (!lockWaiting)
|
||||||
@ -524,6 +530,14 @@ LockWaitCancel(void)
|
|||||||
/* Deadlock timer off */
|
/* Deadlock timer off */
|
||||||
MemSet(&timeval, 0, sizeof(struct itimerval));
|
MemSet(&timeval, 0, sizeof(struct itimerval));
|
||||||
setitimer(ITIMER_REAL, &timeval, &dummy);
|
setitimer(ITIMER_REAL, &timeval, &dummy);
|
||||||
|
#else
|
||||||
|
if (!lockWaiting)
|
||||||
|
return;
|
||||||
|
lockWaiting = false;
|
||||||
|
/* Deadlock timer off */
|
||||||
|
set_alarm(B_INFINITE_TIMEOUT, B_PERIODIC_ALARM);
|
||||||
|
#endif /* __BEOS__ */
|
||||||
|
|
||||||
if (GetOffWaitqueue(MyProc))
|
if (GetOffWaitqueue(MyProc))
|
||||||
elog(ERROR, "Query cancel requested while waiting lock");
|
elog(ERROR, "Query cancel requested while waiting lock");
|
||||||
}
|
}
|
||||||
@ -555,8 +569,12 @@ ProcSleep(PROC_QUEUE *waitQueue,/* lock->waitProcs */
|
|||||||
bool selfConflict = (lockctl->conflictTab[token] & myMask),
|
bool selfConflict = (lockctl->conflictTab[token] & myMask),
|
||||||
prevSame = false;
|
prevSame = false;
|
||||||
bool deadlock_checked = false;
|
bool deadlock_checked = false;
|
||||||
|
#ifndef __BEOS__
|
||||||
struct itimerval timeval,
|
struct itimerval timeval,
|
||||||
dummy;
|
dummy;
|
||||||
|
#else
|
||||||
|
bigtime_t time_interval;
|
||||||
|
#endif
|
||||||
|
|
||||||
MyProc->token = token;
|
MyProc->token = token;
|
||||||
MyProc->waitLock = lock;
|
MyProc->waitLock = lock;
|
||||||
@ -635,9 +653,14 @@ ins:;
|
|||||||
* to 0.
|
* to 0.
|
||||||
* --------------
|
* --------------
|
||||||
*/
|
*/
|
||||||
|
#ifndef __BEOS__
|
||||||
MemSet(&timeval, 0, sizeof(struct itimerval));
|
MemSet(&timeval, 0, sizeof(struct itimerval));
|
||||||
timeval.it_value.tv_sec = DeadlockTimeout / 1000;
|
timeval.it_value.tv_sec = DeadlockTimeout / 1000;
|
||||||
timeval.it_value.tv_usec = (DeadlockTimeout % 1000) * 1000;
|
timeval.it_value.tv_usec = (DeadlockTimeout % 1000) * 1000;
|
||||||
|
#else
|
||||||
|
/* usecs */
|
||||||
|
time_interval = DeadlockTimeout * 1000000;
|
||||||
|
#endif
|
||||||
|
|
||||||
SetWaitingForLock(true);
|
SetWaitingForLock(true);
|
||||||
do
|
do
|
||||||
@ -645,7 +668,11 @@ ins:;
|
|||||||
MyProc->errType = NO_ERROR; /* reset flag after deadlock check */
|
MyProc->errType = NO_ERROR; /* reset flag after deadlock check */
|
||||||
|
|
||||||
if (!deadlock_checked)
|
if (!deadlock_checked)
|
||||||
|
#ifndef __BEOS__
|
||||||
if (setitimer(ITIMER_REAL, &timeval, &dummy))
|
if (setitimer(ITIMER_REAL, &timeval, &dummy))
|
||||||
|
#else
|
||||||
|
if (set_alarm(time_interval, B_ONE_SHOT_RELATIVE_ALARM) < 0)
|
||||||
|
#endif
|
||||||
elog(FATAL, "ProcSleep: Unable to set timer for process wakeup");
|
elog(FATAL, "ProcSleep: Unable to set timer for process wakeup");
|
||||||
deadlock_checked = true;
|
deadlock_checked = true;
|
||||||
|
|
||||||
@ -665,9 +692,13 @@ ins:;
|
|||||||
* We were awoken before a timeout - now disable the timer
|
* We were awoken before a timeout - now disable the timer
|
||||||
* ---------------
|
* ---------------
|
||||||
*/
|
*/
|
||||||
|
#ifndef __BEOS__
|
||||||
timeval.it_value.tv_sec = 0;
|
timeval.it_value.tv_sec = 0;
|
||||||
timeval.it_value.tv_usec = 0;
|
timeval.it_value.tv_usec = 0;
|
||||||
if (setitimer(ITIMER_REAL, &timeval, &dummy))
|
if (setitimer(ITIMER_REAL, &timeval, &dummy))
|
||||||
|
#else
|
||||||
|
if (set_alarm(B_INFINITE_TIMEOUT, B_PERIODIC_ALARM) < 0)
|
||||||
|
#endif
|
||||||
elog(FATAL, "ProcSleep: Unable to diable timer for process wakeup");
|
elog(FATAL, "ProcSleep: Unable to diable timer for process wakeup");
|
||||||
|
|
||||||
/* ----------------
|
/* ----------------
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.176 2000/10/02 19:42:53 petere Exp $
|
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.177 2000/10/03 03:11:19 momjian Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
* this is the "main" module of the postgres backend and
|
* this is the "main" module of the postgres backend and
|
||||||
@ -1397,7 +1397,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
|
|||||||
if (!IsUnderPostmaster)
|
if (!IsUnderPostmaster)
|
||||||
{
|
{
|
||||||
puts("\nPOSTGRES backend interactive interface ");
|
puts("\nPOSTGRES backend interactive interface ");
|
||||||
puts("$Revision: 1.176 $ $Date: 2000/10/02 19:42:53 $\n");
|
puts("$Revision: 1.177 $ $Date: 2000/10/03 03:11:19 $\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1730,7 +1730,8 @@ ShowUsage(void)
|
|||||||
(long int) user.tv_usec,
|
(long int) user.tv_usec,
|
||||||
(long int) sys.tv_sec,
|
(long int) sys.tv_sec,
|
||||||
(long int) sys.tv_usec);
|
(long int) sys.tv_usec);
|
||||||
#ifdef HAVE_GETRUSAGE
|
/* BeOS has rusage but only has some fields, and not these... */
|
||||||
|
#if defined(HAVE_GETRUSAGE) && !defined(__BEOS__)
|
||||||
fprintf(StatFp,
|
fprintf(StatFp,
|
||||||
"!\t%ld/%ld [%ld/%ld] filesystem blocks in/out\n",
|
"!\t%ld/%ld [%ld/%ld] filesystem blocks in/out\n",
|
||||||
r.ru_inblock - Save_r.ru_inblock,
|
r.ru_inblock - Save_r.ru_inblock,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/* ----------
|
/* ----------
|
||||||
* pg_lzcompress.c -
|
* pg_lzcompress.c -
|
||||||
*
|
*
|
||||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/pg_lzcompress.c,v 1.8 2000/07/20 14:23:28 wieck Exp $
|
* $Header: /cvsroot/pgsql/src/backend/utils/adt/pg_lzcompress.c,v 1.9 2000/10/03 03:11:20 momjian Exp $
|
||||||
*
|
*
|
||||||
* This is an implementation of LZ compression for PostgreSQL.
|
* This is an implementation of LZ compression for PostgreSQL.
|
||||||
* It uses a simple history table and generates 2-3 byte tags
|
* It uses a simple history table and generates 2-3 byte tags
|
||||||
@ -474,7 +474,7 @@ pglz_find_match(PGLZ_HistEntry **hstart, char *input, char *end,
|
|||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
pglz_compress(char *source, int slen, PGLZ_Header *dest, PGLZ_Strategy *strategy)
|
pglz_compress(char *source, int32 slen, PGLZ_Header *dest, PGLZ_Strategy *strategy)
|
||||||
{
|
{
|
||||||
int hist_next = 0;
|
int hist_next = 0;
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.62 2000/09/29 13:35:26 petere Exp $
|
* $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.63 2000/10/03 03:11:21 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -134,6 +134,8 @@ elog(int lev, const char *fmt, ...)
|
|||||||
if (lev <= DEBUG && Debugfile < 0)
|
if (lev <= DEBUG && Debugfile < 0)
|
||||||
return; /* ignore debug msgs if noplace to send */
|
return; /* ignore debug msgs if noplace to send */
|
||||||
|
|
||||||
|
/* BeOS doesn't have sys_nerr and should be able to use strerror()... */
|
||||||
|
#ifndef __BEOS__
|
||||||
/* save errno string for %m */
|
/* save errno string for %m */
|
||||||
if (errno < sys_nerr && errno >= 0)
|
if (errno < sys_nerr && errno >= 0)
|
||||||
errorstr = strerror(errno);
|
errorstr = strerror(errno);
|
||||||
@ -180,6 +182,9 @@ elog(int lev, const char *fmt, ...)
|
|||||||
prefix = prefix_buf;
|
prefix = prefix_buf;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
errorstr = strerror(errno);
|
||||||
|
#endif /* __BEOS__ */
|
||||||
|
|
||||||
timestamp_size = 0;
|
timestamp_size = 0;
|
||||||
if (Log_timestamp)
|
if (Log_timestamp)
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/utils/error/Attic/exc.c,v 1.30 2000/09/29 13:35:26 petere Exp $
|
* $Header: /cvsroot/pgsql/src/backend/utils/error/Attic/exc.c,v 1.31 2000/10/03 03:11:22 momjian Exp $
|
||||||
*
|
*
|
||||||
* NOTE
|
* NOTE
|
||||||
* XXX this code needs improvement--check for state violations and
|
* XXX this code needs improvement--check for state violations and
|
||||||
@ -131,7 +131,11 @@ ExcPrint(Exception *excP,
|
|||||||
|
|
||||||
fprintf(stderr, " (%ld)", detail);
|
fprintf(stderr, " (%ld)", detail);
|
||||||
|
|
||||||
|
#ifndef __BEOS__
|
||||||
if (errno > 0 && errno < sys_nerr)
|
if (errno > 0 && errno < sys_nerr)
|
||||||
|
#else
|
||||||
|
if (errno > 0)
|
||||||
|
#endif
|
||||||
fprintf(stderr, " [%s]", strerror(errno));
|
fprintf(stderr, " [%s]", strerror(errno));
|
||||||
else if (errno != 0)
|
else if (errno != 0)
|
||||||
fprintf(stderr, " [Error %d]", errno);
|
fprintf(stderr, " [Error %d]", errno);
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $Id: c.h,v 1.83 2000/10/02 17:15:55 momjian Exp $
|
* $Id: c.h,v 1.84 2000/10/03 03:11:22 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -56,7 +56,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sys/fcntl.h> /* ensure O_BINARY is available */
|
#include <sys/fcntl.h> /* ensure O_BINARY is available */
|
||||||
#endif
|
#endif
|
||||||
#ifdef __BEOS__
|
#ifdef HAVE_SUPPORTDEFS_H
|
||||||
#include <SupportDefs.h>
|
#include <SupportDefs.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -69,7 +69,11 @@
|
|||||||
* Boolean value, either true or false.
|
* Boolean value, either true or false.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#ifndef __BEOS__
|
|
||||||
|
/* BeOS defines bool already, but the compiler chokes on the
|
||||||
|
* #ifndef unless we wrap it in this check.
|
||||||
|
*/
|
||||||
|
#ifndef __BEOS__
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
#ifndef bool
|
#ifndef bool
|
||||||
typedef char bool;
|
typedef char bool;
|
||||||
@ -170,24 +174,22 @@ typedef char *Pointer;
|
|||||||
* used for numerical computations and the
|
* used for numerical computations and the
|
||||||
* frontend/backend protocol.
|
* frontend/backend protocol.
|
||||||
*/
|
*/
|
||||||
#ifndef __BEOS__
|
#ifndef __BEOS__ /* this shouldn't be required, but is is! */
|
||||||
typedef signed char int8; /* == 8 bits */
|
typedef signed char int8; /* == 8 bits */
|
||||||
typedef signed short int16; /* == 16 bits */
|
typedef signed short int16; /* == 16 bits */
|
||||||
typedef signed int int32; /* == 32 bits */
|
typedef signed int int32; /* == 32 bits */
|
||||||
#endif /* __BEOS__ */
|
#endif /* __BEOS__ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* uintN
|
* uintN
|
||||||
* Unsigned integer, EXACTLY N BITS IN SIZE,
|
* Unsigned integer, EXACTLY N BITS IN SIZE,
|
||||||
* used for numerical computations and the
|
* used for numerical computations and the
|
||||||
* frontend/backend protocol.
|
* frontend/backend protocol.
|
||||||
*/
|
*/
|
||||||
#ifndef __BEOS__
|
#ifndef __BEOS__ /* this shouldn't be required, but is is! */
|
||||||
typedef unsigned char uint8; /* == 8 bits */
|
typedef unsigned char uint8; /* == 8 bits */
|
||||||
typedef unsigned short uint16; /* == 16 bits */
|
typedef unsigned short uint16; /* == 16 bits */
|
||||||
typedef unsigned int uint32; /* == 32 bits */
|
typedef unsigned int uint32; /* == 32 bits */
|
||||||
#endif /* __BEOS__ */
|
#endif /* __BEOS__ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* floatN
|
* floatN
|
||||||
* Floating point number, AT LEAST N BITS IN SIZE,
|
* Floating point number, AT LEAST N BITS IN SIZE,
|
||||||
@ -268,8 +270,7 @@ typedef int32 int4;
|
|||||||
typedef float float4;
|
typedef float float4;
|
||||||
typedef double float8;
|
typedef double float8;
|
||||||
|
|
||||||
/* BeOS already has int64 defined, so skip these... */
|
#ifndef __BEOS__ /* this is already defined on BeOS */
|
||||||
#ifndef BEOS
|
|
||||||
#ifdef HAVE_LONG_INT_64
|
#ifdef HAVE_LONG_INT_64
|
||||||
/* Plain "long int" fits, use it */
|
/* Plain "long int" fits, use it */
|
||||||
typedef long int int64;
|
typedef long int int64;
|
||||||
@ -283,9 +284,7 @@ typedef long int int64;
|
|||||||
#define INT64_IS_BUSTED
|
#define INT64_IS_BUSTED
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#else /* Add BeOS support */
|
#endif /* __BEOS__ */
|
||||||
#include <SupportDefs.h>
|
|
||||||
#endif /* BEOS */
|
|
||||||
|
|
||||||
/* ----------------------------------------------------------------
|
/* ----------------------------------------------------------------
|
||||||
* Section 4: datum type + support macros
|
* Section 4: datum type + support macros
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* or in config.h afterwards. Of course, if you edit config.h, then your
|
* or in config.h afterwards. Of course, if you edit config.h, then your
|
||||||
* changes will be overwritten the next time you run configure.
|
* changes will be overwritten the next time you run configure.
|
||||||
*
|
*
|
||||||
* $Id: config.h.in,v 1.138 2000/10/02 17:15:55 momjian Exp $
|
* $Id: config.h.in,v 1.139 2000/10/03 03:11:23 momjian Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef CONFIG_H
|
#ifndef CONFIG_H
|
||||||
@ -342,15 +342,30 @@
|
|||||||
/* Set to 1 if you have <readline/readline.h> */
|
/* Set to 1 if you have <readline/readline.h> */
|
||||||
#undef HAVE_READLINE_READLINE_H
|
#undef HAVE_READLINE_READLINE_H
|
||||||
|
|
||||||
/* Define if you have <sys/ipc.h> */
|
/* Set to 1 if you have <sys/ipc.h> */
|
||||||
#undef HAVE_SYS_IPC_H
|
#undef HAVE_SYS_IPC_H
|
||||||
|
|
||||||
/* Set to 1 if you have <sys/select.h> */
|
/* Set to 1 if you have <sys/select.h> */
|
||||||
#undef HAVE_SYS_SELECT_H
|
#undef HAVE_SYS_SELECT_H
|
||||||
|
|
||||||
/* Set to 1 if you have <sys/un.h> */
|
/* Set to 1 if you have <sys/un.h> */
|
||||||
#undef HAVE_SYS_UN_H
|
#undef HAVE_SYS_UN_H
|
||||||
|
|
||||||
|
/* Set to 1 if you have <sys/sem.h> */
|
||||||
|
#undef HAVE_SYS_SEM_H
|
||||||
|
|
||||||
|
/* Set to 1 if you have <sys/shm.h> */
|
||||||
|
#undef HAVE_SYS_SHM_H
|
||||||
|
|
||||||
|
/* Set to 1 if you have <kernel/OS.h> */
|
||||||
|
#undef HAVE_KERNEL_OS_H
|
||||||
|
|
||||||
|
/* Set to 1 if you have <SupportDefs.h> */
|
||||||
|
#undef HAVE_SUPPORTDEFS_H
|
||||||
|
|
||||||
|
/* Set to 1 if you have <kernel/image.h> */
|
||||||
|
#undef HAVE_KERNEL_IMAGE_H
|
||||||
|
|
||||||
/* Set to 1 if you have <termios.h> */
|
/* Set to 1 if you have <termios.h> */
|
||||||
#undef HAVE_TERMIOS_H
|
#undef HAVE_TERMIOS_H
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
typedef unsigned char slock_t;
|
typedef unsigned char slock_t;
|
||||||
|
|
||||||
#define AF_UNIX 1
|
#define AF_UNIX 1 /* no domain sockets on BeOS */
|
||||||
#define IPPROTO_IP 0
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $Id: ipc.h,v 1.40 2000/10/02 19:42:56 petere Exp $
|
* $Id: ipc.h,v 1.41 2000/10/03 03:11:24 momjian Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
* This file is very architecture-specific. This stuff should actually
|
* This file is very architecture-specific. This stuff should actually
|
||||||
@ -27,7 +27,14 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#ifdef HAVE_SYS_IPC_H
|
#ifdef HAVE_SYS_IPC_H
|
||||||
#include <sys/ipc.h> /* For IPC_PRIVATE */
|
#include <sys/ipc.h> /* For IPC_PRIVATE */
|
||||||
#endif
|
#else
|
||||||
|
/* BeOS doesn't have IPC_PRIVATE so we'll use the value that is set by
|
||||||
|
* FreeBSD (1)
|
||||||
|
*/
|
||||||
|
#define IPC_PRIVATE 1
|
||||||
|
#endif /* HAVE_SYS_IPC_H */
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
#ifndef HAVE_UNION_SEMUN
|
#ifndef HAVE_UNION_SEMUN
|
||||||
union semun
|
union semun
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.134 2000/09/27 15:17:56 petere Exp $
|
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.135 2000/10/03 03:11:25 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -619,8 +619,11 @@ update_db_info(PGconn *conn)
|
|||||||
static int
|
static int
|
||||||
connectMakeNonblocking(PGconn *conn)
|
connectMakeNonblocking(PGconn *conn)
|
||||||
{
|
{
|
||||||
#ifndef WIN32
|
#ifdef WIN32
|
||||||
if (fcntl(conn->sock, F_SETFL, O_NONBLOCK) < 0)
|
if (fcntl(conn->sock, F_SETFL, O_NONBLOCK) < 0)
|
||||||
|
#elif defined(__BEOS__)
|
||||||
|
int on = 1;
|
||||||
|
if (ioctl(conn->sock, FIONBIO, &on) != 0)
|
||||||
#else
|
#else
|
||||||
int on = 1;
|
int on = 1;
|
||||||
|
|
||||||
@ -959,7 +962,6 @@ static int
|
|||||||
connectDBComplete(PGconn *conn)
|
connectDBComplete(PGconn *conn)
|
||||||
{
|
{
|
||||||
PostgresPollingStatusType flag = PGRES_POLLING_WRITING;
|
PostgresPollingStatusType flag = PGRES_POLLING_WRITING;
|
||||||
|
|
||||||
if (conn == NULL || conn->status == CONNECTION_BAD)
|
if (conn == NULL || conn->status == CONNECTION_BAD)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -1039,7 +1041,6 @@ PostgresPollingStatusType
|
|||||||
PQconnectPoll(PGconn *conn)
|
PQconnectPoll(PGconn *conn)
|
||||||
{
|
{
|
||||||
PGresult *res;
|
PGresult *res;
|
||||||
|
|
||||||
if (conn == NULL)
|
if (conn == NULL)
|
||||||
return PGRES_POLLING_FAILED;
|
return PGRES_POLLING_FAILED;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
AROPT:crs
|
AROPT:crs
|
||||||
SHARED_LIB:-fpic -DPIC
|
SHARED_LIB:-fpic -DPIC
|
||||||
CFLAGS:-O2 -DBEOS
|
CFLAGS:-O2
|
||||||
SRCH_INC:
|
SRCH_INC:
|
||||||
SRCH_LIB:
|
SRCH_LIB:
|
||||||
USE_LOCALE:no
|
USE_LOCALE:no
|
||||||
|
Loading…
Reference in New Issue
Block a user