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

Move non-blocking code into its own /port file, for code clarity.

This commit is contained in:
Bruce Momjian
2004-03-10 21:12:49 +00:00
parent ae22a6c185
commit 60a068b389
8 changed files with 53 additions and 39 deletions

View File

@@ -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(),

View File

@@ -37,7 +37,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.372 2004/03/09 05:11:52 momjian Exp $
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.373 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);