1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-12 05:01:15 +03:00

Remove NT-specific file open defines by defining our own open macros for

"rb" and "wb".
This commit is contained in:
Bruce Momjian
2000-06-02 15:57:44 +00:00
parent bf1c8f2b3b
commit cc2b5e5815
28 changed files with 590 additions and 348 deletions

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/file/fd.c,v 1.58 2000/06/02 03:58:32 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/file/fd.c,v 1.59 2000/06/02 15:57:24 momjian Exp $
*
* NOTES:
*
@@ -701,14 +701,8 @@ OpenTemporaryFile(void)
"pg_sorttemp%d.%ld", MyProcPid, tempFileCounter++);
/* Open the file */
#ifndef __CYGWIN32__
file = FileNameOpenFile(tempfilename,
O_RDWR | O_CREAT | O_TRUNC, 0600);
#else
file = FileNameOpenFile(tempfilename,
O_RDWR | O_CREAT | O_TRUNC | O_BINARY, 0600);
#endif
O_RDWR | O_CREAT | O_TRUNC | PG_BINARY, 0600);
if (file <= 0)
elog(ERROR, "Failed to create temporary file %s", tempfilename);

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.69 2000/06/02 03:58:33 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.70 2000/06/02 15:57:26 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -131,11 +131,7 @@ mdcreate(Relation reln)
Assert(reln->rd_unlinked && reln->rd_fd < 0);
path = relpath(RelationGetPhysicalRelationName(reln));
#ifndef __CYGWIN32__
fd = FileNameOpenFile(path, O_RDWR | O_CREAT | O_EXCL, 0600);
#else
fd = FileNameOpenFile(path, O_RDWR | O_CREAT | O_EXCL | O_BINARY, 0600);
#endif
fd = FileNameOpenFile(path, O_RDWR | O_CREAT | O_EXCL | PG_BINARY, 0600);
/*
* During bootstrap processing, we skip that check, because pg_time,
@@ -155,11 +151,7 @@ mdcreate(Relation reln)
reln->rd_rel->relkind == RELKIND_UNCATALOGED)
return -1;
#ifndef __CYGWIN32__
fd = FileNameOpenFile(path, O_RDWR, 0600);
#else
fd = FileNameOpenFile(path, O_RDWR | O_BINARY, 0600);
#endif
fd = FileNameOpenFile(path, O_RDWR | PG_BINARY, 0600);
if (fd < 0)
return -1;
if (!IsBootstrapProcessingMode())
@@ -332,23 +324,12 @@ mdopen(Relation reln)
Assert(reln->rd_fd < 0);
path = relpath(RelationGetPhysicalRelationName(reln));
#ifndef __CYGWIN32__
fd = FileNameOpenFile(path, O_RDWR, 0600);
#else
fd = FileNameOpenFile(path, O_RDWR | O_BINARY, 0600);
#endif
fd = FileNameOpenFile(path, O_RDWR | PG_BINARY, 0600);
if (fd < 0)
{
/* in bootstrap mode, accept mdopen as substitute for mdcreate */
if (IsBootstrapProcessingMode())
{
#ifndef __CYGWIN32__
fd = FileNameOpenFile(path, O_RDWR | O_CREAT | O_EXCL, 0600);
#else
fd = FileNameOpenFile(path, O_RDWR | O_CREAT | O_EXCL | O_BINARY, 0600);
#endif
}
fd = FileNameOpenFile(path, O_RDWR | O_CREAT | O_EXCL | PG_BINARY, 0600);
if (fd < 0)
{
elog(NOTICE, "mdopen: couldn't open %s: %m", path);
@@ -1004,11 +985,7 @@ _mdfd_openseg(Relation reln, int segno, int oflags)
fullpath = path;
/* open the file */
#ifndef __CYGWIN32__
fd = FileNameOpenFile(fullpath, O_RDWR | oflags, 0600);
#else
fd = FileNameOpenFile(fullpath, O_RDWR | O_BINARY | oflags, 0600);
#endif
fd = FileNameOpenFile(fullpath, O_RDWR | PG_BINARY | oflags, 0600);
pfree(fullpath);
@@ -1130,12 +1107,7 @@ _mdfd_blind_getseg(char *dbname, char *relname, Oid dbid, Oid relid,
#endif
/* call fd.c to allow other FDs to be closed if needed */
#ifndef __CYGWIN32__
fd = BasicOpenFile(path, O_RDWR, 0600);
#else
fd = BasicOpenFile(path, O_RDWR | O_BINARY, 0600);
#endif
fd = BasicOpenFile(path, O_RDWR | PG_BINARY, 0600);
if (fd < 0)
elog(DEBUG, "_mdfd_blind_getseg: couldn't open %s: %m", path);