src/solaris/native/sun/awt/awt_GraphicsEnv.c

Print this page




 921 void resetXShmAttachFailed() {
 922     xshmAttachFailed = JNI_FALSE;
 923 }
 924 
 925 void TryInitMITShm(JNIEnv *env, jint *shmExt, jint *shmPixmaps) {
 926     XShmSegmentInfo shminfo;
 927     int XShmMajor, XShmMinor;
 928     int a, b, c;
 929 
 930     AWT_LOCK();
 931     if (canUseShmExt != UNSET_MITSHM) {
 932         *shmExt = canUseShmExt;
 933         *shmPixmaps = canUseShmExtPixmaps;
 934         AWT_UNLOCK();
 935         return;
 936     }
 937 
 938     *shmExt = canUseShmExt = CANT_USE_MITSHM;
 939     *shmPixmaps = canUseShmExtPixmaps = CANT_USE_MITSHM;
 940 





 941     /**
 942      * XShmQueryExtension returns False in remote server case.
 943      * Unfortunately it also returns True in ssh case, so
 944      * we need to test that we can actually do XShmAttach.
 945      */
 946     if (XShmQueryExtension(awt_display)) {
 947         shminfo.shmid = shmget(IPC_PRIVATE, 0x10000, IPC_CREAT|0777);
 948         if (shminfo.shmid < 0) {
 949             AWT_UNLOCK();
 950             J2dRlsTraceLn1(J2D_TRACE_ERROR,
 951                            "TryInitMITShm: shmget has failed: %s",
 952                            strerror(errno));
 953             return;
 954         }
 955         shminfo.shmaddr = (char *) shmat(shminfo.shmid, 0, 0);
 956         if (shminfo.shmaddr == ((char *) -1)) {
 957             shmctl(shminfo.shmid, IPC_RMID, 0);
 958             AWT_UNLOCK();
 959             J2dRlsTraceLn1(J2D_TRACE_ERROR,
 960                            "TryInitMITShm: shmat has failed: %s",




 921 void resetXShmAttachFailed() {
 922     xshmAttachFailed = JNI_FALSE;
 923 }
 924 
 925 void TryInitMITShm(JNIEnv *env, jint *shmExt, jint *shmPixmaps) {
 926     XShmSegmentInfo shminfo;
 927     int XShmMajor, XShmMinor;
 928     int a, b, c;
 929 
 930     AWT_LOCK();
 931     if (canUseShmExt != UNSET_MITSHM) {
 932         *shmExt = canUseShmExt;
 933         *shmPixmaps = canUseShmExtPixmaps;
 934         AWT_UNLOCK();
 935         return;
 936     }
 937 
 938     *shmExt = canUseShmExt = CANT_USE_MITSHM;
 939     *shmPixmaps = canUseShmExtPixmaps = CANT_USE_MITSHM;
 940 
 941     if (awt_display == (Display *)NULL) {
 942         AWT_NOFLUSH_UNLOCK();
 943         return;
 944     }
 945 
 946     /**
 947      * XShmQueryExtension returns False in remote server case.
 948      * Unfortunately it also returns True in ssh case, so
 949      * we need to test that we can actually do XShmAttach.
 950      */
 951     if (XShmQueryExtension(awt_display)) {
 952         shminfo.shmid = shmget(IPC_PRIVATE, 0x10000, IPC_CREAT|0777);
 953         if (shminfo.shmid < 0) {
 954             AWT_UNLOCK();
 955             J2dRlsTraceLn1(J2D_TRACE_ERROR,
 956                            "TryInitMITShm: shmget has failed: %s",
 957                            strerror(errno));
 958             return;
 959         }
 960         shminfo.shmaddr = (char *) shmat(shminfo.shmid, 0, 0);
 961         if (shminfo.shmaddr == ((char *) -1)) {
 962             shmctl(shminfo.shmid, IPC_RMID, 0);
 963             AWT_UNLOCK();
 964             J2dRlsTraceLn1(J2D_TRACE_ERROR,
 965                            "TryInitMITShm: shmat has failed: %s",