Thread
-
Re: [HACKERS] SunOS patches
Tatsuo Ishii <t-ishii@sra.co.jp> — 1998-03-02T02:16:48Z
>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); } -
Re: [HACKERS] SunOS patches
Marc Fournier <scrappy@hub.org> — 1998-03-02T03:05:56Z
On Mon, 2 Mar 1998 t-ishii@sra.co.jp wrote: > > included are patches for Feb 26 snapshot. I hope these are the last > patches for SunOS port:-) Ack! > 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() What breaks by renaming this function?? :( Marc G. Fournier Systems Administrator @ hub.org primary: scrappy@hub.org secondary: scrappy@{freebsd|postgresql}.org -
Re: [HACKERS] SunOS patches
Thomas Lockhart <lockhart@alumni.caltech.edu> — 1998-03-02T03:23:51Z
The Hermit Hacker wrote: > On Mon, 2 Mar 1998 t-ishii@sra.co.jp wrote: > > > > > included are patches for Feb 26 snapshot. I hope these are the last > > patches for SunOS port:-) > > Ack! > > > 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() > > What breaks by renaming this function?? :( On my linux box: ... gcc -I../../include -I../../backend -I/usr/include/ncurses -I/usr/include/readline -O2 -m486 -Wall -Wmissing-prototypes -I.. -c pqcomm.c -o pqcomm.o pqcomm.c:569: warning: no previous prototype for `StreamDoUnlink' ... ipc.c: In function `exitpg': ipc.c:139: warning: implicit declaration of function `StreamDoUnlink' Seems to run OK though. Would like to get the warnings out of there for a release. I didn't pay attention to Tatsuo's earlier patches since they didn't directly affect my platform; where would these things be declared? Can Tatsuo come up with a few more patches to fix this up? It would be worth waiting a few hours on the release to get SunOS in there (the docs claim it is supported :) - Tom -
Re: [HACKERS] SunOS patches
Marc Fournier <scrappy@hub.org> — 1998-03-02T04:01:43Z
On Mon, 2 Mar 1998, Thomas G. Lockhart wrote: > gcc -I../../include -I../../backend -I/usr/include/ncurses > -I/usr/include/readline -O2 -m486 -Wall -Wmissing-prototypes -I.. -c > pqcomm.c -o pqcomm.o > pqcomm.c:569: warning: no previous prototype for `StreamDoUnlink' > ... > ipc.c: In function `exitpg': > ipc.c:139: warning: implicit declaration of function `StreamDoUnlink' > > Seems to run OK though. Would like to get the warnings out of there for a > release. I didn't pay attention to Tatsuo's earlier patches since they didn't > directly affect my platform; where would these things be declared? Can Tatsuo > come up with a few more patches to fix this up? It would be worth waiting a few > hours on the release to get SunOS in there (the docs claim it is supported :) What he said... :) Tatsuo...could you send me a clean patch that fixes the above and includes the last patch? I'll end up scrutinizing it in the morning, most likely, before applying it, but it would be nice to get it in before I bundle things... As long as I'm confident that it won't affect anything or anyone else :) Marc G. Fournier Systems Administrator @ hub.org primary: scrappy@hub.org secondary: scrappy@{freebsd|postgresql}.org