summaryrefslogtreecommitdiff
path: root/sys/compat/linux
diff options
context:
space:
mode:
authorjdolecek <jdolecek@NetBSD.org>2004-09-28 19:05:19 +0000
committerjdolecek <jdolecek@NetBSD.org>2004-09-28 19:05:19 +0000
commitf64366a24008c15e44bec04f4cdde2979d06ce66 (patch)
tree3dd07152f1b96db1047019455fb6124f2cbb4029 /sys/compat/linux
parentb31a120195ebf90165e0c511a8fdcf3c976e9121 (diff)
add flag for shmget(2) to specify that later shmat(2) for the shared memory
segment should succeed even if the segment would be marked removed; use this to implement the Linux-compatible semantics of shmat(2) this fixes the old Linux VMware3 graphics problem with local display, and possibly other local Linux X clients using MIT-SHM
Diffstat (limited to 'sys/compat/linux')
-rw-r--r--sys/compat/linux/arch/alpha/syscalls.master4
-rw-r--r--sys/compat/linux/common/linux_ipc.c25
-rw-r--r--sys/compat/linux/common/linux_ipccall.c6
-rw-r--r--sys/compat/linux/common/linux_shm.h3
4 files changed, 30 insertions, 8 deletions
diff --git a/sys/compat/linux/arch/alpha/syscalls.master b/sys/compat/linux/arch/alpha/syscalls.master
index 05ea620de82..423aa01d515 100644
--- a/sys/compat/linux/arch/alpha/syscalls.master
+++ b/sys/compat/linux/arch/alpha/syscalls.master
@@ -1,4 +1,4 @@
- $NetBSD: syscalls.master,v 1.46 2004/09/08 19:45:21 jdolecek Exp $
+ $NetBSD: syscalls.master,v 1.47 2004/09/28 19:05:19 jdolecek Exp $
;
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@@ -387,7 +387,7 @@
210 NOARGS { int linux_sys_shmctl(int shmid, int cmd, \
struct linux_shmid_ds *buf); }
211 NOARGS { int sys_shmdt(const void *shmaddr); }
-212 NOARGS { int sys_shmget(key_t key, size_t size, int shmflg); }
+212 NOARGS { int linux_sys_shmget(key_t key, size_t size, int shmflg); }
#else
209 UNIMPL shmat
210 UNIMPL shmctl
diff --git a/sys/compat/linux/common/linux_ipc.c b/sys/compat/linux/common/linux_ipc.c
index 73b41ae4c1f..14214eaecb9 100644
--- a/sys/compat/linux/common/linux_ipc.c
+++ b/sys/compat/linux/common/linux_ipc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_ipc.c,v 1.29 2004/09/28 17:26:25 jdolecek Exp $ */
+/* $NetBSD: linux_ipc.c,v 1.30 2004/09/28 19:05:19 jdolecek Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_ipc.c,v 1.29 2004/09/28 17:26:25 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_ipc.c,v 1.30 2004/09/28 19:05:19 jdolecek Exp $");
#if defined(_KERNEL_OPT)
#include "opt_sysv.h"
@@ -354,6 +354,27 @@ linux_sys_msgctl(l, v, retval)
#ifdef SYSVSHM
/*
+ * shmget(2). Just make sure the Linux-compatible shmat() semantics
+ * is enabled for the segment, so that shmat() succeeds even when
+ * the segment would be removed.
+ */
+int
+linux_sys_shmget(l, v, retval)
+ struct lwp *l;
+ void *v;
+ register_t *retval;
+{
+ struct sys_shmget_args /* {
+ syscallarg(key_t) key;
+ syscallarg(size_t) size;
+ syscallarg(int) shmflg;
+ } */ *uap = v;
+
+ SCARG(uap, shmflg) |= _SHM_RMLINGER;
+ return sys_shmget(l, uap, retval);
+}
+
+/*
* shmat(2). Very straightforward, except that Linux passes a pointer
* in which the return value is to be passed. This is subsequently
* handled by libc, apparently.
diff --git a/sys/compat/linux/common/linux_ipccall.c b/sys/compat/linux/common/linux_ipccall.c
index 271e09b6ca2..2ade5682157 100644
--- a/sys/compat/linux/common/linux_ipccall.c
+++ b/sys/compat/linux/common/linux_ipccall.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_ipccall.c,v 1.23 2003/01/18 08:02:53 thorpej Exp $ */
+/* $NetBSD: linux_ipccall.c,v 1.24 2004/09/28 19:05:19 jdolecek Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_ipccall.c,v 1.23 2003/01/18 08:02:53 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_ipccall.c,v 1.24 2004/09/28 19:05:19 jdolecek Exp $");
#if defined(_KERNEL_OPT)
#include "opt_sysv.h"
@@ -334,7 +334,7 @@ linux_shmget(l, uap, retval)
SCARG(&bsa, size) = SCARG(uap, a2);
SCARG(&bsa, shmflg) = SCARG(uap, a3);
- return sys_shmget(l, &bsa, retval);
+ return linux_sys_shmget(l, &bsa, retval);
}
#endif /* SYSVSHM */
diff --git a/sys/compat/linux/common/linux_shm.h b/sys/compat/linux/common/linux_shm.h
index ed236475da8..efe799a9761 100644
--- a/sys/compat/linux/common/linux_shm.h
+++ b/sys/compat/linux/common/linux_shm.h
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_shm.h,v 1.5 2003/01/18 21:21:31 thorpej Exp $ */
+/* $NetBSD: linux_shm.h,v 1.6 2004/09/28 19:05:19 jdolecek Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -85,6 +85,7 @@ struct linux_sys_shmctl_args {
#ifdef SYSVSHM
#ifdef _KERNEL
__BEGIN_DECLS
+int linux_sys_shmget __P((struct lwp *, void *, register_t *));
int linux_sys_shmat __P((struct lwp *, void *, register_t *));
int linux_sys_shmctl __P((struct lwp *, void *, register_t *));
void linux_to_bsd_shmid_ds __P((struct linux_shmid_ds *,