Re: [HACKERS] SunOS patches

Поиск
Список
Период
Сортировка
От t-ishii@sra.co.jp
Тема Re: [HACKERS] SunOS patches
Дата
Msg-id 199803020216.LAA28848@srapc451.sra.co.jp
обсуждение исходный текст
Ответ на SunOS patches  (t-ishii@sra.co.jp)
Ответы Re: [HACKERS] SunOS patches  (The Hermit Hacker <scrappy@hub.org>)
Список pgsql-hackers
>o changed backend/libpq/pqcomm.c. It uses atexit() to unlink an Unix
>domain socket when postmaster exits. Again unfortunately SunOS does
>not have it. Looking for an alternative, I found a general exiting
>callback manager called on_exitpg() has already existed in PostgreSQL!
>So I replaced atexit() with on_exitpg().

I found my previous patches for backend/libpq/pqcomm.c did not work if
backend crashed accidentaly (yes, I found yet another SQL commands to
crash the backend, but it's an another story). If the backend dies
abnormally (SEGFALUT etc.)  postmaster calls functions registered by
on_exitpg(). This is ok. Problem is postmaster does not exits in that
case and leaves the socket file with link counter 0! Too bad. It seems
the only solution that would work with both SunOS and other platforms
is let exitpg() call do_unlink() in backend/libpq/pqcomm.c (note that
exitpg() is the only function calling exit()).

included are patches for Feb 26 snapshot. I hope these are the last
patches for SunOS port:-)

P.S. I didn't see my patches to tempalte/.similar in Mar 1
snapshot. Should I repost the patches?
---
Tatsuo Ishii
t-ishii@sra.co.jp
----------------------------------------------------------------------
*** backend/libpq/pqcomm.c.orig    Fri Feb 27 14:07:52 1998
--- backend/libpq/pqcomm.c    Fri Feb 27 14:08:50 1998
***************
*** 564,571 ****
   * Shutdown routine for backend connection
   * If a Unix socket is used for communication, explicitly close it.
   */
! static void
! do_unlink()
  {
      if (sock_path[0])
          unlink(sock_path);
--- 564,571 ----
   * Shutdown routine for backend connection
   * If a Unix socket is used for communication, explicitly close it.
   */
! void
! StreamDoUnlink()
  {
      if (sock_path[0])
          unlink(sock_path);
***************
*** 645,651 ****
      if (family == AF_UNIX)
      {
          chmod(sock_path, 0777);
-         atexit(do_unlink);
      }
      return (STATUS_OK);
  }
--- 645,650 ----
*** backend/storage/ipc/ipc.c.orig    Fri Feb 27 14:09:12 1998
--- backend/storage/ipc/ipc.c    Fri Feb 27 14:09:26 1998
***************
*** 136,141 ****
--- 136,142 ----
      for (i = onexit_index - 1; i >= 0; --i)
          (*onexit_list[i].function) (code, onexit_list[i].arg);

+      StreamDoUnlink();
      exit(code);
  }


В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Thomas G. Lockhart"
Дата:
Сообщение: Re: [DOCS] Re: [HACKERS] Re: [QUESTIONS] varchar vs text
Следующее
От: t-ishii@sra.co.jp
Дата:
Сообщение: Re: [HACKERS] Open 6.3 issues