summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/shm.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2003-10-22 10:07:59 +0000
committerCorinna Vinschen <corinna@vinschen.de>2003-10-22 10:07:59 +0000
commite217832c4c4d8dba3c13af35b1d107851271b77d (patch)
tree07fd38a06152f7c715f38cd2bf0a6d07064f8ff4 /winsup/cygwin/shm.cc
parent567970786e0db398b9c2a990efb9060b95406e12 (diff)
downloadcygnal-e217832c4c4d8dba3c13af35b1d107851271b77d.tar.gz
cygnal-e217832c4c4d8dba3c13af35b1d107851271b77d.tar.bz2
cygnal-e217832c4c4d8dba3c13af35b1d107851271b77d.zip
* Makefile.in: Add $(LIBSERVER) rule.
* cygserver.h: Moved from include/cygwin to here. * cygserver_ipc.h: Moved from ../cygserver to here. * cygserver_shm.h: Ditto. * cygwin.din: Add shmat, shmctl, shmdt and shmget. * fhandler_tty.cc (fhandler_tty_slave::open): Don't warn about handle dup'ing if not build with USE_SERVER. * shm.cc: Include cygerrno.h unconditionally. (shmat): Set errno to ENOSYS and return -1 if not build with USE_SERVER. (shmctl): Ditto. (shmdt): Ditto. (shmget): Ditto. * woutsup.h: Remove. * include/cygwin/cygserver_process.h: Moved to ../cygserver directory. * include/cygwin/cygserver_transport.h: Ditto. * include/cygwin/cygserver_transport_pipes.h: Ditto. * include/cygwin/cygserver_transport_sockets.h: Ditto. * include/cygwin/version.h: Bump API minor number.
Diffstat (limited to 'winsup/cygwin/shm.cc')
-rw-r--r--winsup/cygwin/shm.cc110
1 files changed, 65 insertions, 45 deletions
diff --git a/winsup/cygwin/shm.cc b/winsup/cygwin/shm.cc
index a7edeace3..a5e7c31df 100644
--- a/winsup/cygwin/shm.cc
+++ b/winsup/cygwin/shm.cc
@@ -12,6 +12,7 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */
#include "winsup.h"
+#include "cygerrno.h"
#ifdef USE_SERVER
#include <sys/types.h>
@@ -19,7 +20,6 @@ details. */
#include <stdio.h>
#include <unistd.h>
-#include "cygerrno.h"
#include "safe_memory.h"
#include "sigproc.h"
@@ -552,50 +552,6 @@ client_shmmgr::new_segment (const int shmid,
}
/*---------------------------------------------------------------------------*
- * shmat ()
- *---------------------------------------------------------------------------*/
-
-extern "C" void *
-shmat (const int shmid, const void *const shmaddr, const int shmflg)
-{
- sigframe thisframe (mainthread);
- return shmmgr.shmat (shmid, shmaddr, shmflg);
-}
-
-/*---------------------------------------------------------------------------*
- * shmctl ()
- *---------------------------------------------------------------------------*/
-
-extern "C" int
-shmctl (const int shmid, const int cmd, struct shmid_ds *const buf)
-{
- sigframe thisframe (mainthread);
- return shmmgr.shmctl (shmid, cmd, buf);
-}
-
-/*---------------------------------------------------------------------------*
- * shmdt ()
- *---------------------------------------------------------------------------*/
-
-extern "C" int
-shmdt (const void *const shmaddr)
-{
- sigframe thisframe (mainthread);
- return shmmgr.shmdt (shmaddr);
-}
-
-/*---------------------------------------------------------------------------*
- * shmget ()
- *---------------------------------------------------------------------------*/
-
-extern "C" int
-shmget (const key_t key, const size_t size, const int shmflg)
-{
- sigframe thisframe (mainthread);
- return shmmgr.shmget (key, size, shmflg);
-}
-
-/*---------------------------------------------------------------------------*
* fixup_shms_after_fork ()
*---------------------------------------------------------------------------*/
@@ -691,3 +647,67 @@ client_request_shm::client_request_shm (const key_t key,
msglen (sizeof (_parameters.in));
}
#endif /* USE_SERVER */
+
+/*---------------------------------------------------------------------------*
+ * shmat ()
+ *---------------------------------------------------------------------------*/
+
+extern "C" void *
+shmat (const int shmid, const void *const shmaddr, const int shmflg)
+{
+#ifdef USE_SERVER
+ sigframe thisframe (mainthread);
+ return shmmgr.shmat (shmid, shmaddr, shmflg);
+#else
+ set_errno (ENOSYS);
+ return (void *) -1;
+#endif
+}
+
+/*---------------------------------------------------------------------------*
+ * shmctl ()
+ *---------------------------------------------------------------------------*/
+
+extern "C" int
+shmctl (const int shmid, const int cmd, struct shmid_ds *const buf)
+{
+#ifdef USE_SERVER
+ sigframe thisframe (mainthread);
+ return shmmgr.shmctl (shmid, cmd, buf);
+#else
+ set_errno (ENOSYS);
+ return -1;
+#endif
+}
+
+/*---------------------------------------------------------------------------*
+ * shmdt ()
+ *---------------------------------------------------------------------------*/
+
+extern "C" int
+shmdt (const void *const shmaddr)
+{
+#ifdef USE_SERVER
+ sigframe thisframe (mainthread);
+ return shmmgr.shmdt (shmaddr);
+#else
+ set_errno (ENOSYS);
+ return -1;
+#endif
+}
+
+/*---------------------------------------------------------------------------*
+ * shmget ()
+ *---------------------------------------------------------------------------*/
+
+extern "C" int
+shmget (const key_t key, const size_t size, const int shmflg)
+{
+#ifdef USE_SERVER
+ sigframe thisframe (mainthread);
+ return shmmgr.shmget (key, size, shmflg);
+#else
+ set_errno (ENOSYS);
+ return -1;
+#endif
+}