1 /*-------------------------------------------------------------------------
6 * Copyright (c) 1996-2009, PostgreSQL Global Development Group
8 * This is a replacement version of kill for Win32 which sends
9 * signals that the backend can recognize.
14 *-------------------------------------------------------------------------
22 pgkill(int pid
, int sig
)
30 /* we allow signal 0 here, but it will be ignored in pg_queue_signal */
31 if (sig
>= PG_SIGNAL_COUNT
|| sig
< 0)
38 /* No support for process groups */
42 snprintf(pipename
, sizeof(pipename
), "\\\\.\\pipe\\pgsignal_%u", pid
);
45 * Writing data to the named pipe can fail for transient reasons.
46 * Therefore, it is useful to retry if it fails. The maximum number of
47 * calls to make was empirically determined from a 90-hour notification
50 for (pipe_tries
= 0; pipe_tries
< 3; pipe_tries
++)
52 if (CallNamedPipe(pipename
, &sigData
, 1, &sigRet
, 1, &bytes
, 1000))
54 if (bytes
!= 1 || sigRet
!= sig
)
63 if (GetLastError() == ERROR_FILE_NOT_FOUND
)
65 else if (GetLastError() == ERROR_ACCESS_DENIED
)