Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6f21f4a

Browse files
committed
Move pgkill out into /port so pg_ctl can use it on Win32.
1 parentd157b7b commit6f21f4a

File tree

5 files changed

+67
-46
lines changed

5 files changed

+67
-46
lines changed

‎configure

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12014,6 +12014,7 @@ esac
1201412014
case $host_os in mingw*)
1201512015
LIBOBJS="$LIBOBJS copydir.$ac_objext"
1201612016
LIBOBJS="$LIBOBJS gettimeofday.$ac_objext"
12017+
LIBOBJS="$LIBOBJS kill.$ac_objext"
1201712018
LIBOBJS="$LIBOBJS open.$ac_objext"
1201812019
LIBOBJS="$LIBOBJS rand.$ac_objext" ;;
1201912020
esac

‎configure.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
dnl Process this file with autoconf to produce a configure script.
2-
dnl $PostgreSQL: pgsql/configure.in,v 1.358 2004/05/22 00:34:49 tgl Exp $
2+
dnl $PostgreSQL: pgsql/configure.in,v 1.359 2004/05/27 13:08:48 momjian Exp $
33
dnl
44
dnl Developers, please strive to achieve this order:
55
dnl
@@ -891,6 +891,7 @@ esac
891891
case $host_os in mingw*)
892892
AC_LIBOBJ(copydir)
893893
AC_LIBOBJ(gettimeofday)
894+
AC_LIBOBJ(kill)
894895
AC_LIBOBJ(open)
895896
AC_LIBOBJ(rand) ;;
896897
esac

‎src/backend/port/win32/signal.c

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
77
*
88
* IDENTIFICATION
9-
* $PostgreSQL: pgsql/src/backend/port/win32/signal.c,v 1.1 2004/04/12 16:19:18 momjian Exp $
9+
* $PostgreSQL: pgsql/src/backend/port/win32/signal.c,v 1.2 2004/05/27 13:08:50 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -152,46 +152,6 @@ pqsignal(int signum, pqsigfunc handler)
152152
returnprevfunc;
153153
}
154154

155-
/* signal sending */
156-
int
157-
pqkill(intpid,intsig)
158-
{
159-
charpipename[128];
160-
BYTEsigData=sig;
161-
BYTEsigRet=0;
162-
DWORDbytes;
163-
164-
if (sig >=PG_SIGNAL_COUNT||sig <=0)
165-
{
166-
errno=EINVAL;
167-
return-1;
168-
}
169-
if (pid <=0)
170-
{
171-
/* No support for process groups */
172-
errno=EINVAL;
173-
return-1;
174-
}
175-
wsprintf(pipename,"\\\\.\\pipe\\pgsignal_%i",pid);
176-
if (!CallNamedPipe(pipename,&sigData,1,&sigRet,1,&bytes,1000))
177-
{
178-
if (GetLastError()==ERROR_FILE_NOT_FOUND)
179-
errno=ESRCH;
180-
elseif (GetLastError()==ERROR_ACCESS_DENIED)
181-
errno=EPERM;
182-
else
183-
errno=EINVAL;
184-
return-1;
185-
}
186-
if (bytes!=1||sigRet!=sig)
187-
{
188-
errno=ESRCH;
189-
return-1;
190-
}
191-
192-
return0;
193-
}
194-
195155
/*
196156
* All functions below execute on the signal handler thread
197157
* and must be synchronized as such!

‎src/include/port/win32.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/include/port/win32.h,v 1.23 2004/04/22 03:51:24 momjian Exp $ */
1+
/* $PostgreSQL: pgsql/src/include/port/win32.h,v 1.24 2004/05/27 13:08:54 momjian Exp $ */
22

33
/* undefine and redefine after #include */
44
#undef mkdir
@@ -116,10 +116,10 @@ void pg_queue_signal(int signum);
116116
#defineSIG_ERR ((pqsigfunc)-1)
117117
#defineSIG_IGN ((pqsigfunc)1)
118118

119-
#ifndefFRONTEND
120-
#definekill(pid,sig) pqkill(pid,sig)
121-
externintpqkill(intpid,intsig);
119+
#definekill(pid,sig) pgkill(pid,sig)
120+
externintpgkill(intpid,intsig);
122121

122+
#ifndefFRONTEND
123123
#definepg_usleep(t) pgwin32_backend_usleep(t)
124124
voidpgwin32_backend_usleep(longmicrosec);
125125
#endif

‎src/port/kill.c

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* kill.c
4+
* kill()
5+
*
6+
* Copyright (c) 1996-2003, PostgreSQL Global Development Group
7+
*
8+
*This is a replacement version of kill for Win32 which sends
9+
*signals that the backend can recognize.
10+
*
11+
* IDENTIFICATION
12+
* $PostgreSQL: pgsql/src/port/kill.c,v 1.1 2004/05/27 13:08:57 momjian Exp $
13+
*
14+
*-------------------------------------------------------------------------
15+
*/
16+
17+
#include"postgres.h"
18+
19+
#ifdefWIN32
20+
/* signal sending */
21+
int
22+
pgkill(intpid,intsig)
23+
{
24+
charpipename[128];
25+
BYTEsigData=sig;
26+
BYTEsigRet=0;
27+
DWORDbytes;
28+
29+
if (sig >=PG_SIGNAL_COUNT||sig <=0)
30+
{
31+
errno=EINVAL;
32+
return-1;
33+
}
34+
if (pid <=0)
35+
{
36+
/* No support for process groups */
37+
errno=EINVAL;
38+
return-1;
39+
}
40+
wsprintf(pipename,"\\\\.\\pipe\\pgsignal_%i",pid);
41+
if (!CallNamedPipe(pipename,&sigData,1,&sigRet,1,&bytes,1000))
42+
{
43+
if (GetLastError()==ERROR_FILE_NOT_FOUND)
44+
errno=ESRCH;
45+
elseif (GetLastError()==ERROR_ACCESS_DENIED)
46+
errno=EPERM;
47+
else
48+
errno=EINVAL;
49+
return-1;
50+
}
51+
if (bytes!=1||sigRet!=sig)
52+
{
53+
errno=ESRCH;
54+
return-1;
55+
}
56+
57+
return0;
58+
}
59+
#endif

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp