]> granicus.if.org Git - postgresql/blobdiff - src/backend/libpq/pqcomm.c
From: t-ishii@sra.co.jp
[postgresql] / src / backend / libpq / pqcomm.c
index 710fe8184ba99cad9f5fbe2601c2ad84da926315..56f0fd658e99a40969c90891c09e56c3fda7f14c 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.46 1998/06/21 16:39:10 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.50 1998/07/26 04:30:28 scrappy Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -30,7 +30,6 @@
  *             pq_getinserv    - initialize address from host and service name
  *             pq_connect              - create remote input / output connection
  *             pq_accept               - accept remote input / output connection
- *             pq_async_notify - receive notification from backend.
  *
  * NOTES
  *             These functions are used by both frontend applications and
@@ -68,8 +67,8 @@
 #include "libpq/auth.h"
 #include "libpq/libpq.h"               /* where the declarations go */
 #include "storage/ipc.h"
-#ifdef MB
-#include "commands/variable.h"
+#ifdef MULTIBYTE
+#include "mb/pg_wchar.h"
 #endif
 
 /* ----------------
@@ -79,7 +78,6 @@
 FILE      *Pfout,
                   *Pfin;
 FILE      *Pfdebug;                    /* debugging libpq */
-int                    PQAsyncNotifyWaiting;           /* for async. notification */
 
 /* --------------------------------
  *             pq_init - open portal file descriptors
@@ -160,9 +158,7 @@ pq_close()
                fclose(Pfout);
                Pfout = NULL;
        }
-       PQAsyncNotifyWaiting = 0;
        PQnotifies_init();
-       pq_unregoob();
 }
 
 /* --------------------------------
@@ -185,7 +181,7 @@ pq_getstr(char *s, int maxlen)
 {
        int                     c = '\0';
 
-#ifdef MB
+#ifdef MULTIBYTE
        unsigned char *p, *ps;
        int len;
 
@@ -203,7 +199,7 @@ pq_getstr(char *s, int maxlen)
                *s++ = c;
        *s = '\0';
 
-#ifdef MB
+#ifdef MULTIBYTE
        p = pg_client_to_server(ps, len);
        if (ps != p) {  /* actual conversion has been done? */
          strcpy(ps, p);
@@ -345,7 +341,7 @@ pq_getint(int b)
 void
 pq_putstr(char *s)
 {
-#ifdef MB
+#ifdef MULTIBYTE
         unsigned char *p;
 
         p = pg_server_to_client(s, strlen(s));
@@ -418,29 +414,6 @@ pq_putint(int i, int b)
        }
 }
 
-/* ---
- *        pq_sendoob - send a string over the out-of-band channel
- *        pq_recvoob - receive a string over the oob channel
- *     NB: Fortunately, the out-of-band channel doesn't conflict with
- *             buffered I/O because it is separate from regular com. channel.
- * ---
- */
-int
-pq_sendoob(char *msg, int len)
-{
-       int                     fd = fileno(Pfout);
-
-       return send(fd, msg, len, MSG_OOB);
-}
-
-int
-pq_recvoob(char *msgPtr, int len)
-{
-       int                     fd = fileno(Pfout);
-
-       return recv(fd, msgPtr, len, MSG_OOB);
-}
-
 /* --------------------------------
  *             pq_getinaddr - initialize address from host and port number
  * --------------------------------
@@ -507,55 +480,6 @@ pq_getinserv(struct sockaddr_in * sin, char *host, char *serv)
        return (pq_getinaddr(sin, host, ntohs(ss->s_port)));
 }
 
-/*
- * register an out-of-band listener proc--at most one allowed.
- * This is used for receiving async. notification from the backend.
- */
-void
-pq_regoob(void (*fptr) ())
-{
-       int                     fd = fileno(Pfout);
-
-#if defined(hpux)
-       ioctl(fd, FIOSSAIOOWN, MyProcPid);
-#elif defined(sco)
-       ioctl(fd, SIOCSPGRP, MyProcPid);
-#else
-       fcntl(fd, F_SETOWN, MyProcPid);
-#endif                                                 /* hpux */
-       pqsignal(SIGURG, fptr);
-}
-
-void
-pq_unregoob()
-{
-       pqsignal(SIGURG, SIG_DFL);
-}
-
-
-void
-pq_async_notify()
-{
-       char            msg[20];
-
-       /* int len = sizeof(msg); */
-       int                     len = 20;
-
-       if (pq_recvoob(msg, len) >= 0)
-       {
-               /* debugging */
-               printf("received notification: %s\n", msg);
-               PQAsyncNotifyWaiting = 1;
-               /* PQappendNotify(msg+1); */
-       }
-       else
-       {
-               extern int      errno;
-
-               printf("SIGURG but no data: len = %d, err=%d\n", len, errno);
-       }
-}
-
 /*
  * Streams -- wrapper around Unix socket system calls
  *
@@ -620,7 +544,7 @@ StreamServerPort(char *hostName, short portName, int *fdP)
                pqdebug("%s", PQerrormsg);
                return (STATUS_ERROR);
        }
-       bzero(&saddr, sizeof(saddr));
+       MemSet((char *) &saddr, 0, sizeof(saddr));
        saddr.sa.sa_family = family;
        if (family == AF_UNIX)
        {
@@ -650,7 +574,7 @@ StreamServerPort(char *hostName, short portName, int *fdP)
        }
 
        if (family == AF_UNIX)
-               on_exitpg(StreamDoUnlink, NULL);
+               on_proc_exit(StreamDoUnlink, NULL);
 
        listen(fd, SOMAXCONN);
 
@@ -816,7 +740,7 @@ StreamOpen(char *hostName, short portName, Port *port)
        return (STATUS_OK);
 }
 
-#ifdef MB
+#ifdef MULTIBYTE
 void
 pq_putncharlen(char *s, int n)
 {