Re: postmaster.pid

Поиск
Список
Период
Сортировка
От Magnus Hagander
Тема Re: postmaster.pid
Дата
Msg-id 6BCB9D8A16AC4241919521715F4D8BCE475B12@algol.sollentuna.se
обсуждение исходный текст
Список pgsql-hackers-win32
> > however I have an hour or so now so I'll take a quick look at the
> > kill() issue.
>
> OK, quick (untested) hack below. Open to suggestions if
> anyone's got a better way to do it...
>
> Regards, Dave
>
> Index: kill.c
> ===================================================================
> RCS file: /projects/cvsroot/pgsql-server/src/port/kill.c,v
> retrieving revision 1.2
> diff -u -r1.2 kill.c
> --- kill.c    24 Jun 2004 18:53:48 -0000    1.2
> +++ kill.c    24 Aug 2004 15:56:03 -0000
> @@ -25,8 +25,25 @@
>      BYTE        sigData = sig;
>      BYTE        sigRet = 0;
>      DWORD        bytes;
> +    DWORD        handle;
>
> -    if (sig >= PG_SIGNAL_COUNT || sig <= 0)
> +    /* Look, but don't touch... */
> +    if (sig == 0)
> +    {
> +        handle = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE,
> pid);
> +        if (!handle)
> +        {
> +            errno = EINVAL;
> +            return -1;
> +        }
> +        else
> +        {
> +            CloseHandle(handle);
> +            return 0;
> +        }
> +    }
> +
> +    /* Regular kill... */
> +    if (sig >= PG_SIGNAL_COUNT || sig < 0)
>      {
>          errno = EINVAL;
>          return -1;
>

I think it's better to call uor named pipe. That way we'll find out if
it's actually a postmaster of ours or a different process alltogether
there.
Just make sure the backend can deal with signal number = 0 and discard
that one (haven't got the code around to check right now, but it should
be a simple if-then-don't in the backend code, if it's not already
there. backend/port/win32/signal.c IIRC)

//Magnus

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: postmaster.pid
Следующее
От: Andrew Dunstan
Дата:
Сообщение: Re: postmaster.pid