mirror of
https://github.com/postgres/postgres.git
synced 2025-11-13 16:22:44 +03:00
Allow Win32 to compile under MinGW. Major changes are:
Win32 port is now called 'win32' rather than 'win'
add -lwsock32 on Win32
make gethostname() be only used when kerberos4 is enabled
use /port/getopt.c
new /port/opendir.c routines
disable GUC unix_socket_group on Win32
convert some keywords.c symbols to KEYWORD_P to prevent conflict
create new FCNTL_NONBLOCK macro to turn off socket blocking
create new /include/port.h file that has /port prototypes, move
out of c.h
new /include/port/win32_include dir to hold missing include files
work around ERROR being defined in Win32 includes
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/libpq/be-secure.c,v 1.31 2003/04/25 04:37:23 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/libpq/be-secure.c,v 1.32 2003/05/15 16:35:28 momjian Exp $
|
||||
*
|
||||
* Since the server static private key ($DataDir/server.key)
|
||||
* will normally be stored unencrypted so that the database
|
||||
@@ -85,16 +85,12 @@
|
||||
#include "libpq/libpq.h"
|
||||
#include "miscadmin.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#include "win32.h"
|
||||
#else
|
||||
#include <sys/socket.h>
|
||||
#include <unistd.h>
|
||||
#include <netdb.h>
|
||||
#include <netinet/in.h>
|
||||
#ifdef HAVE_NETINET_TCP_H
|
||||
#include <netinet/tcp.h>
|
||||
#endif
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.152 2003/04/25 01:24:00 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.153 2003/05/15 16:35:28 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -357,6 +357,9 @@ Setup_AF_UNIX(void)
|
||||
Assert(Unix_socket_group);
|
||||
if (Unix_socket_group[0] != '\0')
|
||||
{
|
||||
#ifdef WIN32
|
||||
elog(FATAL, "Config value 'unix_socket_group' not supported on this platform");
|
||||
#else
|
||||
char *endptr;
|
||||
unsigned long int val;
|
||||
gid_t gid;
|
||||
@@ -385,6 +388,7 @@ Setup_AF_UNIX(void)
|
||||
sock_path, strerror(errno));
|
||||
return STATUS_ERROR;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (chmod(sock_path, Unix_socket_permissions) == -1)
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/main/main.c,v 1.56 2002/11/08 20:23:56 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/main/main.c,v 1.57 2003/05/15 16:35:28 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -159,13 +159,14 @@ main(int argc, char *argv[])
|
||||
strcmp(argv[1], "--version") == 0 ||
|
||||
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...
|
||||
*/
|
||||
#ifndef __BEOS__
|
||||
if (geteuid() == 0)
|
||||
{
|
||||
fprintf(stderr, gettext(
|
||||
@@ -176,7 +177,7 @@ main(int argc, char *argv[])
|
||||
));
|
||||
exit(1);
|
||||
}
|
||||
#endif /* __BEOS__ */
|
||||
#endif /* !__BEOS__ */
|
||||
|
||||
/*
|
||||
* Also make sure that real and effective uids are the same.
|
||||
@@ -193,6 +194,7 @@ main(int argc, char *argv[])
|
||||
argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
#endif /* !WIN32 */
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -221,6 +223,7 @@ main(int argc, char *argv[])
|
||||
* specifying current userid as the "authenticated" Postgres user
|
||||
* name.
|
||||
*/
|
||||
#ifndef WIN32
|
||||
pw = getpwuid(geteuid());
|
||||
if (pw == NULL)
|
||||
{
|
||||
@@ -230,6 +233,18 @@ main(int argc, char *argv[])
|
||||
}
|
||||
/* Allocate new memory because later getpwuid() calls can overwrite it */
|
||||
pw_name_persist = strdup(pw->pw_name);
|
||||
#else
|
||||
{
|
||||
long namesize = 256 /* UNLEN */ + 1;
|
||||
|
||||
pw_name_persist = malloc(namesize);
|
||||
if (!GetUserName(pw_name_persist, &namesize))
|
||||
{
|
||||
fprintf(stderr, "%s: GetUserName failed\n", argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
exit(PostgresMain(argc, new_argv, pw_name_persist));
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.413 2003/05/04 00:03:55 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.414 2003/05/15 16:35:28 momjian Exp $
|
||||
*
|
||||
* HISTORY
|
||||
* AUTHOR DATE MAJOR EVENT
|
||||
@@ -322,12 +322,12 @@ static void doNegateFloat(Value *v);
|
||||
*/
|
||||
|
||||
/* ordinary key words in alphabetical order */
|
||||
%token <keyword> ABORT_P ABSOLUTE ACCESS ACTION ADD AFTER
|
||||
%token <keyword> ABORT_P ABSOLUTE_P ACCESS ACTION ADD AFTER
|
||||
AGGREGATE ALL ALTER ANALYSE ANALYZE AND ANY ARRAY AS ASC
|
||||
ASSERTION ASSIGNMENT AT AUTHORIZATION
|
||||
|
||||
BACKWARD BEFORE BEGIN_P BETWEEN BIGINT BINARY BIT
|
||||
BOOLEAN BOTH BY
|
||||
BOOLEAN_P BOTH BY
|
||||
|
||||
CACHE CALLED CASCADE CASE CAST CHAIN CHAR_P
|
||||
CHARACTER CHARACTERISTICS CHECK CHECKPOINT CLASS CLOSE
|
||||
@@ -336,9 +336,9 @@ static void doNegateFloat(Value *v);
|
||||
CREATEUSER CROSS CURRENT_DATE CURRENT_TIME
|
||||
CURRENT_TIMESTAMP CURRENT_USER CURSOR CYCLE
|
||||
|
||||
DATABASE DAY_P DEALLOCATE DEC DECIMAL DECLARE DEFAULT
|
||||
DATABASE DAY_P DEALLOCATE DEC DECIMAL_P DECLARE DEFAULT
|
||||
DEFERRABLE DEFERRED DEFINER DELETE_P DELIMITER DELIMITERS
|
||||
DESC DISTINCT DO DOMAIN_P DOUBLE DROP
|
||||
DESC DISTINCT DO DOMAIN_P DOUBLE_P DROP
|
||||
|
||||
EACH ELSE ENCODING ENCRYPTED END_P ESCAPE EXCEPT
|
||||
EXCLUSIVE EXECUTE EXISTS EXPLAIN EXTERNAL EXTRACT
|
||||
@@ -351,8 +351,8 @@ static void doNegateFloat(Value *v);
|
||||
HANDLER HAVING HOLD HOUR_P
|
||||
|
||||
ILIKE IMMEDIATE IMMUTABLE IMPLICIT_P IN_P INCREMENT
|
||||
INDEX INHERITS INITIALLY INNER_P INOUT INPUT
|
||||
INSENSITIVE INSERT INSTEAD INT INTEGER INTERSECT
|
||||
INDEX INHERITS INITIALLY INNER_P INOUT INPUT_P
|
||||
INSENSITIVE INSERT INSTEAD INT_P INTEGER INTERSECT
|
||||
INTERVAL INTO INVOKER IS ISNULL ISOLATION
|
||||
|
||||
JOIN
|
||||
@@ -373,18 +373,17 @@ static void doNegateFloat(Value *v);
|
||||
ORDER OUT_P OUTER_P OVERLAPS OVERLAY OWNER
|
||||
|
||||
PARTIAL PASSWORD PATH_P PENDANT PLACING POSITION
|
||||
PRECISION PRESERVE PREPARE PRIMARY PRIOR PRIVILEGES PROCEDURAL
|
||||
PROCEDURE
|
||||
PRECISION PRESERVE PREPARE PRIMARY
|
||||
PRIOR PRIVILEGES PROCEDURAL PROCEDURE
|
||||
|
||||
READ REAL RECHECK REFERENCES REINDEX RELATIVE RENAME REPLACE
|
||||
READ REAL RECHECK REFERENCES REINDEX RELATIVE_P RENAME REPLACE
|
||||
RESET RESTART RESTRICT RETURNS REVOKE RIGHT ROLLBACK ROW ROWS
|
||||
RULE
|
||||
|
||||
SCHEMA SCROLL SECOND_P SECURITY SELECT SEQUENCE
|
||||
SERIALIZABLE SESSION SESSION_USER SET SETOF SHARE
|
||||
SHOW SIMILAR SIMPLE SMALLINT SOME STABLE START STATEMENT
|
||||
STATISTICS STDIN STDOUT STORAGE STRICT SUBSTRING
|
||||
SYSID
|
||||
STATISTICS STDIN STDOUT STORAGE STRICT_P SUBSTRING SYSID
|
||||
|
||||
TABLE TEMP TEMPLATE TEMPORARY THEN TIME TIMESTAMP
|
||||
TO TOAST TRAILING TRANSACTION TREAT TRIGGER TRIM TRUE_P
|
||||
@@ -2675,14 +2674,14 @@ fetch_direction:
|
||||
n->howMany = -1;
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
| ABSOLUTE fetch_count
|
||||
| ABSOLUTE_P fetch_count
|
||||
{
|
||||
FetchStmt *n = makeNode(FetchStmt);
|
||||
n->direction = FETCH_ABSOLUTE;
|
||||
n->howMany = $2;
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
| RELATIVE fetch_count
|
||||
| RELATIVE_P fetch_count
|
||||
{
|
||||
FetchStmt *n = makeNode(FetchStmt);
|
||||
n->direction = FETCH_RELATIVE;
|
||||
@@ -3146,15 +3145,15 @@ createfunc_opt_item:
|
||||
{
|
||||
$$ = makeDefElem("volatility", (Node *)makeString("volatile"));
|
||||
}
|
||||
| CALLED ON NULL_P INPUT
|
||||
| CALLED ON NULL_P INPUT_P
|
||||
{
|
||||
$$ = makeDefElem("strict", (Node *)makeInteger(FALSE));
|
||||
}
|
||||
| RETURNS NULL_P ON NULL_P INPUT
|
||||
| RETURNS NULL_P ON NULL_P INPUT_P
|
||||
{
|
||||
$$ = makeDefElem("strict", (Node *)makeInteger(TRUE));
|
||||
}
|
||||
| STRICT
|
||||
| STRICT_P
|
||||
{
|
||||
$$ = makeDefElem("strict", (Node *)makeInteger(TRUE));
|
||||
}
|
||||
@@ -5077,7 +5076,7 @@ GenericType:
|
||||
* Provide real DECIMAL() and NUMERIC() implementations now - Jan 1998-12-30
|
||||
* - thomas 1997-09-18
|
||||
*/
|
||||
Numeric: INT
|
||||
Numeric: INT_P
|
||||
{
|
||||
$$ = SystemTypeName("int4");
|
||||
}
|
||||
@@ -5101,11 +5100,11 @@ Numeric: INT
|
||||
{
|
||||
$$ = $2;
|
||||
}
|
||||
| DOUBLE PRECISION
|
||||
| DOUBLE_P PRECISION
|
||||
{
|
||||
$$ = SystemTypeName("float8");
|
||||
}
|
||||
| DECIMAL opt_decimal
|
||||
| DECIMAL_P opt_decimal
|
||||
{
|
||||
$$ = SystemTypeName("numeric");
|
||||
$$->typmod = $2;
|
||||
@@ -5120,7 +5119,7 @@ Numeric: INT
|
||||
$$ = SystemTypeName("numeric");
|
||||
$$->typmod = $2;
|
||||
}
|
||||
| BOOLEAN
|
||||
| BOOLEAN_P
|
||||
{
|
||||
$$ = SystemTypeName("bool");
|
||||
}
|
||||
@@ -7179,7 +7178,7 @@ ColLabel: IDENT { $$ = $1; }
|
||||
*/
|
||||
unreserved_keyword:
|
||||
ABORT_P
|
||||
| ABSOLUTE
|
||||
| ABSOLUTE_P
|
||||
| ACCESS
|
||||
| ACTION
|
||||
| ADD
|
||||
@@ -7222,7 +7221,7 @@ unreserved_keyword:
|
||||
| DELIMITER
|
||||
| DELIMITERS
|
||||
| DOMAIN_P
|
||||
| DOUBLE
|
||||
| DOUBLE_P
|
||||
| DROP
|
||||
| EACH
|
||||
| ENCODING
|
||||
@@ -7248,7 +7247,7 @@ unreserved_keyword:
|
||||
| INDEX
|
||||
| INHERITS
|
||||
| INOUT
|
||||
| INPUT
|
||||
| INPUT_P
|
||||
| INSENSITIVE
|
||||
| INSERT
|
||||
| INSTEAD
|
||||
@@ -7299,7 +7298,7 @@ unreserved_keyword:
|
||||
| READ
|
||||
| RECHECK
|
||||
| REINDEX
|
||||
| RELATIVE
|
||||
| RELATIVE_P
|
||||
| RENAME
|
||||
| REPLACE
|
||||
| RESET
|
||||
@@ -7328,8 +7327,8 @@ unreserved_keyword:
|
||||
| STDIN
|
||||
| STDOUT
|
||||
| STORAGE
|
||||
| STRICT
|
||||
| SYSID
|
||||
| STRICT_P
|
||||
| TEMP
|
||||
| TEMPLATE
|
||||
| TEMPORARY
|
||||
@@ -7374,17 +7373,17 @@ unreserved_keyword:
|
||||
col_name_keyword:
|
||||
BIGINT
|
||||
| BIT
|
||||
| BOOLEAN
|
||||
| BOOLEAN_P
|
||||
| CHAR_P
|
||||
| CHARACTER
|
||||
| COALESCE
|
||||
| CONVERT
|
||||
| DEC
|
||||
| DECIMAL
|
||||
| DECIMAL_P
|
||||
| EXISTS
|
||||
| EXTRACT
|
||||
| FLOAT_P
|
||||
| INT
|
||||
| INT_P
|
||||
| INTEGER
|
||||
| INTERVAL
|
||||
| NCHAR
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.138 2003/04/08 23:20:02 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.139 2003/05/15 16:35:28 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -31,7 +31,7 @@
|
||||
static const ScanKeyword ScanKeywords[] = {
|
||||
/* name, value */
|
||||
{"abort", ABORT_P},
|
||||
{"absolute", ABSOLUTE},
|
||||
{"absolute", ABSOLUTE_P},
|
||||
{"access", ACCESS},
|
||||
{"action", ACTION},
|
||||
{"add", ADD},
|
||||
@@ -57,7 +57,7 @@ static const ScanKeyword ScanKeywords[] = {
|
||||
{"bigint", BIGINT},
|
||||
{"binary", BINARY},
|
||||
{"bit", BIT},
|
||||
{"boolean", BOOLEAN},
|
||||
{"boolean", BOOLEAN_P},
|
||||
{"both", BOTH},
|
||||
{"by", BY},
|
||||
{"cache", CACHE},
|
||||
@@ -99,7 +99,7 @@ static const ScanKeyword ScanKeywords[] = {
|
||||
{"day", DAY_P},
|
||||
{"deallocate", DEALLOCATE},
|
||||
{"dec", DEC},
|
||||
{"decimal", DECIMAL},
|
||||
{"decimal", DECIMAL_P},
|
||||
{"declare", DECLARE},
|
||||
{"default", DEFAULT},
|
||||
{"deferrable", DEFERRABLE},
|
||||
@@ -112,7 +112,7 @@ static const ScanKeyword ScanKeywords[] = {
|
||||
{"distinct", DISTINCT},
|
||||
{"do", DO},
|
||||
{"domain", DOMAIN_P},
|
||||
{"double", DOUBLE},
|
||||
{"double", DOUBLE_P},
|
||||
{"drop", DROP},
|
||||
{"each", EACH},
|
||||
{"else", ELSE},
|
||||
@@ -157,11 +157,11 @@ static const ScanKeyword ScanKeywords[] = {
|
||||
{"initially", INITIALLY},
|
||||
{"inner", INNER_P},
|
||||
{"inout", INOUT},
|
||||
{"input", INPUT},
|
||||
{"input", INPUT_P},
|
||||
{"insensitive", INSENSITIVE},
|
||||
{"insert", INSERT},
|
||||
{"instead", INSTEAD},
|
||||
{"int", INT},
|
||||
{"int", INT_P},
|
||||
{"integer", INTEGER},
|
||||
{"intersect", INTERSECT},
|
||||
{"interval", INTERVAL},
|
||||
@@ -246,7 +246,7 @@ static const ScanKeyword ScanKeywords[] = {
|
||||
{"recheck", RECHECK},
|
||||
{"references", REFERENCES},
|
||||
{"reindex", REINDEX},
|
||||
{"relative", RELATIVE},
|
||||
{"relative", RELATIVE_P},
|
||||
{"rename", RENAME},
|
||||
{"replace", REPLACE},
|
||||
{"reset", RESET},
|
||||
@@ -283,7 +283,7 @@ static const ScanKeyword ScanKeywords[] = {
|
||||
{"stdin", STDIN},
|
||||
{"stdout", STDOUT},
|
||||
{"storage", STORAGE},
|
||||
{"strict", STRICT},
|
||||
{"strict", STRICT_P},
|
||||
{"substring", SUBSTRING},
|
||||
{"sysid", SYSID},
|
||||
{"table", TABLE},
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
# be converted to Method 2.
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $Header: /cvsroot/pgsql/src/backend/port/Makefile,v 1.18 2002/07/27 20:10:05 petere Exp $
|
||||
# $Header: /cvsroot/pgsql/src/backend/port/Makefile,v 1.19 2003/05/15 16:35:29 momjian Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
@@ -26,7 +26,7 @@ OBJS+=dynloader.o pg_sema.o pg_shmem.o
|
||||
OBJS+=$(TAS)
|
||||
|
||||
ifeq ($(PORTNAME), qnx4)
|
||||
OBJS+=getrusage.o qnx4/SUBSYS.o
|
||||
OBJS+=qnx4/SUBSYS.o
|
||||
endif
|
||||
ifeq ($(PORTNAME), beos)
|
||||
OBJS+=beos/SUBSYS.o
|
||||
@@ -34,6 +34,9 @@ endif
|
||||
ifeq ($(PORTNAME), darwin)
|
||||
OBJS+=darwin/SUBSYS.o
|
||||
endif
|
||||
ifeq ($(PORTNAME), win32)
|
||||
OBJS+=win32/SUBSYS.o
|
||||
endif
|
||||
|
||||
all: SUBSYS.o
|
||||
|
||||
@@ -55,6 +58,11 @@ darwin/SUBSYS.o: darwin.dir
|
||||
darwin.dir:
|
||||
$(MAKE) -C darwin all
|
||||
|
||||
win32/SUBSYS.o: win32.dir
|
||||
|
||||
win32.dir:
|
||||
$(MAKE) -C win32 all
|
||||
|
||||
tas.o: tas.s
|
||||
$(CC) $(CFLAGS) -c $<
|
||||
|
||||
@@ -67,3 +75,5 @@ distclean clean:
|
||||
$(MAKE) -C beos clean
|
||||
$(MAKE) -C darwin clean
|
||||
$(MAKE) -C qnx4 clean
|
||||
$(MAKE) -C win32 clean
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Header: /cvsroot/pgsql/src/backend/port/dynloader/Attic/win.c,v 1.2 2003/03/21 17:18:34 petere Exp $ */
|
||||
/* $Header: /cvsroot/pgsql/src/backend/port/dynloader/win32.c,v 1.1 2003/05/15 16:35:29 momjian Exp $ */
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
#include "postgres.h"
|
||||
#include "storage/shmem.h"
|
||||
#include "sema.h"
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
@@ -131,7 +130,8 @@ semget(int semKey, int semNum, int flags)
|
||||
Size sem_set_size = sizeof(win32_sem_set_hdr) + semNum * (sizeof(HANDLE) + sizeof(int));
|
||||
HANDLE *sem_handles = NULL;
|
||||
int *sem_counts = NULL;
|
||||
|
||||
int i;
|
||||
|
||||
sec_attrs.nLength = sizeof(sec_attrs);
|
||||
sec_attrs.lpSecurityDescriptor = NULL;
|
||||
sec_attrs.bInheritHandle = TRUE;
|
||||
@@ -158,7 +158,7 @@ semget(int semKey, int semNum, int flags)
|
||||
sem_handles = (HANDLE *) ((off_t) new_set + new_set->m_semaphoreHandles);
|
||||
sem_counts = (int *) ((off_t) new_set + new_set->m_semaphoreCounts);
|
||||
|
||||
for (int i = 0; i < semNum && ans; ++i)
|
||||
for (i = 0; i < semNum && ans; ++i)
|
||||
{
|
||||
strcpy(num_part, _itoa(i, cur_num, 10));
|
||||
|
||||
@@ -186,8 +186,9 @@ semget(int semKey, int semNum, int flags)
|
||||
return MAKE_OFFSET(new_set);
|
||||
else
|
||||
{
|
||||
int i;
|
||||
/* Blow away what we've got right now... */
|
||||
for (int i = 0; i < semNum; ++i)
|
||||
for (i = 0; i < semNum; ++i)
|
||||
{
|
||||
if (sem_handles[i])
|
||||
CloseHandle(sem_handles[i]);
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*
|
||||
* Copyright (c) 2001-2003, PostgreSQL Global Development Group
|
||||
*
|
||||
* $Header: /cvsroot/pgsql/src/backend/postmaster/pgstat.c,v 1.35 2003/04/27 20:09:44 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/postmaster/pgstat.c,v 1.36 2003/05/15 16:35:29 momjian Exp $
|
||||
* ----------
|
||||
*/
|
||||
#include "postgres.h"
|
||||
@@ -217,7 +217,7 @@ pgstat_init(void)
|
||||
* messages will be discarded; backends won't block waiting to send
|
||||
* messages to the collector.
|
||||
*/
|
||||
if (fcntl(pgStatSock, F_SETFL, O_NONBLOCK) < 0)
|
||||
if (FCNTL_NONBLOCK(pgStatSock) < 0)
|
||||
{
|
||||
elog(LOG, "PGSTAT: fcntl() failed: %m");
|
||||
goto startup_failed;
|
||||
@@ -1520,7 +1520,7 @@ pgstat_recvbuffer(void)
|
||||
* Set the write pipe to nonblock mode, so that we cannot block when
|
||||
* the collector falls behind.
|
||||
*/
|
||||
if (fcntl(writePipe, F_SETFL, O_NONBLOCK) < 0)
|
||||
if (FCNTL_NONBLOCK(writePipe) < 0)
|
||||
{
|
||||
elog(LOG, "PGSTATBUFF: fcntl() failed: %m");
|
||||
exit(1);
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.327 2003/05/10 18:15:42 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.328 2003/05/15 16:35:29 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
*
|
||||
@@ -211,6 +211,11 @@ bool LogSourcePort;
|
||||
bool Log_connections = false;
|
||||
bool Db_user_namespace = false;
|
||||
|
||||
/* For FNCTL_NONBLOCK */
|
||||
#if defined(WIN32) || defined(__BEOS__)
|
||||
long ioctlsocket_ret;
|
||||
#endif
|
||||
|
||||
/* list of library:init-function to be preloaded */
|
||||
char *preload_libraries_string = NULL;
|
||||
|
||||
@@ -1708,6 +1713,9 @@ reaper(SIGNAL_ARGS)
|
||||
{
|
||||
int save_errno = errno;
|
||||
|
||||
#ifdef WIN32
|
||||
#warning fix waidpid for Win32
|
||||
#else
|
||||
#ifdef HAVE_WAITPID
|
||||
int status; /* backend exit status */
|
||||
|
||||
@@ -1807,6 +1815,7 @@ reaper(SIGNAL_ARGS)
|
||||
CleanupProc(pid, exitstatus);
|
||||
|
||||
} /* loop over pending child-death reports */
|
||||
#endif
|
||||
|
||||
if (FatalError)
|
||||
{
|
||||
@@ -2141,23 +2150,14 @@ report_fork_failure_to_client(Port *port, int errnum)
|
||||
{
|
||||
char buffer[1000];
|
||||
|
||||
#ifdef __BEOS__
|
||||
int on = 1;
|
||||
#endif
|
||||
|
||||
/* Format the error message packet */
|
||||
snprintf(buffer, sizeof(buffer), "E%s%s\n",
|
||||
gettext("Server process fork() failed: "),
|
||||
strerror(errnum));
|
||||
|
||||
/* Set port to non-blocking. Don't do send() if this fails */
|
||||
#ifdef __BEOS__
|
||||
if (ioctl(port->sock, FIONBIO, &on) != 0)
|
||||
if (FCNTL_NONBLOCK(port->sock) < 0)
|
||||
return;
|
||||
#else
|
||||
if (fcntl(port->sock, F_SETFL, O_NONBLOCK) < 0)
|
||||
return;
|
||||
#endif
|
||||
|
||||
send(port->sock, buffer, strlen(buffer) + 1, 0);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.129 2003/02/18 02:13:24 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.130 2003/05/15 16:35:29 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -944,6 +944,9 @@ ProcSendSignal(BackendId procId)
|
||||
bool
|
||||
enable_sig_alarm(int delayms, bool is_statement_timeout)
|
||||
{
|
||||
#ifdef WIN32
|
||||
# warning add Win32 timer
|
||||
#else
|
||||
struct timeval fin_time;
|
||||
#ifndef __BEOS__
|
||||
struct itimerval timeval;
|
||||
@@ -1012,7 +1015,7 @@ enable_sig_alarm(int delayms, bool is_statement_timeout)
|
||||
if (set_alarm(time_interval, B_ONE_SHOT_RELATIVE_ALARM) < 0)
|
||||
return false;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1026,6 +1029,9 @@ enable_sig_alarm(int delayms, bool is_statement_timeout)
|
||||
bool
|
||||
disable_sig_alarm(bool is_statement_timeout)
|
||||
{
|
||||
#ifdef WIN32
|
||||
#warning add Win32 timer
|
||||
#else
|
||||
/*
|
||||
* Always disable the interrupt if it is active; this avoids being
|
||||
* interrupted by the signal handler and thereby possibly getting
|
||||
@@ -1065,7 +1071,7 @@ disable_sig_alarm(bool is_statement_timeout)
|
||||
if (!CheckStatementTimeout())
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1098,6 +1104,9 @@ CheckStatementTimeout(void)
|
||||
else
|
||||
{
|
||||
/* Not time yet, so (re)schedule the interrupt */
|
||||
#ifdef WIN32
|
||||
#warning add win32 timer
|
||||
#else
|
||||
#ifndef __BEOS__
|
||||
struct itimerval timeval;
|
||||
|
||||
@@ -1120,6 +1129,7 @@ CheckStatementTimeout(void)
|
||||
(statement_fin_time.tv_usec - now.tv_usec);
|
||||
if (set_alarm(time_interval, B_ONE_SHOT_RELATIVE_ALARM) < 0)
|
||||
return false;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/init/Attic/findbe.c,v 1.32 2003/04/04 20:42:12 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/init/Attic/findbe.c,v 1.33 2003/05/15 16:35:29 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -44,9 +44,11 @@ static int
|
||||
ValidateBinary(char *path)
|
||||
{
|
||||
struct stat buf;
|
||||
#ifndef WIN32
|
||||
uid_t euid;
|
||||
struct group *gp;
|
||||
struct passwd *pwp;
|
||||
#endif
|
||||
int i;
|
||||
int is_r = 0;
|
||||
int is_x = 0;
|
||||
@@ -82,6 +84,11 @@ ValidateBinary(char *path)
|
||||
* Ensure that the file is both executable and readable (required for
|
||||
* dynamic loading).
|
||||
*/
|
||||
#ifdef WIN32
|
||||
is_r = buf.st_mode & S_IRUSR;
|
||||
is_x = buf.st_mode & S_IXUSR;
|
||||
return is_x ? (is_r ? 0 : -2) : -1;
|
||||
#else
|
||||
euid = geteuid();
|
||||
if (euid == buf.st_uid)
|
||||
{
|
||||
@@ -125,6 +132,7 @@ ValidateBinary(char *path)
|
||||
elog(DEBUG2, "ValidateBinary: \"%s\" is not other read/execute",
|
||||
path);
|
||||
return is_x ? (is_r ? 0 : -2) : -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Encoding names and routines for work with it. All
|
||||
* in this file is shared bedween FE and BE.
|
||||
*
|
||||
* $Id: encnames.c,v 1.12 2003/03/10 22:28:18 tgl Exp $
|
||||
* $Id: encnames.c,v 1.13 2003/05/15 16:35:29 momjian Exp $
|
||||
*/
|
||||
#ifdef FRONTEND
|
||||
#include "postgres_fe.h"
|
||||
@@ -13,11 +13,7 @@
|
||||
#include "utils/builtins.h"
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#include "win32.h"
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "mb/pg_wchar.h"
|
||||
#include <ctype.h>
|
||||
|
||||
Reference in New Issue
Block a user