jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c
changeset 18184 75811cab0180
parent 15504 c13b899e2b15
child 18253 4323a5fe8bc4
--- a/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c	Tue Apr 16 13:51:53 2013 -0400
+++ b/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c	Wed Feb 27 12:10:59 2013 +0400
@@ -89,6 +89,7 @@
 jint useMitShmExt = CANT_USE_MITSHM;
 jint useMitShmPixmaps = CANT_USE_MITSHM;
 jint forceSharedPixmaps = JNI_FALSE;
+int mitShmPermissionMask = MITSHM_PERM_OWNER;
 
 /* Cached shared image, one for all surface datas. */
 static XImage * cachedXImage;
@@ -119,6 +120,13 @@
     if (getenv("NO_AWT_MITSHM") == NULL &&
         getenv("NO_J2D_MITSHM") == NULL) {
         char * force;
+        char * permission = getenv("J2D_MITSHM_PERMISSION");
+        if (permission != NULL) {
+            if (strcmp(permission, "common") == 0) {
+                mitShmPermissionMask = MITSHM_PERM_COMMON;
+            }
+        }
+
         TryInitMITShm(env, &useMitShmExt, &useMitShmPixmaps);
 
         if(allowShmPixmaps) {
@@ -536,7 +544,8 @@
         return NULL;
     }
     shminfo->shmid =
-        shmget(IPC_PRIVATE, height * img->bytes_per_line, IPC_CREAT|0777);
+        shmget(IPC_PRIVATE, height * img->bytes_per_line,
+               IPC_CREAT|mitShmPermissionMask);
     if (shminfo->shmid < 0) {
         J2dRlsTraceLn1(J2D_TRACE_ERROR,
                        "X11SD_SetupSharedSegment shmget has failed: %s",