* sysv_shm.cc (shmget): Allow to retrieve shared memory segments

by shmid when IPC_KEY_IS_SHMID is set.
This commit is contained in:
Corinna Vinschen 2004-03-30 15:21:18 +00:00
parent 5c7b73ed97
commit d2714c5eda
2 changed files with 11 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2004-03-30 Corinna Vinschen <corinna@vinschen.de>
* sysv_shm.cc (shmget): Allow to retrieve shared memory segments
by shmid when IPC_KEY_IS_SHMID is set.
2004-03-02 Corinna Vinschen <corinna@vinschen.de> 2004-03-02 Corinna Vinschen <corinna@vinschen.de>
* sysv_sem.cc (semundo_adjust): Check for process id instead of * sysv_sem.cc (semundo_adjust): Check for process id instead of

View File

@ -808,6 +808,12 @@ shmget(struct thread *td, struct shmget_args *uap)
mode = uap->shmflg & ACCESSPERMS; mode = uap->shmflg & ACCESSPERMS;
if (uap->key != IPC_PRIVATE) { if (uap->key != IPC_PRIVATE) {
again: again:
#ifdef __CYGWIN__
if (uap->shmflg & IPC_KEY_IS_SHMID)
segnum = shm_find_segment_by_shmid ((int) uap->key) ?
IPCID_TO_IX((int) uap->key) : -1;
else
#endif
segnum = shm_find_segment_by_key(uap->key); segnum = shm_find_segment_by_key(uap->key);
if (segnum >= 0) { if (segnum >= 0) {
error = shmget_existing(td, uap, mode, segnum); error = shmget_existing(td, uap, mode, segnum);