forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit978c03f
committed
attached is a patch that makes SysV semaphore emulation
using POSIX semaphores more robust on Darwin 1.2/Mac OS XPublic Beta. this is for the version of 7.1 availablevia anon cvs as of Jan 14 2001 14:00 PST.since the semaphores and shared memory created by thisemulator are shared with the backends via fork(), theirpersistent names are not necessary. removing theirnames with shm_unlink() and sem_unlink() after creationobviates the need for any "ipcclean" function. further,without these changes, the shared memory (and, therefore,the semaphores) will not be re-initialized/re-created afterthe first execution of the postmaster, until rebootor 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.com1 parent5088f07 commit978c03f
1 file changed
+7
-3
lines changedLines changed: 7 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
10 | 10 |
| |
11 | 11 |
| |
12 | 12 |
| |
13 |
| - | |
| 13 | + | |
14 | 14 |
| |
15 | 15 |
| |
16 | 16 |
| |
| |||
155 | 155 |
| |
156 | 156 |
| |
157 | 157 |
| |
158 |
| - | |
159 |
| - | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
160 | 161 |
| |
161 | 162 |
| |
162 | 163 |
| |
| 164 | + | |
163 | 165 |
| |
164 | 166 |
| |
165 | 167 |
| |
| |||
174 | 176 |
| |
175 | 177 |
| |
176 | 178 |
| |
| 179 | + | |
177 | 180 |
| |
178 | 181 |
| |
179 | 182 |
| |
| |||
244 | 247 |
| |
245 | 248 |
| |
246 | 249 |
| |
| 250 | + | |
247 | 251 |
| |
248 | 252 |
| |
249 | 253 |
| |
|
0 commit comments
Comments
(0)