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

Commitd91acf8

Browse files
committed
Win32:
* Mostly, casting etc to remove compilation warnings in win32 only code.* main.c: set _IONBF to stdout/stderr under win32 (under win32, _IOLBFdefaults to full buffering)* pg_resetxlog/Makefile: ensures dirmod.o gets cleaned (got bitten bythis when, after "make clean"ing, switching compilation between Ming +Cygwin)Claudio Natoli
1 parent033e37b commitd91acf8

File tree

4 files changed

+31
-18
lines changed

4 files changed

+31
-18
lines changed

‎src/backend/main/main.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*
1414
*
1515
* IDENTIFICATION
16-
* $PostgreSQL: pgsql/src/backend/main/main.c,v 1.74 2004/02/22 21:26:55 tgl Exp $
16+
* $PostgreSQL: pgsql/src/backend/main/main.c,v 1.75 2004/03/05 01:11:04 momjian Exp $
1717
*
1818
*-------------------------------------------------------------------------
1919
*/
@@ -91,14 +91,22 @@ main(int argc, char *argv[])
9191
#if defined(WIN32)
9292
{
9393
WSADATAwsaData;
94-
interr=WSAStartup(MAKEWORD(2,2),&wsaData);
94+
interr;
95+
96+
/* Make output streams unbuffered by default */
97+
setvbuf(stdout,NULL,_IONBF,0);
98+
setvbuf(stderr,NULL,_IONBF,0);
99+
100+
/* Prepare Winsock */
101+
err=WSAStartup(MAKEWORD(2,2),&wsaData);
95102
if (err!=0)
96103
{
97104
fprintf(stderr,"%s: WSAStartup failed: %d\n",
98105
argv[0],err);
99106
exit(1);
100107
}
101108

109+
/* Start our win32 signal implementation */
102110
pgwin32_signal_initialize();
103111
}
104112
#endif

‎src/backend/port/dynloader/win32.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,9 @@
88
#definepg_dlclosedlclose
99
#definepg_dlerrordlerror
1010

11+
char*dlerror(void);
12+
intdlclose(void*handle);
13+
void*dlsym(void*handle,constchar*symbol);
14+
void*dlopen(constchar*path,intmode);
15+
1116
#endif/* PORT_PROTOS_H */

‎src/backend/postmaster/postmaster.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*
3838
*
3939
* IDENTIFICATION
40-
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.369 2004/02/25 19:41:22 momjian Exp $
40+
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.370 2004/03/05 01:11:04 momjian Exp $
4141
*
4242
* NOTES
4343
*
@@ -3525,29 +3525,29 @@ pid_t win32_forkexec(const char* path, char *argv[])
35253525
si.cb=sizeof(si);
35263526
if (!CreateProcess(NULL,cmdLine,NULL,NULL,TRUE,0,NULL,NULL,&si,&pi))
35273527
{
3528-
elog(ERROR,"CreateProcess call failed (%d): %m",GetLastError());
3528+
elog(ERROR,"CreateProcess call failed (%i): %m",(int)GetLastError());
35293529
return-1;
35303530
}
35313531

35323532
if (!IsUnderPostmaster)
35333533
/* We are the Postmaster creating a child... */
35343534
win32_AddChild(pi.dwProcessId,pi.hProcess);
3535-
3535+
35363536
if (!DuplicateHandle(GetCurrentProcess(),
35373537
pi.hProcess,
35383538
GetCurrentProcess(),
35393539
&childHandleCopy,
35403540
0,
35413541
FALSE,
3542-
DUPLICATE_SAME_ACCESS))
3542+
DUPLICATE_SAME_ACCESS))
35433543
ereport(FATAL,
3544-
(errmsg_internal("failed to duplicate child handle: %i",GetLastError())));
3544+
(errmsg_internal("failed to duplicate child handle: %i",(int)GetLastError())));
35453545
waiterThread=CreateThread(NULL,64*1024,win32_sigchld_waiter, (LPVOID)childHandleCopy,0,NULL);
35463546
if (!waiterThread)
35473547
ereport(FATAL,
3548-
(errmsg_internal("failed to create sigchld waiter thread: %i",GetLastError())));
3549-
CloseHandle(waiterThread);
3550-
3548+
(errmsg_internal("failed to create sigchld waiter thread: %i",(int)GetLastError())));
3549+
CloseHandle(waiterThread);
3550+
35513551
if (IsUnderPostmaster)
35523552
CloseHandle(pi.hProcess);
35533553
CloseHandle(pi.hThread);
@@ -3600,14 +3600,14 @@ static void win32_RemoveChild(pid_t pid)
36003600

36013601
/* Something stronger than WARNING here? */
36023602
ereport(WARNING,
3603-
(errmsg_internal("unable to find child entry with pid %d",
3603+
(errmsg_internal("unable to find child entry with pid %lu",
36043604
pid)));
36053605
}
36063606

36073607
staticpid_twin32_waitpid(int*exitstatus)
36083608
{
36093609
Assert(win32_childPIDArray&&win32_childHNDArray);
3610-
elog(DEBUG3,"waiting on %d children",win32_numChildren);
3610+
elog(DEBUG3,"waiting on %lu children",win32_numChildren);
36113611

36123612
if (win32_numChildren>0)
36133613
{
@@ -3623,8 +3623,8 @@ static pid_t win32_waitpid(int *exitstatus)
36233623
{
36243624
caseWAIT_FAILED:
36253625
ereport(ERROR,
3626-
(errmsg_internal("failed to wait on %d children: %i",
3627-
win32_numChildren,GetLastError())));
3626+
(errmsg_internal("failed to wait on %lu children: %i",
3627+
win32_numChildren,(int)GetLastError())));
36283628
/* Fall through to WAIT_TIMEOUTs return */
36293629

36303630
caseWAIT_TIMEOUT:
@@ -3641,7 +3641,7 @@ static pid_t win32_waitpid(int *exitstatus)
36413641
* No choice other than to assume a catastrophic failure.
36423642
*/
36433643
ereport(FATAL,
3644-
(errmsg_internal("failed to get exit code for child %d",
3644+
(errmsg_internal("failed to get exit code for child %lu",
36453645
win32_childPIDArray[index])));
36463646
*exitstatus= (int)exitCode;
36473647
returnwin32_childPIDArray[index];
@@ -3661,7 +3661,7 @@ static DWORD WINAPI win32_sigchld_waiter(LPVOID param) {
36613661
if (r==WAIT_OBJECT_0)
36623662
pg_queue_signal(SIGCHLD);
36633663
else
3664-
fprintf(stderr,"ERROR: Failed to wait on child process handle: %i\n",GetLastError());
3664+
fprintf(stderr,"ERROR: Failed to wait on child process handle: %i\n",(int)GetLastError());
36653665
CloseHandle(procHandle);
36663666
return0;
36673667
}

‎src/bin/pg_resetxlog/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# Copyright (c) 1998-2002, PostgreSQL Global Development Group
66
#
7-
# $PostgreSQL: pgsql/src/bin/pg_resetxlog/Makefile,v 1.5 2004/02/10 23:24:13 tgl Exp $
7+
# $PostgreSQL: pgsql/src/bin/pg_resetxlog/Makefile,v 1.6 2004/03/05 01:11:04 momjian Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -38,4 +38,4 @@ uninstall:
3838
rm -f$(DESTDIR)$(bindir)/pg_resetxlog$(X)
3939

4040
cleandistcleanmaintainer-clean:
41-
rm -f pg_resetxlog$(X)pg_resetxlog.opg_crc.o pg_crc.c dirmod.c
41+
rm -f pg_resetxlog$(X) pg_crc.c dirmod.c$(OBJS)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp