On 2022-11-05 Sa 14:36, Andres Freund wrote:
>>
>> use Carp;
>> use Config;
>> -use Fcntl qw(:mode);
>> +use Fcntl qw(:mode :flock :seek O_CREAT O_RDWR);
> Does this do anything useful on windows?
All we're doing here on Windows and elsewhere is getting access to some
constants used in calls to flock(), seek() and sysopen(). It's not
actually doing anything else anywhere.
>
>> + if ($pid +0 > 0)
> Gotta love perl.
Think of it as a typecast.
>
>
>> + {
>> + if (kill 0, $pid)
> Does this work on windows?
>
Yes, it's supposed to. It doesn't actually send a signal, it checks if
the process exists. There's some suggestion it might give false
positives on Windows, but that won't really hurt us here, we'll just
look for a different port.
One possible addition would be to add removing the reservation files in
an END handler. That would be pretty simple.
cheers
andrew
--
Andrew Dunstan
EDB: https://www.enterprisedb.com