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

Commita17c0e0

Browse files
committed
Backpatch Y2K timestamp patch.
1 parent331dc23 commita17c0e0

File tree

2 files changed

+292
-10
lines changed

2 files changed

+292
-10
lines changed

‎doc/README.NT

Lines changed: 290 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
From: "Joost Kraaijeveld" <JKraaijeveld@askesis.nl>
2-
To: "Pgsql-Ports@Postgresql. Org" <pgsql-ports@postgreSQL.org>
3-
Subject: RE: [PORTS] Re: psql under win32
4-
Date: Wed, 21 Apr 1999 07:07:47 +0200
5-
Message-ID: <000001be8bb4$e59b0ab0$0300a8c0@abraracourcix.askesis.nl>
6-
MIME-Version: 1.0
7-
81
Installing PostgreSQL on NT:
92

103
---------------------------------------------------------------------------
@@ -31,7 +24,7 @@ It can be done by done by typing configure, make and make install.
3124
1. Download the Cygwin32 IPC Package by Ludovic LANGE
3225
http://www.multione.capgemini.fr:80/tools/pack_ipc/current.tar.gz
3326
2. Untar the package and follow the readme instructions.
34-
3. Apply the patchpgsql/src/win32/ipc.patch to the cygipc sources
27+
3. Apply the patchat the end of this file to the cygipc sources
3528
before compiling the library.
3629
4. I tested 1.03.
3730
5. I used the \cygwin-b20\h-i568-cygwin32\i586-cygwin32\lib and
@@ -83,3 +76,292 @@ Joost
8376

8477
PS: If you still have problems you can mail to Dan Horak <dan.horak@email.cz>
8578
who is the maintainer for the win32 port
79+
80+
---------------------------------------------------------------------------
81+
82+
*** ./ipc-daemon.c.origTue Dec 01 00:04:24 1998
83+
--- ./ipc-daemon.cFri Sep 24 13:34:16 1999
84+
***************
85+
*** 270,285 ****
86+
{
87+
itoa(100*id+Index, LBuff) ;
88+
LHandle = OpenSemaphore(SEMAPHORE_ALL_ACCESS, FALSE, LBuff) ;
89+
! while (LAdrSem->current_nb[id].current_nb[Index] > 0 )
90+
! {
91+
! WaitForSingleObject(LHandle, 0) ;
92+
! LAdrSem->current_nb[id].current_nb[Index]-- ;
93+
! }
94+
! CloseHandle(LHandle) ;
95+
}
96+
LAdrSem->semary[id] = IPC_UNUSED ;
97+
LAdrSem->state[id] = 0 ;
98+
}
99+
else
100+
{
101+
for (Index = 0; Index < sma->sem_nsems; Index++)
102+
--- 270,284 ----
103+
{
104+
itoa(100*id+Index, LBuff) ;
105+
LHandle = OpenSemaphore(SEMAPHORE_ALL_ACCESS, FALSE, LBuff) ;
106+
! while (WaitForSingleObject(LHandle, 0) == WAIT_OBJECT_0)
107+
! ;
108+
! LAdrSem->current_nb[id].current_nb[Index] = 0;
109+
! CloseHandle(LHandle) ;
110+
}
111+
LAdrSem->semary[id] = IPC_UNUSED ;
112+
LAdrSem->state[id] = 0 ;
113+
}
114+
+ /*
115+
else
116+
{
117+
for (Index = 0; Index < sma->sem_nsems; Index++)
118+
***************
119+
*** 288,293 ****
120+
--- 287,293 ----
121+
LHandle = OpenSemaphore(SEMAPHORE_ALL_ACCESS, FALSE, LBuff) ;
122+
}
123+
}
124+
+ */
125+
}
126+
}
127+
128+
*** ./msg.c.origTue Dec 01 00:16:09 1998
129+
--- ./msg.cFri Sep 17 12:50:50 1999
130+
***************
131+
*** 57,62 ****
132+
--- 57,77 ----
133+
static int GFirstMsg = 0;/*PCPC*/
134+
static int GFdMsg ;/*PCPC*/
135+
136+
+ /*****************************************/
137+
+ /*Initialization of static variables */
138+
+ /*****************************************/
139+
+ static pid_t GProcessId = 0;
140+
+ static void init_globals(void)
141+
+ {
142+
+ pid_t pid;
143+
+
144+
+ if (pid=getpid(), pid != GProcessId)
145+
+ {
146+
+ GFirstMsg = 0;
147+
+ msgbytes = msghdrs = msg_seq = used_queues = max_msqid = 0;
148+
+ GProcessId = pid;
149+
+ }
150+
+ }
151+
/************************************************************************/
152+
/* Demande d'acces a la zone partagee de gestion des semaphores*/
153+
/************************************************************************/
154+
***************
155+
*** 79,84 ****
156+
--- 94,100 ----
157+
{
158+
int LRet ;
159+
160+
+ init_globals();
161+
if( GFirstMsg == 0 )
162+
{
163+
if( IsGSemMsgExist() )
164+
*** ./sem.c.origTue Dec 01 00:16:25 1998
165+
--- ./sem.cFri Sep 17 12:47:11 1999
166+
***************
167+
*** 58,63 ****
168+
--- 58,78 ----
169+
static int GFirstSem = 0;/*PCPC*/
170+
static int GFdSem ;/*PCPC*/
171+
172+
+ static pid_tGProcessId = 0;
173+
+
174+
+ static voidinit_globals(void)
175+
+ {
176+
+ pid_t pid;
177+
+
178+
+ if (pid=getpid(), pid != GProcessId)
179+
+ {
180+
+ GFirstSem = 0;
181+
+ used_sems = used_semids = max_semid = 0;
182+
+ sem_seq = 0;
183+
+ GProcessId = pid;
184+
+ }
185+
+ }
186+
+
187+
/************************************************************************/
188+
/* Demande d'acces a la zone partagee de gestion des semaphores*/
189+
/************************************************************************/
190+
***************
191+
*** 77,82 ****
192+
--- 92,98 ----
193+
{
194+
int LRet ;
195+
196+
+ init_globals();
197+
if( GFirstSem == 0 )
198+
{
199+
if( IsGSemSemExist() )
200+
***************
201+
*** 187,193 ****
202+
{
203+
CloseHandle ( LHandle ) ;
204+
}
205+
! LHandle = CreateSemaphore(NULL, 0, 0x7FFFFFFF, LBuff) ;
206+
if( LHandle == NULL )
207+
{
208+
printf( "Creation de Semaphore \"Sem\" impossible\n" ) ;
209+
--- 203,209 ----
210+
{
211+
CloseHandle ( LHandle ) ;
212+
}
213+
! LHandle = CreateSemaphore(NULL, 0, 1, LBuff) ;
214+
if( LHandle == NULL )
215+
{
216+
printf( "Creation de Semaphore \"Sem\" impossible\n" ) ;
217+
***************
218+
*** 357,371 ****
219+
debug_printf("do_semop : return -EACCES\n");
220+
CYGWIN32_IPCNT_RETURN (-EACCES) ;
221+
}
222+
! ReleaseSemaphore(LHandle, sop->sem_op, &LVal) ;
223+
! shareadrsem->current_nb[id].current_nb[sop->sem_num] +=
224+
! sop->sem_op ;
225+
sem_deconnect() ;
226+
} else {
227+
if( sop->sem_flg == IPC_NOWAIT )
228+
{
229+
! LRet = WaitForSingleObject(LHandle, 0) ;
230+
! if( LRet == WAIT_TIMEOUT )
231+
{
232+
debug_printf("do_semop : return -EAGAIN\n");
233+
CYGWIN32_IPCNT_RETURN (-EAGAIN) ;
234+
--- 373,386 ----
235+
debug_printf("do_semop : return -EACCES\n");
236+
CYGWIN32_IPCNT_RETURN (-EACCES) ;
237+
}
238+
! shareadrsem->current_nb[id].current_nb[sop->sem_num] +=
239+
! sop->sem_op ;
240+
sem_deconnect() ;
241+
+ ReleaseSemaphore(LHandle, 1 , &LVal) ;
242+
} else {
243+
if( sop->sem_flg == IPC_NOWAIT )
244+
{
245+
! if( sop->sem_op + shareadrsem->current_nb[id].current_nb[sop->sem_num] <0 )
246+
{
247+
debug_printf("do_semop : return -EAGAIN\n");
248+
CYGWIN32_IPCNT_RETURN (-EAGAIN) ;
249+
***************
250+
*** 375,390 ****
251+
debug_printf("do_semop : return -EACCES\n");
252+
CYGWIN32_IPCNT_RETURN (-EACCES) ;
253+
}
254+
! shareadrsem->current_nb[id].current_nb[sop->sem_num] -= 1 ;
255+
sem_deconnect() ;
256+
} else {
257+
! LRet = WaitForSingleObject(LHandle, INFINITE) ;
258+
if (sem_connect() == 0)
259+
{
260+
debug_printf("do_semop : return -EACCES\n");
261+
CYGWIN32_IPCNT_RETURN (-EACCES) ;
262+
}
263+
! shareadrsem->current_nb[id].current_nb[sop->sem_num] -= 1 ;
264+
sem_deconnect() ;
265+
}
266+
}
267+
--- 390,407 ----
268+
debug_printf("do_semop : return -EACCES\n");
269+
CYGWIN32_IPCNT_RETURN (-EACCES) ;
270+
}
271+
! shareadrsem->current_nb[id].current_nb[sop->sem_num] += sop->sem_op;
272+
sem_deconnect() ;
273+
} else {
274+
! while(sop->sem_op + shareadrsem->current_nb[id].current_nb[sop->sem_num] <0)
275+
! LRet = WaitForSingleObject(LHandle, INFINITE) ;
276+
!
277+
if (sem_connect() == 0)
278+
{
279+
debug_printf("do_semop : return -EACCES\n");
280+
CYGWIN32_IPCNT_RETURN (-EACCES) ;
281+
}
282+
! shareadrsem->current_nb[id].current_nb[sop->sem_num] += sop->sem_op ;
283+
sem_deconnect() ;
284+
}
285+
}
286+
***************
287+
*** 435,441 ****
288+
char LBuff[100] ;
289+
HANDLE LHandle ;
290+
long LPrevious ;
291+
- int LIndex;
292+
293+
debug_printf("semctl : semid=%X semnum=%X cmd=0x%02X arg=%p\n",semid,semnum,cmd,arg);
294+
if (semid < 0 || semnum < 0 || cmd < 0)
295+
--- 452,457 ----
296+
***************
297+
*** 568,589 ****
298+
if( LHandle != NULL )
299+
{
300+
if( arg.val > shareadrsem->current_nb[id].current_nb[semnum] )
301+
! {
302+
! ReleaseSemaphore(LHandle,
303+
! arg.val-shareadrsem->current_nb[id].current_nb[semnum],
304+
! &LPrevious) ;
305+
! }
306+
! else if (arg.val <
307+
! shareadrsem->current_nb[id].current_nb[semnum] )
308+
! {
309+
! for( LIndex = arg.val;
310+
! LIndex < shareadrsem->current_nb[id].current_nb[semnum];
311+
! LIndex++ )
312+
! {
313+
! WaitForSingleObject(LHandle, 0) ;
314+
! }
315+
! }
316+
! shareadrsem->current_nb[id].current_nb[semnum] = arg.val ;
317+
}
318+
debug_printf("semctl : SETVAL : return 0\n");
319+
CYGWIN32_IPCNT_RETURN_DECONNECT (0);
320+
--- 584,591 ----
321+
if( LHandle != NULL )
322+
{
323+
if( arg.val > shareadrsem->current_nb[id].current_nb[semnum] )
324+
! ReleaseSemaphore(LHandle,1,&LPrevious) ;
325+
! shareadrsem->current_nb[id].current_nb[semnum] = arg.val ;
326+
}
327+
debug_printf("semctl : SETVAL : return 0\n");
328+
CYGWIN32_IPCNT_RETURN_DECONNECT (0);
329+
*** ./shm.c.origFri Sep 17 12:46:24 1999
330+
--- ./shm.cFri Sep 17 12:47:11 1999
331+
***************
332+
*** 59,64 ****
333+
--- 59,81 ----
334+
static int GFirstShm = 0;/*PCPC*/
335+
static int GFdShm ;/*PCPC*/
336+
337+
+ /*****************************************/
338+
+ /*Initialization of static variables */
339+
+ /*****************************************/
340+
+ static pid_t GProcessId = 0;
341+
+ static void init_globals(void)
342+
+ {
343+
+ pid_t pid;
344+
+
345+
+ if (pid=getpid(), pid != GProcessId)
346+
+ {
347+
+ GFirstShm = 0;
348+
+ shm_rss = shm_swp = max_shmid = 0;
349+
+ shm_seq = 0;
350+
+ GProcessId = pid;
351+
+ }
352+
+ }
353+
+
354+
/************************************************************************/
355+
/* Demande d'acces a la zone partagee de gestion des shm*/
356+
/************************************************************************/
357+
***************
358+
*** 82,87 ****
359+
--- 99,105 ----
360+
{
361+
int LRet ;
362+
363+
+ init_globals();
364+
if( GFirstShm == 0 )
365+
{
366+
if( IsGSemShmExist() )
367+

‎src/backend/utils/misc/trace.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,8 @@ tprintf_timestamp()
227227
time=localtime(&tm);
228228

229229
sprintf(pid,"[%d]",MyProcPid);
230-
sprintf(timestamp,"%02d%02d%02d.%02d:%02d:%02d.%03d %7s ",
231-
time->tm_year,time->tm_mon+1,time->tm_mday,
230+
sprintf(timestamp,"%04d%02d%02d.%02d:%02d:%02d.%03d %7s ",
231+
time->tm_year+1900,time->tm_mon+1,time->tm_mday,
232232
time->tm_hour,time->tm_min,time->tm_sec,
233233
(int) (tv.tv_usec/1000),pid);
234234

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp