@@ -330,8 +330,7 @@ PostgresPollingStatusType PQconnectPoll(PGconn *conn);
330
330
socket underlying the database connection.
331
331
Loop thus: If <function>PQconnectPoll(conn)</function> last returned
332
332
<symbol>PGRES_POLLING_READING</symbol>, wait until the socket is ready to
333
- read (as indicated by <function>PQselect()</> or
334
- <function>PQselectExtended()</>).
333
+ read (as indicated by <function>PQselect()</>).
335
334
Then call <function>PQconnectPoll(conn)</function> again.
336
335
Conversely, if <function>PQconnectPoll(conn)</function> last returned
337
336
<symbol>PGRES_POLLING_WRITING</symbol>, wait until the socket is ready
@@ -1959,26 +1958,6 @@ int PQselect(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, str
1959
1958
</listitem>
1960
1959
</varlistentry>
1961
1960
1962
- <varlistentry id="libpq-pqselectextended">
1963
- <term><function>PQselectExtended</function><indexterm><primary>PQselectExtended</></></term>
1964
- <listitem>
1965
- <para>
1966
- Uses select(2) or poll(2) to wait for input. The <literal>timeout</>
1967
- argument specifies the number of milliseconds that
1968
- <function>PQselectExtended</> should block waiting for a file descriptor
1969
- of the connection to become ready. Specifying a negative value
1970
- in <literal>timeout</> means an infinite timeout. Specifying a
1971
- <literal>timeout</> of zero causes <function>poll()</> to return
1972
- immediately.
1973
-
1974
- <synopsis>
1975
- int PQselectExtended(const PGconn *conn, int timeout_ms);
1976
- </synopsis>
1977
-
1978
- </para>
1979
- </listitem>
1980
- </varlistentry>
1981
-
1982
1961
<varlistentry id="libpq-pqbackendpid">
1983
1962
<term><function>PQbackendPID</function><indexterm><primary>PQbackendPID</></></term>
1984
1963
<listitem>
@@ -2044,6 +2023,21 @@ int PQconnectionUsedPassword(const PGconn *conn);
2044
2023
</para>
2045
2024
</listitem>
2046
2025
</varlistentry>
2026
+
2027
+ <varlistentry id="libpq-pqisrsocket">
2028
+ <term><function>PQisRsocket</function><indexterm><primary>PQisRsocket</></></term>
2029
+ <listitem>
2030
+ <para>
2031
+ Returns true (1) if the connection uses <literal>rsocket</literal> API
2032
+ and false (0) otherwise.
2033
+
2034
+ <synopsis>
2035
+ int PQisRsocket(const PGconn *conn);
2036
+ </synopsis>
2037
+
2038
+ </para>
2039
+ </listitem>
2040
+ </varlistentry>
2047
2041
</variablelist>
2048
2042
</para>
2049
2043
@@ -4634,7 +4628,7 @@ int PQisBusy(PGconn *conn);
4634
4628
4635
4629
<para>
4636
4630
A typical application using these functions will have a main loop that
4637
- uses <function>PQselect()</function> or <function>PQselectExtended()</> to wait for
4631
+ uses <function>PQselect()</function> to wait for
4638
4632
all the conditions that it must respond to. One of the conditions
4639
4633
will be input available from the server, which in terms of
4640
4634
<function>PQselect()</function> means readable data on the file
@@ -5184,8 +5178,7 @@ typedef struct pgNotify
5184
5178
useful commands to execute is to call
5185
5179
<function>PQconsumeInput</function>, then check
5186
5180
<function>PQnotifies</function>. You can use
5187
- <function>PQselect()</function> or <function>PQselectExtended()</function>
5188
- to wait for data to arrive from the
5181
+ <function>PQselect()</function> to wait for data to arrive from the
5189
5182
server, thereby using no <acronym>CPU</acronym> power unless there is
5190
5183
something to do. (See <function>PQsocket</function> to obtain the file
5191
5184
descriptor number to use with <function>PQselect()</function>.) Note that
@@ -8433,6 +8426,10 @@ main(int argc, char **argv)
8433
8426
#include <errno.h>
8434
8427
#include <sys/time.h>
8435
8428
#include <sys/types.h>
8429
+ #ifdef HAVE_SYS_SELECT_H
8430
+ #include <sys/select.h>
8431
+ #endif
8432
+
8436
8433
#include "libpq-fe.h"
8437
8434
8438
8435
static void
@@ -8495,21 +8492,23 @@ main(int argc, char **argv)
8495
8492
{
8496
8493
/*
8497
8494
* Sleep until something happens on the connection. We use
8498
- * PQselectExtended to wait for input.
8495
+ * PQselect to wait for input.
8499
8496
*/
8500
8497
int sock;
8498
+ fd_set input_mask;
8501
8499
8502
8500
sock = PQsocket(conn);
8503
8501
8504
8502
if (sock < 0)
8505
- break; /* shouldn't happen */
8503
+ break; /* shouldn't happen */
8506
8504
8507
8505
FD_ZERO(&input_mask);
8508
8506
FD_SET(sock, &input_mask);
8509
8507
8510
- if (PQselectExtended(conn, -1) < 0)
8508
+ if (PQselect(sock + 1, &input_mask, NULL, NULL, NULL,
8509
+ PQisRsocket(conn)) < 0)
8511
8510
{
8512
- fprintf(stderr, "PQselectExtended () failed: %s\n", strerror(errno));
8511
+ fprintf(stderr, "PQselect () failed: %s\n", strerror(errno));
8513
8512
exit_nicely(conn);
8514
8513
}
8515
8514
0 commit comments