delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2000/02/17/08:01:11

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sourceware DOT cygnus DOT com>
List-Archive: <http://sourceware.cygnus.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sourceware DOT cygnus DOT com>
List-Help: <mailto:cygwin-help AT sourceware DOT cygnus DOT com>, <http://sourceware.cygnus.com/ml/#faqs>
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
Message-ID: <F4A9A276019AD311B08C00A024B2517005886E@exchange.mmp.plzen-city.cz>
From: =?iso-8859-1?Q?Hor=E1k_Daniel?= <horak AT sit DOT plzen-city DOT cz>
To: "'Charles S. Wilson'" <cwilson AT ece DOT gatech DOT edu>
Cc: cygwin AT sourceware DOT cygnus DOT com
Subject: RE: Is there an alternative download site for IPC package?
Date: Thu, 17 Feb 2000 13:57:11 +0100
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2650.21)

------_=_NextPart_000_01BF7946.8490C54E
Content-Type: text/plain;
	charset="iso-8859-1"

> I've also mirrored it at http://cygutils.netpedia.net/. My
> version has a few extra patches added -- for instance, the
> missing  ftok() was shamelessly copied from glibc-2.1.2 --
> but has had very little testing.

Can you apply also the included patch? It was developed by some PostgreSQL
hackers (details can be found in pgsql-hackers mailing list) and corrects
the behaviour of the original version (which used some variables
uninitialized, etc). And I think the version number could be taken to 1.04.

			Dan


------_=_NextPart_000_01BF7946.8490C54E
Content-Type: application/octet-stream;
	name="cypipc.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="cypipc.patch"

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


------_=_NextPart_000_01BF7946.8490C54E
Content-Type: text/plain; charset=us-ascii

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com
------_=_NextPart_000_01BF7946.8490C54E--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019