FW: Win32 fix for miscinit.c

Started by Dave Pagealmost 22 years ago4 messagespatches
Jump to latest
#1Dave Page
dpage@pgadmin.org

More haste, less speed...

Patch attached this time!

/D

Show quoted text

-----Original Message-----
From: Dave Page
Sent: 04 October 2004 14:41
To: PostgreSQL-patches
Subject: Win32 fix for miscinit.c

Tom's recent patch to improve stale lockfile detection
included a call to getppid() which doesn't exist on Windows.
There is no clean way to implement one (previously discussed
on hackers-win32) hence the attach patch simply #ifdefs out the call.

Please apply ASAP as the win32 build is currently broken.

Regards, Dave

Attachments:

miscinit.diffapplication/octet-stream; name=miscinit.diffDownload+6-0
#2Andrew Dunstan
andrew@dunslane.net
In reply to: Dave Page (#1)
Re: FW: Win32 fix for miscinit.c

Ugh. *sigh*

I wondered idly if we might be able to make a safe assumption about the
staleness of the lockfile based on (possibly not very portably)
comparing its mtime with the system boot time.

cheers

andrew

Dave Page wrote:

Show quoted text

More haste, less speed...

Patch attached this time!

/D

-----Original Message-----
From: Dave Page
Sent: 04 October 2004 14:41
To: PostgreSQL-patches
Subject: Win32 fix for miscinit.c

Tom's recent patch to improve stale lockfile detection
included a call to getppid() which doesn't exist on Windows.
There is no clean way to implement one (previously discussed
on hackers-win32) hence the attach patch simply #ifdefs out the call.

Please apply ASAP as the win32 build is currently broken.

Regards, Dave

------------------------------------------------------------------------

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Dave Page (#1)
Re: FW: Win32 fix for miscinit.c

"Dave Page" <dpage@vale-housing.co.uk> writes:

Tom's recent patch to improve stale lockfile detection
included a call to getppid() which doesn't exist on Windows.
There is no clean way to implement one (previously discussed
on hackers-win32) hence the attach patch simply #ifdefs out the call.

Done. I think this is no real problem for Windows, since its
implementation of the kill(pid,0) check is not going to be fooled
by parent processes anyway.

regards, tom lane

#4Magnus Hagander
magnus@hagander.net
In reply to: Tom Lane (#3)
Re: FW: Win32 fix for miscinit.c

Tom's recent patch to improve stale lockfile detection included a
call to getppid() which doesn't exist on Windows.
There is no clean way to implement one (previously discussed on
hackers-win32) hence the attach patch simply #ifdefs out the call.

Done. I think this is no real problem for Windows, since its
implementation of the kill(pid,0) check is not going to be
fooled by parent processes anyway.

Correct. It will only catch an actual postgresql process.

Also, the logic was broken anyway since win32 assigns PIDs in a random
order and not sequential.. The probability you will get the same PID
after reboot is *very* low.

//mha