Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
60a068b3
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,体验更适合开发者的 AI 搜索 >>
提交
60a068b3
编写于
3月 10, 2004
作者:
B
Bruce Momjian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move non-blocking code into its own /port file, for code clarity.
上级
ae22a6c1
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
53 addition
and
39 deletion
+53
-39
src/Makefile.global.in
src/Makefile.global.in
+2
-2
src/backend/postmaster/pgstat.c
src/backend/postmaster/pgstat.c
+3
-3
src/backend/postmaster/postmaster.c
src/backend/postmaster/postmaster.c
+2
-7
src/include/c.h
src/include/c.h
+1
-15
src/include/port.h
src/include/port.h
+4
-1
src/interfaces/libpq/Makefile
src/interfaces/libpq/Makefile
+4
-4
src/interfaces/libpq/fe-connect.c
src/interfaces/libpq/fe-connect.c
+2
-7
src/port/noblock.c
src/port/noblock.c
+35
-0
未找到文件。
src/Makefile.global.in
浏览文件 @
60a068b3
# -*-makefile-*-
# $PostgreSQL: pgsql/src/Makefile.global.in,v 1.17
5 2004/02/10 03:42:42 tgl
Exp $
# $PostgreSQL: pgsql/src/Makefile.global.in,v 1.17
6 2004/03/10 21:12:46 momjian
Exp $
#------------------------------------------------------------------------------
# All PostgreSQL makefiles include this file and use the variables it sets,
...
...
@@ -339,7 +339,7 @@ endif
#
# substitute implementations of the C library
LIBOBJS
=
@LIBOBJS@ path.o pgsleep.o sprompt.o thread.o
LIBOBJS
=
@LIBOBJS@
noblock.o
path.o pgsleep.o sprompt.o thread.o
ifneq
(,$(LIBOBJS))
LIBS
+=
-lpgport
...
...
src/backend/postmaster/pgstat.c
浏览文件 @
60a068b3
...
...
@@ -13,7 +13,7 @@
*
* Copyright (c) 2001-2003, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.
59 2004/03/09 05:11:52
momjian Exp $
* $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.
60 2004/03/10 21:12:46
momjian Exp $
* ----------
*/
#include "postgres.h"
...
...
@@ -327,7 +327,7 @@ pgstat_init(void)
* messages will be discarded; backends won't block waiting to send
* messages to the collector.
*/
if
(
FCNTL_NONBLOCK
(
pgStatSock
)
<
0
)
if
(
!
set_noblock
(
pgStatSock
)
)
{
ereport
(
LOG
,
(
errcode_for_socket_access
(),
...
...
@@ -1819,7 +1819,7 @@ pgstat_recvbuffer(void)
* Set the write pipe to nonblock mode, so that we cannot block when
* the collector falls behind.
*/
if
(
FCNTL_NONBLOCK
(
writePipe
)
<
0
)
if
(
!
set_noblock
(
writePipe
)
)
{
ereport
(
LOG
,
(
errcode_for_socket_access
(),
...
...
src/backend/postmaster/postmaster.c
浏览文件 @
60a068b3
...
...
@@ -37,7 +37,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.37
2 2004/03/09 05:11:52
momjian Exp $
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.37
3 2004/03/10 21:12:46
momjian Exp $
*
* NOTES
*
...
...
@@ -219,11 +219,6 @@ bool Db_user_namespace = false;
char
*
rendezvous_name
;
/* For FNCTL_NONBLOCK */
#if defined(WIN32) || defined(__BEOS__)
long
ioctlsocket_ret
=
1
;
#endif
/* list of library:init-function to be preloaded */
char
*
preload_libraries_string
=
NULL
;
...
...
@@ -2365,7 +2360,7 @@ report_fork_failure_to_client(Port *port, int errnum)
strerror
(
errnum
));
/* Set port to non-blocking. Don't do send() if this fails */
if
(
FCNTL_NONBLOCK
(
port
->
sock
)
<
0
)
if
(
!
set_noblock
(
port
->
sock
)
)
return
;
send
(
port
->
sock
,
buffer
,
strlen
(
buffer
)
+
1
,
0
);
...
...
src/include/c.h
浏览文件 @
60a068b3
...
...
@@ -12,7 +12,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/c.h,v 1.1
59 2004/01/10 23:39:51 neilc
Exp $
* $PostgreSQL: pgsql/src/include/c.h,v 1.1
60 2004/03/10 21:12:46 momjian
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -689,20 +689,6 @@ typedef NameData *Name;
#define PG_BINARY_W "w"
#endif
#if !defined(WIN32) && !defined(__BEOS__)
#define FCNTL_NONBLOCK(sock) fcntl(sock, F_SETFL, O_NONBLOCK)
#else
extern
long
ioctlsocket_ret
;
/* Returns non-0 on failure, while fcntl() returns -1 on failure */
#ifdef WIN32
#define FCNTL_NONBLOCK(sock) ((ioctlsocket(sock, FIONBIO, &ioctlsocket_ret) == 0) ? 0 : -1)
#endif
#ifdef __BEOS__
#define FCNTL_NONBLOCK(sock) ((ioctl(sock, FIONBIO, &ioctlsocket_ret) == 0) ? 0 : -1)
#endif
#endif
#if defined(sun) && defined(__sparc__) && !defined(__SVR4)
#include <unistd.h>
#endif
...
...
src/include/port.h
浏览文件 @
60a068b3
...
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/port.h,v 1.2
1 2004/03/09 04:49:02
momjian Exp $
* $PostgreSQL: pgsql/src/include/port.h,v 1.2
2 2004/03/10 21:12:46
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -17,6 +17,9 @@
#include <netdb.h>
#endif
/* non-blocking */
bool
set_noblock
(
int
sock
);
/* Portable path handling for Unix/Win32 */
extern
bool
is_absolute_path
(
const
char
*
filename
);
extern
char
*
first_path_separator
(
const
char
*
filename
);
...
...
src/interfaces/libpq/Makefile
浏览文件 @
60a068b3
...
...
@@ -4,7 +4,7 @@
#
# Copyright (c) 1994, Regents of the University of California
#
# $PostgreSQL: pgsql/src/interfaces/libpq/Makefile,v 1.9
7 2004/02/02 00:11:31
momjian Exp $
# $PostgreSQL: pgsql/src/interfaces/libpq/Makefile,v 1.9
8 2004/03/10 21:12:46
momjian Exp $
#
#-------------------------------------------------------------------------
...
...
@@ -23,7 +23,7 @@ override CPPFLAGS := -I$(srcdir) $(CPPFLAGS) $(THREAD_CPPFLAGS) -DFRONTEND -DSYS
OBJS
=
fe-auth.o fe-connect.o fe-exec.o fe-misc.o fe-print.o fe-lobj.o
\
fe-protocol2.o fe-protocol3.o pqexpbuffer.o pqsignal.o fe-secure.o
\
dllist.o md5.o ip.o wchar.o encnames.o
\
$(
filter
crypt.o getaddrinfo.o inet_aton.o snprintf.o strerror.o path.o thread.o,
$(LIBOBJS)
)
$(
filter
crypt.o getaddrinfo.o inet_aton.o
nonblock.o
snprintf.o strerror.o path.o thread.o,
$(LIBOBJS)
)
ifeq
($(PORTNAME), win32)
OBJS
+=
win32.o
endif
...
...
@@ -52,7 +52,7 @@ backend_src = $(top_srcdir)/src/backend
# For port modules, this only happens if configure decides the module
# is needed (see filter hack in OBJS, above).
crypt.c getaddrinfo.c inet_aton.c snprintf.c strerror.c path.c thread.c
:
% : $(top_srcdir)/src/port/%
crypt.c getaddrinfo.c inet_aton.c
nonblock.c
snprintf.c strerror.c path.c thread.c
:
% : $(top_srcdir)/src/port/%
rm
-f
$@
&&
$(LN_S)
$<
.
md5.c ip.c
:
% : $(backend_src)/libpq/%
...
...
@@ -78,4 +78,4 @@ uninstall: uninstall-lib
rm
-f
$(DESTDIR)$(includedir)
/libpq-fe.h
$(DESTDIR)$(includedir_internal)
/libpq-int.h
$(DESTDIR)$(includedir_internal)
/pqexpbuffer.h
clean distclean maintainer-clean
:
clean-lib
rm
-f
$(OBJS)
crypt.c getaddrinfo.c inet_aton.c snprintf.c strerror.c path.c thread.c dllist.c md5.c ip.c encnames.c wchar.c
rm
-f
$(OBJS)
crypt.c getaddrinfo.c inet_aton.c
nonblock.c
snprintf.c strerror.c path.c thread.c dllist.c md5.c ip.c encnames.c wchar.c
src/interfaces/libpq/fe-connect.c
浏览文件 @
60a068b3
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.26
7 2004/01/09 02:02:43
momjian Exp $
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.26
8 2004/03/10 21:12:47
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -50,11 +50,6 @@
#include "libpq/ip.h"
#include "mb/pg_wchar.h"
/* For FNCTL_NONBLOCK */
#if defined(WIN32) || defined(__BEOS__)
long
ioctlsocket_ret
=
1
;
#endif
#define PGPASSFILE ".pgpass"
/* fall back options if they are not specified by arguments or defined
...
...
@@ -779,7 +774,7 @@ update_db_info(PGconn *conn)
static
int
connectMakeNonblocking
(
PGconn
*
conn
)
{
if
(
FCNTL_NONBLOCK
(
conn
->
sock
)
<
0
)
if
(
!
set_noblock
(
conn
->
sock
)
)
{
char
sebuf
[
256
];
...
...
src/port/noblock.c
0 → 100644
浏览文件 @
60a068b3
/*-------------------------------------------------------------------------
*
* noblock.c
* set a file descriptor as non-blocking
*
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/port/noblock.c,v 1.1 2004/03/10 21:12:49 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
#include <sys/types.h>
#include <fcntl.h>
bool
set_noblock
(
int
sock
)
{
#if !defined(WIN32) && !defined(__BEOS__)
return
(
fcntl
(
sock
,
F_SETFL
,
O_NONBLOCK
)
!=
-
1
);
#else
long
ioctlsocket_ret
=
1
;
/* Returns non-0 on failure, while fcntl() returns -1 on failure */
#ifdef WIN32
return
(
ioctlsocket
(
sock
,
FIONBIO
,
&
ioctlsocket_ret
)
==
0
);
#endif
#ifdef __BEOS__
return
(
ioctl
(
sock
,
FIONBIO
,
&
ioctlsocket_ret
)
==
0
);
#endif
#endif
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录