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
ee7fbb1e
Commit
ee7fbb1e
authored
Jan 09, 2004
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add WIN32 pipe implementation that uses sockets.
Claudio Natoli
parent
0d2148a7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
77 additions
and
7 deletions
+77
-7
configure
configure
+2
-1
configure.in
configure.in
+3
-2
src/backend/postmaster/pgstat.c
src/backend/postmaster/pgstat.c
+17
-4
src/port/pipe.c
src/port/pipe.c
+55
-0
No files found.
configure
View file @
ee7fbb1e
...
@@ -12227,7 +12227,8 @@ esac
...
@@ -12227,7 +12227,8 @@ esac
case
$host_os
in
mingw
*
)
case
$host_os
in
mingw
*
)
LIBOBJS
=
"
$LIBOBJS
dirmod.
$ac_objext
"
LIBOBJS
=
"
$LIBOBJS
dirmod.
$ac_objext
"
LIBOBJS
=
"
$LIBOBJS
copydir.
$ac_objext
"
LIBOBJS
=
"
$LIBOBJS
copydir.
$ac_objext
"
LIBOBJS
=
"
$LIBOBJS
gettimeofday.
$ac_objext
"
;;
LIBOBJS
=
"
$LIBOBJS
gettimeofday.
$ac_objext
"
LIBOBJS
=
"
$LIBOBJS
pipe.
$ac_objext
"
;;
esac
esac
if
test
"
$with_readline
"
=
yes
;
then
if
test
"
$with_readline
"
=
yes
;
then
...
...
configure.in
View file @
ee7fbb1e
dnl Process this file with autoconf to produce a configure script.
dnl Process this file with autoconf to produce a configure script.
dnl $PostgreSQL: pgsql/configure.in,v 1.3
09 2003/12/23 18:40:52 tgl
Exp $
dnl $PostgreSQL: pgsql/configure.in,v 1.3
10 2004/01/09 04:58:09 momjian
Exp $
dnl
dnl
dnl Developers, please strive to achieve this order:
dnl Developers, please strive to achieve this order:
dnl
dnl
...
@@ -924,7 +924,8 @@ esac
...
@@ -924,7 +924,8 @@ esac
case $host_os in mingw*)
case $host_os in mingw*)
AC_LIBOBJ(dirmod)
AC_LIBOBJ(dirmod)
AC_LIBOBJ(copydir)
AC_LIBOBJ(copydir)
AC_LIBOBJ(gettimeofday) ;;
AC_LIBOBJ(gettimeofday)
AC_LIBOBJ(pipe) ;;
esac
esac
if test "$with_readline" = yes; then
if test "$with_readline" = yes; then
...
...
src/backend/postmaster/pgstat.c
View file @
ee7fbb1e
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
*
*
* Copyright (c) 2001-2003, PostgreSQL Global Development Group
* Copyright (c) 2001-2003, PostgreSQL Global Development Group
*
*
* $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.5
1 2004/01/06 23:15:22
momjian Exp $
* $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.5
2 2004/01/09 04:58:09
momjian Exp $
* ----------
* ----------
*/
*/
#include "postgres.h"
#include "postgres.h"
...
@@ -135,6 +135,19 @@ static void pgstat_recv_tabpurge(PgStat_MsgTabpurge *msg, int len);
...
@@ -135,6 +135,19 @@ static void pgstat_recv_tabpurge(PgStat_MsgTabpurge *msg, int len);
static
void
pgstat_recv_dropdb
(
PgStat_MsgDropdb
*
msg
,
int
len
);
static
void
pgstat_recv_dropdb
(
PgStat_MsgDropdb
*
msg
,
int
len
);
static
void
pgstat_recv_resetcounter
(
PgStat_MsgResetcounter
*
msg
,
int
len
);
static
void
pgstat_recv_resetcounter
(
PgStat_MsgResetcounter
*
msg
,
int
len
);
/*
* WIN32 doesn't allow descriptors returned by pipe() to be used in select(),
* so for that platform we use socket() instead of pipe().
*/
#ifndef WIN32
#define pgpipe(a) pipe(a)
#define piperead(a,b,c) read(a,b,c)
#define pipewrite(a,b,c) write(a,b,c)
#else
/* pgpipe() is in /src/port */
#define piperead(a,b,c) recv(a,b,c,0)
#define pipewrite(a,b,c) send(a,b,c,0)
#endif
/* ------------------------------------------------------------
/* ------------------------------------------------------------
* Public functions called from postmaster follow
* Public functions called from postmaster follow
...
@@ -1380,7 +1393,7 @@ pgstat_main(PGSTAT_FORK_ARGS)
...
@@ -1380,7 +1393,7 @@ pgstat_main(PGSTAT_FORK_ARGS)
* two buffer processes competing to read from the UDP socket --- not
* two buffer processes competing to read from the UDP socket --- not
* good.
* good.
*/
*/
if
(
pipe
(
pgStatPipe
)
<
0
)
if
(
p
gp
ipe
(
pgStatPipe
)
<
0
)
{
{
ereport
(
LOG
,
ereport
(
LOG
,
(
errcode_for_socket_access
(),
(
errcode_for_socket_access
(),
...
@@ -1595,7 +1608,7 @@ pgstat_mainChild(PGSTAT_FORK_ARGS)
...
@@ -1595,7 +1608,7 @@ pgstat_mainChild(PGSTAT_FORK_ARGS)
while
(
nread
<
targetlen
)
while
(
nread
<
targetlen
)
{
{
len
=
read
(
readPipe
,
len
=
pipe
read
(
readPipe
,
((
char
*
)
&
msg
)
+
nread
,
((
char
*
)
&
msg
)
+
nread
,
targetlen
-
nread
);
targetlen
-
nread
);
if
(
len
<
0
)
if
(
len
<
0
)
...
@@ -1920,7 +1933,7 @@ pgstat_recvbuffer(void)
...
@@ -1920,7 +1933,7 @@ pgstat_recvbuffer(void)
if
(
xfr
>
msg_have
)
if
(
xfr
>
msg_have
)
xfr
=
msg_have
;
xfr
=
msg_have
;
Assert
(
xfr
>
0
);
Assert
(
xfr
>
0
);
len
=
write
(
writePipe
,
msgbuffer
+
msg_send
,
xfr
);
len
=
pipe
write
(
writePipe
,
msgbuffer
+
msg_send
,
xfr
);
if
(
len
<
0
)
if
(
len
<
0
)
{
{
if
(
errno
==
EINTR
||
errno
==
EAGAIN
)
if
(
errno
==
EINTR
||
errno
==
EAGAIN
)
...
...
src/port/pipe.c
0 → 100644
View file @
ee7fbb1e
/*-------------------------------------------------------------------------
*
* pipe.c
* pipe()
*
* Copyright (c) 1996-2003, 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
* $PostgreSQL: pgsql/src/port/pipe.c,v 1.1 2004/01/09 04:58:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
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
)
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
||
listen
(
s
,
1
)
==
SOCKET_ERROR
||
getsockname
(
s
,
(
SOCKADDR
*
)
&
serv_addr
,
&
len
)
==
SOCKET_ERROR
||
(
handles
[
1
]
=
socket
(
PF_INET
,
SOCK_STREAM
,
0
))
==
INVALID_SOCKET
)
{
closesocket
(
s
);
return
-
1
;
}
if
(
connect
(
handles
[
1
],
(
SOCKADDR
*
)
&
serv_addr
,
len
)
==
SOCKET_ERROR
||
(
handles
[
0
]
=
accept
(
s
,
(
SOCKADDR
*
)
&
serv_addr
,
&
len
))
==
INVALID_SOCKET
)
{
closesocket
(
handles
[
1
]);
handles
[
1
]
=
INVALID_SOCKET
;
closesocket
(
s
);
return
-
1
;
}
closesocket
(
s
);
return
0
;
}
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