Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
d2c1740d
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d2c1740d
编写于
3月 28, 2012
作者:
A
Andrew Dunstan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove now redundant pgpipe code.
上级
7313cc01
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
10 addition
and
124 deletion
+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
未找到文件。
src/backend/port/pipe.c
已删除
100644 → 0
浏览文件 @
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
浏览文件 @
d2c1740d
...
...
@@ -391,9 +391,9 @@ SysLoggerMain(int argc, char *argv[])
}
else
if
(
rc
>
0
&&
FD_ISSET
(
syslogPipe
[
0
],
&
rfds
))
{
bytesRead
=
pipe
read
(
syslogPipe
[
0
],
logbuffer
+
bytes_in_logbuffer
,
sizeof
(
logbuffer
)
-
bytes_in_logbuffer
);
bytesRead
=
read
(
syslogPipe
[
0
],
logbuffer
+
bytes_in_logbuffer
,
sizeof
(
logbuffer
)
-
bytes_in_logbuffer
);
if
(
bytesRead
<
0
)
{
if
(
errno
!=
EINTR
)
...
...
@@ -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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
');
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录