Re: [HACKERS] SunOS patches

From: t-ishii(at)sra(dot)co(dot)jp
To: t-ishii(at)sra(dot)co(dot)jp
Cc: The Hermit Hacker <scrappy(at)hub(dot)org>, PostgreSQL HACKERS <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: [HACKERS] SunOS patches
Date: 1998-03-02 02:16:48
Message-ID: 199803020216.LAA28848@srapc451.sra.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)sra(dot)co(dot)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);
}

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message t-ishii 1998-03-02 02:37:04 Re: [HACKERS] Open 6.3 issues
Previous Message Thomas G. Lockhart 1998-03-02 01:54:24 Re: [DOCS] Re: [HACKERS] Re: [QUESTIONS] varchar vs text