From d2714c5eda9c13f9aec9436d0f99bf263b3d4d88 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 30 Mar 2004 15:21:18 +0000 Subject: [PATCH] * sysv_shm.cc (shmget): Allow to retrieve shared memory segments by shmid when IPC_KEY_IS_SHMID is set. --- winsup/cygserver/ChangeLog | 5 +++++ winsup/cygserver/sysv_shm.cc | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/winsup/cygserver/ChangeLog b/winsup/cygserver/ChangeLog index 761056afa..8af654cdc 100644 --- a/winsup/cygserver/ChangeLog +++ b/winsup/cygserver/ChangeLog @@ -1,3 +1,8 @@ +2004-03-30 Corinna Vinschen + + * sysv_shm.cc (shmget): Allow to retrieve shared memory segments + by shmid when IPC_KEY_IS_SHMID is set. + 2004-03-02 Corinna Vinschen * sysv_sem.cc (semundo_adjust): Check for process id instead of diff --git a/winsup/cygserver/sysv_shm.cc b/winsup/cygserver/sysv_shm.cc index 70ed1a3d4..7d038f0a6 100644 --- a/winsup/cygserver/sysv_shm.cc +++ b/winsup/cygserver/sysv_shm.cc @@ -808,6 +808,12 @@ shmget(struct thread *td, struct shmget_args *uap) mode = uap->shmflg & ACCESSPERMS; if (uap->key != IPC_PRIVATE) { 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); if (segnum >= 0) { error = shmget_existing(td, uap, mode, segnum);