Re: IPC on win32 - additions for 6.5.2 and current trees
От | yutaka tanida |
---|---|
Тема | Re: IPC on win32 - additions for 6.5.2 and current trees |
Дата | |
Msg-id | 37CB94A31ED.C8A2YUTAKA@malgate.marin.or.jp обсуждение исходный текст |
Ответ на | IPC on win32 - additions for 6.5.2 and current trees (Horak Daniel <horak@mmp.plzen-city.cz>) |
Ответы |
Re: [HACKERS] Re: IPC on win32 - additions for 6.5.2 and current trees
(Bruce Momjian <maillist@candle.pha.pa.us>)
|
Список | pgsql-hackers |
Hi, Daniel Horak wrote: > Hi, > > please add the file ipc.patch (patch for the cygipc library) into src/win32 > directory and apply the patch for README.NT (readme.patch). I think it > should go into both the 6.5.2 and current trees. > > I have no reaction from the author of the cygipc library yet, so it will be > better to include the patch into the sources of PostgreSQL I propose more patch against cygipc. Hiroshi Inoue (inoue@tpf.co.jp) found another backend freezing problem. He also found semop() in cygipc can't decrement semaphore value correctly (Only -1 is supported). I create follwing patch fixes these issues. I'm sorry for my poor English. *** sem.c.orig_ Tue Aug 17 14:19:37 1999 --- sem.c Tue Aug 31 16:59:49 1999 *************** *** 204,210 **** { CloseHandle ( LHandle ) ; } ! LHandle = CreateSemaphore(NULL, 0, 0x7FFFFFFF, LBuff) ; if( LHandle == NULL ) { printf( "Creation de Semaphore\"Sem\" impossible\n" ) ; --- 204,210 ---- { CloseHandle ( LHandle ) ; } ! LHandle = CreateSemaphore(NULL, 0, 1, LBuff) ; if( LHandle == NULL ) { printf( "Creation de Semaphore \"Sem\"impossible\n" ) ; *************** *** 374,388 **** debug_printf("do_semop : return -EACCES\n"); CYGWIN32_IPCNT_RETURN (-EACCES) ; } ! ReleaseSemaphore(LHandle, sop->sem_op, &LVal) ; ! shareadrsem->current_nb[id].current_nb[sop->sem_num] += ! sop->sem_op ; sem_deconnect() ; } else { if( sop->sem_flg == IPC_NOWAIT) { ! LRet = WaitForSingleObject(LHandle, 0) ; ! if( LRet == WAIT_TIMEOUT ) { debug_printf("do_semop : return -EAGAIN\n"); CYGWIN32_IPCNT_RETURN(-EAGAIN) ; --- 374,387 ---- debug_printf("do_semop : return -EACCES\n"); CYGWIN32_IPCNT_RETURN (-EACCES) ; } ! shareadrsem->current_nb[id].current_nb[sop->sem_num] += ! sop->sem_op ; sem_deconnect() ; + ReleaseSemaphore(LHandle, 1 , &LVal) ; } else { if( sop->sem_flg == IPC_NOWAIT ) { ! if( sop->sem_op + shareadrsem->current_nb[id].current_nb[sop->sem_num] <0 ) { debug_printf("do_semop: return -EAGAIN\n"); CYGWIN32_IPCNT_RETURN (-EAGAIN) ; *************** *** 392,407 **** debug_printf("do_semop : return -EACCES\n"); CYGWIN32_IPCNT_RETURN (-EACCES) ; } ! shareadrsem->current_nb[id].current_nb[sop->sem_num] -= 1 ; sem_deconnect() ; }else { ! LRet = WaitForSingleObject(LHandle, INFINITE) ; if (sem_connect() == 0) { debug_printf("do_semop: return -EACCES\n"); CYGWIN32_IPCNT_RETURN (-EACCES) ; } ! shareadrsem->current_nb[id].current_nb[sop->sem_num] -= 1 ; sem_deconnect() ; } } --- 391,408 ---- debug_printf("do_semop : return -EACCES\n"); CYGWIN32_IPCNT_RETURN (-EACCES) ; } ! shareadrsem->current_nb[id].current_nb[sop->sem_num] += sop->sem_op; sem_deconnect() ; } else { ! while(sop->sem_op + shareadrsem->current_nb[id].current_nb[sop->sem_num] <0) ! LRet = WaitForSingleObject(LHandle, INFINITE) ; ! if (sem_connect() == 0) { debug_printf("do_semop : return -EACCES\n"); CYGWIN32_IPCNT_RETURN (-EACCES) ; } ! shareadrsem->current_nb[id].current_nb[sop->sem_num] += sop->sem_op ; sem_deconnect() ; } } *************** *** 452,458 **** char LBuff[100] ; HANDLE LHandle ; long LPrevious ; - int LIndex; debug_printf("semctl : semid=%X semnum=%X cmd=0x%02X arg=%p\n",semid,semnum,cmd,arg); if (semid <0 || semnum < 0 || cmd < 0) --- 453,458 ---- *************** *** 585,606 **** if( LHandle != NULL ) { if( arg.val > shareadrsem->current_nb[id].current_nb[semnum]) ! { ! ReleaseSemaphore(LHandle, ! arg.val-shareadrsem->current_nb[id].current_nb[semnum], ! &LPrevious) ; ! } ! else if (arg.val < ! shareadrsem->current_nb[id].current_nb[semnum] ) ! { ! for( LIndex = arg.val; ! LIndex < shareadrsem->current_nb[id].current_nb[semnum]; ! LIndex++ ) ! { ! WaitForSingleObject(LHandle, 0) ; ! } ! } ! shareadrsem->current_nb[id].current_nb[semnum] = arg.val ; } debug_printf("semctl : SETVAL: return 0\n"); CYGWIN32_IPCNT_RETURN_DECONNECT (0); --- 585,592 ---- if( LHandle != NULL ) { if( arg.val > shareadrsem->current_nb[id].current_nb[semnum]) ! ReleaseSemaphore(LHandle,1,&LPrevious) ; ! shareadrsem->current_nb[id].current_nb[semnum] = arg.val ; } debug_printf("semctl : SETVAL : return0\n"); CYGWIN32_IPCNT_RETURN_DECONNECT (0); -- Yutaka tanida / S34 Co., Ltd. tanida@s34.co.jp (Office) yutaka@marin.or.jp(Private, or if you *HATE* Microsoft Outlook)
В списке pgsql-hackers по дате отправления:
Предыдущее
От: Thomas LockhartДата:
Сообщение: Re: [HACKERS] Implications of multi-byte support in a distribution
Следующее
От: Oleg BroytmannДата:
Сообщение: Re: [HACKERS] Implications of multi-byte support in a distribution