pg_ctl error msg on Windows 2000

Started by Magnus Haganderover 19 years ago2 messages
#1Magnus Hagander
mha@sollentuna.net
1 attachment(s)

On version of Windows prior to XP, pg_ctl will *always* log a warning
about not finding Job API functions. This is probably unnecessary, since
they are never present there. The check was originally intended to give
a warning if something was wrong on a system where it was *expected*.

Attached patch checks the OS version before emitting the error message.

//Mag <<pg_ctl.diff>> nus

Attachments:

pg_ctl.diffapplication/octet-stream; name=pg_ctl.diffDownload
Index: src/bin/pg_ctl/pg_ctl.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/pg_ctl/pg_ctl.c,v
retrieving revision 1.71
diff -c -r1.71 pg_ctl.c
*** src/bin/pg_ctl/pg_ctl.c	21 Aug 2006 10:48:21 -0000	1.71
--- src/bin/pg_ctl/pg_ctl.c	24 Sep 2006 15:07:57 -0000
***************
*** 1277,1283 ****
      /* Verify that we found all functions */
      if (_IsProcessInJob == NULL || _CreateJobObject == NULL || _SetInformationJobObject == NULL || _AssignProcessToJobObject == NULL || _QueryInformationJobObject == NULL)
      {
!         write_stderr("WARNING: Unable to locate all job object functions in system API!\n");
      } 
      else
      { 
--- 1277,1291 ----
      /* Verify that we found all functions */
      if (_IsProcessInJob == NULL || _CreateJobObject == NULL || _SetInformationJobObject == NULL || _AssignProcessToJobObject == NULL || _QueryInformationJobObject == NULL)
      {
! 		/* IsProcessInJob() is not available on < WinXP, so there is no need to log the error every time in that case */
! 		OSVERSIONINFO osv;
! 
! 		osv.dwOSVersionInfoSize = sizeof(osv);
! 		if (!GetVersionEx(&osv) || /* could not get version */
! 			(osv.dwMajorVersion == 5 && osv.dwMinorVersion > 0) || /* 5.1=xp, 5.2=2003, etc */
! 			osv.dwMajorVersion > 5) /* anything newer should have the API */
! 			/* Log error if we can't get version, or if we're on WinXP/2003 or newer */
! 			write_stderr("WARNING: Unable to locate all job object functions in system API!\n");
      } 
      else
      { 
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Magnus Hagander (#1)
Re: pg_ctl error msg on Windows 2000

"Magnus Hagander" <mha@sollentuna.net> writes:

On version of Windows prior to XP, pg_ctl will *always* log a warning
about not finding Job API functions. This is probably unnecessary, since
they are never present there. The check was originally intended to give
a warning if something was wrong on a system where it was *expected*.

Attached patch checks the OS version before emitting the error message.

Applied.

regards, tom lane