+++ /dev/null
-*** ./ipc-daemon.c.orig Tue Dec 01 00:04:24 1998\r
---- ./ipc-daemon.c Fri Sep 24 13:34:16 1999\r
-***************\r
-*** 270,285 ****\r
- {\r
- itoa(100*id+Index, LBuff) ;\r
- LHandle = OpenSemaphore(SEMAPHORE_ALL_ACCESS, FALSE, LBuff) ;\r
-! while (LAdrSem->current_nb[id].current_nb[Index] > 0 )\r
-! {\r
-! WaitForSingleObject(LHandle, 0) ;\r
-! LAdrSem->current_nb[id].current_nb[Index]-- ;\r
-! }\r
-! CloseHandle(LHandle) ;\r
- }\r
- LAdrSem->semary[id] = IPC_UNUSED ;\r
- LAdrSem->state[id] = 0 ;\r
- }\r
- else\r
- {\r
- for (Index = 0; Index < sma->sem_nsems; Index++)\r
---- 270,284 ----\r
- {\r
- itoa(100*id+Index, LBuff) ;\r
- LHandle = OpenSemaphore(SEMAPHORE_ALL_ACCESS, FALSE, LBuff) ;\r
-! while (WaitForSingleObject(LHandle, 0) == WAIT_OBJECT_0)\r
-! ;\r
-! LAdrSem->current_nb[id].current_nb[Index] = 0;\r
-! CloseHandle(LHandle) ;\r
- }\r
- LAdrSem->semary[id] = IPC_UNUSED ;\r
- LAdrSem->state[id] = 0 ;\r
- }\r
-+ /*\r
- else\r
- {\r
- for (Index = 0; Index < sma->sem_nsems; Index++)\r
-***************\r
-*** 288,293 ****\r
---- 287,293 ----\r
- LHandle = OpenSemaphore(SEMAPHORE_ALL_ACCESS, FALSE, LBuff) ;\r
- }\r
- }\r
-+ */\r
- }\r
- }\r
- \r
-*** ./msg.c.orig Tue Dec 01 00:16:09 1998\r
---- ./msg.c Fri Sep 17 12:50:50 1999\r
-***************\r
-*** 57,62 ****\r
---- 57,77 ----\r
- static int GFirstMsg = 0; /*PCPC*/\r
- static int GFdMsg ; /*PCPC*/\r
- \r
-+ /*****************************************/\r
-+ /* Initialization of static variables */\r
-+ /*****************************************/\r
-+ static pid_t GProcessId = 0;\r
-+ static void init_globals(void)\r
-+ {\r
-+ pid_t pid;\r
-+ \r
-+ if (pid=getpid(), pid != GProcessId)\r
-+ {\r
-+ GFirstMsg = 0;\r
-+ msgbytes = msghdrs = msg_seq = used_queues = max_msqid = 0;\r
-+ GProcessId = pid;\r
-+ }\r
-+ }\r
- /************************************************************************/\r
- /* Demande d'acces a la zone partagee de gestion des semaphores */\r
- /************************************************************************/\r
-***************\r
-*** 79,84 ****\r
---- 94,100 ----\r
- {\r
- int LRet ;\r
- \r
-+ init_globals();\r
- if( GFirstMsg == 0 )\r
- {\r
- if( IsGSemMsgExist() )\r
-*** ./sem.c.orig Tue Dec 01 00:16:25 1998\r
---- ./sem.c Fri Sep 17 12:47:11 1999\r
-***************\r
-*** 58,63 ****\r
---- 58,78 ----\r
- static int GFirstSem = 0; /*PCPC*/\r
- static int GFdSem ; /*PCPC*/\r
- \r
-+ static pid_t GProcessId = 0;\r
-+ \r
-+ static void init_globals(void)\r
-+ {\r
-+ pid_t pid;\r
-+ \r
-+ if (pid=getpid(), pid != GProcessId)\r
-+ {\r
-+ GFirstSem = 0;\r
-+ used_sems = used_semids = max_semid = 0;\r
-+ sem_seq = 0;\r
-+ GProcessId = pid;\r
-+ }\r
-+ }\r
-+ \r
- /************************************************************************/\r
- /* Demande d'acces a la zone partagee de gestion des semaphores */\r
- /************************************************************************/\r
-***************\r
-*** 77,82 ****\r
---- 92,98 ----\r
- {\r
- int LRet ;\r
- \r
-+ init_globals();\r
- if( GFirstSem == 0 )\r
- {\r
- if( IsGSemSemExist() )\r
-***************\r
-*** 187,193 ****\r
- {\r
- CloseHandle ( LHandle ) ;\r
- }\r
-! LHandle = CreateSemaphore(NULL, 0, 0x7FFFFFFF, LBuff) ;\r
- if( LHandle == NULL )\r
- {\r
- printf( "Creation de Semaphore \"Sem\" impossible\n" ) ;\r
---- 203,209 ----\r
- {\r
- CloseHandle ( LHandle ) ;\r
- }\r
-! LHandle = CreateSemaphore(NULL, 0, 1, LBuff) ;\r
- if( LHandle == NULL )\r
- {\r
- printf( "Creation de Semaphore \"Sem\" impossible\n" ) ;\r
-***************\r
-*** 357,371 ****\r
- debug_printf("do_semop : return -EACCES\n");\r
- CYGWIN32_IPCNT_RETURN (-EACCES) ;\r
- }\r
-! ReleaseSemaphore(LHandle, sop->sem_op, &LVal) ;\r
-! shareadrsem->current_nb[id].current_nb[sop->sem_num] +=\r
-! sop->sem_op ;\r
- sem_deconnect() ;\r
- } else {\r
- if( sop->sem_flg == IPC_NOWAIT )\r
- {\r
-! LRet = WaitForSingleObject(LHandle, 0) ;\r
-! if( LRet == WAIT_TIMEOUT )\r
- {\r
- debug_printf("do_semop : return -EAGAIN\n");\r
- CYGWIN32_IPCNT_RETURN (-EAGAIN) ;\r
---- 373,386 ----\r
- debug_printf("do_semop : return -EACCES\n");\r
- CYGWIN32_IPCNT_RETURN (-EACCES) ;\r
- }\r
-! shareadrsem->current_nb[id].current_nb[sop->sem_num] +=\r
-! sop->sem_op ;\r
- sem_deconnect() ;\r
-+ ReleaseSemaphore(LHandle, 1 , &LVal) ;\r
- } else {\r
- if( sop->sem_flg == IPC_NOWAIT )\r
- {\r
-! if( sop->sem_op + shareadrsem->current_nb[id].current_nb[sop->sem_num] <0 )\r
- {\r
- debug_printf("do_semop : return -EAGAIN\n");\r
- CYGWIN32_IPCNT_RETURN (-EAGAIN) ;\r
-***************\r
-*** 375,390 ****\r
- debug_printf("do_semop : return -EACCES\n");\r
- CYGWIN32_IPCNT_RETURN (-EACCES) ;\r
- }\r
-! shareadrsem->current_nb[id].current_nb[sop->sem_num] -= 1 ;\r
- sem_deconnect() ;\r
- } else {\r
-! LRet = WaitForSingleObject(LHandle, INFINITE) ;\r
- if (sem_connect() == 0)\r
- {\r
- debug_printf("do_semop : return -EACCES\n");\r
- CYGWIN32_IPCNT_RETURN (-EACCES) ;\r
- }\r
-! shareadrsem->current_nb[id].current_nb[sop->sem_num] -= 1 ;\r
- sem_deconnect() ;\r
- }\r
- }\r
---- 390,407 ----\r
- debug_printf("do_semop : return -EACCES\n");\r
- CYGWIN32_IPCNT_RETURN (-EACCES) ;\r
- }\r
-! shareadrsem->current_nb[id].current_nb[sop->sem_num] += sop->sem_op;\r
- sem_deconnect() ;\r
- } else {\r
-! while(sop->sem_op + shareadrsem->current_nb[id].current_nb[sop->sem_num] <0)\r
-! LRet = WaitForSingleObject(LHandle, INFINITE) ;\r
-! \r
- if (sem_connect() == 0)\r
- {\r
- debug_printf("do_semop : return -EACCES\n");\r
- CYGWIN32_IPCNT_RETURN (-EACCES) ;\r
- }\r
-! shareadrsem->current_nb[id].current_nb[sop->sem_num] += sop->sem_op ;\r
- sem_deconnect() ;\r
- }\r
- }\r
-***************\r
-*** 435,441 ****\r
- char LBuff[100] ;\r
- HANDLE LHandle ;\r
- long LPrevious ;\r
-- int LIndex;\r
- \r
- debug_printf("semctl : semid=%X semnum=%X cmd=0x%02X arg=%p\n",semid,semnum,cmd,arg);\r
- if (semid < 0 || semnum < 0 || cmd < 0)\r
---- 452,457 ----\r
-***************\r
-*** 568,589 ****\r
- if( LHandle != NULL )\r
- {\r
- if( arg.val > shareadrsem->current_nb[id].current_nb[semnum] )\r
-! {\r
-! ReleaseSemaphore(LHandle,\r
-! arg.val-shareadrsem->current_nb[id].current_nb[semnum],\r
-! &LPrevious) ;\r
-! }\r
-! else if (arg.val <\r
-! shareadrsem->current_nb[id].current_nb[semnum] )\r
-! {\r
-! for( LIndex = arg.val;\r
-! LIndex < shareadrsem->current_nb[id].current_nb[semnum];\r
-! LIndex++ )\r
-! {\r
-! WaitForSingleObject(LHandle, 0) ;\r
-! }\r
-! }\r
-! shareadrsem->current_nb[id].current_nb[semnum] = arg.val ;\r
- }\r
- debug_printf("semctl : SETVAL : return 0\n");\r
- CYGWIN32_IPCNT_RETURN_DECONNECT (0);\r
---- 584,591 ----\r
- if( LHandle != NULL )\r
- {\r
- if( arg.val > shareadrsem->current_nb[id].current_nb[semnum] )\r
-! ReleaseSemaphore(LHandle,1,&LPrevious) ;\r
-! shareadrsem->current_nb[id].current_nb[semnum] = arg.val ;\r
- }\r
- debug_printf("semctl : SETVAL : return 0\n");\r
- CYGWIN32_IPCNT_RETURN_DECONNECT (0);\r
-*** ./shm.c.orig Fri Sep 17 12:46:24 1999\r
---- ./shm.c Fri Sep 17 12:47:11 1999\r
-***************\r
-*** 59,64 ****\r
---- 59,81 ----\r
- static int GFirstShm = 0; /*PCPC*/\r
- static int GFdShm ; /*PCPC*/\r
- \r
-+ /*****************************************/\r
-+ /* Initialization of static variables */\r
-+ /*****************************************/\r
-+ static pid_t GProcessId = 0;\r
-+ static void init_globals(void)\r
-+ {\r
-+ pid_t pid;\r
-+ \r
-+ if (pid=getpid(), pid != GProcessId)\r
-+ {\r
-+ GFirstShm = 0;\r
-+ shm_rss = shm_swp = max_shmid = 0;\r
-+ shm_seq = 0;\r
-+ GProcessId = pid;\r
-+ }\r
-+ }\r
-+ \r
- /************************************************************************/\r
- /* Demande d'acces a la zone partagee de gestion des shm */\r
- /************************************************************************/\r
-***************\r
-*** 82,87 ****\r
---- 99,105 ----\r
- {\r
- int LRet ;\r
- \r
-+ init_globals();\r
- if( GFirstShm == 0 )\r
- {\r
- if( IsGSemShmExist() )\r