attached is a patch that makes SysV semaphore emulation using POSIX semaphores more robust on Darwin 1.2/Mac OS X Public Beta.  this is for the version of 7.1 available via anon cvs as of Jan 14 2001 14:00 PST.
attached is a patch that makes SysV semaphore emulation
using POSIX semaphores more robust on Darwin 1.2/Mac OS X
Public Beta.  this is for the version of 7.1 available
via anon cvs as of Jan 14 2001 14:00 PST.

since the semaphores and shared memory created by this
emulator are shared with the backends via fork(), their
persistent names are not necessary.  removing their
names with shm_unlink() and sem_unlink() after creation
obviates the need for any "ipcclean" function.  further,
without these changes, the shared memory (and, therefore,
the semaphores) will not be re-initialized/re-created after
the first execution of the postmaster, until reboot
or until some (non-existent) ipcclean function is executed.

this patch does the following:

   1) if the shared memory segment "SysV_Sem_Info" already
      existed, it is cleaned up.  it shouldn't be there anyways.

   2) the real indicator for whether the shared memory/semaphore
      emulator has been initialized is if "SemInfo" has been
      initialized.  the shared memory and semaphores must be
      initialized regardless of whether there was a garbage shared
      memory segment lying around.

   3) the shared memory segment "SysV_Sem_Info" is created with "O_EXCL"
      to catch the case where two postmasters might be starting
      simultaneously, so they don't both end up with the same shared
      memory (one will fail).  note that this can't be done with the
      semaphores because Darwin 1.2 has a bug where attempting to
      open an existing semaphore with "O_EXCL" set will ruin the
      semaphore until the next reboot.

   4) the shared memory segment "SysV_Sem_Info" is unlinked after
      it is created.  it will then exist without a name until the
      postmaster and all backend children exit.
   5) all semaphores are unlinked after they are created.  they'll
      then exist without names until the postmaster and all backend
      children exit.

-michael thornburgh, zenomt@armory.com

zaksoup/gpdb,jmcatamney/gpdb,rubikloud/gpdb,ashwinstar/gpdb,janebeckman/gpdb,randomtask1155/gpdb,techdragon/Postgres-XL,xinzweb/gpdb,pavanvd/postgres-xl,yuanzhao/gpdb,0x0FFF/gpdb,royc1/gpdb,cjcjameson/gpdb,CraigHarris/gpdb,50wu/gpdb,ahachete/gpdb,randomtask1155/gpdb,jmcatamney/gpdb,royc1/gpdb,xuegang/gpdb,snaga/postgres-xl,yuanzhao/gpdb,adam8157/gpdb,snaga/postgres-xl,pavanvd/postgres-xl,oberstet/postgres-xl,Quikling/gpdb,postmind-net/postgres-xl,rubikloud/gpdb,ovr/postgres-xl,ashwinstar/gpdb,kaknikhil/gpdb,kaknikhil/gpdb,CraigHarris/gpdb,pavanvd/postgres-xl,xuegang/gpdb,edespino/gpdb,royc1/gpdb,cjcjameson/gpdb,postmind-net/postgres-xl,CraigHarris/gpdb,janebeckman/gpdb,yuanzhao/gpdb,rvs/gpdb,50wu/gpdb,ahachete/gpdb,ahachete/gpdb,Postgres-XL/Postgres-XL,royc1/gpdb,Chibin/gpdb,randomtask1155/gpdb,0x0FFF/gpdb,atris/gpdb,jmcatamney/gpdb,lpetrov-pivotal/gpdb,Quikling/gpdb,edespino/gpdb,foyzur/gpdb,lintzc/gpdb,Chibin/gpdb,yuanzhao/gpdb,CraigHarris/gpdb,Quikling/gpdb,kaknikhil/gpdb,janebeckman/gpdb,xinzweb/gpdb,lpetrov-pivotal/gpdb,Chibin/gpdb,lintzc/gpdb,CraigHarris/gpdb,foyzur/gpdb,rubikloud/gpdb,techdragon/Postgres-XL,ahachete/gpdb,Quikling/gpdb,tangp3/gpdb,chrishajas/gpdb,kaknikhil/gpdb,cjcjameson/gpdb,rvs/gpdb,lintzc/gpdb,randomtask1155/gpdb,Quikling/gpdb,arcivanov/postgres-xl,Quikling/gpdb,royc1/gpdb,lisakowen/gpdb,tangp3/gpdb,techdragon/Postgres-XL,tpostgres-projects/tPostgres,rubikloud/gpdb,tangp3/gpdb,adam8157/gpdb,rvs/gpdb,edespino/gpdb,yazun/postgres-xl,CraigHarris/gpdb,50wu/gpdb,lintzc/gpdb,royc1/gpdb,atris/gpdb,zaksoup/gpdb,yazun/postgres-xl,Quikling/gpdb,greenplum-db/gpdb,50wu/gpdb,edespino/gpdb,yuanzhao/gpdb,lpetrov-pivotal/gpdb,zaksoup/gpdb,50wu/gpdb,arcivanov/postgres-xl,cjcjameson/gpdb,xuegang/gpdb,lisakowen/gpdb,zaksoup/gpdb,rvs/gpdb,ashwinstar/gpdb,0x0FFF/gpdb,kaknikhil/gpdb,lintzc/gpdb,yazun/postgres-xl,edespino/gpdb,zeroae/postgres-xl,foyzur/gpdb,xinzweb/gpdb,xinzweb/gpdb,lpetrov-pivotal/gpdb,atris/gpdb,ashwinstar/gpdb,lintzc/gpdb,rubikloud/gpdb,Chibin/gpdb,arcivanov/postgres-xl,tangp3/gpdb,foyzur/gpdb,foyzur/gpdb,greenplum-db/gpdb,0x0FFF/gpdb,atris/gpdb,ahachete/gpdb,rubikloud/gpdb,cjcjameson/gpdb,tangp3/gpdb,zeroae/postgres-xl,lisakowen/gpdb,xinzweb/gpdb,edespino/gpdb,rubikloud/gpdb,Chibin/gpdb,chrishajas/gpdb,randomtask1155/gpdb,Chibin/gpdb,postmind-net/postgres-xl,xuegang/gpdb,0x0FFF/gpdb,0x0FFF/gpdb,yuanzhao/gpdb,zeroae/postgres-xl,techdragon/Postgres-XL,lpetrov-pivotal/gpdb,ovr/postgres-xl,tangp3/gpdb,0x0FFF/gpdb,rvs/gpdb,lpetrov-pivotal/gpdb,ovr/postgres-xl,zaksoup/gpdb,xuegang/gpdb,xinzweb/gpdb,jmcatamney/gpdb,adam8157/gpdb,janebeckman/gpdb,pavanvd/postgres-xl,janebeckman/gpdb,lintzc/gpdb,rvs/gpdb,rvs/gpdb,oberstet/postgres-xl,Postgres-XL/Postgres-XL,yuanzhao/gpdb,adam8157/gpdb,ashwinstar/gpdb,yazun/postgres-xl,royc1/gpdb,kmjungersen/PostgresXL,greenplum-db/gpdb,techdragon/Postgres-XL,CraigHarris/gpdb,zaksoup/gpdb,ashwinstar/gpdb,ahachete/gpdb,atris/gpdb,xinzweb/gpdb,kaknikhil/gpdb,janebeckman/gpdb,50wu/gpdb,snaga/postgres-xl,50wu/gpdb,jmcatamney/gpdb,foyzur/gpdb,Postgres-XL/Postgres-XL,xuegang/gpdb,ahachete/gpdb,cjcjameson/gpdb,adam8157/gpdb,Quikling/gpdb,greenplum-db/gpdb,ovr/postgres-xl,tangp3/gpdb,yazun/postgres-xl,Postgres-XL/Postgres-XL,Chibin/gpdb,lisakowen/gpdb,foyzur/gpdb,chrishajas/gpdb,adam8157/gpdb,royc1/gpdb,Quikling/gpdb,zeroae/postgres-xl,Chibin/gpdb,lpetrov-pivotal/gpdb,atris/gpdb,atris/gpdb,randomtask1155/gpdb,xuegang/gpdb,lisakowen/gpdb,chrishajas/gpdb,snaga/postgres-xl,lisakowen/gpdb,pavanvd/postgres-xl,jmcatamney/gpdb,oberstet/postgres-xl,ashwinstar/gpdb,kaknikhil/gpdb,xuegang/gpdb,kaknikhil/gpdb,janebeckman/gpdb,randomtask1155/gpdb,tangp3/gpdb,lpetrov-pivotal/gpdb,rvs/gpdb,greenplum-db/gpdb,lintzc/gpdb,rubikloud/gpdb,adam8157/gpdb,kmjungersen/PostgresXL,arcivanov/postgres-xl,chrishajas/gpdb,CraigHarris/gpdb,Postgres-XL/Postgres-XL,edespino/gpdb,greenplum-db/gpdb,edespino/gpdb,ahachete/gpdb,chrishajas/gpdb,chrishajas/gpdb,snaga/postgres-xl,CraigHarris/gpdb,jmcatamney/gpdb,chrishajas/gpdb,cjcjameson/gpdb,50wu/gpdb,zeroae/postgres-xl,tpostgres-projects/tPostgres,kmjungersen/PostgresXL,postmind-net/postgres-xl,cjcjameson/gpdb,Quikling/gpdb,rvs/gpdb,Chibin/gpdb,rvs/gpdb,foyzur/gpdb,zaksoup/gpdb,oberstet/postgres-xl,lisakowen/gpdb,kmjungersen/PostgresXL,yuanzhao/gpdb,atris/gpdb,arcivanov/postgres-xl,greenplum-db/gpdb,tpostgres-projects/tPostgres,adam8157/gpdb,ovr/postgres-xl,lisakowen/gpdb,yuanzhao/gpdb,zaksoup/gpdb,cjcjameson/gpdb,tpostgres-projects/tPostgres,0x0FFF/gpdb,ashwinstar/gpdb,xinzweb/gpdb,edespino/gpdb,Chibin/gpdb,randomtask1155/gpdb,greenplum-db/gpdb,cjcjameson/gpdb,janebeckman/gpdb,oberstet/postgres-xl,tpostgres-projects/tPostgres,edespino/gpdb,lintzc/gpdb,kaknikhil/gpdb,yuanzhao/gpdb,janebeckman/gpdb,postmind-net/postgres-xl,janebeckman/gpdb,kaknikhil/gpdb,kmjungersen/PostgresXL,xuegang/gpdb,jmcatamney/gpdb,arcivanov/postgres-xl