Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
d2c1740d
Commit
d2c1740d
authored
Mar 28, 2012
by
Andrew Dunstan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove now redundant pgpipe code.
parent
7313cc01
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
10 additions
and
124 deletions
+10
-124
src/backend/port/pipe.c
src/backend/port/pipe.c
+0
-95
src/backend/postmaster/syslogger.c
src/backend/postmaster/syslogger.c
+4
-4
src/bin/pg_basebackup/pg_basebackup.c
src/bin/pg_basebackup/pg_basebackup.c
+3
-3
src/include/port.h
src/include/port.h
+1
-20
src/port/exec.c
src/port/exec.c
+2
-1
src/tools/msvc/Mkvcbuild.pm
src/tools/msvc/Mkvcbuild.pm
+0
-1
No files found.
src/backend/port/pipe.c
deleted
100644 → 0
View file @
7313cc01
/*-------------------------------------------------------------------------
*
* pipe.c
* pipe()
*
* Copyright (c) 1996-2012, PostgreSQL Global Development Group
*
* This is a replacement version of pipe for Win32 which allows
* returned handles to be used in select(). Note that read/write calls
* must be replaced with recv/send.
*
* IDENTIFICATION
* src/backend/port/pipe.c
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
#ifdef WIN32
int
pgpipe
(
int
handles
[
2
])
{
SOCKET
s
;
struct
sockaddr_in
serv_addr
;
int
len
=
sizeof
(
serv_addr
);
handles
[
0
]
=
handles
[
1
]
=
INVALID_SOCKET
;
if
((
s
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
))
==
INVALID_SOCKET
)
{
ereport
(
LOG
,
(
errmsg_internal
(
"pgpipe could not create socket: %ui"
,
WSAGetLastError
())));
return
-
1
;
}
memset
((
void
*
)
&
serv_addr
,
0
,
sizeof
(
serv_addr
));
serv_addr
.
sin_family
=
AF_INET
;
serv_addr
.
sin_port
=
htons
(
0
);
serv_addr
.
sin_addr
.
s_addr
=
htonl
(
INADDR_LOOPBACK
);
if
(
bind
(
s
,
(
SOCKADDR
*
)
&
serv_addr
,
len
)
==
SOCKET_ERROR
)
{
ereport
(
LOG
,
(
errmsg_internal
(
"pgpipe could not bind: %ui"
,
WSAGetLastError
())));
closesocket
(
s
);
return
-
1
;
}
if
(
listen
(
s
,
1
)
==
SOCKET_ERROR
)
{
ereport
(
LOG
,
(
errmsg_internal
(
"pgpipe could not listen: %ui"
,
WSAGetLastError
())));
closesocket
(
s
);
return
-
1
;
}
if
(
getsockname
(
s
,
(
SOCKADDR
*
)
&
serv_addr
,
&
len
)
==
SOCKET_ERROR
)
{
ereport
(
LOG
,
(
errmsg_internal
(
"pgpipe could not getsockname: %ui"
,
WSAGetLastError
())));
closesocket
(
s
);
return
-
1
;
}
if
((
handles
[
1
]
=
socket
(
PF_INET
,
SOCK_STREAM
,
0
))
==
INVALID_SOCKET
)
{
ereport
(
LOG
,
(
errmsg_internal
(
"pgpipe could not create socket 2: %ui"
,
WSAGetLastError
())));
closesocket
(
s
);
return
-
1
;
}
if
(
connect
(
handles
[
1
],
(
SOCKADDR
*
)
&
serv_addr
,
len
)
==
SOCKET_ERROR
)
{
ereport
(
LOG
,
(
errmsg_internal
(
"pgpipe could not connect socket: %ui"
,
WSAGetLastError
())));
closesocket
(
s
);
return
-
1
;
}
if
((
handles
[
0
]
=
accept
(
s
,
(
SOCKADDR
*
)
&
serv_addr
,
&
len
))
==
INVALID_SOCKET
)
{
ereport
(
LOG
,
(
errmsg_internal
(
"pgpipe could not accept socket: %ui"
,
WSAGetLastError
())));
closesocket
(
handles
[
1
]);
handles
[
1
]
=
INVALID_SOCKET
;
closesocket
(
s
);
return
-
1
;
}
closesocket
(
s
);
return
0
;
}
int
piperead
(
int
s
,
char
*
buf
,
int
len
)
{
int
ret
=
recv
(
s
,
buf
,
len
,
0
);
if
(
ret
<
0
&&
WSAGetLastError
()
==
WSAECONNRESET
)
/* EOF on the pipe! (win32 socket based implementation) */
ret
=
0
;
return
ret
;
}
#endif
src/backend/postmaster/syslogger.c
View file @
d2c1740d
...
...
@@ -391,7 +391,7 @@ SysLoggerMain(int argc, char *argv[])
}
else
if
(
rc
>
0
&&
FD_ISSET
(
syslogPipe
[
0
],
&
rfds
))
{
bytesRead
=
pipe
read
(
syslogPipe
[
0
],
bytesRead
=
read
(
syslogPipe
[
0
],
logbuffer
+
bytes_in_logbuffer
,
sizeof
(
logbuffer
)
-
bytes_in_logbuffer
);
if
(
bytesRead
<
0
)
...
...
@@ -487,7 +487,7 @@ SysLogger_Start(void)
#ifndef WIN32
if
(
syslogPipe
[
0
]
<
0
)
{
if
(
p
gp
ipe
(
syslogPipe
)
<
0
)
if
(
pipe
(
syslogPipe
)
<
0
)
ereport
(
FATAL
,
(
errcode_for_socket_access
(),
(
errmsg
(
"could not create pipe for syslog: %m"
))));
...
...
src/bin/pg_basebackup/pg_basebackup.c
View file @
d2c1740d
...
...
@@ -162,7 +162,7 @@ segment_callback(XLogRecPtr segendpos, uint32 timeline)
char
xlogend
[
64
];
MemSet
(
xlogend
,
0
,
sizeof
(
xlogend
));
r
=
pipe
read
(
bgpipe
[
0
],
xlogend
,
sizeof
(
xlogend
));
r
=
read
(
bgpipe
[
0
],
xlogend
,
sizeof
(
xlogend
));
if
(
r
<
0
)
{
fprintf
(
stderr
,
_
(
"%s: could not read from ready pipe: %s
\n
"
),
...
...
@@ -270,7 +270,7 @@ StartLogStreamer(char *startpos, uint32 timeline, char *sysidentifier)
#ifndef WIN32
/* Create our background pipe */
if
(
p
gp
ipe
(
bgpipe
)
<
0
)
if
(
pipe
(
bgpipe
)
<
0
)
{
fprintf
(
stderr
,
_
(
"%s: could not create pipe for background process: %s
\n
"
),
progname
,
strerror
(
errno
));
...
...
@@ -1094,7 +1094,7 @@ BaseBackup(void)
fprintf
(
stderr
,
_
(
"%s: waiting for background process to finish streaming...
\n
"
),
progname
);
#ifndef WIN32
if
(
pipe
write
(
bgpipe
[
1
],
xlogend
,
strlen
(
xlogend
))
!=
strlen
(
xlogend
))
if
(
write
(
bgpipe
[
1
],
xlogend
,
strlen
(
xlogend
))
!=
strlen
(
xlogend
))
{
fprintf
(
stderr
,
_
(
"%s: could not send command to background pipe: %s
\n
"
),
progname
,
strerror
(
errno
));
...
...
src/include/port.h
View file @
d2c1740d
...
...
@@ -250,26 +250,7 @@ extern char *pgwin32_setlocale(int category, const char *locale);
/* Portable prompt handling */
extern
char
*
simple_prompt
(
const
char
*
prompt
,
int
maxlen
,
bool
echo
);
/*
* WIN32 doesn't allow descriptors returned by pipe() to be used in select(),
* so for that platform we use socket() instead of pipe().
* There is some inconsistency here because sometimes we require pg*, like
* pgpipe, but in other cases we define rename to pgrename just on Win32.
*/
#ifndef WIN32
/*
* The function prototypes are not supplied because every C file
* includes this file.
*/
#define pgpipe(a) pipe(a)
#define piperead(a,b,c) read(a,b,c)
#define pipewrite(a,b,c) write(a,b,c)
#else
extern
int
pgpipe
(
int
handles
[
2
]);
extern
int
piperead
(
int
s
,
char
*
buf
,
int
len
);
#define pipewrite(a,b,c) send(a,b,c,0)
#ifdef WIN32
#define PG_SIGNAL_COUNT 32
#define kill(pid,sig) pgkill(pid,sig)
extern
int
pgkill
(
int
pid
,
int
sig
);
...
...
src/port/exec.c
View file @
d2c1740d
...
...
@@ -496,7 +496,8 @@ pipe_read_line(char *cmd, char *line, int maxsize)
/*
* pclose() plus useful error reporting
* Is this necessary? bjm 2004-05-11
* It is better here because pipe.c has win32 backend linkage.
* Originaally this was stated to be here because pipe.c had backend linkage.
* Perhaps that's no longer so now we have got rid of pipe.c amd 2012-03-28
*/
int
pclose_check
(
FILE
*
stream
)
...
...
src/tools/msvc/Mkvcbuild.pm
View file @
d2c1740d
...
...
@@ -73,7 +73,6 @@ sub mkvcbuild
$postgres
->
ReplaceFile
('
src
\
backend
\
port
\
pg_shmem.c
','
src
\
backend
\
port
\
win32_shmem.c
');
$postgres
->
ReplaceFile
('
src
\
backend
\
port
\
pg_latch.c
','
src
\
backend
\
port
\
win32_latch.c
');
$postgres
->
AddFiles
('
src
\
port
',
@pgportfiles
);
$postgres
->
AddFile
('
src
\
backend
\
port
\
pipe.c
');
$postgres
->
AddDir
('
src
\
timezone
');
$postgres
->
AddFiles
('
src
\
backend
\
parser
','
scan.l
','
gram.y
');
$postgres
->
AddFiles
('
src
\
backend
\
bootstrap
','
bootscanner.l
','
bootparse.y
');
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment