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

Commitfc548b2

Browse files
committed
Remove support for using wait3() in place of waitpid().
All Unix-oid platforms that we currently support should have waitpid(),since it's in V2 of the Single Unix Spec. Our git history shows thatthe wait3 code was added to support NextStep, which we officially droppedsupport for as of 9.2. So get rid of the configure test, and simplify themacro spaghetti in reaper(). Per suggestion from Fujii Masao.
1 parent666d494 commitfc548b2

File tree

5 files changed

+12
-33
lines changed

5 files changed

+12
-33
lines changed

‎configure

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19254,8 +19254,7 @@ fi
1925419254

1925519255

1925619256

19257-
19258-
for ac_func in cbrt dlopen fdatasync getifaddrs getpeerucred getrlimit memmove poll pstat readlink setproctitle setsid sigprocmask symlink towlower utime utimes waitpid wcstombs wcstombs_l
19257+
for ac_func in cbrt dlopen fdatasync getifaddrs getpeerucred getrlimit memmove poll pstat readlink setproctitle setsid sigprocmask symlink towlower utime utimes wcstombs wcstombs_l
1925919258
do
1926019259
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
1926119260
{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5

‎configure.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1207,7 +1207,7 @@ PGAC_VAR_INT_TIMEZONE
12071207
AC_FUNC_ACCEPT_ARGTYPES
12081208
PGAC_FUNC_GETTIMEOFDAY_1ARG
12091209

1210-
AC_CHECK_FUNCS([cbrt dlopen fdatasync getifaddrs getpeerucred getrlimit memmove poll pstat readlink setproctitle setsid sigprocmask symlink towlower utime utimeswaitpidwcstombs wcstombs_l])
1210+
AC_CHECK_FUNCS([cbrt dlopen fdatasync getifaddrs getpeerucred getrlimit memmove poll pstat readlink setproctitle setsid sigprocmask symlink towlower utime utimes wcstombs wcstombs_l])
12111211

12121212
AC_REPLACE_FUNCS(fseeko)
12131213
case $host_os in

‎src/backend/postmaster/postmaster.c

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,9 @@ static void InitPostmasterDeathWatchHandle(void);
377377
#ifdefEXEC_BACKEND
378378

379379
#ifdefWIN32
380-
staticpid_twin32_waitpid(int*exitstatus);
380+
#defineWNOHANG 0/* ignored, so any integer value will do */
381+
382+
staticpid_twaitpid(pid_tpid,int*exitstatus,intoptions);
381383
staticvoidWINAPIpgwin32_deadchild_callback(PVOIDlpParameter,BOOLEANTimerOrWaitFired);
382384

383385
staticHANDLEwin32ChildQueue;
@@ -388,7 +390,7 @@ typedef struct
388390
HANDLEprocHandle;
389391
DWORDprocId;
390392
}win32_deadchild_waitinfo;
391-
#endif
393+
#endif/* WIN32 */
392394

393395
staticpid_tbackend_forkexec(Port*port);
394396
staticpid_tinternal_forkexec(intargc,char*argv[],Port*port);
@@ -2268,33 +2270,13 @@ reaper(SIGNAL_ARGS)
22682270
intpid;/* process id of dead child process */
22692271
intexitstatus;/* its exit status */
22702272

2271-
/* These macros hide platform variations in getting child status */
2272-
#ifdefHAVE_WAITPID
2273-
intstatus;/* child exit status */
2274-
2275-
#defineLOOPTEST()((pid = waitpid(-1, &status, WNOHANG)) > 0)
2276-
#defineLOOPHEADER()(exitstatus = status)
2277-
#else/* !HAVE_WAITPID */
2278-
#ifndefWIN32
2279-
unionwaitstatus;/* child exit status */
2280-
2281-
#defineLOOPTEST()((pid = wait3(&status, WNOHANG, NULL)) > 0)
2282-
#defineLOOPHEADER()(exitstatus = status.w_status)
2283-
#else/* WIN32 */
2284-
#defineLOOPTEST()((pid = win32_waitpid(&exitstatus)) > 0)
2285-
#defineLOOPHEADER()
2286-
#endif/* WIN32 */
2287-
#endif/* HAVE_WAITPID */
2288-
22892273
PG_SETMASK(&BlockSig);
22902274

22912275
ereport(DEBUG4,
22922276
(errmsg_internal("reaping dead processes")));
22932277

2294-
while (LOOPTEST())
2278+
while ((pid=waitpid(-1,&exitstatus,WNOHANG))>0)
22952279
{
2296-
LOOPHEADER();
2297-
22982280
/*
22992281
* Check if this child was a startup process.
23002282
*/
@@ -5045,8 +5027,12 @@ ShmemBackendArrayRemove(Backend *bn)
50455027

50465028
#ifdefWIN32
50475029

5030+
/*
5031+
* Subset implementation of waitpid() for Windows. We assume pid is -1
5032+
* (that is, check all child processes) and options is WNOHANG (don't wait).
5033+
*/
50485034
staticpid_t
5049-
win32_waitpid(int*exitstatus)
5035+
waitpid(pid_tpid,int*exitstatus,intoptions)
50505036
{
50515037
DWORDdwd;
50525038
ULONG_PTRkey;

‎src/include/pg_config.h.in

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -614,9 +614,6 @@
614614
/* Define to 1 if you have the `vsnprintf' function. */
615615
#undef HAVE_VSNPRINTF
616616

617-
/* Define to 1 if you have the `waitpid' function. */
618-
#undef HAVE_WAITPID
619-
620617
/* Define to 1 if you have the <wchar.h> header file. */
621618
#undef HAVE_WCHAR_H
622619

‎src/include/pg_config.h.win32

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -505,9 +505,6 @@
505505
/* Define to 1 if you have the `vsnprintf' function. */
506506
#define HAVE_VSNPRINTF 1
507507

508-
/* Define to 1 if you have the `waitpid' function. */
509-
/* #undef HAVE_WAITPID */
510-
511508
/* Define to 1 if you have the <wchar.h> header file. */
512509
#define HAVE_WCHAR_H 1
513510

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp