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